blob: 41252ff62375ce9ce5e4f7d5d709bcdf5912ab4a [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Nirav Shaheb017be2018-02-15 11:20:58 +05302 * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#ifndef _OL_CFG__H_
29#define _OL_CFG__H_
30
Anurag Chouhan6d760662016-02-20 16:05:43 +053031#include <qdf_types.h> /* uint32_t */
Dhanashri Atre12a08392016-02-17 13:10:34 -080032#include <cdp_txrx_cmn.h> /* ol_pdev_handle */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080033#include <cds_ieee80211_common.h> /* ieee80211_qosframe_htc_addr4 */
34#include <enet.h> /* LLC_SNAP_HDR_LEN */
Siddarth Poddar1df1cd82016-04-27 17:32:21 +053035#if defined(CONFIG_HL_SUPPORT)
36#include "wlan_tgt_def_config_hl.h"
37#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038#include "wlan_tgt_def_config.h"
Siddarth Poddar1df1cd82016-04-27 17:32:21 +053039#endif
Dhanashri Atre12a08392016-02-17 13:10:34 -080040#include "ol_txrx_ctrl_api.h" /* txrx_pdev_cfg_param_t */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -080041#include <cdp_txrx_handle.h>
gbian62edd7e2017-03-07 13:12:13 +080042
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080043/**
44 * @brief format of data frames delivered to/from the WLAN driver by/to the OS
45 */
46enum wlan_frm_fmt {
47 wlan_frm_fmt_unknown,
48 wlan_frm_fmt_raw,
49 wlan_frm_fmt_native_wifi,
50 wlan_frm_fmt_802_3,
51};
52
Poddar, Siddarth83905022016-04-16 17:56:08 -070053/* Throttle period Different level Duty Cycle values*/
54#define THROTTLE_DUTY_CYCLE_LEVEL0 (0)
55#define THROTTLE_DUTY_CYCLE_LEVEL1 (50)
56#define THROTTLE_DUTY_CYCLE_LEVEL2 (75)
57#define THROTTLE_DUTY_CYCLE_LEVEL3 (94)
58
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080059struct wlan_ipa_uc_rsc_t {
60 u8 uc_offload_enabled;
61 u32 tx_max_buf_cnt;
62 u32 tx_buf_size;
63 u32 rx_ind_ring_size;
64 u32 tx_partition_base;
65};
66
67/* Config parameters for txrx_pdev */
68struct txrx_pdev_cfg_t {
69 u8 is_high_latency;
70 u8 defrag_timeout_check;
71 u8 rx_pn_check;
72 u8 pn_rx_fwd_check;
73 u8 host_addba;
74 u8 tx_free_at_download;
75 u8 rx_fwd_inter_bss;
76 u32 max_thruput_mbps;
77 u32 target_tx_credit;
78 u32 vow_config;
79 u32 tx_download_size;
80 u32 max_peer_id;
81 u32 max_vdev;
82 u32 max_nbuf_frags;
83 u32 throttle_period_ms;
Poddar, Siddarth83905022016-04-16 17:56:08 -070084 u8 dutycycle_level[4];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080085 enum wlan_frm_fmt frame_type;
86 u8 rx_fwd_disabled;
87 u8 is_packet_log_enabled;
88 u8 is_full_reorder_offload;
Yu Wang66a250b2017-07-19 11:46:40 +080089#ifdef WLAN_FEATURE_TSF_PLUS
90 u8 is_ptp_rx_opt_enabled;
91#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080092 struct wlan_ipa_uc_rsc_t ipa_uc_rsc;
93 bool ip_tcp_udp_checksum_offload;
94 bool enable_rxthread;
95 bool ce_classify_enabled;
96#ifdef QCA_LL_TX_FLOW_CONTROL_V2
97 uint32_t tx_flow_stop_queue_th;
98 uint32_t tx_flow_start_queue_offset;
99#endif
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700100 bool flow_steering_enabled;
gbian62edd7e2017-03-07 13:12:13 +0800101
102 struct ol_tx_sched_wrr_ac_specs_t ac_specs[TX_WMM_AC_NUM];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800103};
104
105/**
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800106 * ol_tx_set_flow_control_parameters() - set flow control parameters
107 * @cfg_ctx: cfg context
108 * @cfg_param: cfg parameters
109 *
110 * Return: none
111 */
112#ifdef QCA_LL_TX_FLOW_CONTROL_V2
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800113void ol_tx_set_flow_control_parameters(struct cdp_cfg *cfg_ctx,
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800114 struct txrx_pdev_cfg_param_t *cfg_param);
115#else
116static inline
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800117void ol_tx_set_flow_control_parameters(struct cdp_cfg *cfg_ctx,
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800118 struct txrx_pdev_cfg_param_t *cfg_param)
119{
120}
121#endif
122
123/**
Jeff Johnsonbacec092016-12-20 14:08:47 -0800124 * ol_pdev_cfg_attach - setup configuration parameters
125 * @osdev: OS handle needed as an argument for some OS primitives
126 * @cfg_param: configuration parameters
127 *
128 * Allocation configuration context that will be used across data path
129 *
130 * Return: the control device object
131 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800132struct cdp_cfg *ol_pdev_cfg_attach(qdf_device_t osdev, void *pcfg_param);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800133
134/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800135 * @brief Specify whether the system is high-latency or low-latency.
136 * @details
137 * Indicate whether the system is operating in high-latency (message
138 * based, e.g. USB) mode or low-latency (memory-mapped, e.g. PCIe) mode.
139 * Some chips support just one type of host / target interface.
140 * Other chips support both LL and HL interfaces (e.g. PCIe and USB),
141 * so the selection will be made based on which bus HW is present, or
142 * which is preferred if both are present.
143 *
144 * @param pdev - handle to the physical device
145 * @return 1 -> high-latency -OR- 0 -> low-latency
146 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800147int ol_cfg_is_high_latency(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800148
149/**
150 * @brief Specify the range of peer IDs.
151 * @details
152 * Specify the maximum peer ID. This is the maximum number of peers,
153 * minus one.
154 * This is used by the host to determine the size of arrays indexed by
155 * peer ID.
156 *
157 * @param pdev - handle to the physical device
158 * @return maximum peer ID
159 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800160int ol_cfg_max_peer_id(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800161
162/**
163 * @brief Specify the max number of virtual devices within a physical device.
164 * @details
165 * Specify how many virtual devices may exist within a physical device.
166 *
167 * @param pdev - handle to the physical device
168 * @return maximum number of virtual devices
169 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800170int ol_cfg_max_vdevs(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800171
172/**
173 * @brief Check whether host-side rx PN check is enabled or disabled.
174 * @details
175 * Choose whether to allocate rx PN state information and perform
176 * rx PN checks (if applicable, based on security type) on the host.
177 * If the rx PN check is specified to be done on the host, the host SW
178 * will determine which peers are using a security type (e.g. CCMP) that
179 * requires a PN check.
180 *
181 * @param pdev - handle to the physical device
182 * @return 1 -> host performs rx PN check -OR- 0 -> no host-side rx PN check
183 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800184int ol_cfg_rx_pn_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185
186/**
187 * @brief Check whether host-side rx forwarding is enabled or disabled.
188 * @details
189 * Choose whether to check whether to forward rx frames to tx on the host.
190 * For LL systems, this rx -> tx host-side forwarding check is typically
191 * enabled.
192 * For HL systems, the rx -> tx forwarding check is typically done on the
193 * target. However, even in HL systems, the host-side rx -> tx forwarding
194 * will typically be enabled, as a second-tier safety net in case the
195 * target doesn't have enough memory to store all rx -> tx forwarded frames.
196 *
197 * @param pdev - handle to the physical device
198 * @return 1 -> host does rx->tx forward -OR- 0 -> no host-side rx->tx forward
199 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800200int ol_cfg_rx_fwd_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800201
202/**
Jeff Johnsonbacec092016-12-20 14:08:47 -0800203 * ol_set_cfg_rx_fwd_disabled - set rx fwd disable/enable
204 *
205 * @pdev - handle to the physical device
206 * @disable_rx_fwd 1 -> no rx->tx forward -> rx->tx forward
207 *
208 * Choose whether to forward rx frames to tx (where applicable) within the
209 * WLAN driver, or to leave all forwarding up to the operating system.
210 * Currently only intra-bss fwd is supported.
211 *
212 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800213void ol_set_cfg_rx_fwd_disabled(struct cdp_cfg *ppdev, uint8_t disable_rx_fwd);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800214
215/**
216 * ol_set_cfg_packet_log_enabled - Set packet log config in HTT
217 * config based on CFG ini configuration
218 *
219 * @pdev - handle to the physical device
220 * @val - 0 - disable, 1 - enable
221 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800222void ol_set_cfg_packet_log_enabled(struct cdp_cfg *ppdev, uint8_t val);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800223
224/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800225 * @brief Check whether rx forwarding is enabled or disabled.
226 * @details
227 * Choose whether to forward rx frames to tx (where applicable) within the
228 * WLAN driver, or to leave all forwarding up to the operating system.
229 *
230 * @param pdev - handle to the physical device
231 * @return 1 -> no rx->tx forward -OR- 0 -> rx->tx forward (in host or target)
232 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800233int ol_cfg_rx_fwd_disabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800234
235/**
236 * @brief Check whether to perform inter-BSS or intra-BSS rx->tx forwarding.
237 * @details
238 * Check whether data received by an AP on one virtual device destined
239 * to a STA associated with a different virtual device within the same
240 * physical device should be forwarded within the driver, or whether
241 * forwarding should only be done within a virtual device.
242 *
243 * @param pdev - handle to the physical device
244 * @return
245 * 1 -> forward both within and between vdevs
246 * -OR-
247 * 0 -> forward only within a vdev
248 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800249int ol_cfg_rx_fwd_inter_bss(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800250
251/**
252 * @brief Specify data frame format used by the OS.
253 * @details
254 * Specify what type of frame (802.3 or native WiFi) the host data SW
255 * should expect from and provide to the OS shim.
256 *
257 * @param pdev - handle to the physical device
258 * @return enumerated data frame format
259 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800260enum wlan_frm_fmt ol_cfg_frame_type(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800261
262/**
263 * @brief Specify the peak throughput.
264 * @details
265 * Specify the peak throughput that a system is expected to support.
266 * The data SW uses this configuration to help choose the size for its
267 * tx descriptor pool and rx buffer ring.
268 * The data SW assumes that the peak throughput applies to either rx or tx,
269 * rather than having separate specs of the rx max throughput vs. the tx
270 * max throughput.
271 *
272 * @param pdev - handle to the physical device
273 * @return maximum supported throughput in Mbps (not MBps)
274 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800275int ol_cfg_max_thruput_mbps(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800276
277/**
278 * @brief Specify the maximum number of fragments per tx network buffer.
279 * @details
280 * Specify the maximum number of fragments that a tx frame provided to
281 * the WLAN driver by the OS may contain.
282 * In LL systems, the host data SW uses this maximum fragment count to
283 * determine how many elements to allocate in the fragmentation descriptor
284 * it creates to specify to the tx MAC DMA where to locate the tx frame's
285 * data.
286 * This maximum fragments count is only for regular frames, not TSO frames,
287 * since TSO frames are sent in segments with a limited number of fragments
288 * per segment.
289 *
290 * @param pdev - handle to the physical device
291 * @return maximum number of fragments that can occur in a regular tx frame
292 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800293int ol_cfg_netbuf_frags_max(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800294
295/**
296 * @brief For HL systems, specify when to free tx frames.
297 * @details
298 * In LL systems, the host's tx frame is referenced by the MAC DMA, and
299 * thus cannot be freed until the target indicates that it is finished
300 * transmitting the frame.
301 * In HL systems, the entire tx frame is downloaded to the target.
302 * Consequently, the target has its own copy of the tx frame, and the
303 * host can free the tx frame as soon as the download completes.
304 * Alternatively, the HL host can keep the frame allocated until the
305 * target explicitly tells the HL host it is done transmitting the frame.
306 * This gives the target the option of discarding its copy of the tx
307 * frame, and then later getting a new copy from the host.
308 * This function tells the host whether it should retain its copy of the
309 * transmit frames until the target explicitly indicates it is finished
310 * transmitting them, or if it should free its copy as soon as the
311 * tx frame is downloaded to the target.
312 *
313 * @param pdev - handle to the physical device
314 * @return
315 * 0 -> retain the tx frame until the target indicates it is done
316 * transmitting the frame
317 * -OR-
318 * 1 -> free the tx frame as soon as the download completes
319 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800320int ol_cfg_tx_free_at_download(struct cdp_cfg *cfg_pdev);
321void ol_cfg_set_tx_free_at_download(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800322
323/**
324 * @brief Low water mark for target tx credit.
325 * Tx completion handler is invoked to reap the buffers when the target tx
326 * credit goes below Low Water Mark.
327 */
328#define OL_CFG_NUM_MSDU_REAP 512
329#define ol_cfg_tx_credit_lwm(pdev) \
330 ((CFG_TGT_NUM_MSDU_DESC > OL_CFG_NUM_MSDU_REAP) ? \
331 (CFG_TGT_NUM_MSDU_DESC - OL_CFG_NUM_MSDU_REAP) : 0)
332
333/**
334 * @brief In a HL system, specify the target initial credit count.
335 * @details
336 * The HL host tx data SW includes a module for determining which tx frames
337 * to download to the target at a given time.
338 * To make this judgement, the HL tx download scheduler has to know
339 * how many buffers the HL target has available to hold tx frames.
340 * Due to the possibility that a single target buffer pool can be shared
341 * between rx and tx frames, the host may not be able to obtain a precise
342 * specification of the tx buffer space available in the target, but it
343 * uses the best estimate, as provided by this configuration function,
344 * to determine how best to schedule the tx frame downloads.
345 *
346 * @param pdev - handle to the physical device
347 * @return the number of tx buffers available in a HL target
348 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800349uint16_t ol_cfg_target_tx_credit(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800350
351/**
352 * @brief Specify the LL tx MSDU header download size.
353 * @details
354 * In LL systems, determine how many bytes from a tx frame to download,
355 * in order to provide the target FW's Descriptor Engine with enough of
356 * the packet's payload to interpret what kind of traffic this is,
357 * and who it is for.
358 * This download size specification does not include the 802.3 / 802.11
359 * frame encapsulation headers; it starts with the encapsulated IP packet
360 * (or whatever ethertype is carried within the ethernet-ish frame).
361 * The LL host data SW will determine how many bytes of the MSDU header to
362 * download by adding this download size specification to the size of the
363 * frame header format specified by the ol_cfg_frame_type configuration
364 * function.
365 *
366 * @param pdev - handle to the physical device
367 * @return the number of bytes beyond the 802.3 or native WiFi header to
368 * download to the target for tx classification
369 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800370int ol_cfg_tx_download_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800371
372/**
373 * brief Specify where defrag timeout and duplicate detection is handled
374 * @details
375 * non-aggregate duplicate detection and timing out stale fragments
376 * requires additional target memory. To reach max client
377 * configurations (128+), non-aggregate duplicate detection and the
378 * logic to time out stale fragments is moved to the host.
379 *
380 * @param pdev - handle to the physical device
381 * @return
382 * 0 -> target is responsible non-aggregate duplicate detection and
383 * timing out stale fragments.
384 *
385 * 1 -> host is responsible non-aggregate duplicate detection and
386 * timing out stale fragments.
387 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800388int ol_cfg_rx_host_defrag_timeout_duplicate_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800389
390/**
391 * brief Query for the period in ms used for throttling for
392 * thermal mitigation
393 * @details
394 * In LL systems, transmit data throttling is used for thermal
395 * mitigation where data is paused and resumed during the
396 * throttle period i.e. the throttle period consists of an
397 * "on" phase when transmit is allowed and an "off" phase when
398 * transmit is suspended. This function returns the total
399 * period used for throttling.
400 *
401 * @param pdev - handle to the physical device
402 * @return the total throttle period in ms
403 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800404int ol_cfg_throttle_period_ms(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800405
406/**
Poddar, Siddarth83905022016-04-16 17:56:08 -0700407 * brief Query for the duty cycle in percentage used for throttling for
408 * thermal mitigation
409 *
410 * @param pdev - handle to the physical device
411 * @param level - duty cycle level
412 * @return the duty cycle level in percentage
413 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800414int ol_cfg_throttle_duty_cycle_level(struct cdp_cfg *cfg_pdev, int level);
Poddar, Siddarth83905022016-04-16 17:56:08 -0700415
416/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800417 * brief Check whether full reorder offload is
418 * enabled/disable by the host
419 * @details
420 * If the host does not support receive reorder (i.e. the
421 * target performs full receive re-ordering) this will return
422 * "enabled"
423 *
424 * @param pdev - handle to the physical device
425 * @return 1 - enable, 0 - disable
426 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800427int ol_cfg_is_full_reorder_offload(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800428
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800429int ol_cfg_is_rx_thread_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800430
Yu Wang66a250b2017-07-19 11:46:40 +0800431#ifdef WLAN_FEATURE_TSF_PLUS
432void ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val);
433u_int8_t ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev);
434#else
435static inline void
436ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val)
437{
438}
439
440static inline u_int8_t
441ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev)
442{
443 return 0;
444}
445#endif
446
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800447/**
448 * ol_cfg_is_ip_tcp_udp_checksum_offload_enabled() - return
449 * ip_tcp_udp_checksum_offload is enable/disable
450 * @pdev : handle to the physical device
451 *
452 * Return: 1 - enable, 0 - disable
453 */
454static inline
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800455int ol_cfg_is_ip_tcp_udp_checksum_offload_enabled(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800456{
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800457 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
Yun Park73fbcf52017-04-05 11:49:16 -0700458
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800459 return cfg->ip_tcp_udp_checksum_offload;
460}
461
462
463#ifdef QCA_LL_TX_FLOW_CONTROL_V2
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800464int ol_cfg_get_tx_flow_stop_queue_th(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800465
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800466int ol_cfg_get_tx_flow_start_queue_offset(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800467#endif
468
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800469bool ol_cfg_is_ce_classify_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800470
471enum wlan_target_fmt_translation_caps {
472 wlan_frm_tran_cap_raw = 0x01,
473 wlan_frm_tran_cap_native_wifi = 0x02,
474 wlan_frm_tran_cap_8023 = 0x04,
475};
476
477/**
478 * @brief Specify the maximum header size added by SW tx encapsulation
479 * @details
480 * This function returns the maximum size of the new L2 header, not the
481 * difference between the new and old L2 headers.
482 * Thus, this function returns the maximum 802.11 header size that the
483 * tx SW may need to add to tx data frames.
484 *
485 * @param pdev - handle to the physical device
486 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800487static inline int ol_cfg_sw_encap_hdr_max_size(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800488{
489 /*
490 * 24 byte basic 802.11 header
491 * + 6 byte 4th addr
492 * + 2 byte QoS control
493 * + 4 byte HT control
494 * + 8 byte LLC/SNAP
495 */
496 return sizeof(struct ieee80211_qosframe_htc_addr4) + LLC_SNAP_HDR_LEN;
497}
498
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800499static inline uint8_t ol_cfg_tx_encap(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800500{
501 /* tx encap done in HW */
502 return 0;
503}
504
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800505static inline int ol_cfg_host_addba(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800506{
507 /*
508 * ADDBA negotiation is handled by the target FW for Peregrine + Rome.
509 */
510 return 0;
511}
512
513/**
514 * @brief If the host SW's ADDBA negotiation fails, should it be retried?
515 *
516 * @param pdev - handle to the physical device
517 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800518static inline int ol_cfg_addba_retry(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800519{
520 return 0; /* disabled for now */
521}
522
523/**
524 * @brief How many frames to hold in a paused vdev's tx queue in LL systems
525 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800526static inline int ol_tx_cfg_max_tx_queue_depth_ll(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800527{
528 /*
529 * Store up to 1500 frames for a paused vdev.
530 * For example, if the vdev is sending 300 Mbps of traffic, and the
531 * PHY is capable of 600 Mbps, then it will take 56 ms for the PHY to
532 * drain both the 700 frames that are queued initially, plus the next
533 * 700 frames that come in while the PHY is catching up.
534 * So in this example scenario, the PHY will remain fully utilized
535 * in a MCC system that has a channel-switching period of 56 ms or less.
536 * 700 frames calculation was correct when FW drain packet without
537 * any overhead. Actual situation drain overhead will slowdown drain
538 * speed. And channel period is less than 56 msec
539 * Worst scenario, 1500 frames should be stored in host.
540 */
541 return 1500;
542}
543
544/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800545 * @brief Get packet log config from HTT config
546 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800547uint8_t ol_cfg_is_packet_log_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800548
549#ifdef IPA_OFFLOAD
550/**
551 * @brief IPA micro controller data path offload enable or not
552 * @detail
553 * This function returns IPA micro controller data path offload
554 * feature enabled or not
555 *
556 * @param pdev - handle to the physical device
557 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800558unsigned int ol_cfg_ipa_uc_offload_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800559/**
560 * @brief IPA micro controller data path TX buffer size
561 * @detail
562 * This function returns IPA micro controller data path offload
563 * TX buffer size which should be pre-allocated by driver.
564 * Default buffer size is 2K
565 *
566 * @param pdev - handle to the physical device
567 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800568unsigned int ol_cfg_ipa_uc_tx_buf_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800569/**
570 * @brief IPA micro controller data path TX buffer size
571 * @detail
572 * This function returns IPA micro controller data path offload
573 * TX buffer count which should be pre-allocated by driver.
574 *
575 * @param pdev - handle to the physical device
576 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800577unsigned int ol_cfg_ipa_uc_tx_max_buf_cnt(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800578/**
579 * @brief IPA micro controller data path TX buffer size
580 * @detail
581 * This function returns IPA micro controller data path offload
582 * RX indication ring size which will notified by WLAN FW to IPA
583 * micro controller
584 *
585 * @param pdev - handle to the physical device
586 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800587unsigned int ol_cfg_ipa_uc_rx_ind_ring_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800588/**
589 * @brief IPA micro controller data path TX buffer size
590 * @param pdev - handle to the physical device
591 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800592unsigned int ol_cfg_ipa_uc_tx_partition_base(struct cdp_cfg *cfg_pdev);
593void ol_cfg_set_ipa_uc_tx_partition_base(struct cdp_cfg *cfg_pdev,
Yun Parkb4f591d2017-03-29 15:51:01 -0700594 uint32_t value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800595#else
596static inline unsigned int ol_cfg_ipa_uc_offload_enabled(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800597 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800598{
599 return 0;
600}
601
602static inline unsigned int ol_cfg_ipa_uc_tx_buf_size(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800603 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800604{
605 return 0;
606}
607
608static inline unsigned int ol_cfg_ipa_uc_tx_max_buf_cnt(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800609 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800610{
611 return 0;
612}
613
614static inline unsigned int ol_cfg_ipa_uc_rx_ind_ring_size(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800615 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800616{
617 return 0;
618}
619
620static inline unsigned int ol_cfg_ipa_uc_tx_partition_base(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800621 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800622{
623 return 0;
624}
Yun Park4d968df2016-10-11 11:44:15 -0700625
626static inline void ol_cfg_set_ipa_uc_tx_partition_base(
Yun Parkb4f591d2017-03-29 15:51:01 -0700627 void *cfg_pdev, uint32_t value)
Yun Park4d968df2016-10-11 11:44:15 -0700628{
Yun Park4d968df2016-10-11 11:44:15 -0700629}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800630#endif /* IPA_OFFLOAD */
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700631
632/**
633 * ol_set_cfg_flow_steering - Set Rx flow steering config based on CFG ini
634 * config.
635 *
636 * @pdev - handle to the physical device
637 * @val - 0 - disable, 1 - enable
638 *
639 * Return: None
640 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800641static inline void ol_set_cfg_flow_steering(struct cdp_cfg *cfg_pdev,
642 uint8_t val)
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700643{
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800644 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700645
646 cfg->flow_steering_enabled = val;
647}
648
649/**
650 * ol_cfg_is_flow_steering_enabled - Return Rx flow steering config.
651 *
652 * @pdev - handle to the physical device
653 *
654 * Return: value of configured flow steering value.
655 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800656static inline uint8_t ol_cfg_is_flow_steering_enabled(struct cdp_cfg *cfg_pdev)
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700657{
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800658 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700659
660 return cfg->flow_steering_enabled;
661}
gbian62edd7e2017-03-07 13:12:13 +0800662
663/**
664 * ol_cfg_get_wrr_skip_weight() - brief Query for the param of wrr_skip_weight
665 * @pdev: handle to the physical device.
666 * @ac: access control, it will be BE, BK, VI, VO
667 *
668 * Return: wrr_skip_weight for specified ac.
669 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530670int ol_cfg_get_wrr_skip_weight(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800671
672/**
673 * ol_cfg_get_credit_threshold() - Query for the param of credit_threshold
674 * @pdev: handle to the physical device.
675 * @ac: access control, it will be BE, BK, VI, VO
676 *
677 * Return: credit_threshold for specified ac.
678 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530679uint32_t ol_cfg_get_credit_threshold(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800680
681/**
682 * ol_cfg_get_send_limit() - Query for the param of send_limit
683 * @pdev: handle to the physical device.
684 * @ac: access control, it will be BE, BK, VI, VO
685 *
686 * Return: send_limit for specified ac.
687 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530688uint16_t ol_cfg_get_send_limit(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800689
690/**
691 * ol_cfg_get_credit_reserve() - Query for the param of credit_reserve
692 * @pdev: handle to the physical device.
693 * @ac: access control, it will be BE, BK, VI, VO
694 *
695 * Return: credit_reserve for specified ac.
696 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530697int ol_cfg_get_credit_reserve(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800698
699/**
700 * ol_cfg_get_discard_weight() - Query for the param of discard_weight
701 * @pdev: handle to the physical device.
702 * @ac: access control, it will be BE, BK, VI, VO
703 *
704 * Return: discard_weight for specified ac.
705 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530706int ol_cfg_get_discard_weight(struct cdp_cfg *pdev, int ac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800707#endif /* _OL_CFG__H_ */