blob: dba86835a488e894f5861c7e0f91044156404c15 [file] [log] [blame]
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301/*
Venkateswara Swamy Bandarubfbef4f2016-12-16 19:12:31 +05302 * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +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 /**
20 * @file cdp_txrx_cmn_struct.h
21 * @brief Define the host data path converged API functions
22 * called by the host control SW and the OS interface module
23 */
24#ifndef _CDP_TXRX_CMN_STRUCT_H_
25#define _CDP_TXRX_CMN_STRUCT_H_
26
Leo Changdb6358c2016-09-27 17:00:52 -070027/**
28 * For WIN legacy header compilation
29 * Temporary add dummy definitions
30 * should be removed properly WIN legacy code handle
31 */
32
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053033#include "htc_api.h"
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053034#include "qdf_types.h"
35#include "qdf_nbuf.h"
Leo Changdb6358c2016-09-27 17:00:52 -070036#ifndef CONFIG_WIN
37#include <cdp_txrx_mob_def.h>
38#endif /* CONFIG_WIN */
Nandha Kishore Easwaran870abda2016-11-16 17:37:19 +053039
Leo Changdb6358c2016-09-27 17:00:52 -070040#ifndef OL_TXRX_NUM_LOCAL_PEER_IDS
41#define OL_TXRX_NUM_LOCAL_PEER_IDS 33 /* default */
42#endif
43
44#define OL_TXRX_INVALID_LOCAL_PEER_ID 0xffff
Ishank Jain1e7401c2017-02-17 15:38:39 +053045#define CDP_INVALID_VDEV_ID 0xff
46#define MAX_MCS 12
47#define MAX_MCS_11A 8
48#define MAX_MCS_11B 7
49#define MAX_MCS_11AC 10
50#define SS_COUNT 8
51#define SUPPORTED_BW 4
52#define SUPPORTED_RECEPTION_TYPES 4
53
Venkata Sharath Chandra Manchalaa405eb72017-03-06 14:35:00 -080054/* Options for Dump Statistics */
55#define CDP_HDD_STATS 0
56#define CDP_TXRX_PATH_STATS 1
57#define CDP_TXRX_HIST_STATS 2
58#define CDP_TXRX_TSO_STATS 3
59#define CDP_HDD_NETIF_OPER_HISTORY 4
60#define CDP_DUMP_TX_FLOW_POOL_INFO 5
61#define CDP_TXRX_DESC_STATS 6
62#define CDP_HIF_STATS 7
63#define CDP_LRO_STATS 8
64#define CDP_NAPI_STATS 9
Mohit Khanna79db2c42017-03-29 19:08:07 -070065#define CDP_WLAN_RX_BUF_DEBUG_STATS 10
Venkata Sharath Chandra Manchala918aefe2017-04-10 10:21:56 -070066#define CDP_RX_RING_STATS 11
Venkata Sharath Chandra Manchalaa405eb72017-03-06 14:35:00 -080067#define CDP_SCHEDULER_STATS 21
68#define CDP_TX_QUEUE_STATS 22
69#define CDP_BUNDLE_STATS 23
70#define CDP_CREDIT_STATS 24
71
Ishank Jain1e7401c2017-02-17 15:38:39 +053072/* WME stream classes */
73#define WME_AC_BE 0 /* best effort */
74#define WME_AC_BK 1 /* background */
75#define WME_AC_VI 2 /* video */
76#define WME_AC_VO 3 /* voice */
77#define WME_AC_MAX 4 /* MAX AC Value */
78
79#define WME_AC_TO_TID(_ac) ( \
80 ((_ac) == WME_AC_VO) ? 6 : \
81 ((_ac) == WME_AC_VI) ? 5 : \
82 ((_ac) == WME_AC_BK) ? 1 : \
83 0)
84
85#define TID_TO_WME_AC(_tid) ( \
86 (((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
87 (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
88 (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
89 WME_AC_VO)
Nandha Kishore Easwaran870abda2016-11-16 17:37:19 +053090
Ishank Jain57c42a12017-04-12 10:42:22 +053091#define CDP_MAX_RX_RINGS 4
Pamidipati, Vijay6b0d2a82017-06-09 04:46:32 +053092
93/*
94 * DP configuration parameters
95 */
96enum cdp_cfg_param_type {
97 CDP_CFG_MAX_PEER_ID,
98 CDP_CFG_NUM_PARAMS
99};
100
Nandha Kishore Easwaran870abda2016-11-16 17:37:19 +0530101/*
102 * htt_dbg_stats_type -
103 * bit positions for each stats type within a stats type bitmask
104 * The bitmask contains 24 bits.
105 */
106enum htt_cmn_dbg_stats_type {
107 HTT_DBG_CMN_STATS_WAL_PDEV_TXRX = 0, /* bit 0 -> 0x1 */
108 HTT_DBG_CMN_STATS_RX_REORDER = 1, /* bit 1 -> 0x2 */
109 HTT_DBG_CMN_STATS_RX_RATE_INFO = 2, /* bit 2 -> 0x4 */
110 HTT_DBG_CMN_STATS_TX_PPDU_LOG = 3, /* bit 3 -> 0x8 */
111 HTT_DBG_CMN_STATS_TX_RATE_INFO = 4, /* bit 4 -> 0x10 */
112 HTT_DBG_CMN_STATS_TIDQ = 5, /* bit 5 -> 0x20 */
113 HTT_DBG_CMN_STATS_TXBF_INFO = 6, /* bit 6 -> 0x40 */
114 HTT_DBG_CMN_STATS_SND_INFO = 7, /* bit 7 -> 0x80 */
115 HTT_DBG_CMN_STATS_ERROR_INFO = 8, /* bit 8 -> 0x100 */
116 HTT_DBG_CMN_STATS_TX_SELFGEN_INFO = 9, /* bit 9 -> 0x200 */
117 HTT_DBG_CMN_STATS_TX_MU_INFO = 10, /* bit 10 -> 0x400 */
118 HTT_DBG_CMN_STATS_SIFS_RESP_INFO = 11, /* bit 11 -> 0x800 */
119 HTT_DBG_CMN_STATS_RESET_INFO = 12, /* bit 12 -> 0x1000 */
120 HTT_DBG_CMN_STATS_MAC_WDOG_INFO = 13, /* bit 13 -> 0x2000 */
121 HTT_DBG_CMN_STATS_TX_DESC_INFO = 14, /* bit 14 -> 0x4000 */
122 HTT_DBG_CMN_STATS_TX_FETCH_MGR_INFO = 15, /* bit 15 -> 0x8000 */
123 HTT_DBG_CMN_STATS_TX_PFSCHED_INFO = 16, /* bit 16 -> 0x10000 */
124 HTT_DBG_CMN_STATS_TX_PATH_STATS_INFO = 17, /* bit 17 -> 0x20000 */
125 /* bits 18-23 currently reserved */
126
127 /* keep this last */
128 HTT_DBG_CMN_NUM_STATS
129};
130
Ishank Jainbc2d91f2017-01-03 18:14:54 +0530131/*
132 * cdp_host_txrx_stats: Different types of host stats
Venkata Sharath Chandra Manchalaa77da0d2017-02-27 22:44:37 -0800133 * @TXRX_HOST_STATS_INVALID: Invalid option
Ishank Jainbc2d91f2017-01-03 18:14:54 +0530134 * @TXRX_RX_RATE_STATS: Rx rate info
135 * @TXRX_TX_RATE_STATS: Tx rate info
136 * @TXRX_TX_HOST_STATS: Print Tx stats
137 * @TXRX_RX_HOST_STATS: Print host Rx stats
138 * @TXRX_CLEAR_STATS: clear all host stats
Venkata Sharath Chandra Manchalaa77da0d2017-02-27 22:44:37 -0800139*/
Ishank Jainbc2d91f2017-01-03 18:14:54 +0530140enum cdp_host_txrx_stats {
Venkata Sharath Chandra Manchalaa77da0d2017-02-27 22:44:37 -0800141 TXRX_HOST_STATS_INVALID = -1,
Ishank Jain6290a3c2017-03-21 10:49:39 +0530142 TXRX_CLEAR_STATS = 0,
143 TXRX_RX_RATE_STATS = 1,
144 TXRX_TX_RATE_STATS = 2,
145 TXRX_TX_HOST_STATS = 3,
146 TXRX_RX_HOST_STATS = 4,
Ishank Jain57c42a12017-04-12 10:42:22 +0530147 TXRX_HOST_STATS_MAX,
Ishank Jainbc2d91f2017-01-03 18:14:54 +0530148};
Nandha Kishore Easwaran870abda2016-11-16 17:37:19 +0530149
150/**
151 * @brief General specification of the tx frame contents
152 *
153 * @details
154 * for efficiency, the HTT packet type values correspond
155 * to the bit positions of the WAL packet type values, so the
156 * translation is a simple shift operation.
157 */
158enum htt_cmn_pkt_type {
159 htt_cmn_pkt_type_raw = 0,
160 htt_cmn_pkt_type_native_wifi = 1,
161 htt_cmn_pkt_type_ethernet = 2,
162
163 /* keep this last */
164 htt_cmn_pkt_num_types
165};
166
Tallapragada Kalyanfd1edcc2017-03-07 19:34:29 +0530167
168enum cdp_host_reo_dest_ring {
169 cdp_host_reo_dest_ring_unknown = 0,
170 cdp_host_reo_dest_ring_1 = 1,
171 cdp_host_reo_dest_ring_2 = 2,
172 cdp_host_reo_dest_ring_3 = 3,
173 cdp_host_reo_dest_ring_4 = 4,
174};
175
Nandha Kishore Easwaran870abda2016-11-16 17:37:19 +0530176enum htt_cmn_t2h_en_stats_type {
177 /* keep this alwyas first */
178 HTT_CMN_T2H_EN_STATS_TYPE_START = 0,
179
180 /** ppdu_common_stats is the payload */
181 HTT_CMN_T2H_EN_STATS_TYPE_COMMON = 1,
182 /** ppdu_sant_stats is the payload */
183 HTT_CMN_T2H_EN_STATS_TYPE_SANT = 2,
184 /** ppdu_common_stats_v2 is the payload */
185 HTT_CMN_T2H_EN_STATS_TYPE_COMMON_V2 = 3,
186
187 /* Keep this last */
188 HTT_CMN_T2H_EN_STATS_TYPE_END = 0x1f,
189};
190
191enum htt_cmn_t2h_en_stats_status {
192 /* Keep this first always */
193 HTT_CMN_T2H_EN_STATS_STATUS_PARTIAL = 0,
194 HTT_CMN_T2H_EN_STATS_STATUS_PRESENT = 1,
195 HTT_CMN_T2H_EN_STATS_STATUS_ERROR = 2,
196 HTT_CMN_T2H_EN_STATS_STATUS_INVALID = 3,
197
198
199 /* keep this always last */
200 HTT_CMN_T2H_EN_STATS_STATUS_SERIES_DONE = 7,
201};
202
Leo Changdb6358c2016-09-27 17:00:52 -0700203/**
204 * struct ol_txrx_peer_state - Peer state information
205 */
206enum ol_txrx_peer_state {
207 OL_TXRX_PEER_STATE_INVALID,
208 OL_TXRX_PEER_STATE_DISC, /* initial state */
209 OL_TXRX_PEER_STATE_CONN, /* authentication in progress */
210 OL_TXRX_PEER_STATE_AUTH, /* authentication successful */
211};
212
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530213typedef struct cdp_soc_t *ol_txrx_soc_handle;
214
215/**
216 * ol_txrx_vdev_delete_cb - callback registered during vdev
217 * detach
218 */
219typedef void (*ol_txrx_vdev_delete_cb)(void *context);
220
221/**
222 * ol_osif_vdev_handle - paque handle for OS shim virtual device
223 * object
224 */
225struct ol_osif_vdev_t;
226typedef struct ol_osif_vdev_t *ol_osif_vdev_handle;
227
228/**
229 * wlan_op_mode - Virtual device operation mode
230 * @wlan_op_mode_unknown: Unknown mode
231 * @wlan_op_mode_ap: AP mode
232 * @wlan_op_mode_ibss: IBSS mode
233 * @wlan_op_mode_sta: STA (client) mode
234 * @wlan_op_mode_monitor: Monitor mode
235 * @wlan_op_mode_ocb: OCB mode
236 */
237enum wlan_op_mode {
238 wlan_op_mode_unknown,
239 wlan_op_mode_ap,
240 wlan_op_mode_ibss,
241 wlan_op_mode_sta,
242 wlan_op_mode_monitor,
243 wlan_op_mode_ocb,
Leo Changdb6358c2016-09-27 17:00:52 -0700244 wlan_op_mode_ndi,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530245};
246
247/**
248 * cdp_mgmt_tx_cb - tx management delivery notification
249 * callback function
250 */
251typedef void
252(*ol_txrx_mgmt_tx_cb)(void *ctxt, qdf_nbuf_t tx_mgmt_frm, int had_error);
253
254/**
255 * ol_rxrx_data_tx_cb - Function registered with the data path
256 * that is called when tx frames marked as "no free" are
257 * done being transmitted
258 */
259typedef void
260(*ol_txrx_data_tx_cb)(void *ctxt, qdf_nbuf_t tx_frm, int had_error);
261
262/**
263 * ol_txrx_tx_fp - top-level transmit function
264 * @data_vdev - handle to the virtual device object
265 * @msdu_list - list of network buffers
266 */
267typedef qdf_nbuf_t (*ol_txrx_tx_fp)(void *data_vdev,
268 qdf_nbuf_t msdu_list);
269/**
270 * ol_txrx_tx_flow_control_fp - tx flow control notification
271 * function from txrx to OS shim
272 * @osif_dev - the virtual device's OS shim object
273 * @tx_resume - tx os q should be resumed or not
274 */
275typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev,
276 bool tx_resume);
277
278/**
279 * ol_txrx_rx_fp - receive function to hand batches of data
280 * frames from txrx to OS shim
281 * @data_vdev - handle to the OSIF virtual device object
282 * @msdu_list - list of network buffers
283 */
284typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list);
285
286/**
Venkateswara Swamy Bandarubfbef4f2016-12-16 19:12:31 +0530287 * ol_txrx_rsim_rx_decap_fp - raw mode simulation function to decap the
288 * packets in receive path.
289 * @osif_dev - the virtual device's OS shim object
290 * @list_head - poniter to head of receive packet queue to decap
291 * @list_tail - poniter to tail of receive packet queue to decap
292 */
293typedef QDF_STATUS(*ol_txrx_rsim_rx_decap_fp)(void *osif_dev,
294 qdf_nbuf_t *list_head,
295 qdf_nbuf_t *list_tail);
296
Venkateswara Swamy Bandaru97482342017-02-16 12:04:50 +0530297/* ol_txrx_rx_fp - external tx free function to read per packet stats and
298 * free tx buffer externally
299 * @netbuf - tx network buffer
300 */
301typedef void (*ol_txrx_tx_free_ext_fp)(qdf_nbuf_t netbuf);
302
Venkateswara Swamy Bandarubfbef4f2016-12-16 19:12:31 +0530303/**
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530304 * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function
305*/
306typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev,
307 qdf_nbuf_t mpdu_head,
308 qdf_nbuf_t mpdu_tail);
309/**
310 * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single
311 * MPDU (802.11 format)
312 */
313typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev,
314 qdf_nbuf_t mpdu,
315 void *rx_status);
316
317/**
318 * ol_txrx_proxy_arp_fp - proxy arp function pointer
319*/
320typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev,
321 qdf_nbuf_t netbuf);
322
Ishank Jainc838b132017-02-17 11:08:18 +0530323/*
324 * ol_txrx_mcast_me_fp - function pointer for multicast enhancement
325 */
326typedef int (*ol_txrx_mcast_me_fp)(ol_osif_vdev_handle vdev,
327 qdf_nbuf_t netbuf);
328
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530329/**
330 * ol_txrx_stats_callback - statistics notify callback
331 */
332typedef void (*ol_txrx_stats_callback)(void *ctxt,
Nandha Kishore Easwaran870abda2016-11-16 17:37:19 +0530333 enum htt_cmn_dbg_stats_type type,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530334 uint8_t *buf, int bytes);
335
336/**
337 * ol_txrx_ops - (pointers to) the functions used for tx and rx
338 * data xfer
339 *
340 * There are two portions of these txrx operations.
341 * The rx portion is filled in by OSIF SW before calling
342 * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register
343 * the txrx SW stores a copy of these rx function pointers, to use
344 * as it delivers rx data frames to the OSIF SW.
345 * The tx portion is filled in by the txrx SW inside
346 * ol_txrx_osif_vdev_register; when the function call returns,
347 * the OSIF SW stores a copy of these tx functions to use as it
348 * delivers tx data frames to the txrx SW.
349 *
350 * @tx.std - the tx function pointer for standard data
351 * frames This function pointer is set by the txrx SW
352 * perform host-side transmit operations based on
353 * whether a HL or LL host/target interface is in use.
354 * @tx.flow_control_cb - the transmit flow control
355 * function that is registered by the
356 * OSIF which is called from txrx to
357 * indicate whether the transmit OS
358 * queues should be paused/resumed
359 * @rx.std - the OS shim rx function to deliver rx data
360 * frames to. This can have different values for
361 * different virtual devices, e.g. so one virtual
362 * device's OS shim directly hands rx frames to the OS,
363 * but another virtual device's OS shim filters out P2P
364 * messages before sending the rx frames to the OS. The
365 * netbufs delivered to the osif_rx function are in the
366 * format specified by the OS to use for tx and rx
367 * frames (either 802.3 or native WiFi)
368 * @rx.wai_check - the tx function pointer for WAPI frames
369 * @rx.mon - the OS shim rx monitor function to deliver
370 * monitor data to Though in practice, it is probable
371 * that the same function will be used for delivering
372 * rx monitor data for all virtual devices, in theory
373 * each different virtual device can have a different
374 * OS shim function for accepting rx monitor data. The
375 * netbufs delivered to the osif_rx_mon function are in
376 * 802.11 format. Each netbuf holds a 802.11 MPDU, not
377 * an 802.11 MSDU. Depending on compile-time
378 * configuration, each netbuf may also have a
379 * monitor-mode encapsulation header such as a radiotap
380 * header added before the MPDU contents.
381 * @proxy_arp - proxy arp function pointer - specified by
382 * OS shim, stored by txrx
383 */
384struct ol_txrx_ops {
385 /* tx function pointers - specified by txrx, stored by OS shim */
386 struct {
387 ol_txrx_tx_fp tx;
Venkateswara Swamy Bandaru97482342017-02-16 12:04:50 +0530388 ol_txrx_tx_free_ext_fp tx_free_ext;
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530389 } tx;
390
391 /* rx function pointers - specified by OS shim, stored by txrx */
392 struct {
393 ol_txrx_rx_fp rx;
394 ol_txrx_rx_check_wai_fp wai_check;
395 ol_txrx_rx_mon_fp mon;
Venkateswara Swamy Bandarubfbef4f2016-12-16 19:12:31 +0530396 ol_txrx_rsim_rx_decap_fp rsim_rx_decap;
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530397 } rx;
398
399 /* proxy arp function pointer - specified by OS shim, stored by txrx */
400 ol_txrx_proxy_arp_fp proxy_arp;
Ishank Jainc838b132017-02-17 11:08:18 +0530401 ol_txrx_mcast_me_fp me_convert;
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530402};
403
404/**
405 * ol_txrx_stats_req - specifications of the requested
406 * statistics
407 */
408struct ol_txrx_stats_req {
409 uint32_t stats_type_upload_mask; /* which stats to upload */
410 uint32_t stats_type_reset_mask; /* which stats to reset */
411
412 /* stats will be printed if either print element is set */
413 struct {
414 int verbose; /* verbose stats printout */
415 int concise; /* concise stats printout (takes precedence) */
416 } print; /* print uploaded stats */
417
418 /* stats notify callback will be invoked if fp is non-NULL */
419 struct {
420 ol_txrx_stats_callback fp;
421 void *ctxt;
422 } callback;
423
424 /* stats will be copied into the specified buffer if buf is non-NULL */
425 struct {
426 uint8_t *buf;
427 int byte_limit; /* don't copy more than this */
428 } copy;
429
430 /*
431 * If blocking is true, the caller will take the specified semaphore
432 * to wait for the stats to be uploaded, and the driver will release
433 * the semaphore when the stats are done being uploaded.
434 */
435 struct {
436 int blocking;
437 /*Note: this needs to change to some qdf_* type */
438 qdf_semaphore_t *sem_ptr;
439 } wait;
440};
441
442
443/* DP soc struct definition */
444struct cdp_soc_t {
445 struct cdp_ops *ops;
Leo Changdb6358c2016-09-27 17:00:52 -0700446 struct ol_if_ops *ol_ops;
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530447};
448
Ishank Jain9f174c62017-03-30 18:37:42 +0530449/*
450 * cdp_vdev_param_type: different types of parameters
451 * to set values in vdev
452 * @CDP_ENABLE_NAWDS: set nawds enable/disable
453 * @CDP_ENABLE_MCAST_EN: enable/disable multicast enhancement
Kabilan Kannan56bfd8f2017-04-26 13:26:47 -0700454 * @CDP_ENABLE_WDS: wds sta
455 * @CDP_ENABLE_PROXYSTA: proxy sta
456 * @CDP_UPDATE_TDLS_FLAGS: tdls link flags
Ishank Jain9f174c62017-03-30 18:37:42 +0530457 */
458enum cdp_vdev_param_type {
459 CDP_ENABLE_NAWDS,
460 CDP_ENABLE_MCAST_EN,
Pamidipati, Vijayc9a13a52017-04-06 17:45:49 +0530461 CDP_ENABLE_WDS,
462 CDP_ENABLE_PROXYSTA,
Kabilan Kannan56bfd8f2017-04-26 13:26:47 -0700463 CDP_UPDATE_TDLS_FLAGS,
Ishank Jain9f174c62017-03-30 18:37:42 +0530464};
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530465
466#define TXRX_FW_STATS_TXSTATS 1
467#define TXRX_FW_STATS_RXSTATS 2
468#define TXRX_FW_STATS_RX_RATE_INFO 3
469#define TXRX_FW_STATS_PHYSTATS 4
470#define TXRX_FW_STATS_PHYSTATS_CONCISE 5
471#define TXRX_FW_STATS_TX_RATE_INFO 6
472#define TXRX_FW_STATS_TID_STATE 7
473#define TXRX_FW_STATS_HOST_STATS 8
474#define TXRX_FW_STATS_CLEAR_HOST_STATS 9
475#define TXRX_FW_STATS_CE_STATS 10
476#define TXRX_FW_STATS_VOW_UMAC_COUNTER 11
477#define TXRX_FW_STATS_ME_STATS 12
478#define TXRX_FW_STATS_TXBF_INFO 13
479#define TXRX_FW_STATS_SND_INFO 14
480#define TXRX_FW_STATS_ERROR_INFO 15
481#define TXRX_FW_STATS_TX_SELFGEN_INFO 16
482#define TXRX_FW_STATS_TX_MU_INFO 17
483#define TXRX_FW_SIFS_RESP_INFO 18
484#define TXRX_FW_RESET_STATS 19
485#define TXRX_FW_MAC_WDOG_STATS 20
486#define TXRX_FW_MAC_DESC_STATS 21
487#define TXRX_FW_MAC_FETCH_MGR_STATS 22
488#define TXRX_FW_MAC_PREFETCH_MGR_STATS 23
Nandha Kishore Easwaran46249e42016-11-15 14:46:35 +0530489#define TXRX_FW_STATS_DURATION_INFO 24
490#define TXRX_FW_STATS_DURATION_INFO_RESET 25
Ishank Jainbc2d91f2017-01-03 18:14:54 +0530491#define TXRX_FW_STATS_HOST_RX_STATS 27
Nandha Kishore Easwaran46249e42016-11-15 14:46:35 +0530492
493#define PER_RADIO_FW_STATS_REQUEST 0
494#define PER_VDEV_FW_STATS_REQUEST 1
495
Venkata Sharath Chandra Manchalaa77da0d2017-02-27 22:44:37 -0800496/*
497 * cdp_stats - options for host and firmware
498 * statistics
499*/
500enum cdp_stats {
501 CDP_TXRX_STATS_0 = 0,
502 CDP_TXRX_STATS_1,
503 CDP_TXRX_STATS_2,
504 CDP_TXRX_STATS_3,
505 CDP_TXRX_STATS_4,
506 CDP_TXRX_STATS_5,
507 CDP_TXRX_STATS_6,
508 CDP_TXRX_STATS_7,
509 CDP_TXRX_STATS_8,
510 CDP_TXRX_STATS_9,
511 CDP_TXRX_STATS_10,
512 CDP_TXRX_STATS_11,
513 CDP_TXRX_STATS_12,
514 CDP_TXRX_STATS_13,
515 CDP_TXRX_STATS_14,
516 CDP_TXRX_STATS_15,
517 CDP_TXRX_STATS_16,
518 CDP_TXRX_STATS_17,
519 CDP_TXRX_STATS_18,
520 CDP_TXRX_STATS_19,
521 CDP_TXRX_STATS_20,
522 CDP_TXRX_STATS_21,
523 CDP_TXRX_STATS_22,
524 CDP_TXRX_STATS_23,
525 CDP_TXRX_STATS_24,
526 CDP_TXRX_STATS_25,
527 CDP_TXRX_STATS_26,
528 CDP_TXRX_STATS_27,
Ishank Jain6290a3c2017-03-21 10:49:39 +0530529 CDP_TXRX_STATS_HTT_MAX = 256,
530 CDP_TXRX_MAX_STATS = 512,
Venkata Sharath Chandra Manchalaa77da0d2017-02-27 22:44:37 -0800531};
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530532
Ishank Jain1e7401c2017-02-17 15:38:39 +0530533/* Different Packet Types */
534enum cdp_packet_type {
535 DOT11_A = 0,
536 DOT11_B = 1,
537 DOT11_N = 2,
538 DOT11_AC = 3,
539 DOT11_AX = 4,
540 DOT11_MAX = 5,
541};
542
543/*
544 * Different Stat update types sent to OL_IF
545 * @UPDATE_PEER_STATS: update peer stats
546 * @UPDATE_VDEV_STATS: update vdev stats
547 * @UPDATE_PDE_STATS: Update pdev stats
548 */
549enum cdp_stat_update_type {
550 UPDATE_PEER_STATS = 0,
551 UPDATE_VDEV_STATS = 1,
552 UPDATE_PDEV_STATS = 2,
553};
554/* packet info */
555struct cdp_pkt_info {
556 /*no of packets*/
557 uint32_t num;
558 /* total no of bytes */
559 uint32_t bytes;
560};
561
562/* Tx Stats */
563struct cdp_tx_stats {
564 /* Pkt Info for which completions were received */
565 struct cdp_pkt_info comp_pkt;
566 /* Unicast Packet Count */
567 struct cdp_pkt_info ucast;
568 /* Multicast Packet Count */
569 struct cdp_pkt_info mcast;
570 /* Successful Tx Packets */
571 struct cdp_pkt_info tx_success;
572 /* Total Tx failure */
573 uint32_t tx_failed;
574 /* Total Packets as ofdma*/
575 uint32_t ofdma;
576 /* Packets in STBC */
577 uint32_t stbc;
578 /* Packets in LDPC */
579 uint32_t ldpc;
580 /* Packet retries */
581 uint32_t retries;
582 /* Number of MSDUs with no MSDU level aggregation */
583 uint32_t non_amsdu_cnt;
584 /* Number of MSDUs part of AMSDU*/
585 uint32_t amsdu_cnt;
586 /* RSSI of last packet */
587 uint32_t last_ack_rssi;
588
589 /* Packet Type */
590 struct {
591 /* MCS Count */
592 uint32_t mcs_count[MAX_MCS + 1];
593 } pkt_type[DOT11_MAX];
594 /* SGI count */
595 uint32_t sgi_count[MAX_MCS + 1];
596 /* Packet Count for different bandwidths */
597 uint32_t bw[SUPPORTED_BW];
598 /* Wireless Multimedia type Count */
599 uint32_t wme_ac_type[WME_AC_MAX];
600 /* Wireless Multimedia type Count */
601 uint32_t excess_retries_ac[WME_AC_MAX];
602
603 /* Packets dropped on the Tx side */
604 struct {
Ishank Jain57c42a12017-04-12 10:42:22 +0530605 /* Discarded by firmware */
Ishank Jain1e7401c2017-02-17 15:38:39 +0530606 uint32_t fw_discard;
607 /* fw_discard_retired */
608 uint32_t fw_discard_retired;
609 /* firmware_discard_untransmitted */
610 uint32_t fw_discard_untransmitted;
611 /* ,pdu_age_out */
612 uint32_t mpdu_age_out;
613 /* firmware_discard_reason1 */
614 uint32_t fw_discard_reason1;
615 /* firmware_discard_reason2 */
616 uint32_t fw_discard_reason2;
617 /* firmware_discard_reason3 */
618 uint32_t fw_discard_reason3;
619 } dropped;
620};
621
622/* Rx Level Stats */
623struct cdp_rx_stats {
624 /* Total packets sent up the stack */
625 struct cdp_pkt_info to_stack;
626 /* Packets received on the reo ring */
Ishank Jain57c42a12017-04-12 10:42:22 +0530627 struct cdp_pkt_info rcvd_reo[CDP_MAX_RX_RINGS];
Ishank Jain1e7401c2017-02-17 15:38:39 +0530628 /* Total unicast packets */
Ishank Jain57c42a12017-04-12 10:42:22 +0530629 struct cdp_pkt_info unicast;
630 /* Total multicast packets */
Ishank Jain1e7401c2017-02-17 15:38:39 +0530631 struct cdp_pkt_info multicast;
632 /* WDS packets received */
633 struct cdp_pkt_info wds;
Ishank Jain1e7401c2017-02-17 15:38:39 +0530634 /* Raw Pakets received */
635 struct cdp_pkt_info raw;
636
Ishank Jain57c42a12017-04-12 10:42:22 +0530637 struct {
638 /* Intra BSS packets received */
639 struct cdp_pkt_info pkts;
640 struct cdp_pkt_info fail;
641 } intra_bss;
642
Ishank Jain1e7401c2017-02-17 15:38:39 +0530643 /* Errors */
644 struct {
645 /* Rx MIC errors */
646 uint32_t mic_err;
647 /* Rx Decryption Errors */
648 uint32_t decrypt_err;
649 } err;
650
651 /* Wireless Multimedia type Count */
652 uint32_t wme_ac_type[WME_AC_MAX];
653 /* Reception type os packets */
654 uint32_t reception_type[SUPPORTED_RECEPTION_TYPES];
Ishank Jain57c42a12017-04-12 10:42:22 +0530655 /* Packet Type */
656 struct {
657 /* MCS Count */
658 uint32_t mcs_count[MAX_MCS + 1];
659 } pkt_type[DOT11_MAX];
Ishank Jain1e7401c2017-02-17 15:38:39 +0530660 /* SGI count */
661 uint32_t sgi_count[MAX_MCS + 1];
662 /* Packet count in spatiel Streams */
663 uint32_t nss[SS_COUNT];
664 /* Packet Count in different bandwidths */
665 uint32_t bw[SUPPORTED_BW];
666 /* Number of MSDUs with no MPDU level aggregation */
667 uint32_t non_ampdu_cnt;
668 /* Number of MSDUs part of AMSPU */
669 uint32_t ampdu_cnt;
670 /* Number of MSDUs with no MSDU level aggregation */
671 uint32_t non_amsdu_cnt;
672 /* Number of MSDUs part of AMSDU*/
673 uint32_t amsdu_cnt;
674};
675
676/* Tx ingress Stats */
677struct cdp_tx_ingress_stats {
678 /* Total packets received for transmission */
679 struct cdp_pkt_info rcvd;
Ishank Jain1e7401c2017-02-17 15:38:39 +0530680 /* Tx packets processed*/
681 struct cdp_pkt_info processed;
682 /* Total packets passed Reinject handler */
683 struct cdp_pkt_info reinject_pkts;
684 /* Total packets passed to inspect handler */
685 struct cdp_pkt_info inspect_pkts;
Ishank Jain57c42a12017-04-12 10:42:22 +0530686
687 struct {
688 /* Total Raw packets */
689 struct cdp_pkt_info raw_pkt;
690 /* DMA map error */
691 uint32_t dma_map_error;
692 } raw;
Ishank Jain1e7401c2017-02-17 15:38:39 +0530693
694 /* TSO packets info */
695 struct {
696 /* No of segments in TSO packets */
697 uint32_t num_seg;
698 /* total no of TSO packets */
699 struct cdp_pkt_info tso_pkt;
700 /* TSO packets dropped by host */
701 uint32_t dropped_host;
702 /* TSO packets dropped by target */
703 uint32_t dropped_target;
704 } tso;
705
706 /* Scatter Gather packet info */
707 struct {
708 /* Total scatter gather packets */
709 struct cdp_pkt_info sg_pkt;
710 /* SG packets dropped by host */
711 uint32_t dropped_host;
712 /* SG packets dropped by target */
713 uint32_t dropped_target;
Ishank Jain57c42a12017-04-12 10:42:22 +0530714 /* Dma map error */
715 uint32_t dma_map_error;
Ishank Jain1e7401c2017-02-17 15:38:39 +0530716 } sg;
717
718 /* Multicast Enhancement packets info */
719 struct {
720 /* total no of multicast conversion packets */
721 struct cdp_pkt_info mcast_pkt;
722 /* packets dropped due to map error */
723 uint32_t dropped_map_error;
724 /* packets dropped due to self Mac address */
725 uint32_t dropped_self_mac;
726 /* Packets dropped due to send fail */
727 uint32_t dropped_send_fail;
728 /* total unicast packets transmitted */
729 uint32_t ucast;
Ishank Jainc838b132017-02-17 11:08:18 +0530730 /* Segment allocation failure */
731 uint32_t fail_seg_alloc;
732 /* NBUF clone failure */
733 uint32_t clone_fail;
Ishank Jain1e7401c2017-02-17 15:38:39 +0530734 } mcast_en;
735
736 /* Packets dropped on the Tx side */
737 struct {
Ishank Jain57c42a12017-04-12 10:42:22 +0530738 /* Total scatter gather packets */
Ishank Jain1e7401c2017-02-17 15:38:39 +0530739 struct cdp_pkt_info dropped_pkt;
740 /* Desc Not Available */
741 uint32_t desc_na;
742 /* Ring Full */
743 uint32_t ring_full;
744 /* Hwenqueue failed */
745 uint32_t enqueue_fail;
746 /* DMA failed */
747 uint32_t dma_error;
Ishank Jain57c42a12017-04-12 10:42:22 +0530748 /* Resource Full: Congestion Control */
749 uint32_t res_full;
Ishank Jain1e7401c2017-02-17 15:38:39 +0530750 } dropped;
751};
752
753struct cdp_vdev_stats {
754 /* Tx ingress stats */
755 struct cdp_tx_ingress_stats tx_i;
756 /* CDP Tx Stats */
757 struct cdp_tx_stats tx;
758 /* CDP Rx Stats */
759 struct cdp_rx_stats rx;
760};
761
762
763struct cdp_peer_stats {
764 /* CDP Tx Stats */
765 struct cdp_tx_stats tx;
766 /* CDP Rx Stats */
767 struct cdp_rx_stats rx;
768};
769
Venkata Sharath Chandra Manchalaa405eb72017-03-06 14:35:00 -0800770/* Tx completions per interrupt */
771struct cdp_hist_tx_comp {
772 uint32_t pkts_1;
773 uint32_t pkts_2_20;
774 uint32_t pkts_21_40;
775 uint32_t pkts_41_60;
776 uint32_t pkts_61_80;
777 uint32_t pkts_81_100;
778 uint32_t pkts_101_200;
779 uint32_t pkts_201_plus;
780};
781
782/* Rx ring descriptors reaped per interrupt */
783struct cdp_hist_rx_ind {
784 uint32_t pkts_1;
785 uint32_t pkts_2_20;
786 uint32_t pkts_21_40;
787 uint32_t pkts_41_60;
788 uint32_t pkts_61_80;
789 uint32_t pkts_81_100;
790 uint32_t pkts_101_200;
791 uint32_t pkts_201_plus;
792};
793
794
Ishank Jain1e7401c2017-02-17 15:38:39 +0530795struct cdp_pdev_stats {
796 /* packets dropped on rx */
797 struct {
Ishank Jain1e7401c2017-02-17 15:38:39 +0530798 /* packets dropped because nsdu_done bit not set */
Ishank Jain57c42a12017-04-12 10:42:22 +0530799 uint32_t msdu_not_done;
800 /* Multicast Echo check */
801 uint32_t mec;
802 /* Mesh Filtered packets */
803 uint32_t mesh_filter;
Ishank Jain1e7401c2017-02-17 15:38:39 +0530804 } dropped;
Ishank Jain57c42a12017-04-12 10:42:22 +0530805
806 struct {
807 /* total packets replnished */
808 struct cdp_pkt_info pkts;
809 /* rxdma errors */
810 uint32_t rxdma_err;
811 /* nbuf alloc failed */
812 uint32_t nbuf_alloc_fail;
813 /* Mapping failure */
814 uint32_t map_err;
815 /* x86 failures */
816 uint32_t x86_fail;
817 } replenish;
818
819 /* Rx Raw Packets */
820 uint32_t rx_raw_pkts;
821 /* Mesh Rx Stats Alloc fail */
822 uint32_t mesh_mem_alloc;
823
Ishank Jain1e7401c2017-02-17 15:38:39 +0530824 /* Rx errors */
825 struct {
Ishank Jain1e7401c2017-02-17 15:38:39 +0530826 /* desc alloc failed errors */
827 uint32_t desc_alloc_fail;
828 } err;
829 /* buffers added back in freelist */
830 uint32_t buf_freelist;
831 /* Tx Ingress stats */
832 struct cdp_tx_ingress_stats tx_i;
833 /* CDP Tx Stats */
834 struct cdp_tx_stats tx;
835 /* CDP Rx Stats */
836 struct cdp_rx_stats rx;
Venkata Sharath Chandra Manchalaa405eb72017-03-06 14:35:00 -0800837 /* Number of Tx completions per interrupt */
838 struct cdp_hist_tx_comp tx_comp_histogram;
839 /* Number of Rx ring descriptors reaped per interrupt */
840 struct cdp_hist_rx_ind rx_ind_histogram;
Ishank Jain1e7401c2017-02-17 15:38:39 +0530841};
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530842#endif