blob: 91fded6b58ce8b7f84c155390fe81f45a47ea2dd [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07002 * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#ifndef _OL_CFG__H_
20#define _OL_CFG__H_
21
Anurag Chouhan6d760662016-02-20 16:05:43 +053022#include <qdf_types.h> /* uint32_t */
Dhanashri Atre12a08392016-02-17 13:10:34 -080023#include <cdp_txrx_cmn.h> /* ol_pdev_handle */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080024#include <cds_ieee80211_common.h> /* ieee80211_qosframe_htc_addr4 */
25#include <enet.h> /* LLC_SNAP_HDR_LEN */
Siddarth Poddar1df1cd82016-04-27 17:32:21 +053026#if defined(CONFIG_HL_SUPPORT)
27#include "wlan_tgt_def_config_hl.h"
28#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080029#include "wlan_tgt_def_config.h"
Siddarth Poddar1df1cd82016-04-27 17:32:21 +053030#endif
Dhanashri Atre12a08392016-02-17 13:10:34 -080031#include "ol_txrx_ctrl_api.h" /* txrx_pdev_cfg_param_t */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -080032#include <cdp_txrx_handle.h>
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -070033#include "qca_vendor.h"
gbian62edd7e2017-03-07 13:12:13 +080034
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035/**
36 * @brief format of data frames delivered to/from the WLAN driver by/to the OS
37 */
38enum wlan_frm_fmt {
39 wlan_frm_fmt_unknown,
40 wlan_frm_fmt_raw,
41 wlan_frm_fmt_native_wifi,
42 wlan_frm_fmt_802_3,
43};
44
hangtian1c37fb92019-04-10 11:15:20 +080045/* Max throughput */
Hangtian Zhu39e2e212019-09-02 13:34:57 +080046#ifdef SLUB_MEM_OPTIMIZE
hangtian1c37fb92019-04-10 11:15:20 +080047#define MAX_THROUGHPUT 400
48#else
49#define MAX_THROUGHPUT 800
50#endif
51
Poddar, Siddarth83905022016-04-16 17:56:08 -070052/* Throttle period Different level Duty Cycle values*/
53#define THROTTLE_DUTY_CYCLE_LEVEL0 (0)
54#define THROTTLE_DUTY_CYCLE_LEVEL1 (50)
55#define THROTTLE_DUTY_CYCLE_LEVEL2 (75)
56#define THROTTLE_DUTY_CYCLE_LEVEL3 (94)
57
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080058struct wlan_ipa_uc_rsc_t {
59 u8 uc_offload_enabled;
60 u32 tx_max_buf_cnt;
61 u32 tx_buf_size;
62 u32 rx_ind_ring_size;
63 u32 tx_partition_base;
64};
65
66/* Config parameters for txrx_pdev */
67struct txrx_pdev_cfg_t {
68 u8 is_high_latency;
69 u8 defrag_timeout_check;
70 u8 rx_pn_check;
71 u8 pn_rx_fwd_check;
72 u8 host_addba;
73 u8 tx_free_at_download;
74 u8 rx_fwd_inter_bss;
75 u32 max_thruput_mbps;
76 u32 target_tx_credit;
77 u32 vow_config;
78 u32 tx_download_size;
79 u32 max_peer_id;
80 u32 max_vdev;
81 u32 max_nbuf_frags;
82 u32 throttle_period_ms;
Poddar, Siddarth83905022016-04-16 17:56:08 -070083 u8 dutycycle_level[4];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084 enum wlan_frm_fmt frame_type;
85 u8 rx_fwd_disabled;
86 u8 is_packet_log_enabled;
87 u8 is_full_reorder_offload;
Yu Wang66a250b2017-07-19 11:46:40 +080088#ifdef WLAN_FEATURE_TSF_PLUS
89 u8 is_ptp_rx_opt_enabled;
90#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080091 struct wlan_ipa_uc_rsc_t ipa_uc_rsc;
92 bool ip_tcp_udp_checksum_offload;
93 bool enable_rxthread;
94 bool ce_classify_enabled;
hangtianb9c91362019-06-07 10:39:38 +080095#if defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(QCA_LL_PDEV_TX_FLOW_CONTROL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080096 uint32_t tx_flow_stop_queue_th;
97 uint32_t tx_flow_start_queue_offset;
hangtianb9c91362019-06-07 10:39:38 +080098#endif
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -070099 bool flow_steering_enabled;
Ajit Pal Singhc31d1012018-06-07 19:47:22 +0530100 /*
101 * To track if credit reporting through
102 * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND is enabled/disabled.
103 * In Genoa(QCN7605) credits are reported through
104 * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND only.
105 */
106 u8 credit_update_enabled;
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -0700107 struct ol_tx_sched_wrr_ac_specs_t ac_specs[QCA_WLAN_AC_ALL];
jitiphil377bcc12018-10-05 19:46:08 +0530108 bool gro_enable;
109 bool tso_enable;
110 bool lro_enable;
111 bool enable_data_stall_detection;
112 bool enable_flow_steering;
113 bool disable_intra_bss_fwd;
114 /* IPA Micro controller data path offload TX buffer size */
115 uint32_t uc_tx_buffer_size;
116 /* IPA Micro controller data path offload RX indication ring count */
117 uint32_t uc_rx_indication_ring_count;
118 /* IPA Micro controller data path offload TX partition base */
119 uint32_t uc_tx_partition_base;
Rakshith Suresh Patkar0f6375c2018-12-04 20:59:07 +0530120 /* Flag to indicate whether new htt format is supported */
121 bool new_htt_format_enabled;
Tiger Yue40e7832019-04-25 10:46:53 +0800122
123#ifdef QCA_SUPPORT_TXRX_DRIVER_TCP_DEL_ACK
124 /* enable the tcp delay ack feature in the driver */
125 bool del_ack_enable;
126 /* timeout if no more tcp ack frames, unit is ms */
127 uint16_t del_ack_timer_value;
128 /* the maximum number of replaced tcp ack frames */
129 uint16_t del_ack_pkt_count;
130#endif
Nirav Shahfb9b1df2019-11-15 11:40:52 +0530131
132#ifdef WLAN_SUPPORT_TXRX_HL_BUNDLE
133 uint16_t bundle_timer_value;
134 uint16_t bundle_size;
135#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800136};
137
138/**
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800139 * ol_tx_set_flow_control_parameters() - set flow control parameters
140 * @cfg_ctx: cfg context
141 * @cfg_param: cfg parameters
142 *
143 * Return: none
144 */
hangtianb9c91362019-06-07 10:39:38 +0800145#if defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(QCA_LL_PDEV_TX_FLOW_CONTROL)
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800146void ol_tx_set_flow_control_parameters(struct cdp_cfg *cfg_ctx,
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800147 struct txrx_pdev_cfg_param_t *cfg_param);
hangtianb9c91362019-06-07 10:39:38 +0800148#else
149static inline
150void ol_tx_set_flow_control_parameters(struct cdp_cfg *cfg_ctx,
151 struct txrx_pdev_cfg_param_t *cfg_param)
152{
153}
154#endif
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800155
156/**
Jeff Johnsonbacec092016-12-20 14:08:47 -0800157 * ol_pdev_cfg_attach - setup configuration parameters
158 * @osdev: OS handle needed as an argument for some OS primitives
159 * @cfg_param: configuration parameters
160 *
161 * Allocation configuration context that will be used across data path
162 *
163 * Return: the control device object
164 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800165struct cdp_cfg *ol_pdev_cfg_attach(qdf_device_t osdev, void *pcfg_param);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800166
167/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800168 * @brief Specify whether the system is high-latency or low-latency.
169 * @details
170 * Indicate whether the system is operating in high-latency (message
171 * based, e.g. USB) mode or low-latency (memory-mapped, e.g. PCIe) mode.
172 * Some chips support just one type of host / target interface.
173 * Other chips support both LL and HL interfaces (e.g. PCIe and USB),
174 * so the selection will be made based on which bus HW is present, or
175 * which is preferred if both are present.
176 *
177 * @param pdev - handle to the physical device
178 * @return 1 -> high-latency -OR- 0 -> low-latency
179 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800180int ol_cfg_is_high_latency(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800181
182/**
Ajit Pal Singhc31d1012018-06-07 19:47:22 +0530183 * @brief Specify whether credit reporting through
184 * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND is enabled by default.
185 * In Genoa credits are reported only through
186 * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND
187 * @details
188 * @param pdev - handle to the physical device
189 * @return 1 -> enabled -OR- 0 -> disabled
190 */
191int ol_cfg_is_credit_update_enabled(struct cdp_cfg *cfg_pdev);
192
193/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800194 * @brief Specify the range of peer IDs.
195 * @details
196 * Specify the maximum peer ID. This is the maximum number of peers,
197 * minus one.
198 * This is used by the host to determine the size of arrays indexed by
199 * peer ID.
200 *
201 * @param pdev - handle to the physical device
202 * @return maximum peer ID
203 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800204int ol_cfg_max_peer_id(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800205
206/**
207 * @brief Specify the max number of virtual devices within a physical device.
208 * @details
209 * Specify how many virtual devices may exist within a physical device.
210 *
211 * @param pdev - handle to the physical device
212 * @return maximum number of virtual devices
213 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800214int ol_cfg_max_vdevs(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800215
216/**
217 * @brief Check whether host-side rx PN check is enabled or disabled.
218 * @details
219 * Choose whether to allocate rx PN state information and perform
220 * rx PN checks (if applicable, based on security type) on the host.
221 * If the rx PN check is specified to be done on the host, the host SW
222 * will determine which peers are using a security type (e.g. CCMP) that
223 * requires a PN check.
224 *
225 * @param pdev - handle to the physical device
226 * @return 1 -> host performs rx PN check -OR- 0 -> no host-side rx PN check
227 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800228int ol_cfg_rx_pn_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800229
230/**
231 * @brief Check whether host-side rx forwarding is enabled or disabled.
232 * @details
233 * Choose whether to check whether to forward rx frames to tx on the host.
234 * For LL systems, this rx -> tx host-side forwarding check is typically
235 * enabled.
236 * For HL systems, the rx -> tx forwarding check is typically done on the
237 * target. However, even in HL systems, the host-side rx -> tx forwarding
238 * will typically be enabled, as a second-tier safety net in case the
239 * target doesn't have enough memory to store all rx -> tx forwarded frames.
240 *
241 * @param pdev - handle to the physical device
242 * @return 1 -> host does rx->tx forward -OR- 0 -> no host-side rx->tx forward
243 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800244int ol_cfg_rx_fwd_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800245
246/**
Jeff Johnsonbacec092016-12-20 14:08:47 -0800247 * ol_set_cfg_rx_fwd_disabled - set rx fwd disable/enable
248 *
249 * @pdev - handle to the physical device
250 * @disable_rx_fwd 1 -> no rx->tx forward -> rx->tx forward
251 *
252 * Choose whether to forward rx frames to tx (where applicable) within the
253 * WLAN driver, or to leave all forwarding up to the operating system.
254 * Currently only intra-bss fwd is supported.
255 *
256 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800257void ol_set_cfg_rx_fwd_disabled(struct cdp_cfg *ppdev, uint8_t disable_rx_fwd);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800258
259/**
260 * ol_set_cfg_packet_log_enabled - Set packet log config in HTT
261 * config based on CFG ini configuration
262 *
263 * @pdev - handle to the physical device
264 * @val - 0 - disable, 1 - enable
265 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800266void ol_set_cfg_packet_log_enabled(struct cdp_cfg *ppdev, uint8_t val);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800267
268/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800269 * @brief Check whether rx forwarding is enabled or disabled.
270 * @details
271 * Choose whether to forward rx frames to tx (where applicable) within the
272 * WLAN driver, or to leave all forwarding up to the operating system.
273 *
274 * @param pdev - handle to the physical device
275 * @return 1 -> no rx->tx forward -OR- 0 -> rx->tx forward (in host or target)
276 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800277int ol_cfg_rx_fwd_disabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800278
279/**
280 * @brief Check whether to perform inter-BSS or intra-BSS rx->tx forwarding.
281 * @details
282 * Check whether data received by an AP on one virtual device destined
283 * to a STA associated with a different virtual device within the same
284 * physical device should be forwarded within the driver, or whether
285 * forwarding should only be done within a virtual device.
286 *
287 * @param pdev - handle to the physical device
288 * @return
289 * 1 -> forward both within and between vdevs
290 * -OR-
291 * 0 -> forward only within a vdev
292 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800293int ol_cfg_rx_fwd_inter_bss(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800294
295/**
296 * @brief Specify data frame format used by the OS.
297 * @details
298 * Specify what type of frame (802.3 or native WiFi) the host data SW
299 * should expect from and provide to the OS shim.
300 *
301 * @param pdev - handle to the physical device
302 * @return enumerated data frame format
303 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800304enum wlan_frm_fmt ol_cfg_frame_type(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800305
306/**
307 * @brief Specify the peak throughput.
308 * @details
309 * Specify the peak throughput that a system is expected to support.
310 * The data SW uses this configuration to help choose the size for its
311 * tx descriptor pool and rx buffer ring.
312 * The data SW assumes that the peak throughput applies to either rx or tx,
313 * rather than having separate specs of the rx max throughput vs. the tx
314 * max throughput.
315 *
316 * @param pdev - handle to the physical device
317 * @return maximum supported throughput in Mbps (not MBps)
318 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800319int ol_cfg_max_thruput_mbps(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800320
321/**
322 * @brief Specify the maximum number of fragments per tx network buffer.
323 * @details
324 * Specify the maximum number of fragments that a tx frame provided to
325 * the WLAN driver by the OS may contain.
326 * In LL systems, the host data SW uses this maximum fragment count to
327 * determine how many elements to allocate in the fragmentation descriptor
328 * it creates to specify to the tx MAC DMA where to locate the tx frame's
329 * data.
330 * This maximum fragments count is only for regular frames, not TSO frames,
331 * since TSO frames are sent in segments with a limited number of fragments
332 * per segment.
333 *
334 * @param pdev - handle to the physical device
335 * @return maximum number of fragments that can occur in a regular tx frame
336 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800337int ol_cfg_netbuf_frags_max(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800338
339/**
340 * @brief For HL systems, specify when to free tx frames.
341 * @details
342 * In LL systems, the host's tx frame is referenced by the MAC DMA, and
343 * thus cannot be freed until the target indicates that it is finished
344 * transmitting the frame.
345 * In HL systems, the entire tx frame is downloaded to the target.
346 * Consequently, the target has its own copy of the tx frame, and the
347 * host can free the tx frame as soon as the download completes.
348 * Alternatively, the HL host can keep the frame allocated until the
349 * target explicitly tells the HL host it is done transmitting the frame.
350 * This gives the target the option of discarding its copy of the tx
351 * frame, and then later getting a new copy from the host.
352 * This function tells the host whether it should retain its copy of the
353 * transmit frames until the target explicitly indicates it is finished
354 * transmitting them, or if it should free its copy as soon as the
355 * tx frame is downloaded to the target.
356 *
357 * @param pdev - handle to the physical device
358 * @return
359 * 0 -> retain the tx frame until the target indicates it is done
360 * transmitting the frame
361 * -OR-
362 * 1 -> free the tx frame as soon as the download completes
363 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800364int ol_cfg_tx_free_at_download(struct cdp_cfg *cfg_pdev);
365void ol_cfg_set_tx_free_at_download(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800366
367/**
368 * @brief Low water mark for target tx credit.
369 * Tx completion handler is invoked to reap the buffers when the target tx
370 * credit goes below Low Water Mark.
371 */
372#define OL_CFG_NUM_MSDU_REAP 512
373#define ol_cfg_tx_credit_lwm(pdev) \
374 ((CFG_TGT_NUM_MSDU_DESC > OL_CFG_NUM_MSDU_REAP) ? \
375 (CFG_TGT_NUM_MSDU_DESC - OL_CFG_NUM_MSDU_REAP) : 0)
376
377/**
378 * @brief In a HL system, specify the target initial credit count.
379 * @details
380 * The HL host tx data SW includes a module for determining which tx frames
381 * to download to the target at a given time.
382 * To make this judgement, the HL tx download scheduler has to know
383 * how many buffers the HL target has available to hold tx frames.
384 * Due to the possibility that a single target buffer pool can be shared
385 * between rx and tx frames, the host may not be able to obtain a precise
386 * specification of the tx buffer space available in the target, but it
387 * uses the best estimate, as provided by this configuration function,
388 * to determine how best to schedule the tx frame downloads.
389 *
390 * @param pdev - handle to the physical device
391 * @return the number of tx buffers available in a HL target
392 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800393uint16_t ol_cfg_target_tx_credit(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800394
395/**
396 * @brief Specify the LL tx MSDU header download size.
397 * @details
398 * In LL systems, determine how many bytes from a tx frame to download,
399 * in order to provide the target FW's Descriptor Engine with enough of
400 * the packet's payload to interpret what kind of traffic this is,
401 * and who it is for.
402 * This download size specification does not include the 802.3 / 802.11
403 * frame encapsulation headers; it starts with the encapsulated IP packet
404 * (or whatever ethertype is carried within the ethernet-ish frame).
405 * The LL host data SW will determine how many bytes of the MSDU header to
406 * download by adding this download size specification to the size of the
407 * frame header format specified by the ol_cfg_frame_type configuration
408 * function.
409 *
410 * @param pdev - handle to the physical device
411 * @return the number of bytes beyond the 802.3 or native WiFi header to
412 * download to the target for tx classification
413 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800414int ol_cfg_tx_download_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800415
416/**
417 * brief Specify where defrag timeout and duplicate detection is handled
418 * @details
419 * non-aggregate duplicate detection and timing out stale fragments
420 * requires additional target memory. To reach max client
421 * configurations (128+), non-aggregate duplicate detection and the
422 * logic to time out stale fragments is moved to the host.
423 *
424 * @param pdev - handle to the physical device
425 * @return
426 * 0 -> target is responsible non-aggregate duplicate detection and
427 * timing out stale fragments.
428 *
429 * 1 -> host is responsible non-aggregate duplicate detection and
430 * timing out stale fragments.
431 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800432int ol_cfg_rx_host_defrag_timeout_duplicate_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800433
434/**
435 * brief Query for the period in ms used for throttling for
436 * thermal mitigation
437 * @details
438 * In LL systems, transmit data throttling is used for thermal
439 * mitigation where data is paused and resumed during the
440 * throttle period i.e. the throttle period consists of an
441 * "on" phase when transmit is allowed and an "off" phase when
442 * transmit is suspended. This function returns the total
443 * period used for throttling.
444 *
445 * @param pdev - handle to the physical device
446 * @return the total throttle period in ms
447 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800448int ol_cfg_throttle_period_ms(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800449
450/**
Poddar, Siddarth83905022016-04-16 17:56:08 -0700451 * brief Query for the duty cycle in percentage used for throttling for
452 * thermal mitigation
453 *
454 * @param pdev - handle to the physical device
455 * @param level - duty cycle level
456 * @return the duty cycle level in percentage
457 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800458int ol_cfg_throttle_duty_cycle_level(struct cdp_cfg *cfg_pdev, int level);
Poddar, Siddarth83905022016-04-16 17:56:08 -0700459
460/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800461 * brief Check whether full reorder offload is
462 * enabled/disable by the host
463 * @details
464 * If the host does not support receive reorder (i.e. the
465 * target performs full receive re-ordering) this will return
466 * "enabled"
467 *
468 * @param pdev - handle to the physical device
469 * @return 1 - enable, 0 - disable
470 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800471int ol_cfg_is_full_reorder_offload(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800472
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800473int ol_cfg_is_rx_thread_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800474
Yu Wang66a250b2017-07-19 11:46:40 +0800475#ifdef WLAN_FEATURE_TSF_PLUS
476void ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val);
477u_int8_t ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev);
478#else
479static inline void
480ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val)
481{
482}
483
484static inline u_int8_t
485ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev)
486{
487 return 0;
488}
489#endif
490
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800491/**
492 * ol_cfg_is_ip_tcp_udp_checksum_offload_enabled() - return
493 * ip_tcp_udp_checksum_offload is enable/disable
494 * @pdev : handle to the physical device
495 *
496 * Return: 1 - enable, 0 - disable
497 */
498static inline
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800499int ol_cfg_is_ip_tcp_udp_checksum_offload_enabled(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800500{
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800501 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
Yun Park73fbcf52017-04-05 11:49:16 -0700502
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800503 return cfg->ip_tcp_udp_checksum_offload;
504}
505
506
hangtianb9c91362019-06-07 10:39:38 +0800507#if defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(QCA_LL_PDEV_TX_FLOW_CONTROL)
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800508int ol_cfg_get_tx_flow_stop_queue_th(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800509
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800510int ol_cfg_get_tx_flow_start_queue_offset(struct cdp_cfg *cfg_pdev);
hangtianb9c91362019-06-07 10:39:38 +0800511#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800512
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800513bool ol_cfg_is_ce_classify_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800514
515enum wlan_target_fmt_translation_caps {
516 wlan_frm_tran_cap_raw = 0x01,
517 wlan_frm_tran_cap_native_wifi = 0x02,
518 wlan_frm_tran_cap_8023 = 0x04,
519};
520
521/**
522 * @brief Specify the maximum header size added by SW tx encapsulation
523 * @details
524 * This function returns the maximum size of the new L2 header, not the
525 * difference between the new and old L2 headers.
526 * Thus, this function returns the maximum 802.11 header size that the
527 * tx SW may need to add to tx data frames.
528 *
529 * @param pdev - handle to the physical device
530 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800531static inline int ol_cfg_sw_encap_hdr_max_size(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800532{
533 /*
534 * 24 byte basic 802.11 header
535 * + 6 byte 4th addr
536 * + 2 byte QoS control
537 * + 4 byte HT control
538 * + 8 byte LLC/SNAP
539 */
540 return sizeof(struct ieee80211_qosframe_htc_addr4) + LLC_SNAP_HDR_LEN;
541}
542
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800543static inline uint8_t ol_cfg_tx_encap(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800544{
545 /* tx encap done in HW */
546 return 0;
547}
548
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800549static inline int ol_cfg_host_addba(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800550{
551 /*
552 * ADDBA negotiation is handled by the target FW for Peregrine + Rome.
553 */
554 return 0;
555}
556
557/**
558 * @brief If the host SW's ADDBA negotiation fails, should it be retried?
559 *
560 * @param pdev - handle to the physical device
561 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800562static inline int ol_cfg_addba_retry(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800563{
564 return 0; /* disabled for now */
565}
566
567/**
568 * @brief How many frames to hold in a paused vdev's tx queue in LL systems
569 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800570static inline int ol_tx_cfg_max_tx_queue_depth_ll(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800571{
572 /*
573 * Store up to 1500 frames for a paused vdev.
574 * For example, if the vdev is sending 300 Mbps of traffic, and the
575 * PHY is capable of 600 Mbps, then it will take 56 ms for the PHY to
576 * drain both the 700 frames that are queued initially, plus the next
577 * 700 frames that come in while the PHY is catching up.
578 * So in this example scenario, the PHY will remain fully utilized
579 * in a MCC system that has a channel-switching period of 56 ms or less.
580 * 700 frames calculation was correct when FW drain packet without
581 * any overhead. Actual situation drain overhead will slowdown drain
582 * speed. And channel period is less than 56 msec
583 * Worst scenario, 1500 frames should be stored in host.
584 */
585 return 1500;
586}
587
588/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800589 * @brief Get packet log config from HTT config
590 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800591uint8_t ol_cfg_is_packet_log_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800592
593#ifdef IPA_OFFLOAD
594/**
595 * @brief IPA micro controller data path offload enable or not
596 * @detail
597 * This function returns IPA micro controller data path offload
598 * feature enabled or not
599 *
600 * @param pdev - handle to the physical device
601 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800602unsigned int ol_cfg_ipa_uc_offload_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800603/**
604 * @brief IPA micro controller data path TX buffer size
605 * @detail
606 * This function returns IPA micro controller data path offload
607 * TX buffer size which should be pre-allocated by driver.
608 * Default buffer size is 2K
609 *
610 * @param pdev - handle to the physical device
611 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800612unsigned int ol_cfg_ipa_uc_tx_buf_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800613/**
614 * @brief IPA micro controller data path TX buffer size
615 * @detail
616 * This function returns IPA micro controller data path offload
617 * TX buffer count which should be pre-allocated by driver.
618 *
619 * @param pdev - handle to the physical device
620 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800621unsigned int ol_cfg_ipa_uc_tx_max_buf_cnt(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800622/**
623 * @brief IPA micro controller data path TX buffer size
624 * @detail
625 * This function returns IPA micro controller data path offload
626 * RX indication ring size which will notified by WLAN FW to IPA
627 * micro controller
628 *
629 * @param pdev - handle to the physical device
630 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800631unsigned int ol_cfg_ipa_uc_rx_ind_ring_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800632/**
633 * @brief IPA micro controller data path TX buffer size
634 * @param pdev - handle to the physical device
635 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800636unsigned int ol_cfg_ipa_uc_tx_partition_base(struct cdp_cfg *cfg_pdev);
637void ol_cfg_set_ipa_uc_tx_partition_base(struct cdp_cfg *cfg_pdev,
Yun Parkb4f591d2017-03-29 15:51:01 -0700638 uint32_t value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800639#else
640static inline unsigned int ol_cfg_ipa_uc_offload_enabled(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800641 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800642{
643 return 0;
644}
645
646static inline unsigned int ol_cfg_ipa_uc_tx_buf_size(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800647 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800648{
649 return 0;
650}
651
652static inline unsigned int ol_cfg_ipa_uc_tx_max_buf_cnt(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800653 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800654{
655 return 0;
656}
657
658static inline unsigned int ol_cfg_ipa_uc_rx_ind_ring_size(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800659 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800660{
661 return 0;
662}
663
664static inline unsigned int ol_cfg_ipa_uc_tx_partition_base(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800665 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800666{
667 return 0;
668}
Yun Park4d968df2016-10-11 11:44:15 -0700669
670static inline void ol_cfg_set_ipa_uc_tx_partition_base(
Yun Parkb4f591d2017-03-29 15:51:01 -0700671 void *cfg_pdev, uint32_t value)
Yun Park4d968df2016-10-11 11:44:15 -0700672{
Yun Park4d968df2016-10-11 11:44:15 -0700673}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800674#endif /* IPA_OFFLOAD */
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700675
676/**
677 * ol_set_cfg_flow_steering - Set Rx flow steering config based on CFG ini
678 * config.
679 *
680 * @pdev - handle to the physical device
681 * @val - 0 - disable, 1 - enable
682 *
683 * Return: None
684 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800685static inline void ol_set_cfg_flow_steering(struct cdp_cfg *cfg_pdev,
686 uint8_t val)
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700687{
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800688 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700689
690 cfg->flow_steering_enabled = val;
691}
692
693/**
694 * ol_cfg_is_flow_steering_enabled - Return Rx flow steering config.
695 *
696 * @pdev - handle to the physical device
697 *
698 * Return: value of configured flow steering value.
699 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800700static inline uint8_t ol_cfg_is_flow_steering_enabled(struct cdp_cfg *cfg_pdev)
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700701{
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800702 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700703
704 return cfg->flow_steering_enabled;
705}
gbian62edd7e2017-03-07 13:12:13 +0800706
707/**
Rakshith Suresh Patkar0f6375c2018-12-04 20:59:07 +0530708 * ol_set_cfg_new_htt_format - Set whether FW supports new htt format
709 *
710 * @pdev - handle to the physical device
711 * @val - true - supported, false - not supported
712 *
713 * Return: None
714 */
715static inline void
716ol_set_cfg_new_htt_format(struct cdp_cfg *cfg_pdev, bool val)
717{
718 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
719
720 cfg->new_htt_format_enabled = val;
721}
722
723/**
724 * ol_cfg_is_htt_new_format_enabled - Return whether FW supports new htt format
725 *
726 * @pdev - handle to the physical device
727 *
728 * Return: value of configured htt_new_format
729 */
730static inline bool
731ol_cfg_is_htt_new_format_enabled(struct cdp_cfg *cfg_pdev)
732{
733 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
734
735 return cfg->new_htt_format_enabled;
736}
737
Tiger Yue40e7832019-04-25 10:46:53 +0800738#ifdef QCA_SUPPORT_TXRX_DRIVER_TCP_DEL_ACK
739/**
740 * ol_cfg_get_del_ack_timer_value() - get delayed ack timer value
741 * @cfg_pdev: pdev handle
742 *
743 * Return: timer value
744 */
745int ol_cfg_get_del_ack_timer_value(struct cdp_cfg *cfg_pdev);
746
747/**
748 * ol_cfg_get_del_ack_enable_value() - get delayed ack enable value
749 * @cfg_pdev: pdev handle
750 *
751 * Return: enable/disable
752 */
753bool ol_cfg_get_del_ack_enable_value(struct cdp_cfg *cfg_pdev);
754
755/**
756 * ol_cfg_get_del_ack_count_value() - get delayed ack count value
757 * @cfg_pdev: pdev handle
758 *
759 * Return: count value
760 */
761int ol_cfg_get_del_ack_count_value(struct cdp_cfg *cfg_pdev);
762
763/**
764 * ol_cfg_update_del_ack_params() - update delayed ack params
765 * @cfg_ctx: cfg context
766 * @cfg_param: parameters
767 *
768 * Return: none
769 */
770void ol_cfg_update_del_ack_params(struct txrx_pdev_cfg_t *cfg_ctx,
771 struct txrx_pdev_cfg_param_t *cfg_param);
772#else
773/**
774 * ol_cfg_update_del_ack_params() - update delayed ack params
775 * @cfg_ctx: cfg context
776 * @cfg_param: parameters
777 *
778 * Return: none
779 */
780static inline
781void ol_cfg_update_del_ack_params(struct txrx_pdev_cfg_t *cfg_ctx,
782 struct txrx_pdev_cfg_param_t *cfg_param)
783{
784}
785#endif
786
Nirav Shahfb9b1df2019-11-15 11:40:52 +0530787#ifdef WLAN_SUPPORT_TXRX_HL_BUNDLE
788int ol_cfg_get_bundle_timer_value(struct cdp_cfg *cfg_pdev);
789int ol_cfg_get_bundle_size(struct cdp_cfg *cfg_pdev);
790#else
791#endif
Rakshith Suresh Patkar0f6375c2018-12-04 20:59:07 +0530792/**
gbian62edd7e2017-03-07 13:12:13 +0800793 * ol_cfg_get_wrr_skip_weight() - brief Query for the param of wrr_skip_weight
794 * @pdev: handle to the physical device.
795 * @ac: access control, it will be BE, BK, VI, VO
796 *
797 * Return: wrr_skip_weight for specified ac.
798 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530799int ol_cfg_get_wrr_skip_weight(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800800
801/**
802 * ol_cfg_get_credit_threshold() - Query for the param of credit_threshold
803 * @pdev: handle to the physical device.
804 * @ac: access control, it will be BE, BK, VI, VO
805 *
806 * Return: credit_threshold for specified ac.
807 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530808uint32_t ol_cfg_get_credit_threshold(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800809
810/**
811 * ol_cfg_get_send_limit() - Query for the param of send_limit
812 * @pdev: handle to the physical device.
813 * @ac: access control, it will be BE, BK, VI, VO
814 *
815 * Return: send_limit for specified ac.
816 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530817uint16_t ol_cfg_get_send_limit(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800818
819/**
820 * ol_cfg_get_credit_reserve() - Query for the param of credit_reserve
821 * @pdev: handle to the physical device.
822 * @ac: access control, it will be BE, BK, VI, VO
823 *
824 * Return: credit_reserve for specified ac.
825 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530826int ol_cfg_get_credit_reserve(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800827
828/**
829 * ol_cfg_get_discard_weight() - Query for the param of discard_weight
830 * @pdev: handle to the physical device.
831 * @ac: access control, it will be BE, BK, VI, VO
832 *
833 * Return: discard_weight for specified ac.
834 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530835int ol_cfg_get_discard_weight(struct cdp_cfg *pdev, int ac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800836#endif /* _OL_CFG__H_ */