blob: e6fa45c9a4765038ac04c9227e22f62cf322aa91 [file] [log] [blame]
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +05301/*
Jeff Johnson590aeb62017-01-05 14:23:08 -08002 * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +05303 *
4 * 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
19#ifndef __WLAN_CFG_H
20#define __WLAN_CFG_H
21
Ravi Joshi891d5202017-02-17 15:01:27 -080022/*
23 * Temporary place holders. These should come either from target config
24 * or platform configuration
25 */
26#if defined(CONFIG_MCL)
27#define MAX_PDEV_CNT 1
28#else
29#define MAX_PDEV_CNT 3
30#endif
31
32/* Tx configuration */
33#define MAX_LINK_DESC_BANKS 8
34#define MAX_TXDESC_POOLS 4
35#define MAX_TCL_DATA_RINGS 4
36#define DP_MAX_TX_RINGS 8
37#define MAX_TX_HW_QUEUES 3
38
39/* Rx configuration */
40#define MAX_RXDESC_POOLS 4
41#define MAX_REO_DEST_RINGS 4
42#define DP_MAX_RX_RINGS 8
43#define MAX_RX_MAC_RINGS 2
44
45/* Miscellaneous configuration */
46#define MAX_IDLE_SCATTER_BUFS 16
47#define DP_MAX_IRQ_PER_CONTEXT 12
48#define DP_MAX_INTERRUPT_CONTEXTS 8
49#define DP_MAX_INTERRUPT_CONTEXTS 8
50#define MAX_HTT_METADATA_LEN 32
51#define MAX_NUM_PEER_ID_PER_PEER 8
52#define DP_MAX_TIDS 17
53#define DP_NON_QOS_TID 16
54
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +053055struct wlan_cfg_dp_pdev_ctxt;
56struct wlan_cfg_dp_soc_ctxt;
57
58/**
59 * wlan_cfg_soc_attach() - Attach configuration interface for SoC
60 *
61 * Allocates context for Soc configuration parameters,
62 * Read configuration information from device tree/ini file and
63 * returns back handle
64 *
65 * Return: Handle to configuration context
66 */
67struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void);
68
69/**
70 * wlan_cfg_soc_detach() - Detach soc configuration handle
71 * @wlan_cfg_ctx: soc configuration handle
72 *
73 * De-allocates memory allocated for SoC configuration
74 *
75 * Return:none
76 */
77void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
78
79/**
80 * wlan_cfg_pdev_attach() Attach configuration interface for pdev
81 *
82 * Allocates context for pdev configuration parameters,
83 * Read configuration information from device tree/ini file and
84 * returns back handle
85 *
86 * Return: Handle to configuration context
87 */
88struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void);
89
90/**
91 * wlan_cfg_pdev_detach() Detach and free pdev configuration handle
92 * @wlan_cfg_pdev_ctx - PDEV Configuration Handle
93 *
94 * Return: void
95 */
96void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
97
Jeff Johnson590aeb62017-01-05 14:23:08 -080098void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num);
99void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
100 int context, int mask);
101void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
102 int context, int mask);
103void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
104 int context, int mask);
105void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
106 int context, int mask);
107void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
108 int mask);
Pamidipati, Vijay6b0d2a82017-06-09 04:46:32 +0530109
110void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val);
111
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530112/**
Ravi Joshifb39e002017-02-11 21:18:40 -0800113 * wlan_cfg_get_num_contexts() - Number of interrupt contexts to be registered
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530114 * @wlan_cfg_ctx - Configuration Handle
115 *
116 * For WIN, DP_NUM_INTERRUPT_CONTEXTS will be equal to number of CPU cores.
117 * Each context (for linux it is a NAPI context) will have a tx_ring_mask,
118 * rx_ring_mask ,and rx_monitor_ring mask to indicate the rings
119 * that are processed by the handler.
120 *
121 * Return: num_contexts
122 */
123int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
124
125/**
Ravi Joshifb39e002017-02-11 21:18:40 -0800126 * wlan_cfg_get_tx_ring_mask() - Return Tx interrupt mask mapped to an
127 * interrupt context
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530128 * @wlan_cfg_ctx - Configuration Handle
129 * @context - Numerical ID identifying the Interrupt/NAPI context
130 *
131 * Return: int_tx_ring_mask[context]
132 */
133int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
134 int context);
135
136/**
Ravi Joshifb39e002017-02-11 21:18:40 -0800137 * wlan_cfg_get_rx_ring_mask() - Return Rx interrupt mask mapped to an
138 * interrupt context
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530139 * @wlan_cfg_ctx - Configuration Handle
140 * @context - Numerical ID identifying the Interrupt/NAPI context
141 *
142 * Return: int_rx_ring_mask[context]
143 */
144int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
145 int context);
146
147/**
Ravi Joshifb39e002017-02-11 21:18:40 -0800148 * wlan_cfg_get_rx_mon_ring_mask() - Return Rx monitor ring interrupt mask
149 * mapped to an interrupt context
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530150 * @wlan_cfg_ctx - Configuration Handle
151 * @context - Numerical ID identifying the Interrupt/NAPI context
152 *
153 * Return: int_rx_mon_ring_mask[context]
154 */
155int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
156 int context);
157
158/**
Ravi Joshifb39e002017-02-11 21:18:40 -0800159 * wlan_cfg_get_ce_ring_mask() - Return CE ring interrupt mask
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530160 * mapped to an interrupt context
161 * @wlan_cfg_ctx - Configuration Handle
162 * @context - Numerical ID identifying the Interrupt/NAPI context
163 *
164 * Return: int_ce_ring_mask[context]
165 */
166int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
167 int context);
168
169/**
Ravi Joshifb39e002017-02-11 21:18:40 -0800170 * wlan_cfg_get_max_clients() - Return maximum number of peers/stations
171 * supported by device
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530172 * @wlan_cfg_ctx - Configuration Handle
173 *
174 * Return: max_clients
175 */
176uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
177
178/**
Ravi Joshifb39e002017-02-11 21:18:40 -0800179 * wlan_cfg_max_alloc_size() - Return Maximum allocation size for any dynamic
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530180 * memory allocation request for this device
181 * @wlan_cfg_ctx - Configuration Handle
182 *
183 * Return: max_alloc_size
184 */
185uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
186
187/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800188 * wlan_cfg_per_pdev_tx_ring() - Return true if Tx rings are mapped as
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530189 * one per radio
190 * @wlan_cfg_ctx - Configuration Handle
191 *
192 * Return: per_pdev_tx_ring
193 */
194int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
195
196/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800197 * wlan_cfg_num_tcl_data_rings() - Number of TCL Data rings supported by device
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530198 * @wlan_cfg_ctx
199 *
200 * Return: num_tcl_data_rings
201 */
202int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
203
204/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800205 * wlan_cfg_per_pdev_rx_ring() - Return true if Rx rings are mapped as
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530206 * one per radio
207 * @wlan_cfg_ctx
208 *
209 * Return: per_pdev_rx_ring
210 */
211int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
212
213/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800214 * wlan_cfg_num_reo_dest_rings() - Number of REO Data rings supported by device
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530215 * @wlan_cfg_ctx - Configuration Handle
216 *
217 * Return: num_reo_dest_rings
218 */
219int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
220
221/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800222 * wlan_cfg_pkt_type() - Default 802.11 encapsulation type
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530223 * @wlan_cfg_ctx - Configuration Handle
224 *
225 * Return: htt_pkt_type_ethernet
226 */
227int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
228
229/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800230 * wlan_cfg_get_num_tx_desc_pool() - Number of Tx Descriptor pools for the
231 * device
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530232 * @wlan_cfg_ctx - Configuration Handle
233 *
234 * Return: num_tx_desc_pool
235 */
236int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
237
238/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800239 * wlan_cfg_get_num_tx_ext_desc_pool() - Number of Tx MSDU ext Descriptor
240 * pools
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530241 * @wlan_cfg_ctx - Configuration Handle
242 *
243 * Return: num_tx_ext_desc_pool
244 */
245int wlan_cfg_get_num_tx_ext_desc_pool(
246 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
247
248/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800249 * wlan_cfg_get_num_tx_desc() - Number of Tx Descriptors per pool
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530250 * @wlan_cfg_ctx - Configuration Handle
251 *
252 * Return: num_tx_desc
253 */
254int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
255
256/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800257 * wlan_cfg_get_num_tx_ext_desc() - Number of Tx MSDU extension Descriptors
258 * per pool
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530259 * @wlan_cfg_ctx - Configuration Handle
260 *
261 * Return: num_tx_ext_desc
262 */
263int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
264
265/*
Jeff Johnson590aeb62017-01-05 14:23:08 -0800266 * wlan_cfg_max_peer_id() - Get maximum peer ID
267 * @cfg: Configuration Handle
268 *
269 * Return: maximum peer ID
270 */
271uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg);
272
273/*
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530274 * wlan_cfg_get_dma_mon_buf_ring_size() - Return Size of monitor buffer ring
275 * @wlan_cfg_pdev_ctx
276 *
277 * Return: dma_mon_buf_ring_size
278 */
279int wlan_cfg_get_dma_mon_buf_ring_size(
280 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
281
282/*
283 * wlan_cfg_get_dma_mon_dest_ring_size() - Return Size of RxDMA Monitor
Ravi Joshifb39e002017-02-11 21:18:40 -0800284 * Destination ring
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530285 * @wlan_cfg_pdev_ctx
286 *
287 * Return: dma_mon_dest_size
288 */
289int wlan_cfg_get_dma_mon_dest_ring_size(
290 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
291
292/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800293 * wlan_cfg_get_dma_mon_stat_ring_size() - Return size of Monitor Status ring
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530294 * @wlan_cfg_pdev_ctx
295 *
296 * Return: dma_mon_stat_ring_size
297 */
298int wlan_cfg_get_dma_mon_stat_ring_size(
299 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
300
301/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800302 * wlan_cfg_get_rx_dma_buf_ring_size() - Return Size of RxDMA buffer ring
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530303 * @wlan_cfg_pdev_ctx
304 *
305 * Return: rx_dma_buf_ring_size
306 */
307int wlan_cfg_get_rx_dma_buf_ring_size(
308 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
309
Dhanashri Atred4032ab2017-01-17 15:05:41 -0800310/*
Ravi Joshifb39e002017-02-11 21:18:40 -0800311 * wlan_cfg_get_num_mac_rings() - Return the number of MAC RX DMA rings
Dhanashri Atred4032ab2017-01-17 15:05:41 -0800312 * per pdev
313 * @wlan_cfg_pdev_ctx
314 *
315 * Return: number of mac DMA rings per pdev
316 */
317int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg);
Dhanashri Atre14049172016-11-11 18:32:36 -0800318
319/*
320 * wlan_cfg_is_lro_enabled - Return LRO enabled/disabled
321 * @wlan_cfg_pdev_ctx
322 *
323 * Return: true - LRO enabled false - LRO disabled
324 */
325bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
326
327/*
328 * wlan_cfg_is_lro_enabled - Return RX hash enabled/disabled
329 * @wlan_cfg_pdev_ctx
330 *
331 * Return: true - enabled false - disabled
332 */
333bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
334
Bharat Kumar M9a5d5372017-05-08 17:41:42 +0530335/*
336 * wlan_cfg_get_dp_pdev_nss_enabled - Return pdev nss enabled/disabled
337 * @wlan_cfg_pdev_ctx
338 *
339 * Return: 1 - enabled 0 - disabled
340 */
341int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg);
342
343/*
344 * wlan_cfg_set_dp_pdev_nss_enabled - set pdev nss enabled/disabled
345 * @wlan_cfg_pdev_ctx
346 */
347void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled);
348
349/*
350 * wlan_cfg_get_dp_soc_nss_cfg - Return soc nss config
351 * @wlan_cfg_pdev_ctx
352 *
353 * Return: nss_cfg
354 */
355int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg);
356
357/*
358 * wlan_cfg_set_dp_soc_nss_cfg - set soc nss config
359 * @wlan_cfg_pdev_ctx
360 *
361 */
362void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg);
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530363#endif