blob: d46130668b81a0f55e36544bb163b2e9a6aa56fa [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 */
46#ifdef QCS403_MEM_OPTIMIZE
47#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;
95#ifdef QCA_LL_TX_FLOW_CONTROL_V2
96 uint32_t tx_flow_stop_queue_th;
97 uint32_t tx_flow_start_queue_offset;
98#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;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122};
123
124/**
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800125 * ol_tx_set_flow_control_parameters() - set flow control parameters
126 * @cfg_ctx: cfg context
127 * @cfg_param: cfg parameters
128 *
129 * Return: none
130 */
131#ifdef QCA_LL_TX_FLOW_CONTROL_V2
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800132void ol_tx_set_flow_control_parameters(struct cdp_cfg *cfg_ctx,
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800133 struct txrx_pdev_cfg_param_t *cfg_param);
134#else
135static inline
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800136void ol_tx_set_flow_control_parameters(struct cdp_cfg *cfg_ctx,
Jeff Johnsonffa9afc2016-12-19 15:34:41 -0800137 struct txrx_pdev_cfg_param_t *cfg_param)
138{
139}
140#endif
141
142/**
Jeff Johnsonbacec092016-12-20 14:08:47 -0800143 * ol_pdev_cfg_attach - setup configuration parameters
144 * @osdev: OS handle needed as an argument for some OS primitives
145 * @cfg_param: configuration parameters
146 *
147 * Allocation configuration context that will be used across data path
148 *
149 * Return: the control device object
150 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800151struct cdp_cfg *ol_pdev_cfg_attach(qdf_device_t osdev, void *pcfg_param);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800152
153/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800154 * @brief Specify whether the system is high-latency or low-latency.
155 * @details
156 * Indicate whether the system is operating in high-latency (message
157 * based, e.g. USB) mode or low-latency (memory-mapped, e.g. PCIe) mode.
158 * Some chips support just one type of host / target interface.
159 * Other chips support both LL and HL interfaces (e.g. PCIe and USB),
160 * so the selection will be made based on which bus HW is present, or
161 * which is preferred if both are present.
162 *
163 * @param pdev - handle to the physical device
164 * @return 1 -> high-latency -OR- 0 -> low-latency
165 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800166int ol_cfg_is_high_latency(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800167
168/**
Ajit Pal Singhc31d1012018-06-07 19:47:22 +0530169 * @brief Specify whether credit reporting through
170 * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND is enabled by default.
171 * In Genoa credits are reported only through
172 * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND
173 * @details
174 * @param pdev - handle to the physical device
175 * @return 1 -> enabled -OR- 0 -> disabled
176 */
177int ol_cfg_is_credit_update_enabled(struct cdp_cfg *cfg_pdev);
178
179/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800180 * @brief Specify the range of peer IDs.
181 * @details
182 * Specify the maximum peer ID. This is the maximum number of peers,
183 * minus one.
184 * This is used by the host to determine the size of arrays indexed by
185 * peer ID.
186 *
187 * @param pdev - handle to the physical device
188 * @return maximum peer ID
189 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800190int ol_cfg_max_peer_id(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191
192/**
193 * @brief Specify the max number of virtual devices within a physical device.
194 * @details
195 * Specify how many virtual devices may exist within a physical device.
196 *
197 * @param pdev - handle to the physical device
198 * @return maximum number of virtual devices
199 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800200int ol_cfg_max_vdevs(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800201
202/**
203 * @brief Check whether host-side rx PN check is enabled or disabled.
204 * @details
205 * Choose whether to allocate rx PN state information and perform
206 * rx PN checks (if applicable, based on security type) on the host.
207 * If the rx PN check is specified to be done on the host, the host SW
208 * will determine which peers are using a security type (e.g. CCMP) that
209 * requires a PN check.
210 *
211 * @param pdev - handle to the physical device
212 * @return 1 -> host performs rx PN check -OR- 0 -> no host-side rx PN check
213 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800214int ol_cfg_rx_pn_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800215
216/**
217 * @brief Check whether host-side rx forwarding is enabled or disabled.
218 * @details
219 * Choose whether to check whether to forward rx frames to tx on the host.
220 * For LL systems, this rx -> tx host-side forwarding check is typically
221 * enabled.
222 * For HL systems, the rx -> tx forwarding check is typically done on the
223 * target. However, even in HL systems, the host-side rx -> tx forwarding
224 * will typically be enabled, as a second-tier safety net in case the
225 * target doesn't have enough memory to store all rx -> tx forwarded frames.
226 *
227 * @param pdev - handle to the physical device
228 * @return 1 -> host does rx->tx forward -OR- 0 -> no host-side rx->tx forward
229 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800230int ol_cfg_rx_fwd_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800231
232/**
Jeff Johnsonbacec092016-12-20 14:08:47 -0800233 * ol_set_cfg_rx_fwd_disabled - set rx fwd disable/enable
234 *
235 * @pdev - handle to the physical device
236 * @disable_rx_fwd 1 -> no rx->tx forward -> rx->tx forward
237 *
238 * Choose whether to forward rx frames to tx (where applicable) within the
239 * WLAN driver, or to leave all forwarding up to the operating system.
240 * Currently only intra-bss fwd is supported.
241 *
242 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800243void ol_set_cfg_rx_fwd_disabled(struct cdp_cfg *ppdev, uint8_t disable_rx_fwd);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800244
245/**
246 * ol_set_cfg_packet_log_enabled - Set packet log config in HTT
247 * config based on CFG ini configuration
248 *
249 * @pdev - handle to the physical device
250 * @val - 0 - disable, 1 - enable
251 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800252void ol_set_cfg_packet_log_enabled(struct cdp_cfg *ppdev, uint8_t val);
Jeff Johnsonbacec092016-12-20 14:08:47 -0800253
254/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800255 * @brief Check whether rx forwarding is enabled or disabled.
256 * @details
257 * Choose whether to forward rx frames to tx (where applicable) within the
258 * WLAN driver, or to leave all forwarding up to the operating system.
259 *
260 * @param pdev - handle to the physical device
261 * @return 1 -> no rx->tx forward -OR- 0 -> rx->tx forward (in host or target)
262 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800263int ol_cfg_rx_fwd_disabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800264
265/**
266 * @brief Check whether to perform inter-BSS or intra-BSS rx->tx forwarding.
267 * @details
268 * Check whether data received by an AP on one virtual device destined
269 * to a STA associated with a different virtual device within the same
270 * physical device should be forwarded within the driver, or whether
271 * forwarding should only be done within a virtual device.
272 *
273 * @param pdev - handle to the physical device
274 * @return
275 * 1 -> forward both within and between vdevs
276 * -OR-
277 * 0 -> forward only within a vdev
278 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800279int ol_cfg_rx_fwd_inter_bss(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800280
281/**
282 * @brief Specify data frame format used by the OS.
283 * @details
284 * Specify what type of frame (802.3 or native WiFi) the host data SW
285 * should expect from and provide to the OS shim.
286 *
287 * @param pdev - handle to the physical device
288 * @return enumerated data frame format
289 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800290enum wlan_frm_fmt ol_cfg_frame_type(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800291
292/**
293 * @brief Specify the peak throughput.
294 * @details
295 * Specify the peak throughput that a system is expected to support.
296 * The data SW uses this configuration to help choose the size for its
297 * tx descriptor pool and rx buffer ring.
298 * The data SW assumes that the peak throughput applies to either rx or tx,
299 * rather than having separate specs of the rx max throughput vs. the tx
300 * max throughput.
301 *
302 * @param pdev - handle to the physical device
303 * @return maximum supported throughput in Mbps (not MBps)
304 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800305int ol_cfg_max_thruput_mbps(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800306
307/**
308 * @brief Specify the maximum number of fragments per tx network buffer.
309 * @details
310 * Specify the maximum number of fragments that a tx frame provided to
311 * the WLAN driver by the OS may contain.
312 * In LL systems, the host data SW uses this maximum fragment count to
313 * determine how many elements to allocate in the fragmentation descriptor
314 * it creates to specify to the tx MAC DMA where to locate the tx frame's
315 * data.
316 * This maximum fragments count is only for regular frames, not TSO frames,
317 * since TSO frames are sent in segments with a limited number of fragments
318 * per segment.
319 *
320 * @param pdev - handle to the physical device
321 * @return maximum number of fragments that can occur in a regular tx frame
322 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800323int ol_cfg_netbuf_frags_max(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800324
325/**
326 * @brief For HL systems, specify when to free tx frames.
327 * @details
328 * In LL systems, the host's tx frame is referenced by the MAC DMA, and
329 * thus cannot be freed until the target indicates that it is finished
330 * transmitting the frame.
331 * In HL systems, the entire tx frame is downloaded to the target.
332 * Consequently, the target has its own copy of the tx frame, and the
333 * host can free the tx frame as soon as the download completes.
334 * Alternatively, the HL host can keep the frame allocated until the
335 * target explicitly tells the HL host it is done transmitting the frame.
336 * This gives the target the option of discarding its copy of the tx
337 * frame, and then later getting a new copy from the host.
338 * This function tells the host whether it should retain its copy of the
339 * transmit frames until the target explicitly indicates it is finished
340 * transmitting them, or if it should free its copy as soon as the
341 * tx frame is downloaded to the target.
342 *
343 * @param pdev - handle to the physical device
344 * @return
345 * 0 -> retain the tx frame until the target indicates it is done
346 * transmitting the frame
347 * -OR-
348 * 1 -> free the tx frame as soon as the download completes
349 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800350int ol_cfg_tx_free_at_download(struct cdp_cfg *cfg_pdev);
351void ol_cfg_set_tx_free_at_download(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800352
353/**
354 * @brief Low water mark for target tx credit.
355 * Tx completion handler is invoked to reap the buffers when the target tx
356 * credit goes below Low Water Mark.
357 */
358#define OL_CFG_NUM_MSDU_REAP 512
359#define ol_cfg_tx_credit_lwm(pdev) \
360 ((CFG_TGT_NUM_MSDU_DESC > OL_CFG_NUM_MSDU_REAP) ? \
361 (CFG_TGT_NUM_MSDU_DESC - OL_CFG_NUM_MSDU_REAP) : 0)
362
363/**
364 * @brief In a HL system, specify the target initial credit count.
365 * @details
366 * The HL host tx data SW includes a module for determining which tx frames
367 * to download to the target at a given time.
368 * To make this judgement, the HL tx download scheduler has to know
369 * how many buffers the HL target has available to hold tx frames.
370 * Due to the possibility that a single target buffer pool can be shared
371 * between rx and tx frames, the host may not be able to obtain a precise
372 * specification of the tx buffer space available in the target, but it
373 * uses the best estimate, as provided by this configuration function,
374 * to determine how best to schedule the tx frame downloads.
375 *
376 * @param pdev - handle to the physical device
377 * @return the number of tx buffers available in a HL target
378 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800379uint16_t ol_cfg_target_tx_credit(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800380
381/**
382 * @brief Specify the LL tx MSDU header download size.
383 * @details
384 * In LL systems, determine how many bytes from a tx frame to download,
385 * in order to provide the target FW's Descriptor Engine with enough of
386 * the packet's payload to interpret what kind of traffic this is,
387 * and who it is for.
388 * This download size specification does not include the 802.3 / 802.11
389 * frame encapsulation headers; it starts with the encapsulated IP packet
390 * (or whatever ethertype is carried within the ethernet-ish frame).
391 * The LL host data SW will determine how many bytes of the MSDU header to
392 * download by adding this download size specification to the size of the
393 * frame header format specified by the ol_cfg_frame_type configuration
394 * function.
395 *
396 * @param pdev - handle to the physical device
397 * @return the number of bytes beyond the 802.3 or native WiFi header to
398 * download to the target for tx classification
399 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800400int ol_cfg_tx_download_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800401
402/**
403 * brief Specify where defrag timeout and duplicate detection is handled
404 * @details
405 * non-aggregate duplicate detection and timing out stale fragments
406 * requires additional target memory. To reach max client
407 * configurations (128+), non-aggregate duplicate detection and the
408 * logic to time out stale fragments is moved to the host.
409 *
410 * @param pdev - handle to the physical device
411 * @return
412 * 0 -> target is responsible non-aggregate duplicate detection and
413 * timing out stale fragments.
414 *
415 * 1 -> host is responsible non-aggregate duplicate detection and
416 * timing out stale fragments.
417 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800418int ol_cfg_rx_host_defrag_timeout_duplicate_check(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800419
420/**
421 * brief Query for the period in ms used for throttling for
422 * thermal mitigation
423 * @details
424 * In LL systems, transmit data throttling is used for thermal
425 * mitigation where data is paused and resumed during the
426 * throttle period i.e. the throttle period consists of an
427 * "on" phase when transmit is allowed and an "off" phase when
428 * transmit is suspended. This function returns the total
429 * period used for throttling.
430 *
431 * @param pdev - handle to the physical device
432 * @return the total throttle period in ms
433 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800434int ol_cfg_throttle_period_ms(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800435
436/**
Poddar, Siddarth83905022016-04-16 17:56:08 -0700437 * brief Query for the duty cycle in percentage used for throttling for
438 * thermal mitigation
439 *
440 * @param pdev - handle to the physical device
441 * @param level - duty cycle level
442 * @return the duty cycle level in percentage
443 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800444int ol_cfg_throttle_duty_cycle_level(struct cdp_cfg *cfg_pdev, int level);
Poddar, Siddarth83905022016-04-16 17:56:08 -0700445
446/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800447 * brief Check whether full reorder offload is
448 * enabled/disable by the host
449 * @details
450 * If the host does not support receive reorder (i.e. the
451 * target performs full receive re-ordering) this will return
452 * "enabled"
453 *
454 * @param pdev - handle to the physical device
455 * @return 1 - enable, 0 - disable
456 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800457int ol_cfg_is_full_reorder_offload(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800458
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800459int ol_cfg_is_rx_thread_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800460
Yu Wang66a250b2017-07-19 11:46:40 +0800461#ifdef WLAN_FEATURE_TSF_PLUS
462void ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val);
463u_int8_t ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev);
464#else
465static inline void
466ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val)
467{
468}
469
470static inline u_int8_t
471ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev)
472{
473 return 0;
474}
475#endif
476
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800477/**
478 * ol_cfg_is_ip_tcp_udp_checksum_offload_enabled() - return
479 * ip_tcp_udp_checksum_offload is enable/disable
480 * @pdev : handle to the physical device
481 *
482 * Return: 1 - enable, 0 - disable
483 */
484static inline
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800485int ol_cfg_is_ip_tcp_udp_checksum_offload_enabled(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800486{
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800487 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
Yun Park73fbcf52017-04-05 11:49:16 -0700488
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800489 return cfg->ip_tcp_udp_checksum_offload;
490}
491
492
493#ifdef QCA_LL_TX_FLOW_CONTROL_V2
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800494int ol_cfg_get_tx_flow_stop_queue_th(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800495
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800496int ol_cfg_get_tx_flow_start_queue_offset(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800497#endif
498
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800499bool ol_cfg_is_ce_classify_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800500
501enum wlan_target_fmt_translation_caps {
502 wlan_frm_tran_cap_raw = 0x01,
503 wlan_frm_tran_cap_native_wifi = 0x02,
504 wlan_frm_tran_cap_8023 = 0x04,
505};
506
507/**
508 * @brief Specify the maximum header size added by SW tx encapsulation
509 * @details
510 * This function returns the maximum size of the new L2 header, not the
511 * difference between the new and old L2 headers.
512 * Thus, this function returns the maximum 802.11 header size that the
513 * tx SW may need to add to tx data frames.
514 *
515 * @param pdev - handle to the physical device
516 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800517static inline int ol_cfg_sw_encap_hdr_max_size(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800518{
519 /*
520 * 24 byte basic 802.11 header
521 * + 6 byte 4th addr
522 * + 2 byte QoS control
523 * + 4 byte HT control
524 * + 8 byte LLC/SNAP
525 */
526 return sizeof(struct ieee80211_qosframe_htc_addr4) + LLC_SNAP_HDR_LEN;
527}
528
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800529static inline uint8_t ol_cfg_tx_encap(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800530{
531 /* tx encap done in HW */
532 return 0;
533}
534
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800535static inline int ol_cfg_host_addba(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800536{
537 /*
538 * ADDBA negotiation is handled by the target FW for Peregrine + Rome.
539 */
540 return 0;
541}
542
543/**
544 * @brief If the host SW's ADDBA negotiation fails, should it be retried?
545 *
546 * @param pdev - handle to the physical device
547 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800548static inline int ol_cfg_addba_retry(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800549{
550 return 0; /* disabled for now */
551}
552
553/**
554 * @brief How many frames to hold in a paused vdev's tx queue in LL systems
555 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800556static inline int ol_tx_cfg_max_tx_queue_depth_ll(struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800557{
558 /*
559 * Store up to 1500 frames for a paused vdev.
560 * For example, if the vdev is sending 300 Mbps of traffic, and the
561 * PHY is capable of 600 Mbps, then it will take 56 ms for the PHY to
562 * drain both the 700 frames that are queued initially, plus the next
563 * 700 frames that come in while the PHY is catching up.
564 * So in this example scenario, the PHY will remain fully utilized
565 * in a MCC system that has a channel-switching period of 56 ms or less.
566 * 700 frames calculation was correct when FW drain packet without
567 * any overhead. Actual situation drain overhead will slowdown drain
568 * speed. And channel period is less than 56 msec
569 * Worst scenario, 1500 frames should be stored in host.
570 */
571 return 1500;
572}
573
574/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800575 * @brief Get packet log config from HTT config
576 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800577uint8_t ol_cfg_is_packet_log_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800578
579#ifdef IPA_OFFLOAD
580/**
581 * @brief IPA micro controller data path offload enable or not
582 * @detail
583 * This function returns IPA micro controller data path offload
584 * feature enabled or not
585 *
586 * @param pdev - handle to the physical device
587 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800588unsigned int ol_cfg_ipa_uc_offload_enabled(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800589/**
590 * @brief IPA micro controller data path TX buffer size
591 * @detail
592 * This function returns IPA micro controller data path offload
593 * TX buffer size which should be pre-allocated by driver.
594 * Default buffer size is 2K
595 *
596 * @param pdev - handle to the physical device
597 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800598unsigned int ol_cfg_ipa_uc_tx_buf_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800599/**
600 * @brief IPA micro controller data path TX buffer size
601 * @detail
602 * This function returns IPA micro controller data path offload
603 * TX buffer count which should be pre-allocated by driver.
604 *
605 * @param pdev - handle to the physical device
606 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800607unsigned int ol_cfg_ipa_uc_tx_max_buf_cnt(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800608/**
609 * @brief IPA micro controller data path TX buffer size
610 * @detail
611 * This function returns IPA micro controller data path offload
612 * RX indication ring size which will notified by WLAN FW to IPA
613 * micro controller
614 *
615 * @param pdev - handle to the physical device
616 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800617unsigned int ol_cfg_ipa_uc_rx_ind_ring_size(struct cdp_cfg *cfg_pdev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800618/**
619 * @brief IPA micro controller data path TX buffer size
620 * @param pdev - handle to the physical device
621 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800622unsigned int ol_cfg_ipa_uc_tx_partition_base(struct cdp_cfg *cfg_pdev);
623void ol_cfg_set_ipa_uc_tx_partition_base(struct cdp_cfg *cfg_pdev,
Yun Parkb4f591d2017-03-29 15:51:01 -0700624 uint32_t value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800625#else
626static inline unsigned int ol_cfg_ipa_uc_offload_enabled(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800627 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800628{
629 return 0;
630}
631
632static inline unsigned int ol_cfg_ipa_uc_tx_buf_size(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800633 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800634{
635 return 0;
636}
637
638static inline unsigned int ol_cfg_ipa_uc_tx_max_buf_cnt(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800639 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800640{
641 return 0;
642}
643
644static inline unsigned int ol_cfg_ipa_uc_rx_ind_ring_size(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800645 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800646{
647 return 0;
648}
649
650static inline unsigned int ol_cfg_ipa_uc_tx_partition_base(
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800651 struct cdp_cfg *cfg_pdev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800652{
653 return 0;
654}
Yun Park4d968df2016-10-11 11:44:15 -0700655
656static inline void ol_cfg_set_ipa_uc_tx_partition_base(
Yun Parkb4f591d2017-03-29 15:51:01 -0700657 void *cfg_pdev, uint32_t value)
Yun Park4d968df2016-10-11 11:44:15 -0700658{
Yun Park4d968df2016-10-11 11:44:15 -0700659}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800660#endif /* IPA_OFFLOAD */
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700661
662/**
663 * ol_set_cfg_flow_steering - Set Rx flow steering config based on CFG ini
664 * config.
665 *
666 * @pdev - handle to the physical device
667 * @val - 0 - disable, 1 - enable
668 *
669 * Return: None
670 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800671static inline void ol_set_cfg_flow_steering(struct cdp_cfg *cfg_pdev,
672 uint8_t val)
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700673{
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800674 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
Manjunathappa Prakashfff753c2016-09-01 19:34:56 -0700675
676 cfg->flow_steering_enabled = val;
677}
678
679/**
680 * ol_cfg_is_flow_steering_enabled - Return Rx flow steering config.
681 *
682 * @pdev - handle to the physical device
683 *
684 * Return: value of configured flow steering value.
685 */
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800686static inline uint8_t ol_cfg_is_flow_steering_enabled(struct cdp_cfg *cfg_pdev)
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 return cfg->flow_steering_enabled;
691}
gbian62edd7e2017-03-07 13:12:13 +0800692
693/**
Rakshith Suresh Patkar0f6375c2018-12-04 20:59:07 +0530694 * ol_set_cfg_new_htt_format - Set whether FW supports new htt format
695 *
696 * @pdev - handle to the physical device
697 * @val - true - supported, false - not supported
698 *
699 * Return: None
700 */
701static inline void
702ol_set_cfg_new_htt_format(struct cdp_cfg *cfg_pdev, bool val)
703{
704 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
705
706 cfg->new_htt_format_enabled = val;
707}
708
709/**
710 * ol_cfg_is_htt_new_format_enabled - Return whether FW supports new htt format
711 *
712 * @pdev - handle to the physical device
713 *
714 * Return: value of configured htt_new_format
715 */
716static inline bool
717ol_cfg_is_htt_new_format_enabled(struct cdp_cfg *cfg_pdev)
718{
719 struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
720
721 return cfg->new_htt_format_enabled;
722}
723
724/**
gbian62edd7e2017-03-07 13:12:13 +0800725 * ol_cfg_get_wrr_skip_weight() - brief Query for the param of wrr_skip_weight
726 * @pdev: handle to the physical device.
727 * @ac: access control, it will be BE, BK, VI, VO
728 *
729 * Return: wrr_skip_weight for specified ac.
730 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530731int ol_cfg_get_wrr_skip_weight(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800732
733/**
734 * ol_cfg_get_credit_threshold() - Query for the param of credit_threshold
735 * @pdev: handle to the physical device.
736 * @ac: access control, it will be BE, BK, VI, VO
737 *
738 * Return: credit_threshold for specified ac.
739 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530740uint32_t ol_cfg_get_credit_threshold(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800741
742/**
743 * ol_cfg_get_send_limit() - Query for the param of send_limit
744 * @pdev: handle to the physical device.
745 * @ac: access control, it will be BE, BK, VI, VO
746 *
747 * Return: send_limit for specified ac.
748 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530749uint16_t ol_cfg_get_send_limit(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800750
751/**
752 * ol_cfg_get_credit_reserve() - Query for the param of credit_reserve
753 * @pdev: handle to the physical device.
754 * @ac: access control, it will be BE, BK, VI, VO
755 *
756 * Return: credit_reserve for specified ac.
757 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530758int ol_cfg_get_credit_reserve(struct cdp_cfg *pdev, int ac);
gbian62edd7e2017-03-07 13:12:13 +0800759
760/**
761 * ol_cfg_get_discard_weight() - Query for the param of discard_weight
762 * @pdev: handle to the physical device.
763 * @ac: access control, it will be BE, BK, VI, VO
764 *
765 * Return: discard_weight for specified ac.
766 */
Nirav Shaheb017be2018-02-15 11:20:58 +0530767int ol_cfg_get_discard_weight(struct cdp_cfg *pdev, int ac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800768#endif /* _OL_CFG__H_ */