1 /* 2 * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. 3 * 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 27 /** 28 * For WIN legacy header compilation 29 * Temporary add dummy definitions 30 * should be removed properly WIN legacy code handle 31 */ 32 33 #include "htc_api.h" 34 #include "qdf_types.h" 35 #include "qdf_nbuf.h" 36 #include "qdf_atomic.h" 37 #ifndef CONFIG_WIN 38 #include <cdp_txrx_mob_def.h> 39 #endif /* CONFIG_WIN */ 40 #include <cdp_txrx_handle.h> 41 #include <cdp_txrx_stats_struct.h> 42 43 #ifndef OL_TXRX_NUM_LOCAL_PEER_IDS 44 /* 45 * Each AP will occupy one ID, so it will occupy two IDs for AP-AP mode. 46 * Clients will be assigned max 32 IDs. 47 * STA(associated)/P2P DEV(self-PEER) will get one ID. 48 */ 49 #define OL_TXRX_NUM_LOCAL_PEER_IDS (32 + 1 + 1 + 1) 50 #endif 51 52 #define CDP_BA_256_BIT_MAP_SIZE_DWORDS 8 53 #define CDP_BA_64_BIT_MAP_SIZE_DWORDS 2 54 #define CDP_RSSI_CHAIN_LEN 8 55 56 #define OL_TXRX_INVALID_LOCAL_PEER_ID 0xffff 57 #define CDP_INVALID_VDEV_ID 0xff 58 /* Options for Dump Statistics */ 59 #define CDP_HDD_STATS 0 60 #define CDP_TXRX_PATH_STATS 1 61 #define CDP_TXRX_HIST_STATS 2 62 #define CDP_TXRX_TSO_STATS 3 63 #define CDP_HDD_NETIF_OPER_HISTORY 4 64 #define CDP_DUMP_TX_FLOW_POOL_INFO 5 65 #define CDP_TXRX_DESC_STATS 6 66 #define CDP_HIF_STATS 7 67 #define CDP_LRO_STATS 8 68 #define CDP_NAPI_STATS 9 69 #define CDP_WLAN_RX_BUF_DEBUG_STATS 10 70 #define CDP_RX_RING_STATS 11 71 #define CDP_DP_NAPI_STATS 12 72 #define CDP_DP_RX_THREAD_STATS 13 73 #define CDP_SCHEDULER_STATS 21 74 #define CDP_TX_QUEUE_STATS 22 75 #define CDP_BUNDLE_STATS 23 76 #define CDP_CREDIT_STATS 24 77 #define CDP_DISCONNECT_STATS 25 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) 90 91 #define CDP_MU_MAX_USERS 8 92 #define CDP_MU_MAX_USER_INDEX (CDP_MU_MAX_USERS - 1) 93 #define CDP_INVALID_PEER 0xffff 94 #define CDP_INVALID_TID 31 95 96 #define CDP_DATA_TID_MAX 8 97 /* 98 * advance rx monitor filter 99 * */ 100 #define MON_FILTER_PASS 0x0001 101 #define MON_FILTER_OTHER 0x0002 102 #define MON_FILTER_ALL 0x0003 103 104 #define FILTER_MGMT_ALL 0xFFFF 105 #define FILTER_MGMT_ASSOC_REQ 0x0001 106 #define FILTER_MGMT_ASSOC_RES 0x0002 107 #define FILTER_MGMT_REASSOC_REQ 0x0004 108 #define FILTER_MGMT_REASSOC_RES 0x0008 109 #define FILTER_MGMT_PROBE_REQ 0x0010 110 #define FILTER_MGMT_PROBE_RES 0x0020 111 #define FILTER_MGMT_TIM_ADVT 0x0040 112 #define FILTER_MGMT_RESERVED_7 0x0080 113 #define FILTER_MGMT_BEACON 0x0100 114 #define FILTER_MGMT_ATIM 0x0200 115 #define FILTER_MGMT_DISASSOC 0x0400 116 #define FILTER_MGMT_AUTH 0x0800 117 #define FILTER_MGMT_DEAUTH 0x1000 118 #define FILTER_MGMT_ACTION 0x2000 119 #define FILTER_MGMT_ACT_NO_ACK 0x4000 120 #define FILTER_MGMT_RESERVED_15 0x8000 121 122 #define FILTER_CTRL_ALL 0xFFFF 123 #define FILTER_CTRL_RESERVED_1 0x0001 124 #define FILTER_CTRL_RESERVED_2 0x0002 125 #define FILTER_CTRL_TRIGGER 0x0004 126 #define FILTER_CTRL_RESERVED_4 0x0008 127 #define FILTER_CTRL_BF_REP_POLL 0x0010 128 #define FILTER_CTRL_VHT_NDP 0x0020 129 #define FILTER_CTRL_FRAME_EXT 0x0040 130 #define FILTER_CTRL_CTRLWRAP 0x0080 131 #define FILTER_CTRL_BA_REQ 0x0100 132 #define FILTER_CTRL_BA 0x0200 133 #define FILTER_CTRL_PSPOLL 0x0400 134 #define FILTER_CTRL_RTS 0x0800 135 #define FILTER_CTRL_CTS 0x1000 136 #define FILTER_CTRL_ACK 0x2000 137 #define FILTER_CTRL_CFEND 0x4000 138 #define FILTER_CTRL_CFEND_CFACK 0x8000 139 140 #define FILTER_DATA_ALL 0xFFFF 141 #define FILTER_DATA_MCAST 0x4000 142 #define FILTER_DATA_UCAST 0x8000 143 #define FILTER_DATA_DATA 0x0001 144 #define FILTER_DATA_NULL 0x0008 145 146 QDF_DECLARE_EWMA(tx_lag, 1024, 8) 147 struct cdp_stats_cookie; 148 149 /* 150 * DP configuration parameters 151 */ 152 enum cdp_cfg_param_type { 153 CDP_CFG_MAX_PEER_ID, 154 CDP_CFG_CCE_DISABLE, 155 CDP_CFG_NUM_PARAMS 156 }; 157 158 /* 159 * htt_dbg_stats_type - 160 * bit positions for each stats type within a stats type bitmask 161 * The bitmask contains 24 bits. 162 */ 163 enum htt_cmn_dbg_stats_type { 164 HTT_DBG_CMN_STATS_WAL_PDEV_TXRX = 0, /* bit 0 -> 0x1 */ 165 HTT_DBG_CMN_STATS_RX_REORDER = 1, /* bit 1 -> 0x2 */ 166 HTT_DBG_CMN_STATS_RX_RATE_INFO = 2, /* bit 2 -> 0x4 */ 167 HTT_DBG_CMN_STATS_TX_PPDU_LOG = 3, /* bit 3 -> 0x8 */ 168 HTT_DBG_CMN_STATS_TX_RATE_INFO = 4, /* bit 4 -> 0x10 */ 169 HTT_DBG_CMN_STATS_TIDQ = 5, /* bit 5 -> 0x20 */ 170 HTT_DBG_CMN_STATS_TXBF_INFO = 6, /* bit 6 -> 0x40 */ 171 HTT_DBG_CMN_STATS_SND_INFO = 7, /* bit 7 -> 0x80 */ 172 HTT_DBG_CMN_STATS_ERROR_INFO = 8, /* bit 8 -> 0x100 */ 173 HTT_DBG_CMN_STATS_TX_SELFGEN_INFO = 9, /* bit 9 -> 0x200 */ 174 HTT_DBG_CMN_STATS_TX_MU_INFO = 10, /* bit 10 -> 0x400 */ 175 HTT_DBG_CMN_STATS_SIFS_RESP_INFO = 11, /* bit 11 -> 0x800 */ 176 HTT_DBG_CMN_STATS_RESET_INFO = 12, /* bit 12 -> 0x1000 */ 177 HTT_DBG_CMN_STATS_MAC_WDOG_INFO = 13, /* bit 13 -> 0x2000 */ 178 HTT_DBG_CMN_STATS_TX_DESC_INFO = 14, /* bit 14 -> 0x4000 */ 179 HTT_DBG_CMN_STATS_TX_FETCH_MGR_INFO = 15, /* bit 15 -> 0x8000 */ 180 HTT_DBG_CMN_STATS_TX_PFSCHED_INFO = 16, /* bit 16 -> 0x10000 */ 181 HTT_DBG_CMN_STATS_TX_PATH_STATS_INFO = 17, /* bit 17 -> 0x20000 */ 182 /* bits 18-23 currently reserved */ 183 184 /* keep this last */ 185 HTT_DBG_CMN_NUM_STATS, 186 HTT_DBG_CMN_NUM_STATS_INVALID = 31, /* bit 31 -> 0x80000000 */ 187 }; 188 189 /* 190 * cdp_host_txrx_stats: Different types of host stats 191 * @TXRX_HOST_STATS_INVALID: Invalid option 192 * @TXRX_RX_RATE_STATS: Rx rate info 193 * @TXRX_TX_RATE_STATS: Tx rate info 194 * @TXRX_TX_HOST_STATS: Print Tx stats 195 * @TXRX_RX_HOST_STATS: Print host Rx stats 196 * @TXRX_CLEAR_STATS: clear all host stats 197 * @TXRX_SRNG_PTR_STATS: Print SRNG pointer stats 198 * @TXRX_RX_MON_STATS: Print monitor mode stats 199 * @TXRX_REO_QUEUE_STATS: Print Per peer REO Queue Stats 200 * @TXRX_SOC_CFG_PARAMS: Print soc cfg params info 201 * @TXRX_PDEV_CFG_PARAMS: Print pdev cfg params info 202 */ 203 enum cdp_host_txrx_stats { 204 TXRX_HOST_STATS_INVALID = -1, 205 TXRX_CLEAR_STATS = 0, 206 TXRX_RX_RATE_STATS = 1, 207 TXRX_TX_RATE_STATS = 2, 208 TXRX_TX_HOST_STATS = 3, 209 TXRX_RX_HOST_STATS = 4, 210 TXRX_AST_STATS = 5, 211 TXRX_SRNG_PTR_STATS = 6, 212 TXRX_RX_MON_STATS = 7, 213 TXRX_REO_QUEUE_STATS = 8, 214 TXRX_SOC_CFG_PARAMS = 9, 215 TXRX_PDEV_CFG_PARAMS = 10, 216 TXRX_HOST_STATS_MAX, 217 }; 218 219 /* 220 * cdp_ppdu_ftype: PPDU Frame Type 221 * @CDP_PPDU_FTYPE_DATA: SU or MU Data Frame 222 * @CDP_PPDU_FTYPE_CTRL: Control/Management Frames 223 * @CDP_PPDU_FTYPE_BAR: SU or MU BAR frames 224 */ 225 enum cdp_ppdu_ftype { 226 CDP_PPDU_FTYPE_CTRL, 227 CDP_PPDU_FTYPE_DATA, 228 CDP_PPDU_FTYPE_BAR, 229 CDP_PPDU_FTYPE_MAX 230 }; 231 232 233 /** 234 * @brief General specification of the tx frame contents 235 * 236 * @details 237 * for efficiency, the HTT packet type values correspond 238 * to the bit positions of the WAL packet type values, so the 239 * translation is a simple shift operation. 240 */ 241 enum htt_cmn_pkt_type { 242 htt_cmn_pkt_type_raw = 0, 243 htt_cmn_pkt_type_native_wifi = 1, 244 htt_cmn_pkt_type_ethernet = 2, 245 htt_cmn_pkt_type_mgmt = 3, 246 htt_cmn_pkt_type_eth2 = 4, 247 248 /* keep this last */ 249 htt_cmn_pkt_num_types 250 }; 251 252 /** 253 * @General description of HTT received packets status 254 * It is similar to htt_rx_status enum 255 * but is added as a cdp enum can be freely used in OL_IF layer 256 */ 257 enum htt_cmn_rx_status { 258 htt_cmn_rx_status_unknown = 0x0, 259 htt_cmn_rx_status_ok, 260 htt_cmn_rx_status_err_fcs, 261 htt_cmn_rx_status_err_dup, 262 htt_cmn_rx_status_err_replay, 263 htt_cmn_rx_status_inv_peer, 264 htt_cmn_rx_status_ctrl_mgmt_null = 0x08, 265 htt_cmn_rx_status_tkip_mic_err = 0x09, 266 htt_cmn_rx_status_decrypt_err = 0x0A, 267 htt_cmn_rx_status_mpdu_length_err = 0x0B, 268 htt_cmn_rx_status_err_misc = 0xFF 269 }; 270 271 272 enum cdp_host_reo_dest_ring { 273 cdp_host_reo_dest_ring_unknown = 0, 274 cdp_host_reo_dest_ring_1 = 1, 275 cdp_host_reo_dest_ring_2 = 2, 276 cdp_host_reo_dest_ring_3 = 3, 277 cdp_host_reo_dest_ring_4 = 4, 278 }; 279 280 enum htt_cmn_t2h_en_stats_type { 281 /* keep this alwyas first */ 282 HTT_CMN_T2H_EN_STATS_TYPE_START = 0, 283 284 /** ppdu_common_stats is the payload */ 285 HTT_CMN_T2H_EN_STATS_TYPE_COMMON = 1, 286 /** ppdu_sant_stats is the payload */ 287 HTT_CMN_T2H_EN_STATS_TYPE_SANT = 2, 288 /** ppdu_common_stats_v2 is the payload */ 289 HTT_CMN_T2H_EN_STATS_TYPE_COMMON_V2 = 3, 290 291 /* Keep this last */ 292 HTT_CMN_T2H_EN_STATS_TYPE_END = 0x1f, 293 }; 294 295 enum htt_cmn_t2h_en_stats_status { 296 /* Keep this first always */ 297 HTT_CMN_T2H_EN_STATS_STATUS_PARTIAL = 0, 298 HTT_CMN_T2H_EN_STATS_STATUS_PRESENT = 1, 299 HTT_CMN_T2H_EN_STATS_STATUS_ERROR = 2, 300 HTT_CMN_T2H_EN_STATS_STATUS_INVALID = 3, 301 302 303 /* keep this always last */ 304 HTT_CMN_T2H_EN_STATS_STATUS_SERIES_DONE = 7, 305 }; 306 307 /** 308 * struct ol_txrx_peer_state - Peer state information 309 */ 310 enum ol_txrx_peer_state { 311 OL_TXRX_PEER_STATE_INVALID, 312 OL_TXRX_PEER_STATE_DISC, /* initial state */ 313 OL_TXRX_PEER_STATE_CONN, /* authentication in progress */ 314 OL_TXRX_PEER_STATE_AUTH, /* authentication successful */ 315 }; 316 317 /** 318 * struct ol_txrx_ast_type - AST entry type information 319 */ 320 enum cdp_txrx_ast_entry_type { 321 CDP_TXRX_AST_TYPE_NONE, /* static ast entry for connected peer */ 322 CDP_TXRX_AST_TYPE_STATIC, /* static ast entry for connected peer */ 323 CDP_TXRX_AST_TYPE_SELF, /* static ast entry for self peer (STA mode) */ 324 CDP_TXRX_AST_TYPE_WDS, /* WDS peer ast entry type*/ 325 CDP_TXRX_AST_TYPE_MEC, /* Multicast echo ast entry type */ 326 CDP_TXRX_AST_TYPE_WDS_HM, /* HM WDS entry */ 327 CDP_TXRX_AST_TYPE_STA_BSS, /* BSS entry(STA mode) */ 328 CDP_TXRX_AST_TYPE_DA, /* AST entry based on Destination address */ 329 CDP_TXRX_AST_TYPE_WDS_HM_SEC, /* HM WDS entry for secondary radio */ 330 CDP_TXRX_AST_TYPE_MAX 331 }; 332 333 /* 334 * cdp_ast_free_status: status passed to callback function before freeing ast 335 * @CDP_TXRX_AST_DELETED - AST is deleted from FW and delete response received 336 * @CDP_TXRX_AST_DELETE_IN_PROGRESS - AST delete command sent to FW and host 337 * is waiting for FW response 338 */ 339 enum cdp_ast_free_status { 340 CDP_TXRX_AST_DELETED, 341 CDP_TXRX_AST_DELETE_IN_PROGRESS, 342 }; 343 344 /** 345 * txrx_ast_free_cb - callback registered for ast free 346 * @ctrl_soc: control path soc context 347 * @cdp_soc: DP soc context 348 * @cookie: cookie 349 * @cdp_ast_free_status: ast free status 350 */ 351 typedef void (*txrx_ast_free_cb)(void *ctrl_soc, 352 void *cdp_soc, 353 void *cookie, 354 enum cdp_ast_free_status); 355 356 #define CDP_MAC_ADDR_LEN 6 357 358 /** 359 * struct cdp_ast_entry_info - AST entry information 360 * @peer_mac_addr: mac address of peer on which AST entry is added 361 * @type: ast entry type 362 * @vdev_id: vdev_id 363 * @pdev_id: pdev_id 364 * @peer_id: peer_id 365 * 366 * This structure holds the ast entry information 367 * 368 */ 369 struct cdp_ast_entry_info { 370 uint8_t peer_mac_addr[CDP_MAC_ADDR_LEN]; 371 enum cdp_txrx_ast_entry_type type; 372 uint8_t vdev_id; 373 uint8_t pdev_id; 374 uint16_t peer_id; 375 }; 376 377 /** 378 * struct cdp_sec_type - security type information 379 */ 380 enum cdp_sec_type { 381 cdp_sec_type_none, 382 cdp_sec_type_wep128, 383 cdp_sec_type_wep104, 384 cdp_sec_type_wep40, 385 cdp_sec_type_tkip, 386 cdp_sec_type_tkip_nomic, 387 cdp_sec_type_aes_ccmp, 388 cdp_sec_type_wapi, 389 cdp_sec_type_aes_ccmp_256, 390 cdp_sec_type_aes_gcmp, 391 cdp_sec_type_aes_gcmp_256, 392 393 /* keep this last! */ 394 cdp_num_sec_types 395 }; 396 397 /** 398 * struct cdp_tx_exception_metadata - Exception path parameters 399 * @peer_id: Peer id of the peer 400 * @tid: Transmit Identifier 401 * @tx_encap_type: Transmit encap type (i.e. Raw, Native Wi-Fi, Ethernet) 402 * @sec_type: sec_type to be passed to HAL 403 * 404 * This structure holds the parameters needed in the exception path of tx 405 * 406 */ 407 struct cdp_tx_exception_metadata { 408 uint16_t peer_id; 409 uint8_t tid; 410 uint16_t tx_encap_type; 411 enum cdp_sec_type sec_type; 412 }; 413 414 typedef struct cdp_soc_t *ol_txrx_soc_handle; 415 416 /** 417 * ol_txrx_vdev_delete_cb - callback registered during vdev 418 * detach 419 */ 420 typedef void (*ol_txrx_vdev_delete_cb)(void *context); 421 422 /** 423 * ol_txrx_peer_unmap_sync_cb - callback registered during peer detach sync 424 */ 425 typedef QDF_STATUS(*ol_txrx_peer_unmap_sync_cb)(uint8_t vdev_id, 426 uint32_t peer_id_cnt, 427 uint16_t *peer_id_list); 428 429 /** 430 * ol_txrx_pkt_direction - Packet Direction 431 * @rx_direction: rx path packet 432 * @tx_direction: tx path packet 433 */ 434 enum txrx_direction { 435 rx_direction = 1, 436 tx_direction = 0, 437 }; 438 439 /** 440 * cdp_capabilities- DP capabilities 441 */ 442 enum cdp_capabilities { 443 CDP_CFG_DP_TSO, 444 CDP_CFG_DP_LRO, 445 CDP_CFG_DP_SG, 446 CDP_CFG_DP_GRO, 447 CDP_CFG_DP_OL_TX_CSUM, 448 CDP_CFG_DP_OL_RX_CSUM, 449 CDP_CFG_DP_RAWMODE, 450 CDP_CFG_DP_PEER_FLOW_CTRL, 451 }; 452 453 /** 454 * ol_txrx_nbuf_classify - Packet classification object 455 * @peer_id: unique peer identifier from fw 456 * @tid: traffic identifier(could be overridden) 457 * @pkt_tid: traffic identifier(cannot be overridden) 458 * @pkt_tos: ip header tos value 459 * @pkt_dscp: ip header dscp value 460 * @tos: index value in map 461 * @dscp: DSCP_TID map index 462 * @is_mcast: multicast pkt check 463 * @is_eap: eapol pkt check 464 * @is_arp: arp pkt check 465 * @is_tcp: tcp pkt check 466 * @is_dhcp: dhcp pkt check 467 * @is_igmp: igmp pkt check 468 * @is_ipv4: ip version 4 pkt check 469 * @is_ipv6: ip version 6 pkt check 470 */ 471 struct ol_txrx_nbuf_classify { 472 uint16_t peer_id; 473 uint8_t tid; 474 uint8_t pkt_tid; 475 uint8_t pkt_tos; 476 uint8_t pkt_dscp; 477 uint8_t tos; 478 uint8_t dscp; 479 uint8_t is_mcast; 480 uint8_t is_eap; 481 uint8_t is_arp; 482 uint8_t is_tcp; 483 uint8_t is_dhcp; 484 uint8_t is_igmp; 485 uint8_t is_ipv4; 486 uint8_t is_ipv6; 487 }; 488 489 /** 490 * ol_osif_vdev_handle - paque handle for OS shim virtual device 491 * object 492 */ 493 struct ol_osif_vdev_t; 494 typedef struct ol_osif_vdev_t *ol_osif_vdev_handle; 495 496 /** 497 * wlan_op_mode - Virtual device operation mode 498 * @wlan_op_mode_unknown: Unknown mode 499 * @wlan_op_mode_ap: AP mode 500 * @wlan_op_mode_ibss: IBSS mode 501 * @wlan_op_mode_sta: STA (client) mode 502 * @wlan_op_mode_monitor: Monitor mode 503 * @wlan_op_mode_ocb: OCB mode 504 */ 505 enum wlan_op_mode { 506 wlan_op_mode_unknown, 507 wlan_op_mode_ap, 508 wlan_op_mode_ibss, 509 wlan_op_mode_sta, 510 wlan_op_mode_monitor, 511 wlan_op_mode_ocb, 512 wlan_op_mode_ndi, 513 }; 514 515 /** 516 * connectivity_stats_pkt_status - data pkt type 517 * @PKT_TYPE_REQ: Request packet 518 * @PKT_TYPE_RSP: Response packet 519 * @PKT_TYPE_TX_DROPPED: TX packet dropped 520 * @PKT_TYPE_RX_DROPPED: RX packet dropped 521 * @PKT_TYPE_RX_DELIVERED: RX packet delivered 522 * @PKT_TYPE_RX_REFUSED: RX packet refused 523 * @PKT_TYPE_TX_HOST_FW_SENT: TX packet FW sent 524 * @PKT_TYPE_TX_ACK_CNT:TC packet acked 525 * @PKT_TYPE_NONE: Invalid packet 526 */ 527 enum connectivity_stats_pkt_status { 528 PKT_TYPE_REQ, 529 PKT_TYPE_RSP, 530 PKT_TYPE_TX_DROPPED, 531 PKT_TYPE_RX_DROPPED, 532 PKT_TYPE_RX_DELIVERED, 533 PKT_TYPE_RX_REFUSED, 534 PKT_TYPE_TX_HOST_FW_SENT, 535 PKT_TYPE_TX_ACK_CNT, 536 PKT_TYPE_NONE, 537 }; 538 539 /** 540 * ol_txrx_mgmt_tx_cb - tx management delivery notification 541 * callback function 542 */ 543 typedef void 544 (*ol_txrx_mgmt_tx_cb)(void *ctxt, qdf_nbuf_t tx_mgmt_frm, int had_error); 545 546 /** 547 * ol_txrx_data_tx_cb - Function registered with the data path 548 * that is called when tx frames marked as "no free" are 549 * done being transmitted 550 */ 551 typedef void 552 (*ol_txrx_data_tx_cb)(void *ctxt, qdf_nbuf_t tx_frm, int had_error); 553 554 /** 555 * ol_txrx_tx_fp - top-level transmit function 556 * @data_vdev - handle to the virtual device object 557 * @msdu_list - list of network buffers 558 */ 559 typedef qdf_nbuf_t (*ol_txrx_tx_fp)(void *data_vdev, 560 qdf_nbuf_t msdu_list); 561 562 /** 563 * ol_txrx_tx_exc_fp - top-level transmit function on exception path 564 * @data_vdev - handle to the virtual device object 565 * @msdu_list - list of network buffers 566 * @tx_exc_metadata - structure that holds parameters to exception path 567 */ 568 typedef qdf_nbuf_t (*ol_txrx_tx_exc_fp)(void *data_vdev, 569 qdf_nbuf_t msdu_list, 570 struct cdp_tx_exception_metadata 571 *tx_exc_metadata); 572 573 /** 574 * ol_txrx_completion_fp - top-level transmit function 575 * for tx completion 576 * @skb: skb data 577 * @osif_dev: the virtual device's OS shim object 578 */ 579 typedef void (*ol_txrx_completion_fp)(qdf_nbuf_t skb, 580 void *osif_dev); 581 /** 582 * ol_txrx_tx_flow_control_fp - tx flow control notification 583 * function from txrx to OS shim 584 * @osif_dev - the virtual device's OS shim object 585 * @tx_resume - tx os q should be resumed or not 586 */ 587 typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev, 588 bool tx_resume); 589 590 /** 591 * ol_txrx_tx_flow_control_is_pause_fp - is tx paused by flow control 592 * function from txrx to OS shim 593 * @osif_dev - the virtual device's OS shim object 594 * 595 * Return: true if tx is paused by flow control 596 */ 597 typedef bool (*ol_txrx_tx_flow_control_is_pause_fp)(void *osif_dev); 598 599 /** 600 * ol_txrx_rx_fp - receive function to hand batches of data 601 * frames from txrx to OS shim 602 * @data_vdev - handle to the OSIF virtual device object 603 * @msdu_list - list of network buffers 604 */ 605 typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list); 606 607 /** 608 * ol_txrx_stats_rx_fp - receive function to hand batches of data 609 * frames from txrx to OS shim 610 * @skb: skb data 611 * @osif_dev: the virtual device's OS shim object 612 * @action: data packet type 613 * @pkt_type: packet data type 614 */ 615 typedef void (*ol_txrx_stats_rx_fp)(struct sk_buff *skb, 616 void *osif_dev, enum connectivity_stats_pkt_status action, 617 uint8_t *pkt_type); 618 619 /** 620 * ol_txrx_get_key_fp - function to gey key based on keyix and peer 621 * mac address 622 * @osif_dev - the virtual device's OS shim object 623 * @key_buf - pointer to store key 624 * @mac_addr - pointer to mac address 625 * @keyix - key id 626 */ 627 typedef QDF_STATUS(*ol_txrx_get_key_fp)(void *osif_dev, uint8_t *key_buf, uint8_t *mac_addr, uint8_t keyix); 628 629 /** 630 * ol_txrx_rsim_rx_decap_fp - raw mode simulation function to decap the 631 * packets in receive path. 632 * @osif_dev - the virtual device's OS shim object 633 * @list_head - poniter to head of receive packet queue to decap 634 * @list_tail - poniter to tail of receive packet queue to decap 635 * @peer - Peer handler 636 */ 637 typedef QDF_STATUS(*ol_txrx_rsim_rx_decap_fp)(void *osif_dev, 638 qdf_nbuf_t *list_head, 639 qdf_nbuf_t *list_tail, 640 struct cdp_peer *peer); 641 642 /* ol_txrx_rx_fp - external tx free function to read per packet stats and 643 * free tx buffer externally 644 * @netbuf - tx network buffer 645 */ 646 typedef void (*ol_txrx_tx_free_ext_fp)(qdf_nbuf_t netbuf); 647 648 /** 649 * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function 650 */ 651 typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev, 652 qdf_nbuf_t mpdu_head, 653 qdf_nbuf_t mpdu_tail); 654 /** 655 * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single 656 * MPDU (802.11 format) 657 */ 658 typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev, 659 qdf_nbuf_t mpdu, 660 void *rx_status); 661 662 /** 663 * ol_txrx_proxy_arp_fp - proxy arp function pointer 664 */ 665 typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev, 666 qdf_nbuf_t netbuf); 667 668 /* 669 * ol_txrx_mcast_me_fp - function pointer for multicast enhancement 670 */ 671 typedef int (*ol_txrx_mcast_me_fp)(ol_osif_vdev_handle vdev, 672 qdf_nbuf_t netbuf); 673 674 /** 675 * ol_txrx_stats_callback - statistics notify callback 676 */ 677 typedef void (*ol_txrx_stats_callback)(void *ctxt, 678 enum htt_cmn_dbg_stats_type type, 679 uint8_t *buf, int bytes); 680 681 /** 682 * ol_txrx_pktdump_cb - callback for packet dump feature 683 */ 684 typedef void (*ol_txrx_pktdump_cb)(qdf_nbuf_t netbuf, uint8_t status, 685 uint8_t vdev_id, uint8_t type); 686 687 /** 688 * ol_txrx_ops - (pointers to) the functions used for tx and rx 689 * data xfer 690 * 691 * There are two portions of these txrx operations. 692 * The rx portion is filled in by OSIF SW before calling 693 * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register 694 * the txrx SW stores a copy of these rx function pointers, to use 695 * as it delivers rx data frames to the OSIF SW. 696 * The tx portion is filled in by the txrx SW inside 697 * ol_txrx_osif_vdev_register; when the function call returns, 698 * the OSIF SW stores a copy of these tx functions to use as it 699 * delivers tx data frames to the txrx SW. 700 * 701 * @tx.std - the tx function pointer for standard data 702 * frames This function pointer is set by the txrx SW 703 * perform host-side transmit operations based on 704 * whether a HL or LL host/target interface is in use. 705 * @tx.flow_control_cb - the transmit flow control 706 * function that is registered by the 707 * OSIF which is called from txrx to 708 * indicate whether the transmit OS 709 * queues should be paused/resumed 710 * @rx.rx - the OS shim rx function to deliver rx data 711 * frames to. This can have different values for 712 * different virtual devices, e.g. so one virtual 713 * device's OS shim directly hands rx frames to the OS, 714 * but another virtual device's OS shim filters out P2P 715 * messages before sending the rx frames to the OS. The 716 * netbufs delivered to the osif_rx function are in the 717 * format specified by the OS to use for tx and rx 718 * frames (either 802.3 or native WiFi). In case RX Threads are enabled, pkts 719 * are given to the thread, instead of the stack via this pointer. 720 * @rx.stack - function to give packets to the stack. Differs from @rx.rx. 721 * In case RX Threads are enabled, this pointer holds the callback to give 722 * packets to the stack. 723 * @rx.wai_check - the tx function pointer for WAPI frames 724 * @rx.mon - the OS shim rx monitor function to deliver 725 * monitor data to Though in practice, it is probable 726 * that the same function will be used for delivering 727 * rx monitor data for all virtual devices, in theory 728 * each different virtual device can have a different 729 * OS shim function for accepting rx monitor data. The 730 * netbufs delivered to the osif_rx_mon function are in 731 * 802.11 format. Each netbuf holds a 802.11 MPDU, not 732 * an 802.11 MSDU. Depending on compile-time 733 * configuration, each netbuf may also have a 734 * monitor-mode encapsulation header such as a radiotap 735 * header added before the MPDU contents. 736 * @rx.std - the OS shim rx function to deliver rx data 737 * @proxy_arp - proxy arp function pointer - specified by 738 * OS shim, stored by txrx 739 * @get_key - function pointer to get key of the peer with 740 * specific key index 741 */ 742 struct ol_txrx_ops { 743 /* tx function pointers - specified by txrx, stored by OS shim */ 744 struct { 745 ol_txrx_tx_fp tx; 746 ol_txrx_tx_exc_fp tx_exception; 747 ol_txrx_tx_free_ext_fp tx_free_ext; 748 ol_txrx_completion_fp tx_comp; 749 } tx; 750 751 /* rx function pointers - specified by OS shim, stored by txrx */ 752 struct { 753 ol_txrx_rx_fp rx; 754 ol_txrx_rx_fp rx_stack; 755 ol_txrx_rx_check_wai_fp wai_check; 756 ol_txrx_rx_mon_fp mon; 757 ol_txrx_stats_rx_fp stats_rx; 758 ol_txrx_rsim_rx_decap_fp rsim_rx_decap; 759 } rx; 760 /* proxy arp function pointer - specified by OS shim, stored by txrx */ 761 ol_txrx_proxy_arp_fp proxy_arp; 762 ol_txrx_mcast_me_fp me_convert; 763 764 ol_txrx_get_key_fp get_key; 765 }; 766 767 /** 768 * ol_txrx_stats_req - specifications of the requested 769 * statistics 770 */ 771 struct ol_txrx_stats_req { 772 uint32_t stats_type_upload_mask; /* which stats to upload */ 773 uint32_t stats_type_reset_mask; /* which stats to reset */ 774 775 /* stats will be printed if either print element is set */ 776 struct { 777 int verbose; /* verbose stats printout */ 778 int concise; /* concise stats printout (takes precedence) */ 779 } print; /* print uploaded stats */ 780 781 /* stats notify callback will be invoked if fp is non-NULL */ 782 struct { 783 ol_txrx_stats_callback fp; 784 void *ctxt; 785 } callback; 786 787 /* stats will be copied into the specified buffer if buf is non-NULL */ 788 struct { 789 uint8_t *buf; 790 int byte_limit; /* don't copy more than this */ 791 } copy; 792 793 /* 794 * If blocking is true, the caller will take the specified semaphore 795 * to wait for the stats to be uploaded, and the driver will release 796 * the semaphore when the stats are done being uploaded. 797 */ 798 struct { 799 int blocking; 800 /*Note: this needs to change to some qdf_* type */ 801 qdf_semaphore_t *sem_ptr; 802 } wait; 803 }; 804 805 806 /* DP soc struct definition */ 807 struct cdp_soc_t { 808 struct cdp_ops *ops; 809 struct ol_if_ops *ol_ops; 810 }; 811 812 /* 813 * cdp_pdev_param_type: different types of parameters 814 * to set values in pdev 815 * @CDP_CONFIG_DEBUG_SNIFFER: Enable debug sniffer feature 816 * @CDP_CONFIG_BPR_ENABLE: Enable bcast probe feature 817 * @CDP_CONFIG_PRIMARY_RADIO: Configure radio as primary 818 * @CDP_CONFIG_ENABLE_PERPKT_TXSTATS: Enable per packet statistics 819 * @CDP_CONFIG_IGMPMLD_OVERRIDE: Override IGMP/MLD 820 * @CDP_CONFIG_IGMPMLD_TID: Configurable TID value when igmmld_override is set 821 * @CDP_CONFIG_ARP_DBG_CONF: Enable ARP debug 822 */ 823 enum cdp_pdev_param_type { 824 CDP_CONFIG_DEBUG_SNIFFER, 825 CDP_CONFIG_BPR_ENABLE, 826 CDP_CONFIG_PRIMARY_RADIO, 827 CDP_CONFIG_ENABLE_PERPKT_TXSTATS, 828 CDP_CONFIG_IGMPMLD_OVERRIDE, 829 CDP_CONFIG_IGMPMLD_TID, 830 CDP_CONFIG_ARP_DBG_CONF, 831 }; 832 833 /* 834 * enum cdp_pdev_bpr_param - different types of parameters 835 * to set value in pdev 836 * @CDP_BPR_DISABLE: Set bpr to disable state 837 * @CDP_BPR_ENABLE: set bpr to enable state 838 * 839 * Enum indicating bpr state to enable/disable. 840 */ 841 enum cdp_pdev_bpr_param { 842 CDP_BPR_DISABLE, 843 CDP_BPR_ENABLE, 844 }; 845 846 /* 847 * cdp_vdev_param_type: different types of parameters 848 * to set values in vdev 849 * @CDP_ENABLE_NAWDS: set nawds enable/disable 850 * @CDP_ENABLE_MCAST_EN: enable/disable multicast enhancement 851 * @CDP_ENABLE_WDS: wds sta 852 * @CDP_ENABLE_MEC: MEC enable flags 853 * @CDP_ENABLE_PROXYSTA: proxy sta 854 * @CDP_UPDATE_TDLS_FLAGS: tdls link flags 855 * @CDP_ENABLE_AP_BRIDGE: set ap_bridging enable/disable 856 * @CDP_ENABLE_CIPHER : set cipher type based on security 857 * @CDP_ENABLE_QWRAP_ISOLATION: qwrap isolation mode 858 */ 859 enum cdp_vdev_param_type { 860 CDP_ENABLE_NAWDS, 861 CDP_ENABLE_MCAST_EN, 862 CDP_ENABLE_WDS, 863 CDP_ENABLE_MEC, 864 CDP_ENABLE_DA_WAR, 865 CDP_ENABLE_PROXYSTA, 866 CDP_UPDATE_TDLS_FLAGS, 867 CDP_CFG_WDS_AGING_TIMER, 868 CDP_ENABLE_AP_BRIDGE, 869 CDP_ENABLE_CIPHER, 870 CDP_ENABLE_QWRAP_ISOLATION 871 }; 872 873 #define TXRX_FW_STATS_TXSTATS 1 874 #define TXRX_FW_STATS_RXSTATS 2 875 #define TXRX_FW_STATS_RX_RATE_INFO 3 876 #define TXRX_FW_STATS_PHYSTATS 4 877 #define TXRX_FW_STATS_PHYSTATS_CONCISE 5 878 #define TXRX_FW_STATS_TX_RATE_INFO 6 879 #define TXRX_FW_STATS_TID_STATE 7 880 #define TXRX_FW_STATS_HOST_STATS 8 881 #define TXRX_FW_STATS_CLEAR_HOST_STATS 9 882 #define TXRX_FW_STATS_CE_STATS 10 883 #define TXRX_FW_STATS_VOW_UMAC_COUNTER 11 884 #define TXRX_FW_STATS_ME_STATS 12 885 #define TXRX_FW_STATS_TXBF_INFO 13 886 #define TXRX_FW_STATS_SND_INFO 14 887 #define TXRX_FW_STATS_ERROR_INFO 15 888 #define TXRX_FW_STATS_TX_SELFGEN_INFO 16 889 #define TXRX_FW_STATS_TX_MU_INFO 17 890 #define TXRX_FW_SIFS_RESP_INFO 18 891 #define TXRX_FW_RESET_STATS 19 892 #define TXRX_FW_MAC_WDOG_STATS 20 893 #define TXRX_FW_MAC_DESC_STATS 21 894 #define TXRX_FW_MAC_FETCH_MGR_STATS 22 895 #define TXRX_FW_MAC_PREFETCH_MGR_STATS 23 896 #define TXRX_FW_STATS_DURATION_INFO 24 897 #define TXRX_FW_STATS_DURATION_INFO_RESET 25 898 #define TXRX_FW_HALPHY_STATS 26 899 #define TXRX_FW_COEX_STATS 27 900 901 #define PER_RADIO_FW_STATS_REQUEST 0 902 #define PER_VDEV_FW_STATS_REQUEST 1 903 /** 904 * enum data_stall_log_event_indicator - Module triggering data stall 905 * @DATA_STALL_LOG_INDICATOR_UNUSED: Unused 906 * @DATA_STALL_LOG_INDICATOR_HOST_DRIVER: Host driver indicates data stall 907 * @DATA_STALL_LOG_INDICATOR_FIRMWARE: FW indicates data stall 908 * @DATA_STALL_LOG_INDICATOR_FRAMEWORK: Framework indicates data stall 909 * 910 * Enum indicating the module that indicates data stall event 911 */ 912 enum data_stall_log_event_indicator { 913 DATA_STALL_LOG_INDICATOR_UNUSED, 914 DATA_STALL_LOG_INDICATOR_HOST_DRIVER, 915 DATA_STALL_LOG_INDICATOR_FIRMWARE, 916 DATA_STALL_LOG_INDICATOR_FRAMEWORK, 917 }; 918 919 /** 920 * enum data_stall_log_event_type - data stall event type 921 * @DATA_STALL_LOG_NONE 922 * @DATA_STALL_LOG_FW_VDEV_PAUSE 923 * @DATA_STALL_LOG_HWSCHED_CMD_FILTER 924 * @DATA_STALL_LOG_HWSCHED_CMD_FLUSH 925 * @DATA_STALL_LOG_FW_RX_REFILL_FAILED 926 * @DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR 927 * @DATA_STALL_LOG_FW_WDOG_ERRORS 928 * @DATA_STALL_LOG_BB_WDOG_ERROR 929 * @DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR 930 * @DATA_STALL_LOG_HOST_STA_TX_TIMEOUT 931 * @DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT 932 * @DATA_STALL_LOG_NUD_FAILURE 933 * 934 * Enum indicating data stall event type 935 */ 936 enum data_stall_log_event_type { 937 DATA_STALL_LOG_NONE, 938 DATA_STALL_LOG_FW_VDEV_PAUSE, 939 DATA_STALL_LOG_HWSCHED_CMD_FILTER, 940 DATA_STALL_LOG_HWSCHED_CMD_FLUSH, 941 DATA_STALL_LOG_FW_RX_REFILL_FAILED, 942 DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR, 943 DATA_STALL_LOG_FW_WDOG_ERRORS, 944 DATA_STALL_LOG_BB_WDOG_ERROR, 945 DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR, 946 /* Stall events triggered by host/framework start from 0x100 onwards. */ 947 DATA_STALL_LOG_HOST_STA_TX_TIMEOUT = 0x100, 948 DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT, 949 DATA_STALL_LOG_NUD_FAILURE, 950 }; 951 952 /** 953 * enum data_stall_log_recovery_type - data stall recovery type 954 * @DATA_STALL_LOG_RECOVERY_NONE, 955 * @DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT, 956 * @DATA_STALL_LOG_RECOVERY_TRIGGER_PDR 957 * 958 * Enum indicating data stall recovery type 959 */ 960 enum data_stall_log_recovery_type { 961 DATA_STALL_LOG_RECOVERY_NONE = 0, 962 DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT, 963 DATA_STALL_LOG_RECOVERY_TRIGGER_PDR, 964 }; 965 966 /** 967 * struct data_stall_event_info - data stall info 968 * @indicator: Module triggering data stall 969 * @data_stall_type: data stall event type 970 * @vdev_id_bitmap: vdev_id_bitmap 971 * @pdev_id: pdev id 972 * @recovery_type: data stall recovery type 973 */ 974 struct data_stall_event_info { 975 uint32_t indicator; 976 uint32_t data_stall_type; 977 uint32_t vdev_id_bitmap; 978 uint32_t pdev_id; 979 uint32_t recovery_type; 980 }; 981 982 typedef void (*data_stall_detect_cb)(struct data_stall_event_info *); 983 984 /* 985 * enum cdp_stats - options for host and firmware 986 * statistics 987 * @CDP_TXRX_STATS_1: HTT Pdev tx stats 988 * @CDP_TXRX_STATS_2: HTT Pdev rx stats 989 * @CDP_TXRX_STATS_3: HTT Pdev Tx HW Queue stats 990 * @CDP_TXRX_STATS_4: HTT Pdev Tx HW Sched stats 991 * @CDP_TXRX_STATS_5: HTT Pdev error stats 992 * @CDP_TXRX_STATS_6: HTT TQM stats 993 * @CDP_TXRX_STATS_7: HTT TQM CMDQ stats 994 * @CDP_TXRX_STATS_8: HTT Tx_de_cmn thread stats 995 * @CDP_TXRX_STATS_9: HTT Pdev Tx rate stats 996 * @CDP_TXRX_STATS_10: HTT Pdev Rx rate stats 997 * @CDP_TXRX_STATS_11: HTT Peer stats 998 * @CDP_TXRX_STATS_12: HTT Tx Self Gen Info 999 * @CDP_TXRX_STATS_13: HTT Tx MU HWQ stats 1000 * @CDP_TXRX_STATS_14: HTT Ring interface info stats 1001 * @CDP_TXRX_STATS_15: HTT SRNG info stats 1002 * @CDP_TXRX_STATS_16: HTT SFM info stats 1003 * @CDP_TXRX_STATS_17: HTT Pdev tx mu mimo sched info 1004 * @CDP_TXRX_STATS_18: HTT Peer list details 1005 * @CDP_TXRX_STATS_19: Reserved 1006 * @CDP_TXRX_STATS_20: Reset Host stats 1007 * @CDP_TXRX_STATS_21: Host Rx rate stats 1008 * @CDP_TXRX_STATS_22: Host Tx rate stats 1009 * @CDP_TXRX_STATS_23: Host Tx stats 1010 * @CDP_TXRX_STATS_24: Host Rx stats 1011 * @CDP_TXRX_STATS_25: Host Ast stats 1012 * @CDP_TXRX_STATS_26: Host Head/Tail Pointer stats 1013 * @CDP_TXRX_STATS_27: Host Monitor mode stats 1014 * @CDP_TXRX_STATS_28: Host Peer entry stats 1015 * @CDP_TXRX_STATS_29: Host Soc config params info 1016 * @CDP_TXRX_STATS_30: Host Pdev config params info 1017 */ 1018 enum cdp_stats { 1019 CDP_TXRX_STATS_0 = 0, 1020 CDP_TXRX_STATS_1, 1021 CDP_TXRX_STATS_2, 1022 CDP_TXRX_STATS_3, 1023 CDP_TXRX_STATS_4, 1024 CDP_TXRX_STATS_5, 1025 CDP_TXRX_STATS_6, 1026 CDP_TXRX_STATS_7, 1027 CDP_TXRX_STATS_8, 1028 CDP_TXRX_STATS_9, 1029 CDP_TXRX_STATS_10, 1030 CDP_TXRX_STATS_11, 1031 CDP_TXRX_STATS_12, 1032 CDP_TXRX_STATS_13, 1033 CDP_TXRX_STATS_14, 1034 CDP_TXRX_STATS_15, 1035 CDP_TXRX_STATS_16, 1036 CDP_TXRX_STATS_17, 1037 CDP_TXRX_STATS_18, 1038 CDP_TXRX_STATS_19, 1039 CDP_TXRX_STATS_20, 1040 CDP_TXRX_STATS_21, 1041 CDP_TXRX_STATS_22, 1042 CDP_TXRX_STATS_23, 1043 CDP_TXRX_STATS_24, 1044 CDP_TXRX_STATS_25, 1045 CDP_TXRX_STATS_26, 1046 CDP_TXRX_STATS_27, 1047 CDP_TXRX_STATS_28, 1048 CDP_TXRX_STATS_29, 1049 CDP_TXRX_STATS_30, 1050 CDP_TXRX_STATS_HTT_MAX = 256, 1051 CDP_TXRX_MAX_STATS = 265, 1052 }; 1053 1054 /* 1055 * Different Stat update types sent to OL_IF 1056 * @UPDATE_PEER_STATS: update peer stats 1057 * @UPDATE_VDEV_STATS: update vdev stats 1058 * @UPDATE_PDE_STATS: Update pdev stats 1059 */ 1060 enum cdp_stat_update_type { 1061 UPDATE_PEER_STATS = 0, 1062 UPDATE_VDEV_STATS = 1, 1063 UPDATE_PDEV_STATS = 2, 1064 }; 1065 1066 /* 1067 * struct cdp_tx_sojourn_stats - Tx sojourn stats 1068 * @ppdu_seq_id: ppdu_seq_id from tx completion 1069 * @avg_sojourn_msdu: average sojourn msdu time 1070 * @sum_sojourn_msdu: sum sojourn msdu time 1071 * @num_msdu: number of msdus per ppdu 1072 * @cookie: cookie to be used by upper layer 1073 */ 1074 struct cdp_tx_sojourn_stats { 1075 uint32_t ppdu_seq_id; 1076 qdf_ewma_tx_lag avg_sojourn_msdu[CDP_DATA_TID_MAX]; 1077 uint32_t sum_sojourn_msdu[CDP_DATA_TID_MAX]; 1078 uint32_t num_msdus[CDP_DATA_TID_MAX]; 1079 struct cdp_stats_cookie *cookie; 1080 }; 1081 1082 /** 1083 * struct cdp_tx_completion_ppdu_user - Tx PPDU completion per-user information 1084 * @completion_status: completion status - OK/Filter/Abort/Timeout 1085 * @tid: TID number 1086 * @peer_id: Peer ID 1087 * @frame_ctrl: frame control field in 802.11 header 1088 * @qos_ctrl: QoS control field in 802.11 header 1089 * @mpdu_tried: number of mpdus tried 1090 * @mpdu_success: number of mpdus successfully transmitted 1091 * @long_retries: long retries 1092 * @short_retries: short retries 1093 * @is_ampdu: mpdu aggregate or non-aggregate? 1094 * @success_bytes: bytes successfully transmitted 1095 * @retry_bytes: bytes retried 1096 * @failed_msdus: MSDUs failed transmission 1097 * @duration: user duration in ppdu 1098 * @ltf_size: ltf_size 1099 * @stbc: stbc 1100 * @he_re: he_re (range extension) 1101 * @txbf: txbf 1102 * @bw: Transmission bandwidth 1103 * <enum 2 transmit_bw_20_MHz> 1104 * <enum 3 transmit_bw_40_MHz> 1105 * <enum 4 transmit_bw_80_MHz> 1106 * <enum 5 transmit_bw_160_MHz> 1107 * @nss: NSS 1,2, ...8 1108 * @mcs: MCS index 1109 * @preamble: preamble 1110 * @gi: guard interval 800/400/1600/3200 ns 1111 * @dcm: dcm 1112 * @ldpc: ldpc 1113 * @delayed_ba: delayed ba bit 1114 * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/ 1115 * UL_BSR_TRIG/UNKNOWN 1116 * @ba_seq_no: Block Ack sequence number 1117 * @ba_bitmap: Block Ack bitmap 1118 * @start_seqa: Sequence number of first MPDU 1119 * @enq_bitmap: Enqueue MPDU bitmap 1120 * @ru_start: RU start index 1121 * @ru_tones: RU tones length 1122 * @is_mcast: MCAST or UCAST 1123 * @tx_rate: Transmission Rate 1124 * @user_pos: user position 1125 * @mu_group_id: mu group id 1126 * @rix: rate index 1127 * @cookie: cookie to used by upper layer 1128 */ 1129 struct cdp_tx_completion_ppdu_user { 1130 uint32_t completion_status:8, 1131 tid:8, 1132 peer_id:16; 1133 uint8_t mac_addr[6]; 1134 uint32_t frame_ctrl:16, 1135 qos_ctrl:16; 1136 uint32_t mpdu_tried_ucast:16, 1137 mpdu_tried_mcast:16; 1138 uint16_t mpdu_success:16; 1139 uint16_t mpdu_failed:16; 1140 uint32_t long_retries:4, 1141 short_retries:4, 1142 tx_ratecode:8, 1143 is_ampdu:1, 1144 ppdu_type:5; 1145 uint32_t success_bytes; 1146 uint32_t retry_bytes; 1147 uint32_t failed_bytes; 1148 uint32_t success_msdus:16, 1149 retry_msdus:16; 1150 uint32_t failed_msdus:16, 1151 duration:16; 1152 uint32_t ltf_size:2, 1153 stbc:1, 1154 he_re:1, 1155 txbf:4, 1156 bw:4, 1157 nss:4, 1158 mcs:4, 1159 preamble:4, 1160 gi:4, 1161 dcm:1, 1162 ldpc:1, 1163 delayed_ba:1; 1164 uint32_t ba_seq_no; 1165 uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS]; 1166 uint32_t start_seq; 1167 uint32_t enq_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS]; 1168 uint32_t failed_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS]; 1169 uint32_t num_mpdu:9, 1170 num_msdu:16; 1171 uint32_t tx_duration; 1172 uint16_t ru_start; 1173 uint16_t ru_tones; 1174 bool is_mcast; 1175 uint32_t tx_rate; 1176 uint32_t tx_ratekbps; 1177 /*ack rssi for separate chains*/ 1178 uint32_t ack_rssi[CDP_RSSI_CHAIN_LEN]; 1179 bool ack_rssi_valid; 1180 uint32_t user_pos; 1181 uint32_t mu_group_id; 1182 uint32_t rix; 1183 struct cdp_stats_cookie *cookie; 1184 }; 1185 1186 /** 1187 * struct cdp_tx_completion_ppdu - Tx PPDU completion information 1188 * @completion_status: completion status - OK/Filter/Abort/Timeout 1189 * @ppdu_id: PPDU Id 1190 * @ppdu_seq_id: ppdu sequence id for sojourn stats 1191 * @vdev_id: VAP Id 1192 * @num_users: Number of users 1193 * @num_mpdu: Number of MPDUs in PPDU 1194 * @num_msdu: Number of MSDUs in PPDU 1195 * @frame_type: frame SU or MU 1196 * @frame_ctrl: frame control of 80211 header 1197 * @channel: Channel informartion 1198 * @ack_rssi: RSSI value of last ack packet (units=dB above noise floor) 1199 * @tx_duration: PPDU airtime 1200 * @ppdu_start_timestamp: TSF at PPDU start 1201 * @ppdu_end_timestamp: TSF at PPDU end 1202 * @ack_timestamp: TSF at the reception of ACK 1203 * @user: per-User stats (array of per-user structures) 1204 */ 1205 struct cdp_tx_completion_ppdu { 1206 uint32_t ppdu_id; 1207 uint32_t ppdu_seq_id; 1208 uint16_t vdev_id; 1209 uint32_t num_users; 1210 uint32_t num_mpdu:9, 1211 num_msdu:16; 1212 uint16_t frame_type; 1213 uint16_t frame_ctrl; 1214 uint16_t channel; 1215 uint16_t phy_mode; 1216 uint32_t ack_rssi; 1217 uint32_t tx_duration; 1218 uint32_t ppdu_start_timestamp; 1219 uint32_t ppdu_end_timestamp; 1220 uint32_t ack_timestamp; 1221 struct cdp_tx_completion_ppdu_user user[CDP_MU_MAX_USERS]; 1222 }; 1223 1224 /** 1225 * struct cdp_dev_stats - Network device stats structure 1226 * @tx_packets: Tx total packets transmitted 1227 * @tx_bytes : Tx total bytes transmitted 1228 * @tx_errors : Tx error due to FW tx failure, Ring failure DMA etc 1229 * @tx_dropped: Tx dropped is same as tx errors as above 1230 * @rx_packets: Rx total packets transmitted 1231 * @rx_bytes : Rx total bytes transmitted 1232 */ 1233 struct cdp_dev_stats { 1234 uint32_t tx_packets; 1235 uint32_t tx_bytes; 1236 uint32_t tx_errors; 1237 uint32_t tx_dropped; 1238 uint32_t rx_packets; 1239 uint32_t rx_bytes; 1240 }; 1241 1242 /** 1243 * struct cdp_rate_stats - Tx/Rx Rate statistics 1244 * @bw: Indicates the BW of the upcoming transmission - 1245 * <enum 2 transmit_bw_20_MHz> 1246 * <enum 3 transmit_bw_40_MHz> 1247 * <enum 4 transmit_bw_80_MHz> 1248 * <enum 5 transmit_bw_160_MHz> 1249 * @pkt_type: Transmit Packet Type 1250 * @stbc: When set, STBC transmission rate was used 1251 * @ldpc: When set, use LDPC transmission rates 1252 * @sgi: <enum 0 0_8_us_sgi > Legacy normal GI 1253 * <enum 1 0_4_us_sgi > Legacy short GI 1254 * <enum 2 1_6_us_sgi > HE related GI 1255 * <enum 3 3_2_us_sgi > HE 1256 * @mcs: Transmit MCS Rate 1257 * @ofdma: Set when the transmission was an OFDMA transmission 1258 * @tones_in_ru: The number of tones in the RU used. 1259 * @tsf: Lower 32 bits of the TSF (timestamp when ppdu transmission finished) 1260 * @peer_id: Peer ID of the flow or MPDU queue 1261 * @tid: TID of the flow or MPDU queue 1262 */ 1263 struct cdp_rate_stats { 1264 uint32_t rate_stats_info_valid:1, 1265 bw:2, 1266 pkt_type:4, 1267 stbc:1, 1268 ldpc:1, 1269 sgi:2, 1270 mcs:4, 1271 ofdma:1, 1272 tones_in_ru:12, 1273 resvd0:4; 1274 uint32_t tsf; 1275 uint16_t peer_id; 1276 uint8_t tid; 1277 }; 1278 1279 /** 1280 * struct cdp_tx_completion_msdu - Tx MSDU completion descriptor 1281 * @ppdu_id: PPDU to which this MSDU belongs 1282 * @transmit_cnt: Number of times this frame has been transmitted 1283 * @ack_frame_rssi: RSSI of the received ACK or BA frame 1284 * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU 1285 * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU 1286 * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU 1287 * @extd: Extended structure containing rate statistics 1288 */ 1289 struct cdp_tx_completion_msdu { 1290 uint32_t ppdu_id; 1291 uint8_t transmit_cnt; 1292 uint32_t ack_frame_rssi:8, 1293 resvd0:1, 1294 first_msdu:1, 1295 last_msdu:1, 1296 msdu_part_of_amsdu:1, 1297 resvd1:20; 1298 struct cdp_rate_stats extd; 1299 }; 1300 1301 /** 1302 * struct cdp_rx_indication_ppdu - Rx PPDU indication structure 1303 * @ppdu_id: PPDU Id 1304 * @is_ampdu: mpdu aggregate or non-aggregate? 1305 * @num_mpdu: Number of MPDUs in PPDU 1306 * @reserved: Reserved bits for future use 1307 * @num_msdu: Number of MSDUs in PPDU 1308 * @udp_msdu_count: Number of UDP MSDUs in PPDU 1309 * @tcp_msdu_count: Number of TCP MSDUs in PPDU 1310 * @other_msdu_count: Number of MSDUs other than UDP and TCP MSDUs in PPDU 1311 * @duration: PPDU duration 1312 * @tid: TID number 1313 * @peer_id: Peer ID 1314 * @vdev_id: VAP ID 1315 * @mac_addr: Peer MAC Address 1316 * @first_data_seq_ctrl: Sequence control field of first data frame 1317 * @ltf_size: ltf_size 1318 * @stbc: When set, STBC rate was used 1319 * @he_re: he_re (range extension) 1320 * @bw: Bandwidth 1321 * <enum 0 bw_20_MHz> 1322 * <enum 1 bw_40_MHz> 1323 * <enum 2 bw_80_MHz> 1324 * <enum 3 bw_160_MHz> 1325 * @nss: NSS 1,2, ...8 1326 * @mcs: MCS index 1327 * @preamble: preamble 1328 * @gi: <enum 0 0_8_us_sgi > Legacy normal GI 1329 * <enum 1 0_4_us_sgi > Legacy short GI 1330 * <enum 2 1_6_us_sgi > HE related GI 1331 * <enum 3 3_2_us_sgi > HE 1332 * @dcm: dcm 1333 * @ldpc: ldpc 1334 * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/ 1335 * UL_BSR_TRIG/UNKNOWN 1336 * @rssi: RSSI value (units = dB above noise floor) 1337 * @timestamp: TSF at the reception of PPDU 1338 * @length: PPDU length 1339 * @channel: Channel informartion 1340 * @lsig_A: L-SIG in 802.11 PHY header 1341 * @frame_ctrl: frame control field 1342 * @rix: rate index 1343 * @rssi_chain: rssi chain per nss per bw 1344 * @cookie: cookie to used by upper layer 1345 */ 1346 struct cdp_rx_indication_ppdu { 1347 uint32_t ppdu_id; 1348 uint16_t is_ampdu:1, 1349 num_mpdu:9, 1350 reserved:6; 1351 uint32_t num_msdu; 1352 uint32_t num_bytes; 1353 uint16_t udp_msdu_count; 1354 uint16_t tcp_msdu_count; 1355 uint16_t other_msdu_count; 1356 uint16_t duration; 1357 uint32_t tid:8, 1358 peer_id:16; 1359 uint8_t vdev_id; 1360 uint8_t mac_addr[6]; 1361 uint16_t first_data_seq_ctrl; 1362 union { 1363 uint32_t rate_info; 1364 struct { 1365 uint32_t ltf_size:2, 1366 stbc:1, 1367 he_re:1, 1368 bw:4, 1369 nss:4, 1370 mcs:4, 1371 preamble:4, 1372 gi:4, 1373 dcm:1, 1374 ldpc:1, 1375 ppdu_type:5; 1376 }; 1377 } u; 1378 uint32_t rix; 1379 uint32_t lsig_a; 1380 uint32_t rssi; 1381 uint64_t timestamp; 1382 uint32_t length; 1383 uint8_t channel; 1384 uint8_t beamformed; 1385 1386 uint32_t rx_ratekbps; 1387 uint32_t ppdu_rx_rate; 1388 1389 uint32_t retries; 1390 uint32_t rx_byte_count; 1391 uint8_t rx_ratecode; 1392 uint8_t fcs_error_mpdus; 1393 uint16_t frame_ctrl; 1394 uint32_t rssi_chain[SS_COUNT][MAX_BW]; 1395 struct cdp_stats_cookie *cookie; 1396 }; 1397 1398 /** 1399 * struct cdp_rx_indication_msdu - Rx MSDU info 1400 * @ppdu_id: PPDU to which the MSDU belongs 1401 * @msdu_len: Length of MSDU in bytes 1402 * @ack_frame_rssi: RSSI of the received ACK or BA frame 1403 * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU 1404 * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU 1405 * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU 1406 * @extd: Extended structure containing rate statistics 1407 */ 1408 struct cdp_rx_indication_msdu { 1409 uint32_t ppdu_id; 1410 uint16_t msdu_len; 1411 uint32_t ack_frame_rssi:8, 1412 resvd0:1, 1413 first_msdu:1, 1414 last_msdu:1, 1415 msdu_part_of_amsdu:1, 1416 msdu_part_of_ampdu:1, 1417 resvd1:19; 1418 struct cdp_rate_stats extd; 1419 }; 1420 1421 /** 1422 * struct cdp_config_params - Propagate configuration parameters to datapath 1423 * @tso_enable: Enable/Disable TSO 1424 * @lro_enable: Enable/Disable LRO 1425 * @gro_enable: Enable/Disable GRO 1426 * @flow_steering_enable: Enable/Disable Rx Hash based flow steering 1427 * @tcp_Udp_ChecksumOffload: Enable/Disable tcp-Udp checksum Offload 1428 * @napi_enable: Enable/Disable Napi 1429 * @ipa_enable: Flag indicating if IPA is enabled or not 1430 * @tx_flow_stop_queue_threshold: Value to Pause tx queues 1431 * @tx_flow_start_queue_offset: Available Tx descriptors to unpause 1432 * tx queue 1433 */ 1434 struct cdp_config_params { 1435 unsigned int tso_enable:1; 1436 unsigned int lro_enable:1; 1437 unsigned int gro_enable:1; 1438 unsigned int flow_steering_enable:1; 1439 unsigned int tcp_udp_checksumoffload:1; 1440 unsigned int napi_enable:1; 1441 unsigned int ipa_enable:1; 1442 /* Set when QCA_LL_TX_FLOW_CONTROL_V2 is enabled */ 1443 uint8_t tx_flow_stop_queue_threshold; 1444 uint8_t tx_flow_start_queue_offset; 1445 1446 }; 1447 1448 /** 1449 * cdp_txrx_stats_req: stats request wrapper 1450 * used to pass request information to cdp layer 1451 * @stats: type of stats requested 1452 * @param0: opaque argument 0 to be passed to htt 1453 * @param1: opaque argument 1 to be passed to htt 1454 * @param2: opaque argument 2 to be passed to htt 1455 * @param3: opaque argument 3 to be passed to htt 1456 * @mac id: mac_id 1457 */ 1458 struct cdp_txrx_stats_req { 1459 enum cdp_stats stats; 1460 uint32_t param0; 1461 uint32_t param1; 1462 uint32_t param2; 1463 uint32_t param3; 1464 uint32_t cookie_val; 1465 uint8_t mac_id; 1466 char *peer_addr; 1467 }; 1468 1469 /** 1470 * struct cdp_monitor_filter - monitor filter info 1471 * @mode: set filter mode 1472 * @fp_mgmt: set Filter Pass MGMT Configuration 1473 * @fp_ctrl: set Filter Pass CTRL Configuration 1474 * @fp_data: set Filter Pass DATA Configuration 1475 * @mo_mgmt: set Monitor Other MGMT Configuration 1476 * @mo_ctrl: set Monitor Other CTRL Configuration 1477 * @mo_data: set Monitor other DATA Configuration 1478 * 1479 */ 1480 struct cdp_monitor_filter { 1481 uint16_t mode; 1482 uint16_t fp_mgmt; 1483 uint16_t fp_ctrl; 1484 uint16_t fp_data; 1485 uint16_t mo_mgmt; 1486 uint16_t mo_ctrl; 1487 uint16_t mo_data; 1488 }; 1489 1490 /** 1491 * cdp_dp_cfg - dp ini config enum 1492 */ 1493 enum cdp_dp_cfg { 1494 cfg_dp_enable_data_stall, 1495 cfg_dp_enable_ip_tcp_udp_checksum_offload, 1496 cfg_dp_tso_enable, 1497 cfg_dp_lro_enable, 1498 cfg_dp_gro_enable, 1499 cfg_dp_tx_flow_start_queue_offset, 1500 cfg_dp_tx_flow_stop_queue_threshold, 1501 cfg_dp_ipa_uc_tx_buf_size, 1502 cfg_dp_ipa_uc_tx_partition_base, 1503 cfg_dp_ipa_uc_rx_ind_ring_count, 1504 cfg_dp_enable_flow_steering, 1505 cfg_dp_reorder_offload_supported, 1506 cfg_dp_ce_classify_enable, 1507 cfg_dp_disable_intra_bss_fwd, 1508 }; 1509 1510 /** 1511 * struct cdp_peer_cookie - cookie used when creating peer 1512 * @peer_id: peer id 1513 * @mac_addr: MAC address of peer 1514 * @cookie: cookie to be used by consumer 1515 * @ctx: context passed to be used by consumer 1516 */ 1517 struct cdp_peer_cookie { 1518 uint8_t peer_id; 1519 uint8_t mac_addr[CDP_MAC_ADDR_LEN]; 1520 uint8_t cookie; 1521 struct cdp_stats_cookie *ctx; 1522 }; 1523 #endif 1524