1 /* 2 * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: qdf_nbuf_public network buffer API 22 * This file defines the network buffer abstraction. 23 */ 24 25 #ifndef _QDF_NBUF_H 26 #define _QDF_NBUF_H 27 28 #include <qdf_util.h> 29 #include <qdf_types.h> 30 #include <qdf_lock.h> 31 #include <i_qdf_trace.h> 32 #include <i_qdf_nbuf.h> 33 #include <qdf_net_types.h> 34 35 #define IPA_NBUF_OWNER_ID 0xaa55aa55 36 #define QDF_NBUF_PKT_TRAC_TYPE_DNS 0x01 37 #define QDF_NBUF_PKT_TRAC_TYPE_EAPOL 0x02 38 #define QDF_NBUF_PKT_TRAC_TYPE_DHCP 0x04 39 #define QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION 0x08 40 #define QDF_NBUF_PKT_TRAC_TYPE_ARP 0x10 41 #define QDF_NBUF_PKT_TRAC_TYPE_ICMP 0x20 42 #define QDF_NBUF_PKT_TRAC_TYPE_ICMPv6 0x40 43 #define QDF_HL_CREDIT_TRACKING 0x80 44 45 #define QDF_NBUF_PKT_TRAC_MAX_STRING 12 46 #define QDF_NBUF_PKT_TRAC_PROTO_STRING 4 47 #define QDF_NBUF_PKT_ERROR 1 48 49 #define QDF_NBUF_TRAC_IPV4_OFFSET 14 50 #define QDF_NBUF_TRAC_IPV4_HEADER_MASK 0xF 51 #define QDF_NBUF_TRAC_IPV4_HEADER_SIZE 20 52 #define QDF_NBUF_TRAC_DHCP_SRV_PORT 67 53 #define QDF_NBUF_TRAC_DHCP_CLI_PORT 68 54 #define QDF_NBUF_TRAC_ETH_TYPE_OFFSET 12 55 #define QDF_NBUF_TRAC_VLAN_ETH_TYPE_OFFSET 16 56 #define QDF_NBUF_TRAC_DOUBLE_VLAN_ETH_TYPE_OFFSET 20 57 #define QDF_NBUF_TRAC_EAPOL_ETH_TYPE 0x888E 58 #define QDF_NBUF_TRAC_WAPI_ETH_TYPE 0x88b4 59 #define QDF_NBUF_TRAC_ARP_ETH_TYPE 0x0806 60 #define QDF_NBUF_PKT_IPV4_DSCP_MASK 0xFC 61 #define QDF_NBUF_PKT_IPV4_DSCP_SHIFT 0x02 62 #define QDF_NBUF_TRAC_TDLS_ETH_TYPE 0x890D 63 #define QDF_NBUF_TRAC_IPV4_ETH_TYPE 0x0800 64 #define QDF_NBUF_TRAC_IPV6_ETH_TYPE 0x86dd 65 #define QDF_NBUF_DEST_MAC_OFFSET 0 66 #define QDF_NBUF_SRC_MAC_OFFSET 6 67 #define QDF_NBUF_TRAC_IPV4_TOS_OFFSET 15 68 #define QDF_NBUF_TRAC_IPV4_PROTO_TYPE_OFFSET 23 69 #define QDF_NBUF_TRAC_VLAN_IPV4_PROTO_TYPE_OFFSET 27 70 #define QDF_NBUF_TRAC_IPV4_DEST_ADDR_OFFSET 30 71 #define QDF_NBUF_TRAC_IPV4_SRC_ADDR_OFFSET 26 72 #define QDF_NBUF_TRAC_IPV6_PROTO_TYPE_OFFSET 20 73 #define QDF_NBUF_TRAC_VLAN_IPV6_PROTO_TYPE_OFFSET 24 74 #define QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK 0xE0000000 75 #define QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK 0xF0000000 76 #define QDF_NBUF_TRAC_IPV6_DEST_ADDR_OFFSET 38 77 #define QDF_NBUF_TRAC_IPV6_DEST_ADDR 0xFF00 78 #define QDF_NBUF_TRAC_IPV6_OFFSET 14 79 #define QDF_NBUF_TRAC_VLAN_IPV6_OFFSET 18 80 #define QDF_NBUF_TRAC_IPV6_HEADER_SIZE 40 81 #define QDF_NBUF_TRAC_ICMP_TYPE 1 82 #define QDF_NBUF_TRAC_IGMP_TYPE 2 83 #define QDF_NBUF_TRAC_TCP_TYPE 6 84 #define QDF_NBUF_TRAC_TCP_FLAGS_OFFSET (47 - 34) 85 #define QDF_NBUF_TRAC_TCP_ACK_OFFSET (42 - 34) 86 #define QDF_NBUF_TRAC_TCP_HEADER_LEN_OFFSET (46 - 34) 87 #define QDF_NBUF_TRAC_TCP_ACK_MASK 0x10 88 #define QDF_NBUF_TRAC_TCP_SPORT_OFFSET (34 - 34) 89 #define QDF_NBUF_TRAC_TCP_DPORT_OFFSET (36 - 34) 90 #define QDF_NBUF_TRAC_UDP_TYPE 17 91 #define QDF_NBUF_TRAC_ICMPV6_TYPE 0x3a 92 #define QDF_NBUF_TRAC_HOPOPTS_TYPE 0 93 #define QDF_NBUF_TRAC_DHCP6_SRV_PORT 547 94 #define QDF_NBUF_TRAC_DHCP6_CLI_PORT 546 95 #define QDF_NBUF_TRAC_MDNS_SRC_N_DST_PORT 5353 96 #define QDF_NBUF_TRAC_IP_OFFSET 14 97 #define QDF_NBUF_TRAC_VLAN_IP_OFFSET 18 98 #define QDF_NBUF_TRAC_DOUBLE_VLAN_IP_OFFSET 22 99 /* One dword for IPv4 header size unit */ 100 #define QDF_NBUF_IPV4_HDR_SIZE_UNIT 4 101 102 /* EAPOL Related MASK */ 103 #define EAPOL_PACKET_TYPE_OFFSET 15 104 #define EAPOL_KEY_INFO_OFFSET 19 105 #define EAPOL_PKT_LEN_OFFSET 16 106 #define EAPOL_KEY_LEN_OFFSET 21 107 108 #define EAPOL_PACKET_TYPE_EAP 0 109 #define EAPOL_PACKET_TYPE_START 1 110 #define EAPOL_PACKET_TYPE_LOGOFF 2 111 #define EAPOL_PACKET_TYPE_KEY 3 112 113 #define EAPOL_KEY_TYPE_MASK 0x0800 114 #define EAPOL_KEY_ENCRYPTED_MASK 0x0010 115 116 /* EAP Related Mask */ 117 118 #define EAP_CODE_OFFSET 18 119 #define EAP_LENGTH_OFFSET 20 120 #define EAP_TYPE_OFFSET 22 121 #define QDF_EAP_REQUEST 1 122 #define QDF_EAP_RESPONSE 2 123 #define QDF_EAP_SUCCESS 3 124 #define QDF_EAP_FAILURE 4 125 #define QDF_EAP_INITIATE 5 126 #define QDF_EAP_FINISH 6 127 128 /* ARP Related MASK */ 129 #define QDF_NBUF_PKT_ARP_OPCODE_OFFSET 20 130 #define QDF_NBUF_PKT_ARPOP_REQ 1 131 #define QDF_NBUF_PKT_ARPOP_REPLY 2 132 #define QDF_NBUF_PKT_ARP_SRC_IP_OFFSET 28 133 #define QDF_NBUF_PKT_ARP_TGT_IP_OFFSET 38 134 135 /* ICMPv4 Related MASK */ 136 #define QDF_NBUF_PKT_ICMPv4_OPCODE_OFFSET 34 137 #define QDF_NBUF_PKT_ICMPv4OP_REQ 0x08 138 #define QDF_NBUF_PKT_ICMPv4OP_REPLY 0x00 139 #define QDF_NBUF_PKT_ICMPv4_SRC_IP_OFFSET 26 140 #define QDF_NBUF_PKT_ICMPv4_TGT_IP_OFFSET 30 141 #define QDF_NBUF_PKT_ICMPV4_REDIRECT 0x05 142 143 /* TCP Related MASK */ 144 #define QDF_NBUF_PKT_TCP_OPCODE_OFFSET 47 145 #define QDF_NBUF_PKT_TCPOP_SYN 0x02 146 #define QDF_NBUF_PKT_TCPOP_SYN_ACK 0x12 147 #define QDF_NBUF_PKT_TCPOP_ACK 0x10 148 #define QDF_NBUF_PKT_TCP_SRC_PORT_OFFSET 34 149 #define QDF_NBUF_PKT_TCP_DST_PORT_OFFSET 36 150 151 /* DNS Related MASK */ 152 #define QDF_NBUF_PKT_DNS_OVER_UDP_OPCODE_OFFSET 44 153 #define QDF_NBUF_PKT_DNSOP_BITMAP 0xF800 154 #define QDF_NBUF_PKT_DNSOP_STANDARD_QUERY 0x0000 155 #define QDF_NBUF_PKT_DNSOP_STANDARD_RESPONSE 0x8000 156 #define QDF_NBUF_PKT_DNS_SRC_PORT_OFFSET 34 157 #define QDF_NBUF_PKT_DNS_DST_PORT_OFFSET 36 158 #define QDF_NBUF_PKT_DNS_NAME_OVER_UDP_OFFSET 54 159 #define QDF_NBUF_PKT_DNS_STANDARD_PORT 53 160 161 /* Tracked Packet types */ 162 #define QDF_NBUF_TX_PKT_INVALID 0 163 #define QDF_NBUF_TX_PKT_DATA_TRACK 1 164 #define QDF_NBUF_TX_PKT_MGMT_TRACK 2 165 #define QDF_NBUF_RX_PKT_DATA_TRACK 3 166 167 /* Different Packet states */ 168 #define QDF_NBUF_TX_PKT_HDD 1 169 #define QDF_NBUF_TX_PKT_TXRX_ENQUEUE 2 170 #define QDF_NBUF_TX_PKT_TXRX_DEQUEUE 3 171 #define QDF_NBUF_TX_PKT_TXRX 4 172 #define QDF_NBUF_TX_PKT_HTT 5 173 #define QDF_NBUF_TX_PKT_HTC 6 174 #define QDF_NBUF_TX_PKT_HIF 7 175 #define QDF_NBUF_TX_PKT_CE 8 176 #define QDF_NBUF_TX_PKT_FREE 9 177 #define QDF_NBUF_TX_PKT_LI_DP 10 178 #define QDF_NBUF_TX_PKT_DP 11 179 #define QDF_NBUF_TX_PKT_STATE_MAX 12 180 181 /* nbuf allocations only come from one domain */ 182 #define QDF_DEBUG_NBUF_DOMAIN 0 183 184 /* qdf_nbuf allocate and map max retry threshold when failed */ 185 #define QDF_NBUF_ALLOC_MAP_RETRY_THRESHOLD 20 186 187 /* Enable flag to print TSO specific prints in datapath */ 188 #ifdef TSO_DEBUG_LOG_ENABLE 189 #define TSO_DEBUG(fmt, args ...) \ 190 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_NONE, \ 191 fmt, ## args) 192 #else 193 #define TSO_DEBUG(fmt, args ...) 194 #endif 195 196 #define IEEE80211_AMPDU_FLAG 0x01 197 198 #ifdef GET_MSDU_AGGREGATION 199 #define IEEE80211_AMSDU_FLAG 0x02 200 #endif 201 202 #define MAX_CHAIN 8 203 #define QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS 8 204 205 /** 206 * @qdf_nbuf_queue_t - Platform independent packet queue abstraction 207 */ 208 typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t; 209 210 /** 211 * This is the length for radiotap, combined length 212 * (Mandatory part struct ieee80211_radiotap_header + RADIOTAP_HEADER_LEN) 213 * cannot be more than available headroom_sz. 214 * increase this when we add more radiotap elements. 215 * Number after '+' indicates maximum possible increase due to alignment 216 */ 217 #define RADIOTAP_TX_FLAGS_LEN (2 + 1) 218 #define RADIOTAP_VHT_FLAGS_LEN (12 + 1) 219 #define RADIOTAP_HE_FLAGS_LEN (12 + 1) 220 #define RADIOTAP_HE_MU_FLAGS_LEN (8 + 1) 221 #define RADIOTAP_HE_MU_OTHER_FLAGS_LEN (18 + 1) 222 #define RADIOTAP_U_SIG_FLAGS_LEN (12 + 3) 223 #define RADIOTAP_EHT_FLAGS_LEN (32 + 3) 224 #define RADIOTAP_FIXED_HEADER_LEN 17 225 #define RADIOTAP_HT_FLAGS_LEN 3 226 #define RADIOTAP_AMPDU_STATUS_LEN (8 + 3) 227 #define RADIOTAP_VENDOR_NS_LEN \ 228 (sizeof(struct qdf_radiotap_vendor_ns_ath) + 1) 229 /* This is Radio Tap Header Extension Length. 230 * 4 Bytes for Extended it_present bit map + 231 * 4 bytes padding for alignment 232 */ 233 #define RADIOTAP_HEADER_EXT_LEN (2 * sizeof(uint32_t)) 234 #define RADIOTAP_HEADER_EXT2_LEN \ 235 (sizeof(struct qdf_radiotap_ext2)) 236 #define RADIOTAP_HEADER_LEN (RADIOTAP_BASE_HEADER_LEN + \ 237 RADIOTAP_FIXED_HEADER_LEN + \ 238 RADIOTAP_TX_FLAGS_LEN + \ 239 RADIOTAP_HT_FLAGS_LEN + \ 240 RADIOTAP_VHT_FLAGS_LEN + \ 241 RADIOTAP_AMPDU_STATUS_LEN + \ 242 RADIOTAP_HE_FLAGS_LEN + \ 243 RADIOTAP_HE_MU_FLAGS_LEN + \ 244 RADIOTAP_HE_MU_OTHER_FLAGS_LEN + \ 245 RADIOTAP_VENDOR_NS_LEN + \ 246 RADIOTAP_HEADER_EXT_LEN + \ 247 RADIOTAP_HEADER_EXT2_LEN + \ 248 RADIOTAP_U_SIG_FLAGS_LEN + \ 249 RADIOTAP_EHT_FLAGS_LEN) 250 251 /** 252 * struct mon_rx_status - This will have monitor mode rx_status extracted from 253 * htt_rx_desc used later to update radiotap information. 254 * @tsft: Time Synchronization Function timer 255 * @ppdu_timestamp: Timestamp in the PPDU_START TLV 256 * @chan_freq: Capture channel frequency 257 * @chan_num: Capture channel number 258 * @chan_flags: Bitmap of Channel flags, IEEE80211_CHAN_TURBO, 259 * IEEE80211_CHAN_CCK... 260 * @ht_flags: HT flags, only present for HT frames. 261 * @vht_flags: VHT flags, only present for VHT frames. 262 * @vht_flag_values1-5: Contains corresponding data for flags field 263 * @he_flags: HE (11ax) flags, only present in HE frames 264 * @he_mu_flags: HE-MU (11ax) flags, only present in HE frames 265 * @he_mu_other_flags: HE-MU-OTHER (11ax) flags, only present in HE frames 266 * @usig_flags: USIG flags, only present in 802.11BE and subsequent protocol 267 * @eht_flags: EHT (11be) flags, only present in EHT frames 268 * @nr_ant: Number of Antennas used for streaming 269 * @mcs: MCS index of Rx frame 270 * @nss: Number of spatial streams 271 * @bw: bandwidth of rx frame 272 * @is_stbc: Is STBC enabled 273 * @sgi: Rx frame short guard interval 274 * @he_re: HE range extension 275 * @ldpc: ldpc enabled 276 * @beamformed: Is frame beamformed. 277 * @dcm: dcm 278 * @preamble_type: Preamble type in radio header 279 * @tid: QoS traffic tid number 280 * @rs_fcs_err: FCS error flag 281 * @cck_flag: Flag to indicate CCK modulation 282 * @ofdm_flag: Flag to indicate OFDM modulation 283 * @ulofdma_flag: Flag to indicate UL OFDMA PPDU 284 * @monitor_direct_used: monitor direct mode 285 * @data_sequence_control_info_valid: field to indicate validity of seq control 286 * @rxpcu_filter_pass: Flag which indicates whether RX packets are received in 287 * BSS mode(not in promisc mode) 288 * @add_rtap_ext: add radio tap extension 289 * @frame_control_info_valid: field indicates if fc value is valid 290 * @add_rtap_ext2: add radiotap extension2 291 * @reception_type: PPDU reception type 292 * @ltf_size: ltf size 293 * @tx_status: packet tx status 294 * @rx_antenna: rx antenna 295 * @vht_flag_values6: VHT flag value6 296 * @he_mu_other_flags: HE MU other flag 297 * @he_sig_b_common: HE (11ax) sig B common field 298 * @he_sig_b_common_known: HE (11ax) sig B common known field 299 * @l_sig_a_info: L_SIG_A value coming in Rx descriptor 300 * @l_sig_b_info: L_SIG_B value coming in Rx descriptor 301 * @num_eht_user_info_valid: Number of valid EHT user info 302 * @rate: Rate in terms 500Kbps 303 * @rtap_flags: Bit map of available fields in the radiotap 304 * @ant_signal_db: Rx packet RSSI 305 * @ht_mcs: MCS index for HT RX frames 306 * @tcp_msdu_count: TCP MSDU Count 307 * @udp_msdu_count: UDP MSDU Count 308 * @other_msdu_count: Other MSDU Count 309 * @vht_flag_values1: VHT flag value 1 310 * @vht_flag_values2: VHT flag value 2 311 * @vht_flag_values3: VHT flag value 3 312 * @vht_flag_values4: VHT flag value 4 313 * @vht_flag_values5: VHT flag value 5 314 * @he_sig_b_common_RU[4]: HE (11ax) common RU assignment index 315 * @rssi_comb: Combined RSSI 316 * @rssi[MAX_CHAIN]: 8 bits RSSI per 20Mhz per chain 317 * @duration: 802.11 Duration 318 * @frame_control: frame control field 319 * @ast_index: AST table hash index 320 * @rs_flags: Flags to indicate AMPDU or AMSDU aggregation 321 * @he_per_user_1: HE per user info1 322 * @he_per_user_2: HE per user info2 323 * @he_per_user_position: HE per user position info 324 * @he_per_user_known: HE per user known info 325 * @he_flags1: HE flags 326 * @he_flags2: HE flags 327 * @he_RU[4]: HE RU assignment index 328 * @he_data1: HE property of received frame 329 * @he_data2: HE property of received frame 330 * @he_data3: HE property of received frame 331 * @he_data4: HE property of received frame 332 * @he_data5: HE property of received frame 333 * @prev_ppdu_id: ppdu_id in previously received message 334 * @ppdu_id: Id of the PLCP protocol data unit 335 * 336 * The following variables are not coming from the TLVs. 337 * These variables are placeholders for passing information to update_radiotap 338 * function. 339 * @device_id: Device ID coming from sub-system (PCI, AHB etc..) 340 * @chan_noise_floor: Channel Noise Floor for the pdev 341 * @first_data_seq_ctrl: Sequence ctrl field of first data frame 342 * @rssi_chain: Rssi chain per nss per bw 343 * @tx_retry_cnt: tx retry count 344 * @start_seq: starting sequence number 345 * @ba_bitmap: 256 bit block ack bitmap 346 * @mpdu_retry_cnt: Rx mpdu retry count 347 * @punctured_pattern: punctured pattern (0 means the band is punctured) 348 * @usig_common: U-SIG property of received frame 349 * @usig_value: U-SIG property of received frame 350 * @usig_mask: U-SIG property of received frame 351 * @eht_known: EHT property of received frame 352 * @eht_data: EHT property of received frame 353 * @eht_user_info: EHT USER property of received frame 354 * @phyrx_abort: phy aborted undecoded frame indication 355 * @phyrx_abort_reason: abort reason in phyrx_abort_request_info 356 * @vht_crc: vht crc 357 * @vht_no_txop_ps: TXOP power save mode 358 * @he_crc: he crc 359 * @l_sig_length: L SIG A length 360 * @l_sig_a_parity: L SIG A parity 361 * @l_sig_a_pkt_type: L SIG A info pkt type 362 * @l_sig_a_implicit_sounding: L SIG A info captured implicit sounding 363 * @ht_length: num of bytes in PSDU 364 * @smoothing: Indicate smoothing 365 * @not_sounding: Indicate sounding 366 * @aggregation: Indicate A-MPDU format 367 * @ht_stbc: Indicate stbc 368 * @ht_crc: ht crc 369 * @rx_user_status: pointer to mon_rx_user_status, when set update 370 * @rssi_offset: This offset value will use for RSSI db to dbm conversion 371 * @rssi_dbm_conv_support: Rssi dbm converstion support param 372 * radiotap header will use userinfo from this structure. 373 */ 374 struct mon_rx_status { 375 uint64_t tsft; 376 uint32_t ppdu_timestamp; 377 qdf_freq_t chan_freq; 378 uint16_t chan_num; 379 uint16_t chan_flags; 380 uint32_t ht_flags : 1, 381 vht_flags : 1, 382 he_flags : 1, 383 he_mu_flags : 1, 384 usig_flags : 1, 385 eht_flags : 1, 386 nr_ant : 3, 387 mcs : 4, 388 nss : 3, 389 bw : 4, 390 is_stbc : 1, 391 sgi : 2, 392 he_re : 1, 393 ldpc : 1, 394 beamformed : 1, 395 dcm : 1, 396 preamble_type : 4; 397 uint32_t tid : 5, 398 rs_fcs_err : 1, 399 cck_flag : 1, 400 ofdm_flag : 1, 401 ulofdma_flag : 1, 402 monitor_direct_used : 1, 403 data_sequence_control_info_valid : 1, 404 rxpcu_filter_pass : 1, 405 add_rtap_ext : 1, 406 frame_control_info_valid : 1, 407 add_rtap_ext2 : 1, 408 reception_type : 4, 409 ltf_size : 2, 410 tx_status : 4; 411 uint32_t rx_antenna : 24; 412 uint16_t vht_flag_values6; 413 uint16_t he_mu_other_flags; 414 uint16_t he_sig_b_common; 415 uint16_t he_sig_b_common_known; 416 uint32_t l_sig_a_info; 417 uint32_t l_sig_b_info; 418 uint8_t num_eht_user_info_valid; 419 uint8_t rate; 420 uint8_t rtap_flags; 421 uint8_t ant_signal_db; 422 uint8_t ht_mcs; 423 uint16_t tcp_msdu_count; 424 uint16_t udp_msdu_count; 425 uint16_t other_msdu_count; 426 uint8_t vht_flag_values1; 427 uint8_t vht_flag_values2; 428 uint8_t vht_flag_values3[4]; 429 uint8_t vht_flag_values4; 430 uint8_t vht_flag_values5; 431 uint8_t he_sig_b_common_RU[4]; 432 int8_t rssi_comb; 433 int8_t rssi[MAX_CHAIN]; 434 uint16_t duration; 435 uint16_t frame_control; 436 uint16_t ast_index; 437 uint8_t rs_flags; 438 /* New HE radiotap fields */ 439 uint16_t he_per_user_1; 440 uint16_t he_per_user_2; 441 uint8_t he_per_user_position; 442 uint8_t he_per_user_known; 443 uint16_t he_flags1; 444 uint16_t he_flags2; 445 uint8_t he_RU[8]; 446 uint16_t he_data1; 447 uint16_t he_data2; 448 uint16_t he_data3; 449 uint16_t he_data4; 450 uint16_t he_data5; 451 uint16_t he_data6; 452 uint32_t ppdu_len; 453 uint16_t prev_ppdu_id; 454 uint16_t ppdu_id; 455 uint16_t device_id; 456 int16_t chan_noise_floor; 457 uint16_t first_data_seq_ctrl; 458 int8_t rssi_chain[8][8]; 459 uint8_t tx_retry_cnt; 460 uint16_t start_seq; 461 uint32_t ba_bitmap[8]; 462 uint16_t mpdu_retry_cnt; 463 #ifdef WLAN_FEATURE_11BE 464 uint16_t punctured_pattern; 465 #endif 466 uint32_t usig_common; 467 uint32_t usig_value; 468 uint32_t usig_mask; 469 uint32_t eht_known; 470 uint32_t eht_data[6]; 471 uint32_t eht_user_info[4]; 472 #ifdef QCA_UNDECODED_METADATA_SUPPORT 473 uint32_t phyrx_abort:1, 474 phyrx_abort_reason:8, 475 vht_crc:8, 476 vht_no_txop_ps:1, 477 he_crc:4; 478 uint32_t l_sig_length:12, 479 l_sig_a_parity:1, 480 l_sig_a_pkt_type:4, 481 l_sig_a_implicit_sounding:1; 482 uint32_t ht_length:16, 483 smoothing:1, 484 not_sounding:1, 485 aggregation:1, 486 ht_stbc:2, 487 ht_crc:8; 488 #endif 489 struct mon_rx_user_status *rx_user_status; 490 int32_t rssi_offset; 491 bool rssi_dbm_conv_support; 492 }; 493 494 /** 495 * struct mon_rx_user_status - This will have monitor mode per user rx_status 496 * extracted from hardware TLV. 497 * @mcs: MCS index of Rx frame 498 * @nss: Number of spatial streams 499 * @mu_ul_info_valid: MU UL info below is valid 500 * @ofdma_ru_start_index: OFDMA RU start index 501 * @ofdma_ru_width: OFDMA total RU width 502 * @ofdma_ru_size: OFDMA RU size index 503 * @is_ampdu: AMPDU flag 504 * @mu_ul_user_v0_word0: MU UL user info word 0 505 * @mu_ul_user_v0_word1: MU UL user info word 1 506 * @ast_index: AST table hash index 507 * @sw_peer_id: software peer id 508 * @tid: QoS traffic tid number 509 * @preamble_type: Preamble type in radio header 510 * @ht_flags: HT flags, only present for HT frames. 511 * @vht_flags: VHT flags, only present for VHT frames. 512 * @he_flags: HE (11ax) flags, only present in HE frames 513 * @frame_control_info_valid: field indicates if fc value is valid 514 * @frame_control: frame control field 515 * @data_sequence_control_info_valid: field to indicate validity of seq control 516 * @filter_category: mpdu filter category 517 * @tcp_msdu_count: tcp protocol msdu count 518 * @udp_msdu_count: udp protocol msdu count 519 * @other_msdu_count: other protocol msdu count 520 * @first_data_seq_ctrl: Sequence ctrl field of first data frame 521 * @duration: 802.11 Duration 522 * @vht_flag_values1-5: Contains corresponding data for flags field 523 * @he_flags1: HE flags 524 * @he_flags2: HE flags 525 * @he_RU[4]: HE RU assignment index 526 * @he_data1: HE property of received frame 527 * @he_data2: HE property of received frame 528 * @he_data3: HE property of received frame 529 * @he_data4: HE property of received frame 530 * @he_data5: HE property of received frame 531 * @he_data6: HE property of received frame 532 * @he_per_user_1: HE per user info1 533 * @he_per_user_2: HE per user info2 534 * @he_per_user_position: HE per user position info 535 * @he_per_user_known: HE per user known info 536 * @rtap_flags: Bit map of available fields in the radiotap 537 * @rs_flags: Flags to indicate AMPDU or AMSDU aggregation 538 * @mpdu_cnt_fcs_ok: mpdu count received with fcs ok 539 * @mpdu_cnt_fcs_err: mpdu count received with fcs ok bitmap 540 * @mpdu_fcs_ok_bitmap: mpdu with fcs ok bitmap 541 * @mpdu_ok_byte_count: mpdu byte count with fcs ok 542 * @mpdu_err_byte_count: mpdu byte count with fcs err 543 * @retry_mpdu: mpdu retry count 544 * @start_seq: starting sequence number 545 * @ba_control: Block ack control 546 * @ba_bitmap: 256 bit block ack bitmap 547 * @aid: Association ID 548 * @mpdu_q: user mpdu_queue used for monitor 549 */ 550 struct mon_rx_user_status { 551 uint32_t mcs:4, 552 nss:3, 553 mu_ul_info_valid:1, 554 ofdma_ru_start_index:7, 555 ofdma_ru_width:7, 556 ofdma_ru_size:8, 557 is_ampdu:1; 558 uint32_t mu_ul_user_v0_word0; 559 uint32_t mu_ul_user_v0_word1; 560 uint32_t ast_index : 16, 561 sw_peer_id : 16; 562 uint32_t tid : 4, 563 preamble_type : 4, 564 ht_flags : 1, 565 vht_flags : 1, 566 he_flags : 1, 567 frame_control_info_valid : 1, 568 frame_control : 16, 569 data_sequence_control_info_valid : 1, 570 ba_bitmap_sz : 2, 571 filter_category : 2; 572 uint16_t tcp_msdu_count; 573 uint16_t udp_msdu_count; 574 uint16_t other_msdu_count; 575 uint16_t first_data_seq_ctrl; 576 uint16_t duration; 577 uint8_t vht_flag_values2; 578 uint8_t vht_flag_values3[4]; 579 uint8_t vht_flag_values4; 580 uint8_t vht_flag_values5; 581 uint16_t vht_flag_values6; 582 uint16_t he_flags1; 583 uint16_t he_flags2; 584 uint8_t he_RU[8]; 585 uint16_t he_data1; 586 uint16_t he_data2; 587 uint16_t he_data3; 588 uint16_t he_data4; 589 uint16_t he_data5; 590 uint16_t he_data6; 591 uint8_t he_per_user_1; 592 uint8_t he_per_user_2; 593 uint8_t he_per_user_position; 594 uint8_t he_per_user_known; 595 uint8_t rtap_flags; 596 uint8_t rs_flags; 597 uint16_t mpdu_cnt_fcs_ok; 598 uint8_t mpdu_cnt_fcs_err; 599 uint32_t mpdu_fcs_ok_bitmap[QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS]; 600 uint32_t mpdu_ok_byte_count; 601 uint32_t mpdu_err_byte_count; 602 uint16_t retry_mpdu; 603 uint16_t start_seq; 604 uint16_t ba_control; 605 uint32_t ba_bitmap[8]; 606 uint16_t aid; 607 qdf_nbuf_queue_t mpdu_q; 608 }; 609 610 /** 611 * struct qdf_radiotap_vendor_ns - Vendor Namespace header as per 612 * Radiotap spec: https://www.radiotap.org/fields/Vendor%20Namespace.html 613 * @oui: Vendor OUI 614 * @selector: sub_namespace selector 615 * @skip_length: How many bytes of Vendor Namespace data that follows 616 */ 617 struct qdf_radiotap_vendor_ns { 618 uint8_t oui[3]; 619 uint8_t selector; 620 uint16_t skip_length; 621 } __attribute__((__packed__)); 622 623 /** 624 * struct qdf_radiotap_vendor_ns_ath - Combined QTI Vendor NS 625 * including the Radiotap specified Vendor Namespace header and 626 * QTI specific Vendor Namespace data 627 * @lsig: L_SIG_A (or L_SIG) 628 * @device_id: Device Identification 629 * @lsig_b: L_SIG_B 630 * @ppdu_start_timestamp: Timestamp from RX_PPDU_START TLV 631 */ 632 struct qdf_radiotap_vendor_ns_ath { 633 struct qdf_radiotap_vendor_ns hdr; 634 /* QTI specific data follows */ 635 uint32_t lsig; 636 uint32_t device_id; 637 uint32_t lsig_b; 638 uint32_t ppdu_start_timestamp; 639 } __attribute__((__packed__)); 640 641 /** 642 * struct qdf_radiotap_ext2 - radiotap ext2 fields 643 * ppdu_id: ppdu_id of current msdu 644 * prev_ppdu_id: ppdu_id of previous msdu 645 * tid: tid number of previous msdu 646 * start_seq: start sequence of previous msdu 647 * ba_bitmap: block ack bitmap of previous msdu 648 */ 649 struct qdf_radiotap_ext2 { 650 uint32_t ppdu_id; 651 uint32_t prev_ppdu_id; 652 uint16_t tid:8, 653 reserved:8; 654 uint16_t start_seq; 655 uint32_t ba_bitmap[8]; 656 } __attribute__((__packed__)); 657 658 #define QDF_MEM_FUNC_NAME_SIZE 48 659 660 /* Masks for HE SIG known fields in mon_rx_status structure */ 661 #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU0 0x00000001 662 #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU1 0x00000002 663 #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU2 0x00000004 664 #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU3 0x00000008 665 #define QDF_MON_STATUS_HE_SIG_B_USER_KNOWN_SIG_B_ALL 0x00fe0000 666 #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_SU 0x00000000 667 #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_EXT_SU 0x40000000 668 #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_TRIG 0xc0000000 669 670 /* DHCP Related Mask */ 671 #define QDF_DHCP_OPTION53 (0x35) 672 #define QDF_DHCP_OPTION53_LENGTH (1) 673 #define QDF_DHCP_OPTION53_OFFSET (0x11A) 674 #define QDF_DHCP_OPTION53_LENGTH_OFFSET (0x11B) 675 #define QDF_DHCP_OPTION53_STATUS_OFFSET (0x11C) 676 #define DHCP_PKT_LEN_OFFSET 16 677 #define DHCP_TRANSACTION_ID_OFFSET 46 678 #define QDF_DHCP_DISCOVER (1) 679 #define QDF_DHCP_OFFER (2) 680 #define QDF_DHCP_REQUEST (3) 681 #define QDF_DHCP_DECLINE (4) 682 #define QDF_DHCP_ACK (5) 683 #define QDF_DHCP_NAK (6) 684 #define QDF_DHCP_RELEASE (7) 685 #define QDF_DHCP_INFORM (8) 686 687 /* ARP Related Mask */ 688 #define ARP_SUB_TYPE_OFFSET 20 689 #define ARP_REQUEST (1) 690 #define ARP_RESPONSE (2) 691 692 /* IPV4 header fields offset values */ 693 #define IPV4_PKT_LEN_OFFSET 16 694 #define IPV4_TCP_SEQ_NUM_OFFSET 38 695 #define IPV4_SRC_ADDR_OFFSET 26 696 #define IPV4_DST_ADDR_OFFSET 30 697 #define IPV4_SRC_PORT_OFFSET 34 698 #define IPV4_DST_PORT_OFFSET 36 699 700 /* IPV4 ICMP Related Mask */ 701 #define ICMP_ID_OFFSET 38 702 #define ICMP_SEQ_NUM_OFFSET 40 703 #define ICMP_SUBTYPE_OFFSET 34 704 #define ICMP_REQUEST 0x08 705 #define ICMP_RESPONSE 0x00 706 707 #define IPV6_ADDR_STR "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:"\ 708 "%02x%02x:%02x%02x" 709 710 /* IPV6 header fields offset values */ 711 #define IPV6_PKT_LEN_OFFSET 18 712 #define IPV6_TCP_SEQ_NUM_OFFSET 58 713 #define IPV6_SRC_ADDR_OFFSET 22 714 #define IPV6_DST_ADDR_OFFSET 38 715 #define IPV6_SRC_PORT_OFFSET 54 716 #define IPV6_DST_PORT_OFFSET 56 717 718 /* IPV6 ICMPV6 Related Mask */ 719 #define ICMPV6_REDIRECT 137 720 #define ICMPV6_SEQ_NUM_OFFSET 60 721 #define ICMPV6_SUBTYPE_OFFSET 54 722 #define ICMPV6_REQUEST 0x80 723 #define ICMPV6_RESPONSE 0x81 724 #define ICMPV6_RS 0x85 725 #define ICMPV6_RA 0x86 726 #define ICMPV6_NS 0x87 727 #define ICMPV6_NA 0x88 728 729 #define QDF_NBUF_IPA_CHECK_MASK 0x80000000 730 731 /* HE Radiotap data1 Mask */ 732 #define QDF_MON_STATUS_HE_SU_FORMAT_TYPE 0x0000 733 #define QDF_MON_STATUS_HE_EXT_SU_FORMAT_TYPE 0x0001 734 #define QDF_MON_STATUS_HE_MU_FORMAT_TYPE 0x0002 735 #define QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE 0x0003 736 737 738 #define QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN 0x0008 739 #define QDF_MON_STATUS_HE_DL_UL_KNOWN 0x0010 740 #define QDF_MON_STATUS_HE_MCS_KNOWN 0x0020 741 #define QDF_MON_STATUS_HE_DCM_KNOWN 0x0040 742 #define QDF_MON_STATUS_HE_CODING_KNOWN 0x0080 743 #define QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN 0x0100 744 #define QDF_MON_STATUS_HE_STBC_KNOWN 0x0200 745 #define QDF_MON_STATUS_HE_SPATIAL_REUSE_1_KNOWN 0x0400 746 #define QDF_MON_STATUS_HE_SPATIAL_REUSE_2_KNOWN 0x0800 747 #define QDF_MON_STATUS_HE_SPATIAL_REUSE_3_KNOWN 0x1000 748 #define QDF_MON_STATUS_HE_SPATIAL_REUSE_4_KNOWN 0x2000 749 #define QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN 0x4000 750 #define QDF_MON_STATUS_HE_DOPPLER_KNOWN 0x8000 751 #define QDF_MON_STATUS_HE_BSS_COLOR_KNOWN 0x0004 752 753 /* HE Radiotap data2 Mask */ 754 #define QDF_MON_STATUS_HE_GI_KNOWN 0x0002 755 #define QDF_MON_STATUS_TXBF_KNOWN 0x0010 756 #define QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN 0x0020 757 #define QDF_MON_STATUS_TXOP_KNOWN 0x0040 758 #define QDF_MON_STATUS_LTF_SYMBOLS_KNOWN 0x0004 759 #define QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN 0x0008 760 #define QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN 0x0080 761 #define QDF_MON_STATUS_RU_ALLOCATION_OFFSET_KNOWN 0x4000 762 #define QDF_MON_STATUS_RU_ALLOCATION_SHIFT 8 763 764 /* HE radiotap data3 shift values */ 765 #define QDF_MON_STATUS_BEAM_CHANGE_SHIFT 6 766 #define QDF_MON_STATUS_DL_UL_SHIFT 7 767 #define QDF_MON_STATUS_TRANSMIT_MCS_SHIFT 8 768 #define QDF_MON_STATUS_DCM_SHIFT 12 769 #define QDF_MON_STATUS_CODING_SHIFT 13 770 #define QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT 14 771 #define QDF_MON_STATUS_STBC_SHIFT 15 772 773 /* HE radiotap data4 shift values */ 774 #define QDF_MON_STATUS_STA_ID_SHIFT 4 775 776 /* HE radiotap data5 */ 777 #define QDF_MON_STATUS_GI_SHIFT 4 778 #define QDF_MON_STATUS_HE_LTF_SIZE_SHIFT 6 779 #define QDF_MON_STATUS_HE_LTF_SYM_SHIFT 8 780 #define QDF_MON_STATUS_TXBF_SHIFT 14 781 #define QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT 15 782 #define QDF_MON_STATUS_PRE_FEC_PAD_SHIFT 12 783 784 /* HE radiotap data6 */ 785 #define QDF_MON_STATUS_HE_DATA_6_NSS_SHIFT 0 786 #define QDF_MON_STATUS_DOPPLER_SHIFT 4 787 #define QDF_MON_STATUS_TXOP_SHIFT 8 788 789 /* HE radiotap HE-MU flags1 */ 790 #define QDF_MON_STATUS_SIG_B_MCS_SHIFT 0x0000 791 #define QDF_MON_STATUS_SIG_B_MCS_KNOWN 0x0010 792 #define QDF_MON_STATUS_SIG_B_DCM_SHIFT 5 793 #define QDF_MON_STATUS_SIG_B_DCM_KNOWN 0x0040 794 #define QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN 0x0080 795 #define QDF_MON_STATUS_CHANNEL_1_RU_KNOWN 0x0100 796 #define QDF_MON_STATUS_CHANNEL_2_RU_KNOWN 0x0200 797 #define QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN 0x1000 798 #define QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_VALUE 0x2000 799 #define QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_SHIFT 13 800 #define QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN 0x8000 801 #define QDF_MON_STATUS_RU_0_KNOWN 0x0100 802 #define QDF_MON_STATUS_RU_1_KNOWN 0x0200 803 #define QDF_MON_STATUS_RU_2_KNOWN 0x0400 804 #define QDF_MON_STATUS_RU_3_KNOWN 0x0800 805 #define QDF_MON_STATUS_DCM_FLAG_1_SHIFT 5 806 #define QDF_MON_STATUS_SPATIAL_REUSE_MU_KNOWN 0x0100 807 #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN 0x4000 808 #define QDF_MON_STATUS_SIG_B_SYMBOL_USER_KNOWN 0x8000 809 810 /* HE radiotap HE-MU flags2 */ 811 #define QDF_MON_STATUS_SIG_A_BANDWIDTH_KNOWN 0x0004 812 #define QDF_MON_STATUS_SIG_A_BANDWIDTH_SHIFT 0 813 #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT 3 814 #define QDF_MON_STATUS_BW_KNOWN 0x0004 815 #define QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT 4 816 #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_KNOWN 0x0100 817 #define QDF_MON_STATUS_NUM_SIG_B_FLAG_2_SHIFT 9 818 #define QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_KNOWN 0x0400 819 #define QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_SHIFT 8 820 #define QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_VALUE 0x0800 821 #define QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_SHIFT 11 822 #define QDF_MON_STATUS_LTF_FLAG_2_SYMBOLS_SHIFT 12 823 #define QDF_MON_STATUS_LTF_KNOWN 0x8000 824 825 /* HE radiotap per_user_1 */ 826 #define QDF_MON_STATUS_STA_SPATIAL_SHIFT 11 827 #define QDF_MON_STATUS_TXBF_SHIFT 14 828 #define QDF_MON_STATUS_RESERVED_SET_TO_1_SHIFT 19 829 #define QDF_MON_STATUS_STA_CODING_SHIFT 20 830 831 /* HE radiotap per_user_2 */ 832 #define QDF_MON_STATUS_STA_MCS_SHIFT 4 833 #define QDF_MON_STATUS_STA_DCM_SHIFT 5 834 835 /* HE radiotap per user known */ 836 #define QDF_MON_STATUS_USER_FIELD_POSITION_KNOWN 0x01 837 #define QDF_MON_STATUS_STA_ID_PER_USER_KNOWN 0x02 838 #define QDF_MON_STATUS_STA_NSTS_KNOWN 0x04 839 #define QDF_MON_STATUS_STA_TX_BF_KNOWN 0x08 840 #define QDF_MON_STATUS_STA_SPATIAL_CONFIG_KNOWN 0x10 841 #define QDF_MON_STATUS_STA_MCS_KNOWN 0x20 842 #define QDF_MON_STATUS_STA_DCM_KNOWN 0x40 843 #define QDF_MON_STATUS_STA_CODING_KNOWN 0x80 844 845 /* U-SIG Common Mask */ 846 #define QDF_MON_STATUS_USIG_PHY_VERSION_KNOWN 0x00000001 847 #define QDF_MON_STATUS_USIG_BW_KNOWN 0x00000002 848 #define QDF_MON_STATUS_USIG_UL_DL_KNOWN 0x00000004 849 #define QDF_MON_STATUS_USIG_BSS_COLOR_KNOWN 0x00000008 850 #define QDF_MON_STATUS_USIG_TXOP_KNOWN 0x00000010 851 852 #define QDF_MON_STATUS_USIG_PHY_VERSION_SHIFT 12 853 #define QDF_MON_STATUS_USIG_BW_SHIFT 15 854 #define QDF_MON_STATUS_USIG_UL_DL_SHIFT 18 855 #define QDF_MON_STATUS_USIG_BSS_COLOR_SHIFT 19 856 #define QDF_MON_STATUS_USIG_TXOP_SHIFT 25 857 858 /* U-SIG MU/TB Value */ 859 #define QDF_MON_STATUS_USIG_DISREGARD_SHIFT 0 860 #define QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_SHIFT 6 861 #define QDF_MON_STATUS_USIG_VALIDATE_SHIFT 8 862 863 #define QDF_MON_STATUS_USIG_MU_VALIDATE1_SHIFT 5 864 #define QDF_MON_STATUS_USIG_MU_PUNCTURE_CH_INFO_SHIFT 9 865 #define QDF_MON_STATUS_USIG_MU_VALIDATE2_SHIFT 14 866 #define QDF_MON_STATUS_USIG_MU_EHT_SIG_MCS_SHIFT 15 867 #define QDF_MON_STATUS_USIG_MU_NUM_EHT_SIG_SYM_SHIFT 17 868 869 #define QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_1_SHIFT 9 870 #define QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_2_SHIFT 13 871 #define QDF_MON_STATUS_USIG_TB_DISREGARD1_SHIFT 17 872 873 #define QDF_MON_STATUS_USIG_CRC_SHIFT 22 874 #define QDF_MON_STATUS_USIG_TAIL_SHIFT 26 875 876 /* U-SIG MU/TB Mask */ 877 #define QDF_MON_STATUS_USIG_DISREGARD_KNOWN 0x00000001 878 #define QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_KNOWN 0x00000004 879 #define QDF_MON_STATUS_USIG_VALIDATE_KNOWN 0x00000008 880 881 #define QDF_MON_STATUS_USIG_MU_VALIDATE1_KNOWN 0x00000002 882 #define QDF_MON_STATUS_USIG_MU_PUNCTURE_CH_INFO_KNOWN 0x00000010 883 #define QDF_MON_STATUS_USIG_MU_VALIDATE2_KNOWN 0x00000020 884 #define QDF_MON_STATUS_USIG_MU_EHT_SIG_MCS_KNOWN 0x00000040 885 #define QDF_MON_STATUS_USIG_MU_NUM_EHT_SIG_SYM_KNOWN 0x00000080 886 887 #define QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_1_KNOWN 0x00000010 888 #define QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_2_KNOWN 0x00000020 889 #define QDF_MON_STATUS_USIG_TB_DISREGARD1_KNOWN 0x00000040 890 891 #define QDF_MON_STATUS_USIG_CRC_KNOWN 0x00000100 892 #define QDF_MON_STATUS_USIG_TAIL_KNOWN 0x00000200 893 894 /* EHT known Mask */ 895 #define QDF_MON_STATUS_EHT_CONTENT_CH_INDEX_KNOWN 0x00000001 896 #define QDF_MON_STATUS_EHT_SPATIAL_REUSE_KNOWN 0x00000002 897 #define QDF_MON_STATUS_EHT_GUARD_INTERVAL_KNOWN 0x00000004 898 #define QDF_MON_STATUS_EHT_LTF_KNOWN 0x00000008 899 #define QDF_MON_STATUS_EHT_EHT_LTF_KNOWN 0x00000010 900 #define QDF_MON_STATUS_EHT_LDPC_EXTRA_SYMBOL_SEG_KNOWN 0x00000020 901 #define QDF_MON_STATUS_EHT_PRE_FEC_PADDING_FACTOR_KNOWN 0x00000040 902 #define QDF_MON_STATUS_EHT_PE_DISAMBIGUITY_KNOWN 0x00000080 903 #define QDF_MON_STATUS_EHT_DISREARD_KNOWN 0x00000100 904 #define QDF_MON_STATUS_EHT_CRC1_KNOWN 0x00002000 905 #define QDF_MON_STATUS_EHT_TAIL1_KNOWN 0x00004000 906 #define QDF_MON_STATUS_EHT_CRC2_KNOWN 0x00008000 907 #define QDF_MON_STATUS_EHT_TAIL2_KNOWN 0x00010000 908 #define QDF_MON_STATUS_EHT_RU_MRU_SIZE_KNOWN 0x00400000 909 #define QDF_MON_STATUS_EHT_RU_MRU_INDEX_KNOWN 0x00800000 910 #define QDF_MON_STATUS_EHT_TB_RU_ALLOCATION_KNOWN 0x01000000 911 912 #define QDF_MON_STATUS_EHT_NUM_NON_OFDMA_USERS_KNOWN 0x00080000 913 #define QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_KNOWN 0x00100000 914 #define QDF_MON_STATUS_EHT_USER_ENC_BLOCK_TAIL_KNOWN 0x00200000 915 916 #define QDF_MON_STATUS_EHT_NDP_DISREGARD_KNOWN 0x00000200 917 #define QDF_MON_STATUS_EHT_NDP_NSS_KNOWN 0x00020000 918 #define QDF_MON_STATUS_EHT_NDP_BEAMFORMED_KNOWN 0x00040000 919 920 #define QDF_MON_STATUS_EHT_NUM_KNOWN_RU_ALLOCATIONS_SHIFT 10 921 922 /* EHT data0 Mask/SHIFT */ 923 #define QDF_MON_STATUS_EHT_CONTENT_CH_INDEX_SHIFT 0 924 #define QDF_MON_STATUS_EHT_SPATIAL_REUSE_SHIFT 3 925 #define QDF_MON_STATUS_EHT_GI_SHIFT 7 926 #define QDF_MON_STATUS_EHT_LTF_SHIFT 9 927 #define QDF_MON_STATUS_EHT_EHT_LTF_SHIFT 11 928 #define QDF_MON_STATUS_EHT_LDPC_EXTRA_SYMBOL_SEG_SHIFT 14 929 #define QDF_MON_STATUS_EHT_PRE_FEC_PADDING_FACTOR_SHIFT 15 930 #define QDF_MON_STATUS_EHT_PE_DISAMBIGUITY_SHIFT 17 931 #define QDF_MON_STATUS_EHT_NDP_DISREGARD_SHIFT 18 932 #define QDF_MON_STATUS_EHT_DISREGARD_SHIFT 18 933 #define QDF_MON_STATUS_EHT_CRC1_SHIFT 22 934 #define QDF_MON_STATUS_EHT_TAIL1_SHIFT 26 935 936 /* EHT data1 Mask/SHIFT */ 937 #define QDF_MON_STATUS_EHT_RU_MRU_SIZE_SHIFT 0 938 #define QDF_MON_STATUS_EHT_RU_MRU_INDEX_SHIFT 5 939 #define QDF_MON_STATUS_EHT_RU_ALLOCATION1_1_SHIFT 13 940 #define QDF_MON_STATUS_EHT_RU_ALLOCATION1_2_SHIFT 22 941 942 /* EHT data2 Mask/SHIFT */ 943 #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_1_SHIFT 0 944 #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_2_SHIFT 9 945 #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_3_SHIFT 18 946 947 /* EHT data3 Mask/SHIFT */ 948 #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_4_SHIFT 0 949 #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_5_SHIFT 9 950 #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_6_SHIFT 18 951 952 /* EHT data4 Mask/SHIFT */ 953 #define QDF_MON_STATUS_EHT_CRC2_SHIFT 0 954 #define QDF_MON_STATUS_EHT_TAIL2_SHIFT 4 955 #define QDF_MON_STATUS_EHT_NDP_NSS_SHIFT 12 956 #define QDF_MON_STATUS_EHT_NDP_BEAMFORMED_SHIFT 16 957 #define QDF_MON_STATUS_EHT_NUM_NON_OFDMA_USERS_SHIFT 17 958 #define QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_SHIFT 20 959 #define QDF_MON_STATUS_EHT_USER_ENC_BLOCK_TAIL_SHIFT 24 960 961 /* EHT data5 Mask/SHIFT */ 962 #define QDF_MON_STATUS_EHT_TB_RU_PS160_SHIFT 0 963 #define QDF_MON_STATUS_EHT_TB_RU_PS80_SHIFT 1 964 #define QDF_MON_STATUS_EHT_TB_RU_B7_B1_SHIFT 2 965 966 /* EHT user info Mask/SHIFT */ 967 #define QDF_MON_STATUS_EHT_USER_STA_ID_KNOWN 0x00000001 968 #define QDF_MON_STATUS_EHT_USER_MCS_KNOWN 0x00000002 969 #define QDF_MON_STATUS_EHT_USER_CODING_KNOWN 0x00000004 970 #define QDF_MON_STATUS_EHT_USER_RESERVED_KNOWN 0x00000008 971 #define QDF_MON_STATUS_EHT_USER_NSS_KNOWN 0x00000010 972 #define QDF_MON_STATUS_EHT_USER_BEAMFORMING_KNOWN 0x00000020 973 #define QDF_MON_STATUS_EHT_USER_SPATIAL_CONFIG_KNOWN 0x00000040 974 975 #define QDF_MON_STATUS_EHT_USER_DATA_FOR_THIS_USER_SHIFT 7 976 #define QDF_MON_STATUS_EHT_USER_STA_ID_SHIFT 8 977 #define QDF_MON_STATUS_EHT_USER_CODING_SHIFT 19 978 #define QDF_MON_STATUS_EHT_USER_MCS_SHIFT 20 979 #define QDF_MON_STATUS_EHT_USER_NSS_SHIFT 24 980 #define QDF_MON_STATUS_EHT_USER_RESERVED_SHIFT 28 981 #define QDF_MON_STATUS_EHT_USER_BEAMFORMING_SHIFT 29 982 #define QDF_MON_STATUS_EHT_USER_SPATIAL_CONFIG_SHIFT 24 983 984 /** 985 * enum qdf_proto_type - protocol type 986 * @QDF_PROTO_TYPE_DHCP - DHCP 987 * @QDF_PROTO_TYPE_EAPOL - EAPOL 988 * @QDF_PROTO_TYPE_ARP - ARP 989 * @QDF_PROTO_TYPE_MGMT - MGMT 990 * @QDF_PROTO_TYPE_ICMP - ICMP 991 * @QDF_PROTO_TYPE_ICMPv6 - ICMPv6 992 * @QDF_PROTO_TYPE_EVENT - EVENT 993 * @QDF_PROTO_TYPE_DNS - DNS 994 */ 995 enum qdf_proto_type { 996 QDF_PROTO_TYPE_DHCP, 997 QDF_PROTO_TYPE_EAPOL, 998 QDF_PROTO_TYPE_ARP, 999 QDF_PROTO_TYPE_MGMT, 1000 QDF_PROTO_TYPE_ICMP, 1001 QDF_PROTO_TYPE_ICMPv6, 1002 QDF_PROTO_TYPE_EVENT, 1003 QDF_PROTO_TYPE_DNS, 1004 QDF_PROTO_TYPE_MAX 1005 }; 1006 1007 /** 1008 * qdf_reception_type - reception type used by lithium phy TLV 1009 * @QDF_RECEPTION_TYPE_ULOFMDA - UL OFDMA 1010 * @QDF_RECEPTION_TYPE_ULMIMO - UL MIMO 1011 * @QQDF_RECEPTION_TYPE_FRAMELESS - Frame less 1012 * @QDF_RECEPTION_TYPE_OTHER - All the other types 1013 */ 1014 enum qdf_reception_type { 1015 QDF_RECEPTION_TYPE_ULOFMDA, 1016 QDF_RECEPTION_TYPE_ULMIMO, 1017 QDF_RECEPTION_TYPE_OTHER, 1018 QDF_RECEPTION_TYPE_FRAMELESS 1019 }; 1020 1021 /** 1022 * cb_ftype - Frame type information in skb cb 1023 * @CB_FTYPE_INVALID - Invalid 1024 * @CB_FTYPE_MCAST2UCAST - Multicast to Unicast converted packet 1025 * @CB_FTYPE_TSO - TCP Segmentation Offload 1026 * @CB_FTYPE_TSO_SG - TSO Scatter Gather 1027 * @CB_FTYPE_SG - Scatter Gather 1028 * @CB_FTYPE_INTRABSS_FWD - Intra BSS forwarding 1029 * @CB_FTYPE_RX_INFO - Rx information 1030 * @CB_FTYPE_MESH_RX_INFO - Mesh Rx information 1031 * @CB_FTYPE_MESH_TX_INFO - Mesh Tx information 1032 * @CB_FTYPE_DMS - Directed Multicast Service 1033 * @CB_FTYPE_SAWF - SAWF information 1034 */ 1035 enum cb_ftype { 1036 CB_FTYPE_INVALID = 0, 1037 CB_FTYPE_MCAST2UCAST = 1, 1038 CB_FTYPE_TSO = 2, 1039 CB_FTYPE_TSO_SG = 3, 1040 CB_FTYPE_SG = 4, 1041 CB_FTYPE_INTRABSS_FWD = 5, 1042 CB_FTYPE_RX_INFO = 6, 1043 CB_FTYPE_MESH_RX_INFO = 7, 1044 CB_FTYPE_MESH_TX_INFO = 8, 1045 CB_FTYPE_DMS = 9, 1046 CB_FTYPE_SAWF = 10, 1047 }; 1048 1049 /** 1050 * @qdf_nbuf_t - Platform independent packet abstraction 1051 */ 1052 typedef __qdf_nbuf_t qdf_nbuf_t; 1053 1054 /** 1055 * @qdf_nbuf_shared_info_t- Platform independent shared info 1056 */ 1057 typedef __qdf_nbuf_shared_info_t qdf_nbuf_shared_info_t; 1058 1059 /** 1060 * struct qdf_nbuf_track_t - Network buffer track structure 1061 * 1062 * @p_next: Pointer to next 1063 * @net_buf: Pointer to network buffer 1064 * @func_name: Function name 1065 * @line_num: Line number 1066 * @size: Size 1067 * @map_func_name: nbuf mapping function name 1068 * @map_line_num: mapping function line number 1069 * @unmap_func_name: nbuf unmapping function name 1070 * @unmap_line_num: mapping function line number 1071 * @is_nbuf_mapped: indicate mapped/unmapped nbuf 1072 * @time: mapping function timestamp 1073 * @smmu_map_line_num: smmu mapping line number 1074 * @smmu_unmap_line_num: smmu unmapping line number 1075 * @smmu_map_func_name: smmu mapping function name 1076 * @smmu_unmap_func_name: smmu unmapping function name 1077 * @is_nbuf_smmu_mapped: nbuf is smmu mapped 1078 * @smmu_map_iova_addr: nbuf smmu map virtual address 1079 * @smmu_map_pa_addr: nbuf smmu map physical address 1080 * @smmu_unmap_iova_addr: nbuf smmu unmap virtual address 1081 * @smmu_unmap_pa_addr: nbuf smmu unmap physical address 1082 */ 1083 struct qdf_nbuf_track_t { 1084 struct qdf_nbuf_track_t *p_next; 1085 qdf_nbuf_t net_buf; 1086 char func_name[QDF_MEM_FUNC_NAME_SIZE]; 1087 uint32_t line_num; 1088 size_t size; 1089 char map_func_name[QDF_MEM_FUNC_NAME_SIZE]; 1090 uint32_t map_line_num; 1091 char unmap_func_name[QDF_MEM_FUNC_NAME_SIZE]; 1092 uint32_t unmap_line_num; 1093 bool is_nbuf_mapped; 1094 qdf_time_t time; 1095 #ifdef NBUF_SMMU_MAP_UNMAP_DEBUG 1096 uint32_t smmu_map_line_num; 1097 uint32_t smmu_unmap_line_num; 1098 char smmu_map_func_name[QDF_MEM_FUNC_NAME_SIZE]; 1099 char smmu_unmap_func_name[QDF_MEM_FUNC_NAME_SIZE]; 1100 bool is_nbuf_smmu_mapped; 1101 unsigned long smmu_map_iova_addr; 1102 unsigned long smmu_map_pa_addr; 1103 unsigned long smmu_unmap_iova_addr; 1104 unsigned long smmu_unmap_pa_addr; 1105 #endif 1106 }; 1107 1108 typedef struct qdf_nbuf_track_t QDF_NBUF_TRACK; 1109 1110 /** 1111 * typedef qdf_nbuf_queue_head_t - Platform independent nbuf queue head 1112 */ 1113 typedef __qdf_nbuf_queue_head_t qdf_nbuf_queue_head_t; 1114 1115 /** 1116 * @qdf_dma_map_cb_t - Dma map callback prototype 1117 */ 1118 typedef void (*qdf_dma_map_cb_t)(void *arg, qdf_nbuf_t buf, 1119 qdf_dma_map_t dmap); 1120 1121 /* BUS/DMA mapping routines */ 1122 1123 static inline QDF_STATUS 1124 qdf_nbuf_dmamap_create(qdf_device_t osdev, qdf_dma_map_t *dmap) 1125 { 1126 return __qdf_nbuf_dmamap_create(osdev, dmap); 1127 } 1128 1129 static inline void 1130 qdf_nbuf_dmamap_destroy(qdf_device_t osdev, qdf_dma_map_t dmap) 1131 { 1132 __qdf_nbuf_dmamap_destroy(osdev, dmap); 1133 } 1134 1135 static inline void 1136 qdf_nbuf_dmamap_set_cb(qdf_dma_map_t dmap, qdf_dma_map_cb_t cb, void *arg) 1137 { 1138 __qdf_nbuf_dmamap_set_cb(dmap, cb, arg); 1139 } 1140 1141 static inline void 1142 qdf_nbuf_set_send_complete_flag(qdf_nbuf_t buf, bool flag) 1143 { 1144 __qdf_nbuf_set_send_complete_flag(buf, flag); 1145 } 1146 1147 #define QDF_NBUF_QUEUE_WALK_SAFE(queue, var, tvar) \ 1148 __qdf_nbuf_queue_walk_safe(queue, var, tvar) 1149 1150 #ifdef NBUF_MAP_UNMAP_DEBUG 1151 /** 1152 * qdf_nbuf_map_check_for_leaks() - check for nbuf map leaks 1153 * 1154 * Check for net buffers that have been mapped, but never unmapped. 1155 * 1156 * Returns: None 1157 */ 1158 void qdf_nbuf_map_check_for_leaks(void); 1159 1160 QDF_STATUS qdf_nbuf_map_debug(qdf_device_t osdev, 1161 qdf_nbuf_t buf, 1162 qdf_dma_dir_t dir, 1163 const char *func, 1164 uint32_t line); 1165 1166 #define qdf_nbuf_map(osdev, buf, dir) \ 1167 qdf_nbuf_map_debug(osdev, buf, dir, __func__, __LINE__) 1168 1169 void qdf_nbuf_unmap_debug(qdf_device_t osdev, 1170 qdf_nbuf_t buf, 1171 qdf_dma_dir_t dir, 1172 const char *func, 1173 uint32_t line); 1174 1175 #define qdf_nbuf_unmap(osdev, buf, dir) \ 1176 qdf_nbuf_unmap_debug(osdev, buf, dir, __func__, __LINE__) 1177 1178 QDF_STATUS qdf_nbuf_map_single_debug(qdf_device_t osdev, 1179 qdf_nbuf_t buf, 1180 qdf_dma_dir_t dir, 1181 const char *func, 1182 uint32_t line); 1183 1184 #define qdf_nbuf_map_single(osdev, buf, dir) \ 1185 qdf_nbuf_map_single_debug(osdev, buf, dir, __func__, __LINE__) 1186 1187 void qdf_nbuf_unmap_single_debug(qdf_device_t osdev, 1188 qdf_nbuf_t buf, 1189 qdf_dma_dir_t dir, 1190 const char *func, 1191 uint32_t line); 1192 1193 #define qdf_nbuf_unmap_single(osdev, buf, dir) \ 1194 qdf_nbuf_unmap_single_debug(osdev, buf, dir, __func__, __LINE__) 1195 1196 QDF_STATUS qdf_nbuf_map_nbytes_debug(qdf_device_t osdev, 1197 qdf_nbuf_t buf, 1198 qdf_dma_dir_t dir, 1199 int nbytes, 1200 const char *func, 1201 uint32_t line); 1202 1203 #define qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes) \ 1204 qdf_nbuf_map_nbytes_debug(osdev, buf, dir, nbytes, __func__, __LINE__) 1205 1206 void qdf_nbuf_unmap_nbytes_debug(qdf_device_t osdev, 1207 qdf_nbuf_t buf, 1208 qdf_dma_dir_t dir, 1209 int nbytes, 1210 const char *func, 1211 uint32_t line); 1212 1213 #define qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes) \ 1214 qdf_nbuf_unmap_nbytes_debug(osdev, buf, dir, nbytes, __func__, __LINE__) 1215 1216 QDF_STATUS qdf_nbuf_map_nbytes_single_debug(qdf_device_t osdev, 1217 qdf_nbuf_t buf, 1218 qdf_dma_dir_t dir, 1219 int nbytes, 1220 const char *func, 1221 uint32_t line); 1222 1223 #define qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes) \ 1224 qdf_nbuf_map_nbytes_single_debug(osdev, buf, dir, nbytes, \ 1225 __func__, __LINE__) 1226 1227 void qdf_nbuf_unmap_nbytes_single_debug(qdf_device_t osdev, 1228 qdf_nbuf_t buf, 1229 qdf_dma_dir_t dir, 1230 int nbytes, 1231 const char *func, 1232 uint32_t line); 1233 1234 #define qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes) \ 1235 qdf_nbuf_unmap_nbytes_single_debug(osdev, buf, dir, nbytes, \ 1236 __func__, __LINE__) 1237 1238 void qdf_nbuf_unmap_nbytes_single_paddr_debug(qdf_device_t osdev, 1239 qdf_nbuf_t buf, 1240 qdf_dma_addr_t phy_addr, 1241 qdf_dma_dir_t dir, int nbytes, 1242 const char *func, uint32_t line); 1243 1244 #define qdf_nbuf_unmap_nbytes_single_paddr(osdev, buf, phy_addr, dir, nbytes) \ 1245 qdf_nbuf_unmap_nbytes_single_paddr_debug(osdev, buf, phy_addr, \ 1246 dir, nbytes, __func__, \ 1247 __LINE__) 1248 #else /* NBUF_MAP_UNMAP_DEBUG */ 1249 1250 static inline void qdf_nbuf_map_check_for_leaks(void) {} 1251 1252 static inline QDF_STATUS 1253 qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 1254 { 1255 return __qdf_nbuf_map(osdev, buf, dir); 1256 } 1257 1258 static inline void 1259 qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 1260 { 1261 __qdf_nbuf_unmap(osdev, buf, dir); 1262 } 1263 1264 static inline QDF_STATUS 1265 qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 1266 { 1267 return __qdf_nbuf_map_single(osdev, buf, dir); 1268 } 1269 1270 static inline void 1271 qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 1272 { 1273 __qdf_nbuf_unmap_single(osdev, buf, dir); 1274 } 1275 1276 static inline QDF_STATUS 1277 qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf, 1278 qdf_dma_dir_t dir, int nbytes) 1279 { 1280 return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes); 1281 } 1282 1283 static inline void 1284 qdf_nbuf_unmap_nbytes(qdf_device_t osdev, 1285 qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes) 1286 { 1287 __qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes); 1288 } 1289 1290 static inline QDF_STATUS 1291 qdf_nbuf_map_nbytes_single( 1292 qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes) 1293 { 1294 return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes); 1295 } 1296 1297 static inline void 1298 qdf_nbuf_unmap_nbytes_single( 1299 qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes) 1300 { 1301 return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes); 1302 } 1303 1304 static inline void 1305 qdf_nbuf_unmap_nbytes_single_paddr(qdf_device_t osdev, qdf_nbuf_t buf, 1306 qdf_dma_addr_t phy_addr, qdf_dma_dir_t dir, 1307 int nbytes) 1308 { 1309 __qdf_mem_unmap_nbytes_single(osdev, phy_addr, dir, nbytes); 1310 } 1311 #endif /* NBUF_MAP_UNMAP_DEBUG */ 1312 1313 /** 1314 * qdf_nbuf_queue_head_dequeue() - dequeue nbuf from the head of queue 1315 * @nbuf_queue_head: pointer to nbuf queue head 1316 * 1317 * Return: pointer to network buffer dequeued 1318 */ 1319 static inline 1320 qdf_nbuf_t qdf_nbuf_queue_head_dequeue(qdf_nbuf_queue_head_t *nbuf_queue_head) 1321 { 1322 return __qdf_nbuf_queue_head_dequeue(nbuf_queue_head); 1323 } 1324 1325 /** 1326 * qdf_nbuf_queue_head_qlen() - length of the queue 1327 * @nbuf_queue_head: pointer to nbuf queue head 1328 * 1329 * Return: length of queue (number of nbufs) pointed by qdf_nbuf_queue_head_t 1330 */ 1331 static inline 1332 uint32_t qdf_nbuf_queue_head_qlen(qdf_nbuf_queue_head_t *nbuf_queue_head) 1333 { 1334 return __qdf_nbuf_queue_head_qlen(nbuf_queue_head); 1335 } 1336 1337 /** 1338 * qdf_nbuf_queue_head_enqueue_tail() - enqueue nbuf into queue tail 1339 * @nbuf_queue_head: pointer to nbuf queue head 1340 * @nbuf: nbuf to be enqueued 1341 * 1342 * Return: None 1343 */ 1344 static inline 1345 void qdf_nbuf_queue_head_enqueue_tail(qdf_nbuf_queue_head_t *nbuf_queue_head, 1346 qdf_nbuf_t nbuf) 1347 { 1348 return __qdf_nbuf_queue_head_enqueue_tail(nbuf_queue_head, nbuf); 1349 } 1350 1351 /** 1352 * qdf_nbuf_queue_head_init() - initialize qdf_nbuf_queue_head_t 1353 * @nbuf_queue_head: pointer to nbuf queue head to be initialized 1354 * 1355 * Return: None 1356 */ 1357 static inline 1358 void qdf_nbuf_queue_head_init(qdf_nbuf_queue_head_t *nbuf_queue_head) 1359 { 1360 return __qdf_nbuf_queue_head_init(nbuf_queue_head); 1361 } 1362 1363 /** 1364 * qdf_nbuf_queue_head_purge() - purge qdf_nbuf_queue_head_t 1365 * @nbuf_queue_head: pointer to nbuf queue head to be purged 1366 * 1367 * Return: None 1368 */ 1369 static inline 1370 void qdf_nbuf_queue_head_purge(qdf_nbuf_queue_head_t *nbuf_queue_head) 1371 { 1372 return __qdf_nbuf_queue_head_purge(nbuf_queue_head); 1373 } 1374 1375 /** 1376 * qdf_nbuf_queue_head_lock() - Acquire the nbuf_queue_head lock 1377 * @head: nbuf_queue_head of the nbuf_list for which lock is to be acquired 1378 * 1379 * Return: void 1380 */ 1381 static inline void qdf_nbuf_queue_head_lock(qdf_nbuf_queue_head_t *head) 1382 { 1383 __qdf_nbuf_queue_head_lock(head); 1384 } 1385 1386 /** 1387 * qdf_nbuf_queue_head_unlock() - Release the nbuf queue lock 1388 * @head: nbuf_queue_head of the nbuf_list for which lock is to be release 1389 * 1390 * Return: void 1391 */ 1392 static inline void qdf_nbuf_queue_head_unlock(qdf_nbuf_queue_head_t *head) 1393 { 1394 __qdf_nbuf_queue_head_unlock(head); 1395 } 1396 1397 static inline void 1398 qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 1399 { 1400 __qdf_nbuf_sync_for_cpu(osdev, buf, dir); 1401 } 1402 1403 /** 1404 * qdf_nbuf_dma_inv_range() - Invalidate the specified virtual address range 1405 * @buf_start: start address 1406 * @buf_end: end address 1407 * 1408 * Return: none 1409 */ 1410 static inline void 1411 qdf_nbuf_dma_inv_range(const void *buf_start, const void *buf_end) 1412 { 1413 __qdf_nbuf_dma_inv_range(buf_start, buf_end); 1414 } 1415 1416 /** 1417 * qdf_nbuf_dma_inv_range_no_dsb() - barrierless Invalidate the specified 1418 * virtual address range 1419 * @buf_start: start address 1420 * @buf_end: end address 1421 * 1422 * Return: none 1423 */ 1424 static inline void 1425 qdf_nbuf_dma_inv_range_no_dsb(const void *buf_start, const void *buf_end) 1426 { 1427 __qdf_nbuf_dma_inv_range_no_dsb(buf_start, buf_end); 1428 } 1429 1430 /** 1431 * qdf_nbuf_dma_clean_range_no_dsb() - barrierless clean the specified 1432 * virtual address range 1433 * @buf_start: start address 1434 * @buf_end: end address 1435 * 1436 * Return: none 1437 */ 1438 static inline void 1439 qdf_nbuf_dma_clean_range_no_dsb(const void *buf_start, const void *buf_end) 1440 { 1441 __qdf_nbuf_dma_clean_range_no_dsb(buf_start, buf_end); 1442 } 1443 1444 static inline void 1445 qdf_dsb(void) 1446 { 1447 __qdf_dsb(); 1448 } 1449 1450 static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf) 1451 { 1452 return __qdf_nbuf_get_num_frags(buf); 1453 } 1454 1455 /** 1456 * qdf_nbuf_dma_clean_range() - Clean the specified virtual address range 1457 * @buf_start: start address 1458 * @buf_end: end address 1459 * 1460 * Return: none 1461 */ 1462 static inline void 1463 qdf_nbuf_dma_clean_range(const void *buf_start, const void *buf_end) 1464 { 1465 __qdf_nbuf_dma_clean_range(buf_start, buf_end); 1466 } 1467 1468 /** 1469 * qdf_nbuf_get_frag_len() - get fragment length 1470 * @buf: Network buffer 1471 * @frag_num: Fragment number 1472 * 1473 * Return: Fragment length 1474 */ 1475 static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num) 1476 { 1477 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 1478 return __qdf_nbuf_get_frag_len(buf, frag_num); 1479 } 1480 1481 /** 1482 * qdf_nbuf_get_frag_vaddr() - get fragment virtual address 1483 * @buf: Network buffer 1484 * @frag_num: Fragment number 1485 * 1486 * Return: Fragment virtual address 1487 */ 1488 static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf, 1489 int frag_num) 1490 { 1491 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 1492 return __qdf_nbuf_get_frag_vaddr(buf, frag_num); 1493 } 1494 1495 /** 1496 * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address 1497 * @buf: Network buffer 1498 * 1499 * Return: Fragment virtual address 1500 */ 1501 static inline unsigned char * 1502 qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf) 1503 { 1504 return __qdf_nbuf_get_frag_vaddr_always(buf); 1505 } 1506 1507 /** 1508 * qdf_nbuf_get_frag_paddr() - get physical address for skb linear buffer 1509 * or skb fragment, based on frag_num passed 1510 * @buf: Network buffer 1511 * @frag_num: Fragment number 1512 * 1513 * Return: Fragment physical address 1514 */ 1515 static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf, 1516 unsigned int frag_num) 1517 { 1518 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 1519 return __qdf_nbuf_get_frag_paddr(buf, frag_num); 1520 } 1521 1522 /** 1523 * qdf_nbuf_get_tx_frag_paddr() - get physical address for skb fragments only 1524 * @buf: Network buffer 1525 * 1526 * Return: Fragment physical address 1527 * Usage guideline: Use “qdf_nbuf_frag_map()” to dma map the specific 1528 * skb fragment , followed by “qdf_nbuf_get_tx_frag_paddr” 1529 */ 1530 static inline qdf_dma_addr_t qdf_nbuf_get_tx_frag_paddr(qdf_nbuf_t buf) 1531 { 1532 return __qdf_nbuf_get_tx_frag_paddr(buf); 1533 } 1534 1535 /** 1536 * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream 1537 * @buf: Network buffer 1538 * @frag_num: Fragment number 1539 * 1540 * Return: Fragment wordstream or not 1541 */ 1542 static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num) 1543 { 1544 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 1545 return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num); 1546 } 1547 1548 /** 1549 * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream 1550 * @buf: Network buffer 1551 * @frag_num: Fragment number 1552 * @is_wordstream: Wordstream 1553 * 1554 * Return: none 1555 */ 1556 static inline void 1557 qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf, 1558 int frag_num, int is_wordstream) 1559 { 1560 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 1561 __qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream); 1562 } 1563 1564 static inline void 1565 qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, uint8_t vdev_id) 1566 { 1567 __qdf_nbuf_set_vdev_ctx(buf, vdev_id); 1568 } 1569 1570 static inline void 1571 qdf_nbuf_set_tx_ftype(qdf_nbuf_t buf, enum cb_ftype type) 1572 { 1573 __qdf_nbuf_set_tx_ftype(buf, type); 1574 } 1575 1576 static inline void 1577 qdf_nbuf_set_rx_ftype(qdf_nbuf_t buf, enum cb_ftype type) 1578 { 1579 __qdf_nbuf_set_rx_ftype(buf, type); 1580 } 1581 1582 1583 1584 static inline uint8_t 1585 qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf) 1586 { 1587 return __qdf_nbuf_get_vdev_ctx(buf); 1588 } 1589 1590 static inline enum cb_ftype qdf_nbuf_get_tx_ftype(qdf_nbuf_t buf) 1591 { 1592 return __qdf_nbuf_get_tx_ftype(buf); 1593 } 1594 1595 static inline enum cb_ftype qdf_nbuf_get_rx_ftype(qdf_nbuf_t buf) 1596 { 1597 return __qdf_nbuf_get_rx_ftype(buf); 1598 } 1599 1600 1601 static inline qdf_dma_addr_t 1602 qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf) 1603 { 1604 return __qdf_nbuf_mapped_paddr_get(buf); 1605 } 1606 1607 static inline void 1608 qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr) 1609 { 1610 __qdf_nbuf_mapped_paddr_set(buf, paddr); 1611 } 1612 1613 static inline void 1614 qdf_nbuf_frag_push_head(qdf_nbuf_t buf, 1615 int frag_len, unsigned char *frag_vaddr, 1616 qdf_dma_addr_t frag_paddr) 1617 { 1618 __qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr); 1619 } 1620 1621 #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf)) 1622 1623 /** 1624 * qdf_nbuf_set_rx_chfrag_start() - set msdu start bit 1625 * @buf: Network buffer 1626 * @val: 0/1 1627 * 1628 * Return: void 1629 */ 1630 static inline void 1631 qdf_nbuf_set_rx_chfrag_start(qdf_nbuf_t buf, uint8_t val) 1632 { 1633 __qdf_nbuf_set_rx_chfrag_start(buf, val); 1634 } 1635 1636 /** 1637 * qdf_nbuf_is_rx_chfrag_start() - get msdu start bit 1638 * @buf: Network buffer 1639 * 1640 * Return: integer value - 0/1 1641 */ 1642 static inline int qdf_nbuf_is_rx_chfrag_start(qdf_nbuf_t buf) 1643 { 1644 return __qdf_nbuf_is_rx_chfrag_start(buf); 1645 } 1646 1647 /** 1648 * qdf_nbuf_set_rx_chfrag_cont() - set msdu continuation bit 1649 * @buf: Network buffer 1650 * @val: 0/1 1651 * 1652 * Return: void 1653 */ 1654 static inline void 1655 qdf_nbuf_set_rx_chfrag_cont(qdf_nbuf_t buf, uint8_t val) 1656 { 1657 __qdf_nbuf_set_rx_chfrag_cont(buf, val); 1658 } 1659 1660 /** 1661 * qdf_nbuf_is_rx_chfrag_cont() - get msdu continuation bit 1662 * @buf: Network buffer 1663 * 1664 * Return: integer value - 0/1 1665 */ 1666 static inline int qdf_nbuf_is_rx_chfrag_cont(qdf_nbuf_t buf) 1667 { 1668 return __qdf_nbuf_is_rx_chfrag_cont(buf); 1669 } 1670 1671 /** 1672 * qdf_nbuf_set_rx_chfrag_end() - set msdu end bit 1673 * @buf: Network buffer 1674 * @val: 0/1 1675 * 1676 * Return: void 1677 */ 1678 static inline void qdf_nbuf_set_rx_chfrag_end(qdf_nbuf_t buf, uint8_t val) 1679 { 1680 __qdf_nbuf_set_rx_chfrag_end(buf, val); 1681 } 1682 1683 /** 1684 * qdf_nbuf_is_rx_chfrag_end() - set msdu end bit 1685 * @buf: Network buffer 1686 * 1687 * Return: integer value - 0/1 1688 */ 1689 static inline int qdf_nbuf_is_rx_chfrag_end(qdf_nbuf_t buf) 1690 { 1691 return __qdf_nbuf_is_rx_chfrag_end(buf); 1692 } 1693 1694 /** 1695 * qdf_nbuf_set_da_mcbc() - set da is mcbc 1696 * @buf: Network buffer 1697 * @val: 0/1 1698 * 1699 * Return: void 1700 */ 1701 static inline void 1702 qdf_nbuf_set_da_mcbc(qdf_nbuf_t buf, uint8_t val) 1703 { 1704 __qdf_nbuf_set_da_mcbc(buf, val); 1705 } 1706 1707 /** 1708 * qdf_nbuf_is_da_mcbc() - get da is mcbc bit 1709 * @buf: Network buffer 1710 * 1711 * Return: integer value - 0/1 1712 */ 1713 static inline int qdf_nbuf_is_da_mcbc(qdf_nbuf_t buf) 1714 { 1715 return __qdf_nbuf_is_da_mcbc(buf); 1716 } 1717 1718 /** 1719 * qdf_nbuf_set_da_valid() - set da valid bit 1720 * @buf: Network buffer 1721 * @val: 0/1 1722 * 1723 * Return: void 1724 */ 1725 static inline void qdf_nbuf_set_da_valid(qdf_nbuf_t buf, uint8_t val) 1726 { 1727 __qdf_nbuf_set_da_valid(buf, val); 1728 } 1729 1730 /** 1731 * qdf_nbuf_is_da_valid() - get da valid bit 1732 * @buf: Network buffer 1733 * 1734 * Return: integer value - 0/1 1735 */ 1736 static inline int qdf_nbuf_is_da_valid(qdf_nbuf_t buf) 1737 { 1738 return __qdf_nbuf_is_da_valid(buf); 1739 } 1740 1741 /** 1742 * qdf_nbuf_set_sa_valid() - set sa valid bit 1743 * @buf: Network buffer 1744 * @val: 0/1 1745 * 1746 * Return: void 1747 */ 1748 static inline void qdf_nbuf_set_sa_valid(qdf_nbuf_t buf, uint8_t val) 1749 { 1750 __qdf_nbuf_set_sa_valid(buf, val); 1751 } 1752 1753 /** 1754 * qdf_nbuf_is_sa_valid() - get da valid bit 1755 * @buf: Network buffer 1756 * 1757 * Return: integer value - 0/1 1758 */ 1759 static inline int qdf_nbuf_is_sa_valid(qdf_nbuf_t buf) 1760 { 1761 return __qdf_nbuf_is_sa_valid(buf); 1762 } 1763 1764 /** 1765 * qdf_nbuf_set_rx_retry_flag() - set rx retry flag bit 1766 * @buf: Network buffer 1767 * @val: 0/1 1768 * 1769 * Return: void 1770 */ 1771 static inline void qdf_nbuf_set_rx_retry_flag(qdf_nbuf_t buf, uint8_t val) 1772 { 1773 __qdf_nbuf_set_rx_retry_flag(buf, val); 1774 } 1775 1776 /** 1777 * qdf_nbuf_is_rx_retry_flag() - get rx retry flag bit 1778 * @buf: Network buffer 1779 * 1780 * Return: integer value - 0/1 1781 */ 1782 static inline int qdf_nbuf_is_rx_retry_flag(qdf_nbuf_t buf) 1783 { 1784 return __qdf_nbuf_is_rx_retry_flag(buf); 1785 } 1786 1787 /** 1788 * qdf_nbuf_set_raw_frame() - set raw_frame bit 1789 * @buf: Network buffer 1790 * @val: 0/1 1791 * 1792 * Return: void 1793 */ 1794 static inline void qdf_nbuf_set_raw_frame(qdf_nbuf_t buf, uint8_t val) 1795 { 1796 __qdf_nbuf_set_raw_frame(buf, val); 1797 } 1798 1799 /** 1800 * qdf_nbuf_is_raw_frame() - get raw_frame bit 1801 * @buf: Network buffer 1802 * 1803 * Return: integer value - 0/1 1804 */ 1805 static inline int qdf_nbuf_is_raw_frame(qdf_nbuf_t buf) 1806 { 1807 return __qdf_nbuf_is_raw_frame(buf); 1808 } 1809 1810 /** 1811 * qdf_nbuf_set_tid_val() - set tid_val 1812 * @buf: Network buffer 1813 * @val: 4 bits tid value 1814 */ 1815 static inline void qdf_nbuf_set_tid_val(qdf_nbuf_t buf, uint8_t val) 1816 { 1817 __qdf_nbuf_set_tid_val(buf, val); 1818 } 1819 1820 /** 1821 * qdf_nbuf_get_tid_val() - get tid_val 1822 * @buf: Network buffer 1823 * 1824 * Return: integer value[4 bits tid value] 1825 */ 1826 static inline uint8_t qdf_nbuf_get_tid_val(qdf_nbuf_t buf) 1827 { 1828 return __qdf_nbuf_get_tid_val(buf); 1829 } 1830 1831 /** 1832 * qdf_nbuf_set_frag_list() - set frag list bit 1833 * @buf: Network buffer 1834 * @val: 0/1 1835 * 1836 * Return: void 1837 */ 1838 static inline void qdf_nbuf_set_is_frag(qdf_nbuf_t buf, uint8_t val) 1839 { 1840 __qdf_nbuf_set_is_frag(buf, val); 1841 } 1842 1843 /** 1844 * qdf_nbuf_is_sa_valid() - get da frag list bit 1845 * @buf: Network buffer 1846 * 1847 * Return: integer value - 0/1 1848 */ 1849 static inline int qdf_nbuf_is_frag(qdf_nbuf_t buf) 1850 { 1851 return __qdf_nbuf_is_frag(buf); 1852 } 1853 1854 /** 1855 * qdf_nbuf_set_tx_chfrag_start() - set msdu start bit 1856 * @buf: Network buffer 1857 * @val: 0/1 1858 * 1859 * Return: void 1860 */ 1861 static inline void 1862 qdf_nbuf_set_tx_chfrag_start(qdf_nbuf_t buf, uint8_t val) 1863 { 1864 __qdf_nbuf_set_tx_chfrag_start(buf, val); 1865 } 1866 1867 /** 1868 * qdf_nbuf_is_tx_chfrag_start() - get msdu start bit 1869 * @buf: Network buffer 1870 * 1871 * Return: integer value - 0/1 1872 */ 1873 static inline int qdf_nbuf_is_tx_chfrag_start(qdf_nbuf_t buf) 1874 { 1875 return __qdf_nbuf_is_tx_chfrag_start(buf); 1876 } 1877 1878 /** 1879 * qdf_nbuf_set_tx_chfrag_cont() - set msdu continuation bit 1880 * @buf: Network buffer 1881 * @val: 0/1 1882 * 1883 * Return: void 1884 */ 1885 static inline void 1886 qdf_nbuf_set_tx_chfrag_cont(qdf_nbuf_t buf, uint8_t val) 1887 { 1888 __qdf_nbuf_set_tx_chfrag_cont(buf, val); 1889 } 1890 1891 /** 1892 * qdf_nbuf_is_tx_chfrag_cont() - get msdu continuation bit 1893 * @buf: Network buffer 1894 * 1895 * Return: integer value - 0/1 1896 */ 1897 static inline int qdf_nbuf_is_tx_chfrag_cont(qdf_nbuf_t buf) 1898 { 1899 return __qdf_nbuf_is_tx_chfrag_cont(buf); 1900 } 1901 1902 /** 1903 * qdf_nbuf_set_tx_chfrag_end() - set msdu end bit 1904 * @buf: Network buffer 1905 * @val: 0/1 1906 * 1907 * Return: void 1908 */ 1909 static inline void qdf_nbuf_set_tx_chfrag_end(qdf_nbuf_t buf, uint8_t val) 1910 { 1911 __qdf_nbuf_set_tx_chfrag_end(buf, val); 1912 } 1913 1914 /** 1915 * qdf_nbuf_is_tx_chfrag_end() - set msdu end bit 1916 * @buf: Network buffer 1917 * 1918 * Return: integer value - 0/1 1919 */ 1920 static inline int qdf_nbuf_is_tx_chfrag_end(qdf_nbuf_t buf) 1921 { 1922 return __qdf_nbuf_is_tx_chfrag_end(buf); 1923 } 1924 1925 static inline void 1926 qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg) 1927 { 1928 __qdf_nbuf_dma_map_info(bmap, sg); 1929 } 1930 1931 /** 1932 * qdf_nbuf_is_tso() - is the network buffer a jumbo packet? 1933 * @buf: Network buffer 1934 * 1935 * Return: 1 - this is a jumbo packet 0 - not a jumbo packet 1936 */ 1937 static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf) 1938 { 1939 return __qdf_nbuf_is_tso(nbuf); 1940 } 1941 1942 /** 1943 * qdf_nbuf_get_users() - function to get the number of users referencing this 1944 * network buffer 1945 * 1946 * @nbuf: network buffer 1947 * 1948 * Return: number of user references to nbuf. 1949 */ 1950 static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf) 1951 { 1952 return __qdf_nbuf_get_users(nbuf); 1953 } 1954 1955 /** 1956 * qdf_nbuf_next() - get the next packet in the linked list 1957 * @buf: Network buffer 1958 * 1959 * This function can be used when nbufs are directly linked into a list, 1960 * rather than using a separate network buffer queue object. 1961 * 1962 * Return: next network buffer in the linked list 1963 */ 1964 static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf) 1965 { 1966 return __qdf_nbuf_next(buf); 1967 } 1968 1969 #ifdef NBUF_MEMORY_DEBUG 1970 1971 #define QDF_NET_BUF_TRACK_MAX_SIZE (1024) 1972 1973 enum qdf_nbuf_event_type { 1974 QDF_NBUF_ALLOC, 1975 QDF_NBUF_ALLOC_CLONE, 1976 QDF_NBUF_ALLOC_COPY, 1977 QDF_NBUF_ALLOC_FAILURE, 1978 QDF_NBUF_FREE, 1979 QDF_NBUF_MAP, 1980 QDF_NBUF_UNMAP, 1981 QDF_NBUF_ALLOC_COPY_EXPAND, 1982 QDF_NBUF_SMMU_MAP, 1983 QDF_NBUF_SMMU_UNMAP, 1984 }; 1985 1986 void qdf_net_buf_debug_init(void); 1987 void qdf_net_buf_debug_exit(void); 1988 void qdf_net_buf_debug_clean(void); 1989 void qdf_nbuf_history_add(qdf_nbuf_t nbuf, const char *func, uint32_t line, 1990 enum qdf_nbuf_event_type type); 1991 void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size, 1992 const char *func_name, uint32_t line_num); 1993 /** 1994 * qdf_net_buf_debug_update_node() - update nbuf in debug hash table 1995 * 1996 * Return: none 1997 */ 1998 void qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name, 1999 uint32_t line_num); 2000 void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf); 2001 2002 /** 2003 * qdf_net_buf_debug_update_map_node() - update nbuf in debug 2004 * hash table with the mapping function info 2005 * @nbuf: network buffer 2006 * @func: function name that requests for mapping the nbuf 2007 * @line_num: function line number 2008 * 2009 * Return: none 2010 */ 2011 void qdf_net_buf_debug_update_map_node(qdf_nbuf_t net_buf, 2012 const char *func_name, 2013 uint32_t line_num); 2014 2015 /** 2016 * qdf_nbuf_smmu_map_debug() - map smmu buffer 2017 * @nbuf: network buffer 2018 * @hdl: ipa handle 2019 * @num_buffers: number of buffers 2020 * @info: memory info 2021 * @func: function name 2022 * @line: line number 2023 * 2024 * Return: QDF_STATUS 2025 */ 2026 QDF_STATUS qdf_nbuf_smmu_map_debug(qdf_nbuf_t nbuf, 2027 uint8_t hdl, 2028 uint8_t num_buffers, 2029 qdf_mem_info_t *info, 2030 const char *func, 2031 uint32_t line); 2032 2033 /** 2034 * qdf_nbuf_smmu_unmap_debug() - unmap smmu buffer 2035 * @nbuf: network buffer 2036 * @hdl: ipa handle 2037 * @num_buffers: number of buffers 2038 * @info: memory info 2039 * @func: function name 2040 * @line: line number 2041 * 2042 * Return: QDF_STATUS 2043 */ 2044 QDF_STATUS qdf_nbuf_smmu_unmap_debug(qdf_nbuf_t nbuf, 2045 uint8_t hdl, 2046 uint8_t num_buffers, 2047 qdf_mem_info_t *info, 2048 const char *func, 2049 uint32_t line); 2050 2051 #ifdef NBUF_SMMU_MAP_UNMAP_DEBUG 2052 /** 2053 * qdf_nbuf_map_check_for_smmu_leaks() - check for nbuf smmu map leaks 2054 * 2055 * Check for net buffers that have been smmu mapped, but never smmu unmapped. 2056 * 2057 * Returns: None 2058 */ 2059 void qdf_nbuf_map_check_for_smmu_leaks(void); 2060 2061 /** 2062 * qdf_net_buf_debug_update_smmu_map_node() - update nbuf in debug 2063 * hash table with the mapping function info 2064 * @nbuf: network buffer 2065 * @iova: Virtual address of buffer 2066 * @pa: Physical address of buffer 2067 * @func: function name that requests for mapping the nbuf 2068 * @line: function line number 2069 * 2070 * Return: none 2071 */ 2072 void qdf_net_buf_debug_update_smmu_map_node(qdf_nbuf_t nbuf, 2073 unsigned long iova, 2074 unsigned long pa, 2075 const char *func, 2076 uint32_t line); 2077 2078 /** 2079 * qdf_net_buf_debug_update_smmu_unmap_node() - update nbuf in debug 2080 * hash table with the unmapping function info 2081 * @nbuf: network buffer 2082 * @iova: Virtual address of buffer 2083 * @pa: Physical address of buffer 2084 * @func: function name that requests for unmapping the nbuf 2085 * @line: function line number 2086 * 2087 * Return: none 2088 */ 2089 void qdf_net_buf_debug_update_smmu_unmap_node(qdf_nbuf_t nbuf, 2090 unsigned long iova, 2091 unsigned long pa, 2092 const char *func, 2093 uint32_t line); 2094 #endif 2095 2096 /** 2097 * qdf_net_buf_debug_update_unmap_node() - update nbuf in debug 2098 * hash table with the unmap function info 2099 * @nbuf: network buffer 2100 * @func: function name that requests for unmapping the nbuf 2101 * @line_num: function line number 2102 * 2103 * Return: none 2104 */ 2105 void qdf_net_buf_debug_update_unmap_node(qdf_nbuf_t net_buf, 2106 const char *func_name, 2107 uint32_t line_num); 2108 2109 /** 2110 * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak 2111 * @net_buf: Network buf holding head segment (single) 2112 * @func_name: pointer to function name 2113 * @line_num: line number 2114 * 2115 * WLAN driver module's SKB which are allocated by network stack are 2116 * suppose to call this API before freeing it such that the SKB 2117 * is not reported as memory leak. 2118 * 2119 * Return: none 2120 */ 2121 void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf, 2122 const char *func_name, 2123 uint32_t line_num); 2124 void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf); 2125 2126 /* nbuf allocation routines */ 2127 2128 #define qdf_nbuf_alloc_simple(d, s, r, a, p) \ 2129 __qdf_nbuf_alloc_simple(d, s, __func__, __LINE__) 2130 2131 #define qdf_nbuf_alloc(d, s, r, a, p) \ 2132 qdf_nbuf_alloc_debug(d, s, r, a, p, __func__, __LINE__) 2133 2134 qdf_nbuf_t qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size, 2135 int reserve, int align, int prio, 2136 const char *func, uint32_t line); 2137 2138 /** 2139 * qdf_nbuf_alloc_no_recycler() - Allocates skb 2140 * @size: Size to be allocated for skb 2141 * @reserve: Reserved headroom size 2142 * @align: Align 2143 * @func: Function name of the call site 2144 * @line: Line number of the callsite 2145 * 2146 * This API allocates skb of required size and aligns if needed and reserves 2147 * some space in the front. This skb allocation is not from skb recycler pool. 2148 * 2149 * Return: Allocated nbuf pointer 2150 */ 2151 #define qdf_nbuf_alloc_no_recycler(s, r, a) \ 2152 qdf_nbuf_alloc_no_recycler_debug(s, r, a, __func__, __LINE__) 2153 2154 qdf_nbuf_t qdf_nbuf_alloc_no_recycler_debug(size_t size, int reserve, int align, 2155 const char *func, uint32_t line); 2156 #define qdf_nbuf_free(d) \ 2157 qdf_nbuf_free_debug(d, __func__, __LINE__) 2158 2159 void qdf_nbuf_free_debug(qdf_nbuf_t nbuf, const char *func, uint32_t line); 2160 2161 #define qdf_nbuf_free_simple(d) \ 2162 qdf_nbuf_free_debug_simple(d, __func__, __LINE__) 2163 2164 void qdf_nbuf_free_debug_simple(qdf_nbuf_t nbuf, const char *func, 2165 uint32_t line); 2166 2167 #define qdf_nbuf_clone(buf) \ 2168 qdf_nbuf_clone_debug(buf, __func__, __LINE__) 2169 2170 /** 2171 * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly) 2172 * @buf: nbuf to clone from 2173 * @func: name of the calling function 2174 * @line: line number of the callsite 2175 * 2176 * This function clones the nbuf and creates a memory tracking 2177 * node corresponding to that cloned skbuff structure. 2178 * 2179 * Return: cloned buffer 2180 */ 2181 qdf_nbuf_t qdf_nbuf_clone_debug(qdf_nbuf_t buf, const char *func, 2182 uint32_t line); 2183 2184 #define qdf_nbuf_copy(buf) \ 2185 qdf_nbuf_copy_debug(buf, __func__, __LINE__) 2186 2187 /** 2188 * qdf_nbuf_copy_debug() - returns a private copy of the buf 2189 * @buf: nbuf to copy from 2190 * @func: name of the calling function 2191 * @line: line number of the callsite 2192 * 2193 * This API returns a private copy of the buf, the buf returned is completely 2194 * modifiable by callers. It also creates a memory tracking node corresponding 2195 * to that new skbuff structure. 2196 * 2197 * Return: copied buffer 2198 */ 2199 qdf_nbuf_t qdf_nbuf_copy_debug(qdf_nbuf_t buf, const char *func, uint32_t line); 2200 2201 #define qdf_nbuf_copy_expand(buf, headroom, tailroom) \ 2202 qdf_nbuf_copy_expand_debug(buf, headroom, tailroom, __func__, __LINE__) 2203 2204 /** 2205 * qdf_nbuf_copy_expand_debug() - copy and expand nbuf 2206 * @buf: Network buf instance 2207 * @headroom: Additional headroom to be added 2208 * @tailroom: Additional tailroom to be added 2209 * @func: name of the calling function 2210 * @line: line number of the callsite 2211 * 2212 * Return: New nbuf that is a copy of buf, with additional head and tailroom 2213 * or NULL if there is no memory 2214 */ 2215 qdf_nbuf_t 2216 qdf_nbuf_copy_expand_debug(qdf_nbuf_t buf, int headroom, int tailroom, 2217 const char *func, uint32_t line); 2218 2219 /** 2220 * qdf_nbuf_unshare() - make a copy of the shared nbuf 2221 * @buf: Network buf instance 2222 * 2223 * Return: New nbuf which is a copy of the received nbuf if it is cloned, 2224 * else, return the original nbuf 2225 */ 2226 #define qdf_nbuf_unshare(d) \ 2227 qdf_nbuf_unshare_debug(d, __func__, __LINE__) 2228 2229 qdf_nbuf_t 2230 qdf_nbuf_unshare_debug(qdf_nbuf_t buf, const char *func_name, 2231 uint32_t line_num); 2232 2233 #else /* NBUF_MEMORY_DEBUG */ 2234 2235 static inline void qdf_net_buf_debug_init(void) {} 2236 static inline void qdf_net_buf_debug_exit(void) {} 2237 2238 static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf, 2239 const char *func_name, 2240 uint32_t line_num) 2241 { 2242 } 2243 2244 static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf) 2245 { 2246 } 2247 2248 static inline void 2249 qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name, 2250 uint32_t line_num) 2251 { 2252 } 2253 2254 static inline void 2255 qdf_net_buf_debug_update_map_node(qdf_nbuf_t net_buf, 2256 const char *func_name, 2257 uint32_t line_num) 2258 { 2259 } 2260 2261 static inline void 2262 qdf_net_buf_debug_update_unmap_node(qdf_nbuf_t net_buf, 2263 const char *func_name, 2264 uint32_t line_num) 2265 { 2266 } 2267 /* Nbuf allocation routines */ 2268 2269 #define qdf_nbuf_alloc_simple(osdev, size, reserve, align, prio) \ 2270 qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \ 2271 __func__, __LINE__) 2272 2273 #define qdf_nbuf_alloc(osdev, size, reserve, align, prio) \ 2274 qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \ 2275 __func__, __LINE__) 2276 2277 #define qdf_nbuf_alloc_no_recycler(size, reserve, align) \ 2278 qdf_nbuf_alloc_no_recycler_fl(size, reserve, align, __func__, __LINE__) 2279 2280 static inline qdf_nbuf_t 2281 qdf_nbuf_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve, int align, 2282 int prio, const char *func, uint32_t line) 2283 { 2284 return __qdf_nbuf_alloc(osdev, size, reserve, align, prio, func, line); 2285 } 2286 2287 /** 2288 * qdf_nbuf_alloc_no_recycler_fl() - Allocate SKB 2289 * @size: Size to be allocated for skb 2290 * @reserve: Reserved headroom size 2291 * @align: Align 2292 * @func: Function name of the call site 2293 * @line: Line number of the callsite 2294 * 2295 * This API allocates skb of required size and aligns if needed and reserves 2296 * some space in the front. This skb allocation is not from skb recycler pool. 2297 * 2298 * Return: Allocated nbuf pointer 2299 */ 2300 static inline qdf_nbuf_t 2301 qdf_nbuf_alloc_no_recycler_fl(size_t size, int reserve, int align, 2302 const char *func, uint32_t line) 2303 { 2304 return __qdf_nbuf_alloc_no_recycler(size, reserve, align, func, line); 2305 } 2306 2307 #define qdf_nbuf_free_simple(d) qdf_nbuf_free(d) 2308 2309 static inline void qdf_nbuf_free(qdf_nbuf_t buf) 2310 { 2311 if (qdf_likely(buf)) 2312 __qdf_nbuf_free(buf); 2313 } 2314 2315 /** 2316 * qdf_nbuf_clone() - clone the nbuf (copy is readonly) 2317 * @buf: Pointer to network buffer 2318 * 2319 * This function clones the nbuf and returns new sk_buff 2320 * structure. 2321 * 2322 * Return: cloned skb 2323 */ 2324 static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf) 2325 { 2326 return __qdf_nbuf_clone(buf); 2327 } 2328 2329 /** 2330 * qdf_nbuf_copy() - returns a private copy of the buf 2331 * @buf: Pointer to network buffer 2332 * 2333 * This API returns a private copy of the buf, the buf returned is completely 2334 * modifiable by callers 2335 * 2336 * Return: skb or NULL 2337 */ 2338 static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf) 2339 { 2340 return __qdf_nbuf_copy(buf); 2341 } 2342 2343 /** 2344 * qdf_nbuf_copy_expand() - copy and expand nbuf 2345 * @buf: Network buf instance 2346 * @headroom: Additional headroom to be added 2347 * @tailroom: Additional tailroom to be added 2348 * 2349 * Return: New nbuf that is a copy of buf, with additional head and tailroom 2350 * or NULL if there is no memory 2351 */ 2352 static inline qdf_nbuf_t qdf_nbuf_copy_expand(qdf_nbuf_t buf, int headroom, 2353 int tailroom) 2354 { 2355 return __qdf_nbuf_copy_expand(buf, headroom, tailroom); 2356 } 2357 2358 static inline qdf_nbuf_t qdf_nbuf_unshare(qdf_nbuf_t buf) 2359 { 2360 return __qdf_nbuf_unshare(buf); 2361 } 2362 #endif /* NBUF_MEMORY_DEBUG */ 2363 2364 /** 2365 * qdf_nbuf_kfree() - Free nbuf using kfree 2366 * @buf: Pointer to network buffer 2367 * 2368 * This function is called to free the skb on failure cases 2369 * 2370 * Return: None 2371 */ 2372 static inline void qdf_nbuf_kfree(qdf_nbuf_t buf) 2373 { 2374 __qdf_nbuf_kfree(buf); 2375 } 2376 2377 /** 2378 * qdf_nbuf_dev_kfree() - Free nbuf using dev based os call 2379 * @buf: Pointer to network buffer 2380 * 2381 * This function is called to free the skb on failure cases 2382 * 2383 * Return: None 2384 */ 2385 static inline void qdf_nbuf_dev_kfree(qdf_nbuf_t buf) 2386 { 2387 __qdf_nbuf_dev_kfree(buf); 2388 } 2389 2390 /** 2391 * qdf_nbuf_copy_expand_fraglist() - copy and expand nbuf and 2392 * get reference of the fraglist. 2393 * @buf: Network buf instance 2394 * @headroom: Additional headroom to be added 2395 * @tailroom: Additional tailroom to be added 2396 * 2397 * Return: New nbuf that is a copy of buf, with additional head and tailroom 2398 * or NULL if there is no memory 2399 */ 2400 static inline qdf_nbuf_t 2401 qdf_nbuf_copy_expand_fraglist(qdf_nbuf_t buf, int headroom, 2402 int tailroom) 2403 { 2404 buf = qdf_nbuf_copy_expand(buf, headroom, tailroom); 2405 2406 /* get fraglist reference */ 2407 if (buf) 2408 __qdf_nbuf_get_ref_fraglist(buf); 2409 2410 return buf; 2411 } 2412 2413 #ifdef WLAN_FEATURE_FASTPATH 2414 /** 2415 * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state 2416 * 2417 * @buf: buf instance 2418 * Return: data pointer of this buf where new data has to be 2419 * put, or NULL if there is not enough room in this buf. 2420 */ 2421 void qdf_nbuf_init_fast(qdf_nbuf_t nbuf); 2422 #endif /* WLAN_FEATURE_FASTPATH */ 2423 2424 /** 2425 * @qdf_nbuf_list_free() - free a list of nbufs 2426 * @buf_list: A list of nbufs to be freed 2427 * 2428 * Return: none 2429 */ 2430 2431 static inline void qdf_nbuf_list_free(qdf_nbuf_t buf_list) 2432 { 2433 while (buf_list) { 2434 qdf_nbuf_t next = qdf_nbuf_next(buf_list); 2435 qdf_nbuf_free(buf_list); 2436 buf_list = next; 2437 } 2438 } 2439 2440 static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err) 2441 { 2442 qdf_nbuf_list_free(buf_list); 2443 } 2444 2445 static inline void qdf_nbuf_ref(qdf_nbuf_t buf) 2446 { 2447 __qdf_nbuf_ref(buf); 2448 } 2449 2450 static inline int qdf_nbuf_shared(qdf_nbuf_t buf) 2451 { 2452 return __qdf_nbuf_shared(buf); 2453 } 2454 2455 static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src) 2456 { 2457 return __qdf_nbuf_cat(dst, src); 2458 } 2459 2460 /** 2461 * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb 2462 * @skb: SKB pointer 2463 * @offset: offset 2464 * @len: Length 2465 * @to: To 2466 * 2467 * Return: int32_t 2468 */ 2469 static inline int32_t 2470 qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to) 2471 { 2472 return __qdf_nbuf_copy_bits(nbuf, offset, len, to); 2473 } 2474 2475 2476 /* nbuf manipulation routines */ 2477 2478 /** 2479 * @qdf_nbuf_head() - return the address of an nbuf's buffer 2480 * @buf: netbuf 2481 * 2482 * Return: head address 2483 */ 2484 static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf) 2485 { 2486 return __qdf_nbuf_head(buf); 2487 } 2488 2489 /** 2490 * qdf_nbuf_data() - Return the address of the start of data within an nbuf 2491 * @buf: Network buffer 2492 * 2493 * Return: Data address 2494 */ 2495 static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf) 2496 { 2497 return __qdf_nbuf_data(buf); 2498 } 2499 2500 /** 2501 * qdf_nbuf_data_addr() - Return the address of skb->data 2502 * @buf: Network buffer 2503 * 2504 * Return: Data address 2505 */ 2506 static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf) 2507 { 2508 return __qdf_nbuf_data_addr(buf); 2509 } 2510 2511 /** 2512 * qdf_nbuf_headroom() - amount of headroom int the current nbuf 2513 * @buf: Network buffer 2514 * 2515 * Return: Amount of head room 2516 */ 2517 static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf) 2518 { 2519 return __qdf_nbuf_headroom(buf); 2520 } 2521 2522 /** 2523 * qdf_nbuf_tailroom() - amount of tail space available 2524 * @buf: Network buffer 2525 * 2526 * Return: amount of tail room 2527 */ 2528 static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf) 2529 { 2530 return __qdf_nbuf_tailroom(buf); 2531 } 2532 2533 /** 2534 * qdf_nbuf_push_head() - push data in the front 2535 * @buf: Network buf instance 2536 * @size: Size to be pushed 2537 * 2538 * Return: New data pointer of this buf after data has been pushed, 2539 * or NULL if there is not enough room in this buf. 2540 */ 2541 static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size) 2542 { 2543 return __qdf_nbuf_push_head(buf, size); 2544 } 2545 2546 /** 2547 * qdf_nbuf_put_tail() - puts data in the end 2548 * @buf: Network buf instance 2549 * @size: Size to be pushed 2550 * 2551 * Return: Data pointer of this buf where new data has to be 2552 * put, or NULL if there is not enough room in this buf. 2553 */ 2554 static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size) 2555 { 2556 return __qdf_nbuf_put_tail(buf, size); 2557 } 2558 2559 /** 2560 * qdf_nbuf_pull_head() - pull data out from the front 2561 * @buf: Network buf instance 2562 * @size: Size to be popped 2563 * 2564 * Return: New data pointer of this buf after data has been popped, 2565 * or NULL if there is not sufficient data to pull. 2566 */ 2567 static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size) 2568 { 2569 return __qdf_nbuf_pull_head(buf, size); 2570 } 2571 2572 /** 2573 * qdf_nbuf_trim_tail() - trim data out from the end 2574 * @buf: Network buf instance 2575 * @size: Size to be popped 2576 * 2577 * Return: none 2578 */ 2579 static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size) 2580 { 2581 __qdf_nbuf_trim_tail(buf, size); 2582 } 2583 2584 /** 2585 * qdf_nbuf_len() - get the length of the buf 2586 * @buf: Network buf instance 2587 * 2588 * Return: total length of this buf. 2589 */ 2590 static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf) 2591 { 2592 return __qdf_nbuf_len(buf); 2593 } 2594 2595 /** 2596 * qdf_nbuf_set_pktlen() - set the length of the buf 2597 * @buf: Network buf instance 2598 * @size: Size to be set 2599 * 2600 * Return: none 2601 */ 2602 static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len) 2603 { 2604 __qdf_nbuf_set_pktlen(buf, len); 2605 } 2606 2607 /** 2608 * qdf_nbuf_reserve() - trim data out from the end 2609 * @buf: Network buf instance 2610 * @size: Size to be popped 2611 * 2612 * Return: none 2613 */ 2614 static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size) 2615 { 2616 __qdf_nbuf_reserve(buf, size); 2617 } 2618 2619 /** 2620 * qdf_nbuf_set_data_pointer() - set data pointer 2621 * @buf: Network buf instance 2622 * @data: data pointer 2623 * 2624 * Return: none 2625 */ 2626 static inline void qdf_nbuf_set_data_pointer(qdf_nbuf_t buf, uint8_t *data) 2627 { 2628 __qdf_nbuf_set_data_pointer(buf, data); 2629 } 2630 2631 /** 2632 * qdf_nbuf_set_len() - set data length 2633 * @buf: Network buf instance 2634 * @len: data length 2635 * Return: none 2636 */ 2637 static inline void qdf_nbuf_set_len(qdf_nbuf_t buf, uint32_t len) 2638 { 2639 __qdf_nbuf_set_len(buf, len); 2640 } 2641 2642 /** 2643 * qdf_nbuf_set_tail_pointer() - set data tail pointer 2644 * @buf: Network buf instance 2645 * @len: length of data 2646 * 2647 * Return: none 2648 */ 2649 static inline void qdf_nbuf_set_tail_pointer(qdf_nbuf_t buf, int len) 2650 { 2651 __qdf_nbuf_set_tail_pointer(buf, len); 2652 } 2653 2654 /** 2655 * qdf_nbuf_unlink_no_lock() - unlink a nbuf from nbuf list 2656 * @buf: Network buf instance 2657 * @list: list to use 2658 * 2659 * This is a lockless version, driver must acquire locks if it 2660 * needs to synchronize 2661 * 2662 * Return: none 2663 */ 2664 static inline void 2665 qdf_nbuf_unlink_no_lock(qdf_nbuf_t buf, qdf_nbuf_queue_head_t *list) 2666 { 2667 __qdf_nbuf_unlink_no_lock(buf, list); 2668 } 2669 2670 /** 2671 * qdf_nbuf_reset() - reset the buffer data and pointer 2672 * @buf: Network buf instance 2673 * @reserve: reserve 2674 * @align: align 2675 * 2676 * Return: none 2677 */ 2678 static inline void qdf_nbuf_reset(qdf_nbuf_t buf, int reserve, int align) 2679 { 2680 __qdf_nbuf_reset(buf, reserve, align); 2681 } 2682 2683 /** 2684 * qdf_nbuf_dev_scratch_is_supported() - dev_scratch support for network buffer 2685 * in kernel 2686 * 2687 * Return: true if dev_scratch is supported 2688 * false if dev_scratch is not supported 2689 */ 2690 static inline bool qdf_nbuf_is_dev_scratch_supported(void) 2691 { 2692 return __qdf_nbuf_is_dev_scratch_supported(); 2693 } 2694 2695 /** 2696 * qdf_nbuf_get_dev_scratch() - get dev_scratch of network buffer 2697 * @buf: Pointer to network buffer 2698 * 2699 * Return: dev_scratch if dev_scratch supported 2700 * 0 if dev_scratch not supported 2701 */ 2702 static inline unsigned long qdf_nbuf_get_dev_scratch(qdf_nbuf_t buf) 2703 { 2704 return __qdf_nbuf_get_dev_scratch(buf); 2705 } 2706 2707 /** 2708 * qdf_nbuf_set_dev_scratch() - set dev_scratch of network buffer 2709 * @buf: Pointer to network buffer 2710 * @value: value to be set in dev_scratch of network buffer 2711 * 2712 * Return: void 2713 */ 2714 static inline void qdf_nbuf_set_dev_scratch(qdf_nbuf_t buf, unsigned long value) 2715 { 2716 __qdf_nbuf_set_dev_scratch(buf, value); 2717 } 2718 2719 /** 2720 * qdf_nbuf_set_dev() - set dev in network buffer 2721 * @buf: Pointer to network buffer 2722 * @dev: netdev to be set in network buffer 2723 * 2724 * Return: void 2725 */ 2726 static inline 2727 void qdf_nbuf_set_dev(qdf_nbuf_t nbuf, qdf_netdev_t dev) 2728 { 2729 __qdf_nbuf_set_dev(nbuf, dev); 2730 } 2731 2732 /** 2733 * qdf_nbuf_get_dev_mtu() - get dev mtu in n/w buffer 2734 * @buf: Pointer to network buffer 2735 * 2736 * Return: dev mtu value in nbuf 2737 */ 2738 static inline 2739 unsigned int qdf_nbuf_get_dev_mtu(qdf_nbuf_t nbuf) 2740 { 2741 return __qdf_nbuf_get_dev_mtu(nbuf); 2742 } 2743 2744 /** 2745 * qdf_nbuf_set_protocol_eth_tye_trans() - set protocol using eth trans os API 2746 * @buf: Pointer to network buffer 2747 * 2748 * Return: None 2749 */ 2750 static inline 2751 void qdf_nbuf_set_protocol_eth_tye_trans(qdf_nbuf_t nbuf) 2752 { 2753 __qdf_nbuf_set_protocol_eth_type_trans(nbuf); 2754 } 2755 2756 /** 2757 * qdf_nbuf_peek_header() - return the data pointer & length of the header 2758 * @buf: Network nbuf 2759 * @addr: Data pointer 2760 * @len: Length of the data 2761 * 2762 * Return: none 2763 */ 2764 static inline void 2765 qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len) 2766 { 2767 __qdf_nbuf_peek_header(buf, addr, len); 2768 } 2769 2770 /* nbuf queue routines */ 2771 2772 /** 2773 * qdf_nbuf_queue_init() - initialize buf queue 2774 * @head: Network buf queue head 2775 * 2776 * Return: none 2777 */ 2778 static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head) 2779 { 2780 __qdf_nbuf_queue_init(head); 2781 } 2782 2783 /** 2784 * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue 2785 * @head: Network buf queue head 2786 * @buf: Network buf 2787 * 2788 * Return: none 2789 */ 2790 static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf) 2791 { 2792 __qdf_nbuf_queue_add(head, buf); 2793 } 2794 2795 /** 2796 * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue 2797 * @head: Network buf queue head 2798 * @buf: Network buf 2799 * 2800 * Return: none 2801 */ 2802 static inline void 2803 qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf) 2804 { 2805 __qdf_nbuf_queue_insert_head(head, buf); 2806 } 2807 2808 /** 2809 * qdf_nbuf_queue_remove_last() - remove last nbuf from queue 2810 * @head: Network buf queue head 2811 * 2812 * Return: none 2813 */ 2814 static inline qdf_nbuf_t qdf_nbuf_queue_remove_last(qdf_nbuf_queue_t *head) 2815 { 2816 return __qdf_nbuf_queue_remove_last(head); 2817 } 2818 2819 /** 2820 * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue 2821 * @head: Network buf queue head 2822 * 2823 * Return: The head buf in the buf queue. 2824 */ 2825 static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head) 2826 { 2827 return __qdf_nbuf_queue_remove(head); 2828 } 2829 2830 /** 2831 * qdf_nbuf_queue_len() - get the length of the queue 2832 * @head: Network buf queue head 2833 * 2834 * Return: length of the queue 2835 */ 2836 static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head) 2837 { 2838 return __qdf_nbuf_queue_len(head); 2839 } 2840 2841 /** 2842 * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer 2843 * @buf: Network buffer 2844 * 2845 * Return: next buffer/packet 2846 */ 2847 static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf) 2848 { 2849 return __qdf_nbuf_queue_next(buf); 2850 } 2851 2852 /** 2853 * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty 2854 * @nbq: Network buf queue handle 2855 * 2856 * Return: true if queue is empty 2857 * false if queue is not empty 2858 */ 2859 static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq) 2860 { 2861 return __qdf_nbuf_is_queue_empty(nbq); 2862 } 2863 2864 static inline qdf_nbuf_queue_t * 2865 qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src) 2866 { 2867 return __qdf_nbuf_queue_append(dest, src); 2868 } 2869 2870 static inline void 2871 qdf_nbuf_queue_free(qdf_nbuf_queue_t *head) 2872 { 2873 qdf_nbuf_t buf = NULL; 2874 2875 while ((buf = qdf_nbuf_queue_remove(head)) != NULL) 2876 qdf_nbuf_free(buf); 2877 } 2878 2879 static inline qdf_nbuf_t 2880 qdf_nbuf_queue_first(qdf_nbuf_queue_t *head) 2881 { 2882 return __qdf_nbuf_queue_first(head); 2883 } 2884 2885 static inline qdf_nbuf_t 2886 qdf_nbuf_queue_last(qdf_nbuf_queue_t *head) 2887 { 2888 return __qdf_nbuf_queue_last(head); 2889 } 2890 2891 /** 2892 * qdf_nbuf_get_protocol() - return the protocol value of the skb 2893 * @skb: Pointer to network buffer 2894 * 2895 * Return: skb protocol 2896 */ 2897 static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb) 2898 { 2899 return __qdf_nbuf_get_protocol(skb); 2900 } 2901 2902 /** 2903 * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb 2904 * @skb: Pointer to network buffer 2905 * 2906 * Return: skb ip_summed 2907 */ 2908 static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb) 2909 { 2910 return __qdf_nbuf_get_ip_summed(skb); 2911 } 2912 2913 /** 2914 * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb 2915 * @skb: Pointer to network buffer 2916 * @ip_summed: ip checksum 2917 * 2918 * Return: none 2919 */ 2920 static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb, 2921 uint8_t ip_summed) 2922 { 2923 __qdf_nbuf_set_ip_summed(skb, ip_summed); 2924 } 2925 2926 /** 2927 * qdf_nbuf_set_next() - add a packet to a linked list 2928 * @this_buf: Predecessor buffer 2929 * @next_buf: Successor buffer 2930 * 2931 * This function can be used to directly link nbufs, rather than using 2932 * a separate network buffer queue object. 2933 * 2934 * Return: none 2935 */ 2936 static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf) 2937 { 2938 __qdf_nbuf_set_next(this_buf, next_buf); 2939 } 2940 2941 /* nbuf extension routines */ 2942 2943 /** 2944 * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new 2945 * nbuf 2946 * @this_buf: predecessor buffer 2947 * @next_buf: successor buffer 2948 * 2949 * This function is used to link up many nbufs containing a single logical 2950 * packet - not a collection of packets. Do not use for linking the first 2951 * extension to the head 2952 * 2953 * Return: none 2954 */ 2955 static inline void 2956 qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf) 2957 { 2958 __qdf_nbuf_set_next_ext(this_buf, next_buf); 2959 } 2960 2961 /** 2962 * qdf_nbuf_next_ext() - get the next packet extension in the linked list 2963 * @buf: Network buffer 2964 * 2965 * Return: Next network buffer in the linked list 2966 */ 2967 static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf) 2968 { 2969 return __qdf_nbuf_next_ext(buf); 2970 } 2971 2972 /** 2973 * qdf_nbuf_append_ext_list() - link list of packet extensions to the head 2974 * segment 2975 * @head_buf: Network buf holding head segment (single) 2976 * @ext_list: Network buf list holding linked extensions to the head 2977 * @ext_len: Total length of all buffers in the extension list 2978 * 2979 * This function is used to link up a list of packet extensions (seg1, 2, 2980 * ...) to the nbuf holding the head segment (seg0) 2981 * 2982 * Return: none 2983 */ 2984 static inline void 2985 qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list, 2986 qdf_size_t ext_len) 2987 { 2988 __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len); 2989 } 2990 2991 /** 2992 * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list. 2993 * @head_buf: Network buf holding head segment (single) 2994 * 2995 * This ext_list is populated when we have Jumbo packet, for example in case of 2996 * monitor mode amsdu packet reception, and are stiched using frags_list. 2997 * 2998 * Return: Network buf list holding linked extensions from head buf. 2999 */ 3000 static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf) 3001 { 3002 return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf); 3003 } 3004 3005 /** 3006 * qdf_nbuf_get_shinfo() - gets the shared info of head buf 3007 * @head_buf: Network buffer 3008 * 3009 * Return: shared info of head buf 3010 */ 3011 static inline qdf_nbuf_shared_info_t qdf_nbuf_get_shinfo(qdf_nbuf_t head_buf) 3012 { 3013 return (qdf_nbuf_shared_info_t)__qdf_nbuf_get_shinfo(head_buf); 3014 } 3015 3016 /** 3017 * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand 3018 * @buf: Network buffer 3019 * 3020 * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame 3021 */ 3022 static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf) 3023 { 3024 return __qdf_nbuf_get_tx_cksum(buf); 3025 } 3026 3027 /** 3028 * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to 3029 * indicate checksum info to the stack. 3030 * @buf: Network buffer 3031 * @cksum: Checksum 3032 * 3033 * Return: none 3034 */ 3035 static inline void 3036 qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum) 3037 { 3038 __qdf_nbuf_set_rx_cksum(buf, cksum); 3039 } 3040 3041 /** 3042 * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf 3043 * @buf: Network buffer 3044 * 3045 * Return: TID value 3046 */ 3047 static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf) 3048 { 3049 return __qdf_nbuf_get_tid(buf); 3050 } 3051 3052 /** 3053 * qdf_nbuf_set_tid() - this function sets the TID value in nbuf 3054 * @buf: Network buffer 3055 * @tid: TID value 3056 * 3057 * Return: none 3058 */ 3059 static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid) 3060 { 3061 __qdf_nbuf_set_tid(buf, tid); 3062 } 3063 3064 /** 3065 * qdf_nbuf_get_exemption_type() - this function extracts the exemption type 3066 * from nbuf 3067 * @buf: Network buffer 3068 * 3069 * Return: Exemption type 3070 */ 3071 static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf) 3072 { 3073 return __qdf_nbuf_get_exemption_type(buf); 3074 } 3075 3076 /** 3077 * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given 3078 * offset 3079 * @buf: Network buffer 3080 * @proto: Protocol 3081 * 3082 * Return: none 3083 */ 3084 static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto) 3085 { 3086 __qdf_nbuf_set_protocol(buf, proto); 3087 } 3088 3089 /** 3090 * qdf_nbuf_trace_get_proto_type() - this function return packet proto type 3091 * @buf: Network buffer 3092 * 3093 * Return: Packet protocol type 3094 */ 3095 static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf) 3096 { 3097 return __qdf_nbuf_trace_get_proto_type(buf); 3098 } 3099 3100 /** 3101 * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback 3102 * @cb_func_ptr: Callback pointer 3103 * 3104 * Return: none 3105 */ 3106 static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr) 3107 { 3108 __qdf_nbuf_reg_trace_cb(cb_func_ptr); 3109 } 3110 3111 3112 /** 3113 * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download 3114 * @buf: Network buffer 3115 * @candi: Candidate of parallel download frame 3116 * 3117 * This function stores a flag specifying this TX frame is suitable for 3118 * downloading though a 2nd TX data pipe that is used for short frames for 3119 * protocols that can accept out-of-order delivery. 3120 * 3121 * Return: none 3122 */ 3123 static inline void 3124 qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi) 3125 { 3126 __qdf_nbuf_set_tx_htt2_frm(buf, candi); 3127 } 3128 3129 /** 3130 * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download 3131 * @buf: Network buffer 3132 * 3133 * This function return whether this TX frame is allow to download though a 2nd 3134 * TX data pipe or not. 3135 * 3136 * Return: none 3137 */ 3138 static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf) 3139 { 3140 return __qdf_nbuf_get_tx_htt2_frm(buf); 3141 } 3142 3143 /** 3144 * qdf_nbuf_get_dhcp_subtype() - get the subtype 3145 * of DHCP packet. 3146 * @buf: Pointer to DHCP packet buffer 3147 * 3148 * This func. returns the subtype of DHCP packet. 3149 * 3150 * Return: subtype of the DHCP packet. 3151 */ 3152 static inline enum qdf_proto_subtype 3153 qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf) 3154 { 3155 return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf)); 3156 } 3157 3158 /** 3159 * qdf_nbuf_data_get_dhcp_subtype() - get the subtype 3160 * of DHCP packet. 3161 * @buf: Pointer to DHCP packet data buffer 3162 * 3163 * This func. returns the subtype of DHCP packet. 3164 * 3165 * Return: subtype of the DHCP packet. 3166 */ 3167 static inline enum qdf_proto_subtype 3168 qdf_nbuf_data_get_dhcp_subtype(uint8_t *data) 3169 { 3170 return __qdf_nbuf_data_get_dhcp_subtype(data); 3171 } 3172 3173 /** 3174 * qdf_nbuf_get_eapol_subtype() - get the subtype 3175 * of EAPOL packet. 3176 * @buf: Pointer to EAPOL packet buffer 3177 * 3178 * This func. returns the subtype of EAPOL packet. 3179 * 3180 * Return: subtype of the EAPOL packet. 3181 */ 3182 static inline enum qdf_proto_subtype 3183 qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf) 3184 { 3185 return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf)); 3186 } 3187 3188 /** 3189 * qdf_nbuf_data_get_eapol_subtype() - get the subtype 3190 * of EAPOL packet. 3191 * @data: Pointer to EAPOL packet data buffer 3192 * 3193 * This func. returns the subtype of EAPOL packet. 3194 * 3195 * Return: subtype of the EAPOL packet. 3196 */ 3197 static inline enum qdf_proto_subtype 3198 qdf_nbuf_data_get_eapol_subtype(uint8_t *data) 3199 { 3200 return __qdf_nbuf_data_get_eapol_subtype(data); 3201 } 3202 3203 /** 3204 * qdf_nbuf_get_arp_subtype() - get the subtype 3205 * of ARP packet. 3206 * @buf: Pointer to ARP packet buffer 3207 * 3208 * This func. returns the subtype of ARP packet. 3209 * 3210 * Return: subtype of the ARP packet. 3211 */ 3212 static inline enum qdf_proto_subtype 3213 qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf) 3214 { 3215 return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf)); 3216 } 3217 3218 /** 3219 * qdf_nbuf_data_get_arp_subtype() - get the subtype 3220 * of ARP packet. 3221 * @data: Pointer to ARP packet data buffer 3222 * 3223 * This func. returns the subtype of ARP packet. 3224 * 3225 * Return: subtype of the ARP packet. 3226 */ 3227 static inline enum qdf_proto_subtype 3228 qdf_nbuf_data_get_arp_subtype(uint8_t *data) 3229 { 3230 return __qdf_nbuf_data_get_arp_subtype(data); 3231 } 3232 3233 /** 3234 * qdf_nbuf_get_icmp_subtype() - get the subtype 3235 * of IPV4 ICMP packet. 3236 * @buf: Pointer to IPV4 ICMP packet buffer 3237 * 3238 * This func. returns the subtype of ICMP packet. 3239 * 3240 * Return: subtype of the ICMP packet. 3241 */ 3242 static inline enum qdf_proto_subtype 3243 qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf) 3244 { 3245 return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf)); 3246 } 3247 3248 /** 3249 * qdf_nbuf_data_get_icmp_subtype() - get the subtype 3250 * of IPV4 ICMP packet. 3251 * @data: Pointer to IPV4 ICMP packet data buffer 3252 * 3253 * This func. returns the subtype of ICMP packet. 3254 * 3255 * Return: subtype of the ICMP packet. 3256 */ 3257 static inline enum qdf_proto_subtype 3258 qdf_nbuf_data_get_icmp_subtype(uint8_t *data) 3259 { 3260 return __qdf_nbuf_data_get_icmp_subtype(data); 3261 } 3262 3263 /** 3264 * qdf_nbuf_get_icmpv6_subtype() - get the subtype 3265 * of IPV6 ICMPV6 packet. 3266 * @buf: Pointer to IPV6 ICMPV6 packet buffer 3267 * 3268 * This func. returns the subtype of ICMPV6 packet. 3269 * 3270 * Return: subtype of the ICMPV6 packet. 3271 */ 3272 static inline enum qdf_proto_subtype 3273 qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf) 3274 { 3275 return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf)); 3276 } 3277 3278 /** 3279 * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype 3280 * of IPV6 ICMPV6 packet. 3281 * @data: Pointer to IPV6 ICMPV6 packet data buffer 3282 * 3283 * This func. returns the subtype of ICMPV6 packet. 3284 * 3285 * Return: subtype of the ICMPV6 packet. 3286 */ 3287 static inline enum qdf_proto_subtype 3288 qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data) 3289 { 3290 return __qdf_nbuf_data_get_icmpv6_subtype(data); 3291 } 3292 3293 /** 3294 * qdf_nbuf_is_ipv4_last_fragment() - Check if IPV4 packet is last fragment 3295 * @nbuf: Network buffer 3296 * 3297 * This function check if IPV4 packet is last fragment or not. 3298 * Caller has to call this function for ipv4 packets only. 3299 * 3300 * Return: True if ipv4 packet is last fragment otherwise false 3301 */ 3302 static inline bool 3303 qdf_nbuf_is_ipv4_last_fragment(qdf_nbuf_t nbuf) 3304 { 3305 return __qdf_nbuf_is_ipv4_last_fragment(nbuf); 3306 } 3307 3308 /** 3309 * qdf_nbuf_data_set_ipv4_tos() - set the TOS field of IPV4 packet. 3310 * 3311 * @data: Pointer to IPV4 packet data buffer 3312 * @tos: TOS value to be set in IPV4 packet 3313 * 3314 * This func. set the TOS field of IPV4 packet. 3315 * 3316 * Return: None 3317 */ 3318 static inline void 3319 qdf_nbuf_data_set_ipv4_tos(uint8_t *data, uint8_t tos) 3320 { 3321 __qdf_nbuf_data_set_ipv4_tos(data, tos); 3322 } 3323 3324 /** 3325 * qdf_nbuf_data_get_ipv4_tos() - get the TOS field of IPV4 packet. 3326 * 3327 * @data: Pointer to IPV4 packet data buffer 3328 * 3329 * This func. returns the TOS field of IPV4 packet. 3330 * 3331 * Return: TOS of IPV4 packet. 3332 */ 3333 static inline uint8_t 3334 qdf_nbuf_data_get_ipv4_tos(uint8_t *data) 3335 { 3336 return __qdf_nbuf_data_get_ipv4_tos(data); 3337 } 3338 3339 /** 3340 * qdf_nbuf_data_get_ipv4_proto() - get the proto type 3341 * of IPV4 packet. 3342 * @data: Pointer to IPV4 packet data buffer 3343 * 3344 * This func. returns the proto type of IPV4 packet. 3345 * 3346 * Return: proto type of IPV4 packet. 3347 */ 3348 static inline uint8_t 3349 qdf_nbuf_data_get_ipv4_proto(uint8_t *data) 3350 { 3351 return __qdf_nbuf_data_get_ipv4_proto(data); 3352 } 3353 3354 /** 3355 * qdf_nbuf_data_set_ipv6_tc() - set the TC field 3356 * of IPV6 packet. 3357 * @data: Pointer to IPV6 packet data buffer 3358 * @tc: Value to IPV6 packet TC field 3359 * 3360 * This func. set the TC field of IPV6 packet. 3361 * 3362 * Return: None 3363 */ 3364 static inline void 3365 qdf_nbuf_data_set_ipv6_tc(uint8_t *data, uint8_t tc) 3366 { 3367 __qdf_nbuf_data_set_ipv6_tc(data, tc); 3368 } 3369 3370 /** 3371 * qdf_nbuf_data_get_ipv6_tc() - get the TC field 3372 * of IPV6 packet. 3373 * @data: Pointer to IPV6 packet data buffer 3374 * 3375 * This func. returns the TC field of IPV6 packet. 3376 * 3377 * Return: Traffic classification field of IPV6 packet. 3378 */ 3379 static inline uint8_t 3380 qdf_nbuf_data_get_ipv6_tc(uint8_t *data) 3381 { 3382 return __qdf_nbuf_data_get_ipv6_tc(data); 3383 } 3384 3385 /** 3386 * qdf_nbuf_data_get_ipv6_proto() - get the proto type 3387 * of IPV6 packet. 3388 * @data: Pointer to IPV6 packet data buffer 3389 * 3390 * This func. returns the proto type of IPV6 packet. 3391 * 3392 * Return: proto type of IPV6 packet. 3393 */ 3394 static inline uint8_t 3395 qdf_nbuf_data_get_ipv6_proto(uint8_t *data) 3396 { 3397 return __qdf_nbuf_data_get_ipv6_proto(data); 3398 } 3399 3400 /** 3401 * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not 3402 * @buf: buffer 3403 * 3404 * This api is for Tx packets. 3405 * 3406 * Return: true if packet is ipv4 packet 3407 */ 3408 static inline 3409 bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf) 3410 { 3411 return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf)); 3412 } 3413 3414 /** 3415 * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not 3416 * @data: data 3417 * 3418 * This api is for Tx packets. 3419 * 3420 * Return: true if packet is ipv4 packet 3421 */ 3422 static inline 3423 bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data) 3424 { 3425 return __qdf_nbuf_data_is_ipv4_pkt(data); 3426 } 3427 3428 /** 3429 * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not 3430 * @buf: buffer 3431 * 3432 * This api is for ipv4 packet. 3433 * 3434 * Return: true if packet is DHCP packet 3435 */ 3436 static inline 3437 bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf) 3438 { 3439 return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf)); 3440 } 3441 3442 /** 3443 * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet. 3444 * @data: Pointer to DHCP packet data buffer 3445 * 3446 * This func. checks whether it is a DHCP packet or not. 3447 * 3448 * Return: true if it is a DHCP packet 3449 * false if not 3450 */ 3451 static inline 3452 bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data) 3453 { 3454 return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data); 3455 } 3456 3457 /** 3458 * qdf_nbuf_data_is_ipv6_mdsn_pkt() - check if it is MDNS packet. 3459 * @data: Pointer to packet data buffer 3460 * 3461 * This func. checks whether it is a MDNS packet or not. 3462 * 3463 * Return: true if it is a MDNS packet, false if not 3464 */ 3465 static inline 3466 bool qdf_nbuf_is_ipv6_mdns_pkt(qdf_nbuf_t buf) 3467 { 3468 return __qdf_nbuf_data_is_ipv6_mdns_pkt(qdf_nbuf_data(buf)); 3469 } 3470 3471 /** 3472 * qdf_nbuf_data_is_ipv6_dhcp_pkt() - check if it is DHCP packet. 3473 * @data: Pointer to DHCP packet data buffer 3474 * 3475 * This func. checks whether it is a DHCP packet or not. 3476 * 3477 * Return: true if it is a DHCP packet 3478 * false if not 3479 */ 3480 static inline 3481 bool qdf_nbuf_is_ipv6_dhcp_pkt(qdf_nbuf_t buf) 3482 { 3483 return __qdf_nbuf_data_is_ipv6_dhcp_pkt(qdf_nbuf_data(buf)); 3484 } 3485 3486 /** 3487 * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not 3488 * @buf: buffer 3489 * 3490 * This api is for ipv4 packet. 3491 * 3492 * Return: true if packet is EAPOL packet 3493 */ 3494 static inline 3495 bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf) 3496 { 3497 return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf)); 3498 } 3499 3500 /** 3501 * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet. 3502 * @data: Pointer to EAPOL packet data buffer 3503 * 3504 * This func. checks whether it is a EAPOL packet or not. 3505 * 3506 * Return: true if it is a EAPOL packet 3507 * false if not 3508 */ 3509 static inline 3510 bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data) 3511 { 3512 return __qdf_nbuf_data_is_ipv4_eapol_pkt(data); 3513 } 3514 3515 /** 3516 * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not 3517 * @buf: buffer 3518 * 3519 * This api is for ipv4 packet. 3520 * 3521 * Return: true if packet is WAPI packet 3522 */ 3523 static inline 3524 bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf) 3525 { 3526 return __qdf_nbuf_is_ipv4_wapi_pkt(buf); 3527 } 3528 3529 /** 3530 * qdf_nbuf_is_ipv4_igmp_pkt() - check if packet is a igmp packet or not 3531 * @buf: buffer 3532 * 3533 * This api is for ipv4 packet. 3534 * 3535 * Return: true if packet is igmp packet 3536 */ 3537 static inline 3538 bool qdf_nbuf_is_ipv4_igmp_pkt(qdf_nbuf_t buf) 3539 { 3540 return __qdf_nbuf_data_is_ipv4_igmp_pkt(qdf_nbuf_data(buf)); 3541 } 3542 3543 /** 3544 * qdf_nbuf_is_ipv6_igmp_pkt() - check if packet is a igmp packet or not 3545 * @buf: buffer 3546 * 3547 * This api is for ipv6 packet. 3548 * 3549 * Return: true if packet is igmp packet 3550 */ 3551 static inline 3552 bool qdf_nbuf_is_ipv6_igmp_pkt(qdf_nbuf_t buf) 3553 { 3554 return __qdf_nbuf_data_is_ipv6_igmp_pkt(qdf_nbuf_data(buf)); 3555 } 3556 3557 /** 3558 * qdf_nbuf_is_ipv4_tdls_pkt() - check if packet is a tdls packet or not 3559 * @buf: buffer 3560 * 3561 * This api is for ipv4 packet. 3562 * 3563 * Return: true if packet is TDLS packet 3564 */ 3565 static inline 3566 bool qdf_nbuf_is_ipv4_tdls_pkt(qdf_nbuf_t buf) 3567 { 3568 return __qdf_nbuf_is_ipv4_tdls_pkt(buf); 3569 } 3570 3571 /** 3572 * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not 3573 * @buf: buffer 3574 * 3575 * This api is for ipv4 packet. 3576 * 3577 * Return: true if packet is ARP packet 3578 */ 3579 static inline 3580 bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf) 3581 { 3582 return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf)); 3583 } 3584 3585 /** 3586 * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet. 3587 * @data: Pointer to ARP packet data buffer 3588 * 3589 * This func. checks whether it is a ARP packet or not. 3590 * 3591 * Return: TRUE if it is a ARP packet 3592 * FALSE if not 3593 */ 3594 static inline 3595 bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data) 3596 { 3597 return __qdf_nbuf_data_is_ipv4_arp_pkt(data); 3598 } 3599 3600 /** 3601 * qdf_nbuf_data_is_arp_req() - check if ARP packet is request. 3602 * @buf: buffer 3603 * 3604 * This func. checks whether it is a ARP request or not. 3605 * 3606 * Return: true if it is a ARP request or FALSE if not 3607 */ 3608 static inline 3609 bool qdf_nbuf_data_is_arp_req(qdf_nbuf_t buf) 3610 { 3611 return __qdf_nbuf_data_is_arp_req(qdf_nbuf_data(buf)); 3612 } 3613 3614 /** 3615 * qdf_nbuf_data_is_arp_rsp() - check if ARP packet is response. 3616 * @buf: buffer 3617 * 3618 * This func. checks whether it is a ARP response or not. 3619 * 3620 * Return: true if it is a ARP response or FALSE if not 3621 */ 3622 static inline 3623 bool qdf_nbuf_data_is_arp_rsp(qdf_nbuf_t buf) 3624 { 3625 return __qdf_nbuf_data_is_arp_rsp(qdf_nbuf_data(buf)); 3626 } 3627 3628 /** 3629 * qdf_nbuf_data_get_arp_src_ip() - get ARP packet source IP gateway. 3630 * @buf: buffer 3631 * 3632 * Return: ARP packet source IP value. 3633 */ 3634 static inline 3635 uint32_t qdf_nbuf_get_arp_src_ip(qdf_nbuf_t buf) 3636 { 3637 return __qdf_nbuf_get_arp_src_ip(qdf_nbuf_data(buf)); 3638 } 3639 3640 /** 3641 * qdf_nbuf_data_get_arp_tgt_ip() - get ARP packet target IP gateway. 3642 * @buf: buffer 3643 * 3644 * Return: ARP packet target IP value. 3645 */ 3646 static inline 3647 uint32_t qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_t buf) 3648 { 3649 return __qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_data(buf)); 3650 } 3651 3652 /** 3653 * qdf_nbuf_get_dns_domain_name() - get dns domain name of required length 3654 * @buf: buffer 3655 * @len: length to copy 3656 * 3657 * Return: dns domain name 3658 */ 3659 static inline 3660 uint8_t *qdf_nbuf_get_dns_domain_name(qdf_nbuf_t buf, uint32_t len) 3661 { 3662 return __qdf_nbuf_get_dns_domain_name(qdf_nbuf_data(buf), len); 3663 } 3664 3665 /** 3666 * qdf_nbuf_data_is_dns_query() - check if skb data is a dns query 3667 * @buf: buffer 3668 * 3669 * Return: true if packet is dns query packet. 3670 * false otherwise. 3671 */ 3672 static inline 3673 bool qdf_nbuf_data_is_dns_query(qdf_nbuf_t buf) 3674 { 3675 return __qdf_nbuf_data_is_dns_query(qdf_nbuf_data(buf)); 3676 } 3677 3678 /** 3679 * qdf_nbuf_data_is_dns_response() - check if skb data is a dns response 3680 * @buf: buffer 3681 * 3682 * Return: true if packet is dns response packet. 3683 * false otherwise. 3684 */ 3685 static inline 3686 bool qdf_nbuf_data_is_dns_response(qdf_nbuf_t buf) 3687 { 3688 return __qdf_nbuf_data_is_dns_response(qdf_nbuf_data(buf)); 3689 } 3690 3691 /** 3692 * qdf_nbuf_data_is_tcp_fin() - check if skb data is a tcp fin 3693 * @buf: buffer 3694 * 3695 * Return: true if packet is tcp fin packet. 3696 * false otherwise. 3697 */ 3698 static inline 3699 bool qdf_nbuf_data_is_tcp_fin(qdf_nbuf_t buf) 3700 { 3701 return __qdf_nbuf_data_is_tcp_fin(qdf_nbuf_data(buf)); 3702 } 3703 3704 /** 3705 * qdf_nbuf_data_is_tcp_fin_ack() - check if skb data is a tcp fin ack 3706 * @buf: buffer 3707 * 3708 * Return: true if packet is tcp fin ack packet. 3709 * false otherwise. 3710 */ 3711 static inline 3712 bool qdf_nbuf_data_is_tcp_fin_ack(qdf_nbuf_t buf) 3713 { 3714 return __qdf_nbuf_data_is_tcp_fin_ack(qdf_nbuf_data(buf)); 3715 } 3716 3717 /** 3718 * qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn 3719 * @buf: buffer 3720 * 3721 * Return: true if packet is tcp syn packet. 3722 * false otherwise. 3723 */ 3724 static inline 3725 bool qdf_nbuf_data_is_tcp_syn(qdf_nbuf_t buf) 3726 { 3727 return __qdf_nbuf_data_is_tcp_syn(qdf_nbuf_data(buf)); 3728 } 3729 3730 /** 3731 * qdf_nbuf_data_is_tcp_syn_ack() - check if skb data is a tcp syn ack 3732 * @buf: buffer 3733 * 3734 * Return: true if packet is tcp syn ack packet. 3735 * false otherwise. 3736 */ 3737 static inline 3738 bool qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_t buf) 3739 { 3740 return __qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_data(buf)); 3741 } 3742 3743 /** 3744 * qdf_nbuf_data_is_tcp_rst() - check if skb data is a tcp rst 3745 * @buf: buffer 3746 * 3747 * Return: true if packet is tcp rst packet. 3748 * false otherwise. 3749 */ 3750 static inline 3751 bool qdf_nbuf_data_is_tcp_rst(qdf_nbuf_t buf) 3752 { 3753 return __qdf_nbuf_data_is_tcp_rst(qdf_nbuf_data(buf)); 3754 } 3755 3756 /** 3757 * qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack 3758 * @buf: buffer 3759 * 3760 * Return: true if packet is tcp ack packet. 3761 * false otherwise. 3762 */ 3763 static inline 3764 bool qdf_nbuf_data_is_tcp_ack(qdf_nbuf_t buf) 3765 { 3766 return __qdf_nbuf_data_is_tcp_ack(qdf_nbuf_data(buf)); 3767 } 3768 3769 /** 3770 * qdf_nbuf_data_get_tcp_src_port() - get tcp src port 3771 * @buf: buffer 3772 * 3773 * Return: tcp source port value. 3774 */ 3775 static inline 3776 uint16_t qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_t buf) 3777 { 3778 return __qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_data(buf)); 3779 } 3780 3781 /** 3782 * qdf_nbuf_data_get_tcp_dst_port() - get tcp dst port 3783 * @buf: buffer 3784 * 3785 * Return: tcp destination port value. 3786 */ 3787 static inline 3788 uint16_t qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_t buf) 3789 { 3790 return __qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_data(buf)); 3791 } 3792 3793 /** 3794 * qdf_nbuf_data_is_icmpv4_req() - check if ICMPv4 packet is request. 3795 * @buf: buffer 3796 * 3797 * This func. checks whether it is a ICMPv4 request or not. 3798 * 3799 * Return: true if it is a ICMPv4 request or fALSE if not 3800 */ 3801 static inline 3802 bool qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_t buf) 3803 { 3804 return __qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_data(buf)); 3805 } 3806 3807 /** 3808 * qdf_nbuf_data_is_icmpv4_rsp() - check if ICMPv4 packet is res 3809 * @buf: buffer 3810 * 3811 * Return: true if packet is icmpv4 response 3812 * false otherwise. 3813 */ 3814 static inline 3815 bool qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_t buf) 3816 { 3817 return __qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_data(buf)); 3818 } 3819 3820 static inline 3821 bool qdf_nbuf_is_icmpv4_redirect(qdf_nbuf_t buf) 3822 { 3823 return __qdf_nbuf_data_is_icmpv4_redirect(qdf_nbuf_data(buf)); 3824 } 3825 3826 /** 3827 * qdf_nbuf_get_icmpv4_src_ip() - get icmpv4 src IP 3828 * @buf: buffer 3829 * 3830 * Return: icmpv4 packet source IP value. 3831 */ 3832 static inline 3833 uint32_t qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_t buf) 3834 { 3835 return __qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_data(buf)); 3836 } 3837 3838 /** 3839 * qdf_nbuf_data_get_icmpv4_tgt_ip() - get icmpv4 target IP 3840 * @buf: buffer 3841 * 3842 * Return: icmpv4 packet target IP value. 3843 */ 3844 static inline 3845 uint32_t qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_t buf) 3846 { 3847 return __qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_data(buf)); 3848 } 3849 3850 /** 3851 * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet. 3852 * @buf: Pointer to IPV6 packet buffer 3853 * 3854 * This func. checks whether it is a IPV6 packet or not. 3855 * 3856 * Return: TRUE if it is a IPV6 packet 3857 * FALSE if not 3858 */ 3859 static inline 3860 bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf) 3861 { 3862 return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf)); 3863 } 3864 3865 static inline 3866 bool qdf_nbuf_is_icmpv6_redirect(qdf_nbuf_t buf) 3867 { 3868 return __qdf_nbuf_data_is_icmpv6_redirect(qdf_nbuf_data(buf)); 3869 } 3870 /** 3871 * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet. 3872 * @data: Pointer to IPV6 packet data buffer 3873 * 3874 * This func. checks whether it is a IPV6 packet or not. 3875 * 3876 * Return: TRUE if it is a IPV6 packet 3877 * FALSE if not 3878 */ 3879 static inline 3880 bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data) 3881 { 3882 return __qdf_nbuf_data_is_ipv6_pkt(data); 3883 } 3884 3885 /** 3886 * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet. 3887 * @data: Pointer to IPV4 packet data buffer 3888 * 3889 * This func. checks whether it is a IPV4 multicast packet or not. 3890 * 3891 * Return: TRUE if it is a IPV4 multicast packet 3892 * FALSE if not 3893 */ 3894 static inline 3895 bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data) 3896 { 3897 return __qdf_nbuf_data_is_ipv4_mcast_pkt(data); 3898 } 3899 3900 /** 3901 * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet. 3902 * @data: Pointer to IPV6 packet data buffer 3903 * 3904 * This func. checks whether it is a IPV6 multicast packet or not. 3905 * 3906 * Return: TRUE if it is a IPV6 multicast packet 3907 * FALSE if not 3908 */ 3909 static inline 3910 bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data) 3911 { 3912 return __qdf_nbuf_data_is_ipv6_mcast_pkt(data); 3913 } 3914 3915 /** 3916 * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet. 3917 * @buf: Pointer to IPV4 ICMP packet buffer 3918 * 3919 * This func. checks whether it is a ICMP packet or not. 3920 * 3921 * Return: TRUE if it is a ICMP packet 3922 * FALSE if not 3923 */ 3924 static inline 3925 bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf) 3926 { 3927 return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf)); 3928 } 3929 3930 /** 3931 * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet. 3932 * @data: Pointer to IPV4 ICMP packet data buffer 3933 * 3934 * This func. checks whether it is a ICMP packet or not. 3935 * 3936 * Return: TRUE if it is a ICMP packet 3937 * FALSE if not 3938 */ 3939 static inline 3940 bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data) 3941 { 3942 return __qdf_nbuf_data_is_icmp_pkt(data); 3943 } 3944 3945 /** 3946 * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet. 3947 * @buf: Pointer to IPV6 ICMPV6 packet buffer 3948 * 3949 * This func. checks whether it is a ICMPV6 packet or not. 3950 * 3951 * Return: TRUE if it is a ICMPV6 packet 3952 * FALSE if not 3953 */ 3954 static inline 3955 bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf) 3956 { 3957 return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf)); 3958 } 3959 3960 /** 3961 * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet. 3962 * @data: Pointer to IPV6 ICMPV6 packet data buffer 3963 * 3964 * This func. checks whether it is a ICMPV6 packet or not. 3965 * 3966 * Return: TRUE if it is a ICMPV6 packet 3967 * FALSE if not 3968 */ 3969 static inline 3970 bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data) 3971 { 3972 return __qdf_nbuf_data_is_icmpv6_pkt(data); 3973 } 3974 3975 /** 3976 * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet. 3977 * @buf: Pointer to IPV4 UDP packet buffer 3978 * 3979 * This func. checks whether it is a IPV4 UDP packet or not. 3980 * 3981 * Return: TRUE if it is a IPV4 UDP packet 3982 * FALSE if not 3983 */ 3984 static inline 3985 bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf) 3986 { 3987 return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf)); 3988 } 3989 3990 /** 3991 * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet. 3992 * @data: Pointer to IPV4 UDP packet data buffer 3993 * 3994 * This func. checks whether it is a IPV4 UDP packet or not. 3995 * 3996 * Return: TRUE if it is a IPV4 UDP packet 3997 * FALSE if not 3998 */ 3999 static inline 4000 bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data) 4001 { 4002 return __qdf_nbuf_data_is_ipv4_udp_pkt(data); 4003 } 4004 4005 /** 4006 * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet. 4007 * @buf: Pointer to IPV4 TCP packet buffer 4008 * 4009 * This func. checks whether it is a IPV4 TCP packet or not. 4010 * 4011 * Return: TRUE if it is a IPV4 TCP packet 4012 * FALSE if not 4013 */ 4014 static inline 4015 bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf) 4016 { 4017 return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf)); 4018 } 4019 4020 /** 4021 * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet. 4022 * @data: Pointer to IPV4 TCP packet data buffer 4023 * 4024 * This func. checks whether it is a IPV4 TCP packet or not. 4025 * 4026 * Return: TRUE if it is a IPV4 TCP packet 4027 * FALSE if not 4028 */ 4029 static inline 4030 bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data) 4031 { 4032 return __qdf_nbuf_data_is_ipv4_tcp_pkt(data); 4033 } 4034 4035 /** 4036 * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet. 4037 * @buf: Pointer to IPV6 UDP packet buffer 4038 * 4039 * This func. checks whether it is a IPV6 UDP packet or not. 4040 * 4041 * Return: TRUE if it is a IPV6 UDP packet 4042 * FALSE if not 4043 */ 4044 static inline 4045 bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf) 4046 { 4047 return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf)); 4048 } 4049 4050 /** 4051 * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet. 4052 * @data: Pointer to IPV6 UDP packet data buffer 4053 * 4054 * This func. checks whether it is a IPV6 UDP packet or not. 4055 * 4056 * Return: TRUE if it is a IPV6 UDP packet 4057 * FALSE if not 4058 */ 4059 static inline 4060 bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data) 4061 { 4062 return __qdf_nbuf_data_is_ipv6_udp_pkt(data); 4063 } 4064 4065 /** 4066 * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet. 4067 * @buf: Pointer to IPV6 TCP packet buffer 4068 * 4069 * This func. checks whether it is a IPV6 TCP packet or not. 4070 * 4071 * Return: TRUE if it is a IPV6 TCP packet 4072 * FALSE if not 4073 */ 4074 static inline 4075 bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf) 4076 { 4077 return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf)); 4078 } 4079 4080 /** 4081 * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet. 4082 * @data: Pointer to IPV6 TCP packet data buffer 4083 * 4084 * This func. checks whether it is a IPV6 TCP packet or not. 4085 * 4086 * Return: TRUE if it is a IPV6 TCP packet 4087 * FALSE if not 4088 */ 4089 static inline 4090 bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data) 4091 { 4092 return __qdf_nbuf_data_is_ipv6_tcp_pkt(data); 4093 } 4094 4095 /** 4096 * qdf_nbuf_is_bcast_pkt() - check if it is broadcast packet. 4097 * @buf: Network buffer 4098 * 4099 * This func. checks whether packet is broadcast or not. 4100 * 4101 * Return: TRUE if it is broadcast packet 4102 * FALSE if not 4103 */ 4104 static inline 4105 bool qdf_nbuf_is_bcast_pkt(qdf_nbuf_t buf) 4106 { 4107 return __qdf_nbuf_is_bcast_pkt(buf); 4108 } 4109 4110 /** 4111 * qdf_nbuf_pkt_type_is_mcast() - check if skb pkt type is mcast 4112 * @buf: Network buffer 4113 * 4114 * Return: TRUE if skb pkt type is mcast 4115 * FALSE if not 4116 */ 4117 static inline 4118 bool qdf_nbuf_pkt_type_is_mcast(qdf_nbuf_t buf) 4119 { 4120 return __qdf_nbuf_pkt_type_is_mcast(buf); 4121 } 4122 4123 /** 4124 * qdf_nbuf_pkt_type_is_bcast() - check if skb pkt type is bcast 4125 * @buf: Network buffer 4126 * 4127 * Return: TRUE if skb pkt type is mcast 4128 * FALSE if not 4129 */ 4130 static inline 4131 bool qdf_nbuf_pkt_type_is_bcast(qdf_nbuf_t buf) 4132 { 4133 return __qdf_nbuf_pkt_type_is_bcast(buf); 4134 } 4135 4136 /** 4137 * qdf_nbuf_is_mcast_replay() - check if it is multicast replay packet. 4138 * @buf: Network buffer 4139 * 4140 * This func. checks whether packet is multicast replay packet or not. 4141 * 4142 * Return: TRUE if it is multicast packet 4143 * FALSE if not 4144 */ 4145 static inline 4146 bool qdf_nbuf_is_mcast_replay(qdf_nbuf_t buf) 4147 { 4148 return __qdf_nbuf_is_mcast_replay(buf); 4149 } 4150 4151 /** 4152 * qdf_nbuf_is_arp_local() - check if it is local or no local arp 4153 * @buf: Network buffer 4154 * 4155 * This func. checks whether packet is local or no local arp. 4156 * 4157 * Return: TRUE if it is broadcast packet 4158 * FALSE if not 4159 */ 4160 static inline 4161 bool qdf_nbuf_is_arp_local(qdf_nbuf_t buf) 4162 { 4163 return __qdf_nbuf_is_arp_local(buf); 4164 } 4165 4166 /** 4167 * qdf_nbuf_reset_num_frags() - decrement the number of fragments 4168 * @buf: Network buffer 4169 * 4170 * Return: Number of fragments 4171 */ 4172 static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf) 4173 { 4174 __qdf_nbuf_reset_num_frags(buf); 4175 } 4176 4177 /** 4178 * qdf_dmaaddr_to_32s - return high and low parts of dma_addr 4179 * 4180 * Returns the high and low 32-bits of the DMA addr in the provided ptrs 4181 * 4182 * Return: N/A 4183 */ 4184 static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr, 4185 uint32_t *lo, uint32_t *hi) 4186 { 4187 return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi); 4188 } 4189 4190 /** 4191 * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO 4192 * network buffer into segments 4193 * @nbuf: network buffer to be segmented 4194 * @tso_info: This is the output. The information about the 4195 * TSO segments will be populated within this. 4196 * 4197 * This function fragments a TCP jumbo packet into smaller 4198 * segments to be transmitted by the driver. It chains the TSO 4199 * segments created into a list. 4200 * 4201 * Return: number of TSO segments 4202 */ 4203 static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev, 4204 qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info) 4205 { 4206 return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info); 4207 } 4208 4209 /** 4210 * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element 4211 * 4212 * @osdev: qdf device handle 4213 * @tso_seg: TSO segment element to be unmapped 4214 * @is_last_seg: whether this is last tso seg or not 4215 * 4216 * Return: none 4217 */ 4218 static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev, 4219 struct qdf_tso_seg_elem_t *tso_seg, 4220 bool is_last_seg) 4221 { 4222 return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg); 4223 } 4224 4225 /** 4226 * qdf_nbuf_get_tcp_payload_len() - function to return the tso payload len 4227 * @nbuf: network buffer 4228 * 4229 * Return: size of the tso packet 4230 */ 4231 static inline size_t qdf_nbuf_get_tcp_payload_len(qdf_nbuf_t nbuf) 4232 { 4233 return __qdf_nbuf_get_tcp_payload_len(nbuf); 4234 } 4235 4236 /** 4237 * qdf_nbuf_get_tso_num_seg() - function to calculate the number 4238 * of TCP segments within the TSO jumbo packet 4239 * @nbuf: TSO jumbo network buffer to be segmented 4240 * 4241 * This function calculates the number of TCP segments that the 4242 network buffer can be divided into. 4243 * 4244 * Return: number of TCP segments 4245 */ 4246 static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf) 4247 { 4248 return __qdf_nbuf_get_tso_num_seg(nbuf); 4249 } 4250 4251 /** 4252 * qdf_nbuf_get_gso_segs() - Return the number of gso segments in 4253 * nbuf 4254 * @nbuf: Network buffer 4255 * 4256 * Return: number of gso segments in nbuf 4257 */ 4258 static inline uint16_t qdf_nbuf_get_gso_segs(qdf_nbuf_t nbuf) 4259 { 4260 return __qdf_nbuf_get_gso_segs(nbuf); 4261 } 4262 4263 /** 4264 * qdf_nbuf_set_gso_segs() - set the number of gso segments in 4265 * nbuf 4266 * @nbuf: Network buffer 4267 * @val: val to be set 4268 * 4269 * Return: None 4270 */ 4271 static inline void qdf_nbuf_set_gso_segs(qdf_nbuf_t nbuf, uint16_t val) 4272 { 4273 __qdf_nbuf_set_gso_segs(nbuf, val); 4274 } 4275 4276 /** 4277 * qdf_nbuf_set_gso_type_udp_l4() - set the gso type to GSO UDP L4 4278 * @nbuf: Network buffer 4279 * 4280 * Return: None 4281 */ 4282 static inline void qdf_nbuf_set_gso_type_udp_l4(qdf_nbuf_t nbuf) 4283 { 4284 __qdf_nbuf_set_gso_type_udp_l4(nbuf); 4285 } 4286 4287 /** 4288 * qdf_nbuf_set_ip_summed_partial() - set the ip summed to CHECKSUM_PARTIAL 4289 * @nbuf: Network buffer 4290 * 4291 * Return: None 4292 */ 4293 static inline void qdf_nbuf_set_ip_summed_partial(qdf_nbuf_t nbuf) 4294 { 4295 __qdf_nbuf_set_ip_summed_partial(nbuf); 4296 } 4297 4298 /** 4299 * qdf_nbuf_get_gso_size() - Return the number of gso size in 4300 * nbuf 4301 * @nbuf: Network buffer 4302 * 4303 * Return: number of gso segments in nbuf 4304 */ 4305 static inline unsigned int qdf_nbuf_get_gso_size(qdf_nbuf_t nbuf) 4306 { 4307 return __qdf_nbuf_get_gso_size(nbuf); 4308 } 4309 4310 /** 4311 * qdf_nbuf_set_gso_size() - Set the gso size in nbuf 4312 * @skb: Pointer to network buffer 4313 * 4314 * Return: Return the number of gso segments 4315 */ 4316 static inline void qdf_nbuf_set_gso_size(qdf_nbuf_t nbuf, unsigned int val) 4317 { 4318 __qdf_nbuf_set_gso_size(nbuf, val); 4319 } 4320 4321 /** 4322 * qdf_nbuf_inc_users() - function to increment the number of 4323 * users referencing this network buffer 4324 * 4325 * @nbuf: network buffer 4326 * 4327 * This function increments the number of users referencing this 4328 * network buffer 4329 * 4330 * Return: the network buffer 4331 */ 4332 static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf) 4333 { 4334 return __qdf_nbuf_inc_users(nbuf); 4335 } 4336 4337 /** 4338 * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb 4339 * 4340 * @nbuf: Network buffer (skb on linux) 4341 * 4342 * This function returns the values of data_attr field 4343 * in struct cvg_nbuf_cb{}, to which skb->cb is typecast. 4344 * This value is actually the value programmed in CE descriptor. 4345 * 4346 * Return: Value of data_attr 4347 */ 4348 static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf) 4349 { 4350 return __qdf_nbuf_data_attr_get(buf); 4351 } 4352 4353 /** 4354 * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb 4355 * 4356 * @nbuf: Network buffer (skb on linux) 4357 * @data_attr: Value to be stored cvg_nbuf_cb->data_attr 4358 * 4359 * This function stores the value to be programmed in CE 4360 * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{} 4361 * 4362 * Return: void 4363 */ 4364 static inline 4365 void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr) 4366 { 4367 __qdf_nbuf_data_attr_set(buf, data_attr); 4368 } 4369 4370 /** 4371 * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata 4372 * 4373 * @nbuf: Network buffer (skb on linux) 4374 * 4375 * This function parses the payload to figure out relevant 4376 * Tx meta-data e.g. whether to enable tx_classify bit 4377 * in CE. 4378 * 4379 * Return: void 4380 */ 4381 #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get 4382 4383 void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state); 4384 void qdf_nbuf_tx_desc_count_display(void); 4385 void qdf_nbuf_tx_desc_count_clear(void); 4386 4387 static inline qdf_nbuf_t 4388 qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom) 4389 { 4390 return __qdf_nbuf_realloc_headroom(buf, headroom); 4391 } 4392 4393 static inline qdf_nbuf_t 4394 qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom) 4395 { 4396 return __qdf_nbuf_realloc_tailroom(buf, tailroom); 4397 } 4398 4399 static inline qdf_nbuf_t 4400 qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom) 4401 { 4402 return __qdf_nbuf_expand(buf, headroom, tailroom); 4403 } 4404 4405 static inline int 4406 qdf_nbuf_linearize(qdf_nbuf_t buf) 4407 { 4408 return __qdf_nbuf_linearize(buf); 4409 } 4410 4411 static inline bool 4412 qdf_nbuf_is_cloned(qdf_nbuf_t buf) 4413 { 4414 return __qdf_nbuf_is_cloned(buf); 4415 } 4416 4417 static inline void 4418 qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg) 4419 { 4420 __qdf_nbuf_frag_info(buf, sg); 4421 } 4422 4423 static inline qdf_nbuf_tx_cksum_t 4424 qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where) 4425 { 4426 return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where); 4427 } 4428 4429 static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf) 4430 { 4431 __qdf_nbuf_reset_ctxt(nbuf); 4432 } 4433 4434 static inline void qdf_nbuf_init(qdf_nbuf_t buf) 4435 { 4436 __qdf_nbuf_init(buf); 4437 } 4438 4439 static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf) 4440 { 4441 return __qdf_nbuf_network_header(buf); 4442 } 4443 4444 static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf) 4445 { 4446 return __qdf_nbuf_transport_header(buf); 4447 } 4448 4449 static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf) 4450 { 4451 return __qdf_nbuf_tcp_tso_size(buf); 4452 } 4453 4454 static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf) 4455 { 4456 return __qdf_nbuf_get_cb(nbuf); 4457 } 4458 4459 static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf) 4460 { 4461 return __qdf_nbuf_get_nr_frags(nbuf); 4462 } 4463 4464 static inline uint32_t qdf_nbuf_get_nr_frags_in_fraglist(qdf_nbuf_t nbuf) 4465 { 4466 return __qdf_nbuf_get_nr_frags_in_fraglist(nbuf); 4467 } 4468 4469 static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf) 4470 { 4471 return __qdf_nbuf_headlen(buf); 4472 } 4473 4474 static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev, 4475 qdf_nbuf_t buf, int offset, 4476 qdf_dma_dir_t dir, int cur_frag) 4477 { 4478 return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag); 4479 } 4480 4481 static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf) 4482 { 4483 return __qdf_nbuf_tso_tcp_v4(buf); 4484 } 4485 4486 static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf) 4487 { 4488 return __qdf_nbuf_tso_tcp_v6(buf); 4489 } 4490 4491 static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf) 4492 { 4493 return __qdf_nbuf_tcp_seq(buf); 4494 } 4495 4496 static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf) 4497 { 4498 return __qdf_nbuf_l2l3l4_hdr_len(buf); 4499 } 4500 4501 /** 4502 * qdf_nbuf_get_tcp_hdr_len() - return TCP header length of the skb 4503 * @skb: sk buff 4504 * 4505 * Return: size of TCP header length 4506 */ 4507 static inline size_t qdf_nbuf_get_tcp_hdr_len(qdf_nbuf_t nbuf) 4508 { 4509 return __qdf_nbuf_get_tcp_hdr_len(nbuf); 4510 } 4511 4512 static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf) 4513 { 4514 return __qdf_nbuf_is_nonlinear(buf); 4515 } 4516 4517 static inline uint32_t 4518 qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num) 4519 { 4520 return __qdf_nbuf_get_frag_size(buf, frag_num); 4521 } 4522 4523 static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf) 4524 { 4525 return __qdf_nbuf_get_priority(buf); 4526 } 4527 4528 static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p) 4529 { 4530 __qdf_nbuf_set_priority(buf, p); 4531 } 4532 4533 static inline void qdf_nbuf_record_rx_queue(qdf_nbuf_t buf, uint32_t queue_id) 4534 { 4535 __qdf_nbuf_record_rx_queue(buf, queue_id); 4536 } 4537 4538 static inline uint16_t 4539 qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf) 4540 { 4541 return __qdf_nbuf_get_queue_mapping(buf); 4542 } 4543 4544 static inline void 4545 qdf_nbuf_set_queue_mapping(qdf_nbuf_t buf, uint16_t val) 4546 { 4547 __qdf_nbuf_set_queue_mapping(buf, val); 4548 } 4549 4550 static inline char * 4551 qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf) 4552 { 4553 return __qdf_nbuf_get_priv_ptr(buf); 4554 } 4555 4556 /** 4557 * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf. 4558 * @rx_status: rx_status containing required info to update radiotap 4559 * @nbuf: Pointer to nbuf 4560 * @headroom_sz: Available headroom size 4561 * 4562 * Return: radiotap length. 4563 */ 4564 unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status, 4565 qdf_nbuf_t nbuf, uint32_t headroom_sz); 4566 4567 /** 4568 * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame. 4569 * @buf: Pointer to nbuf 4570 * 4571 * Return: None 4572 */ 4573 static inline void 4574 qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf) 4575 { 4576 __qdf_nbuf_mark_wakeup_frame(buf); 4577 } 4578 4579 /** 4580 * qdf_nbuf_reg_free_cb - Registers nbuf free callback 4581 * @cb_func_ptr: Callback pointer 4582 * 4583 * This function registers nbuf free callback 4584 * 4585 * Return: void 4586 */ 4587 static inline void 4588 qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr) 4589 { 4590 __qdf_nbuf_reg_free_cb(cb_func_ptr); 4591 } 4592 4593 /** 4594 * qdf_nbuf_count_get() - get global nbuf gauge 4595 * 4596 * Return: global nbuf gauge 4597 */ 4598 static inline int qdf_nbuf_count_get(void) 4599 { 4600 return __qdf_nbuf_count_get(); 4601 } 4602 4603 /** 4604 * qdf_nbuf_count_inc() - increment nbuf global count 4605 * 4606 * @buf: sk buff 4607 * 4608 * Return: void 4609 */ 4610 static inline void qdf_nbuf_count_inc(qdf_nbuf_t buf) 4611 { 4612 return __qdf_nbuf_count_inc(buf); 4613 } 4614 4615 /** 4616 * qdf_nbuf_count_dec() - decrement nbuf global count 4617 * 4618 * @buf: sk buff 4619 * 4620 * Return: void 4621 */ 4622 static inline void qdf_nbuf_count_dec(qdf_nbuf_t buf) 4623 { 4624 return __qdf_nbuf_count_dec(buf); 4625 } 4626 4627 /** 4628 * qdf_nbuf_mod_init() - Initialization routine for qdf_nbuf 4629 * 4630 * Return void 4631 */ 4632 static inline void qdf_nbuf_mod_init(void) 4633 { 4634 return __qdf_nbuf_mod_init(); 4635 } 4636 4637 /** 4638 * qdf_nbuf_mod_init() - Unintialization routine for qdf_nbuf 4639 * 4640 * Return void 4641 */ 4642 static inline void qdf_nbuf_mod_exit(void) 4643 { 4644 return __qdf_nbuf_mod_exit(); 4645 } 4646 4647 /** 4648 * qdf_nbuf_orphan() - orphan a nbuf 4649 * @buf: Pointer to network buffer 4650 * 4651 * If a buffer currently has an owner then we call the 4652 * owner's destructor function 4653 * 4654 * Return: void 4655 */ 4656 static inline void qdf_nbuf_orphan(qdf_nbuf_t buf) 4657 { 4658 return __qdf_nbuf_orphan(buf); 4659 } 4660 4661 /** 4662 * qdf_nbuf_get_frag_size_by_idx() - Get size of nbuf frag at index idx 4663 * @nbuf: qdf_nbuf_t 4664 * @idx: Frag index for which frag size is requested 4665 * 4666 * Return: Frag size 4667 */ 4668 static inline unsigned int qdf_nbuf_get_frag_size_by_idx(qdf_nbuf_t nbuf, 4669 uint8_t idx) 4670 { 4671 return __qdf_nbuf_get_frag_size_by_idx(nbuf, idx); 4672 } 4673 4674 /** 4675 * qdf_nbuf_get_frag_addr() - Get nbuf frag address at index idx 4676 * @nbuf: qdf_nbuf_t 4677 * @idx: Frag index for which frag address is requested 4678 * 4679 * Return: Frag address 4680 */ 4681 static inline qdf_frag_t qdf_nbuf_get_frag_addr(qdf_nbuf_t nbuf, uint8_t idx) 4682 { 4683 return __qdf_nbuf_get_frag_addr(nbuf, idx); 4684 } 4685 4686 /** 4687 * qdf_nbuf_trim_add_frag_size() - Increase/Decrease frag_size by size 4688 * @nbuf: qdf_nbuf_t 4689 * @idx: Frag index 4690 * @size: Size by which frag_size needs to be increased/decreased 4691 * +Ve means increase, -Ve means decrease 4692 * @truesize: truesize 4693 */ 4694 static inline void qdf_nbuf_trim_add_frag_size(qdf_nbuf_t nbuf, uint8_t idx, 4695 int size, unsigned int truesize) 4696 { 4697 __qdf_nbuf_trim_add_frag_size(nbuf, idx, size, truesize); 4698 } 4699 4700 /** 4701 * qdf_nbuf_set_mark() - Set nbuf mark 4702 * @nbuf: qdf_nbuf_t 4703 * @mark: Value to set mark 4704 * 4705 * Return: none 4706 */ 4707 static inline void qdf_nbuf_set_mark(qdf_nbuf_t nbuf, uint32_t mark) 4708 { 4709 __qdf_nbuf_set_mark(nbuf, mark); 4710 } 4711 4712 /** 4713 * qdf_nbuf_get_mark() - Get nbuf mark 4714 * @nbuf: qdf_nbuf_t 4715 * 4716 * Return: mark value 4717 */ 4718 static inline uint32_t qdf_nbuf_get_mark(qdf_nbuf_t nbuf) 4719 { 4720 return __qdf_nbuf_get_mark(nbuf); 4721 } 4722 4723 /** 4724 * qdf_nbuf_get_data_len() - Return the size of the nbuf from 4725 * data pointer to end pointer 4726 * @nbuf: qdf_nbuf_t 4727 * 4728 * Return: size of network buffer from data pointer to end 4729 * pointer 4730 */ 4731 static inline qdf_size_t qdf_nbuf_get_data_len(qdf_nbuf_t nbuf) 4732 { 4733 return __qdf_nbuf_get_data_len(nbuf); 4734 } 4735 4736 /** 4737 * qdf_nbuf_set_data_len() - Return the data_len of the nbuf 4738 * @nbuf: qdf_nbuf_t 4739 * @len: data_len to be set 4740 * 4741 * Return: set data_len value 4742 */ 4743 static inline qdf_size_t qdf_nbuf_set_data_len(qdf_nbuf_t nbuf, uint32_t len) 4744 { 4745 return __qdf_nbuf_set_data_len(nbuf, len); 4746 } 4747 4748 /** 4749 * qdf_nbuf_get_only_data_len() - Return the data_len of the nbuf 4750 * @nbuf: qdf_nbuf_t 4751 * 4752 * Return: data_len value 4753 */ 4754 static inline qdf_size_t qdf_nbuf_get_only_data_len(qdf_nbuf_t nbuf) 4755 { 4756 return __qdf_nbuf_get_only_data_len(nbuf); 4757 } 4758 4759 /** 4760 * qdf_nbuf_set_hash() - set the hash of the buf 4761 * @buf: Network buf instance 4762 * @len: len to be set 4763 * 4764 * Return: none 4765 */ 4766 static inline void qdf_nbuf_set_hash(qdf_nbuf_t buf, uint32_t len) 4767 { 4768 __qdf_nbuf_set_hash(buf, len); 4769 } 4770 4771 /** 4772 * qdf_nbuf_set_sw_hash() - set the sw hash of the buf 4773 * @buf: Network buf instance 4774 * @len: len to be set 4775 * 4776 * Return: none 4777 */ 4778 static inline void qdf_nbuf_set_sw_hash(qdf_nbuf_t buf, uint32_t len) 4779 { 4780 __qdf_nbuf_set_sw_hash(buf, len); 4781 } 4782 4783 /** 4784 * qdf_nbuf_set_csum_start() - set the csum start of the buf 4785 * @buf: Network buf instance 4786 * @len: len to be set 4787 * 4788 * Return: none 4789 */ 4790 static inline void qdf_nbuf_set_csum_start(qdf_nbuf_t buf, uint16_t len) 4791 { 4792 __qdf_nbuf_set_csum_start(buf, len); 4793 } 4794 4795 /** 4796 * qdf_nbuf_set_csum_offset() - set the csum offset of the buf 4797 * @buf: Network buf instance 4798 * @len: len to be set 4799 * 4800 * Return: none 4801 */ 4802 static inline void qdf_nbuf_set_csum_offset(qdf_nbuf_t buf, uint16_t len) 4803 { 4804 __qdf_nbuf_set_csum_offset(buf, len); 4805 } 4806 4807 /** 4808 * qdf_nbuf_get_end_offset() - Return the size of the nbuf from 4809 * head pointer to end pointer 4810 * @nbuf: qdf_nbuf_t 4811 * 4812 * Return: size of network buffer from head pointer to end 4813 * pointer 4814 */ 4815 static inline qdf_size_t qdf_nbuf_get_end_offset(qdf_nbuf_t nbuf) 4816 { 4817 return __qdf_nbuf_get_end_offset(nbuf); 4818 } 4819 4820 /** 4821 * qdf_nbuf_get_truesize() - Return the true size of the nbuf 4822 * including the header and variable data area 4823 * @nbuf: qdf_nbuf_t 4824 * 4825 * Return: size of network buffer 4826 */ 4827 static inline qdf_size_t qdf_nbuf_get_truesize(qdf_nbuf_t nbuf) 4828 { 4829 return __qdf_nbuf_get_truesize(nbuf); 4830 } 4831 4832 #ifdef NBUF_FRAG_MEMORY_DEBUG 4833 4834 #define qdf_nbuf_move_frag_page_offset(f, i, o) \ 4835 qdf_nbuf_move_frag_page_offset_debug(f, i, o, __func__, __LINE__) 4836 4837 /** 4838 * qdf_nbuf_move_frag_page_offset_debug() - Move frag page_offset by size 4839 * and adjust length by size. 4840 * @nbuf: qdf_nbuf_t 4841 * @idx: Frag index 4842 * @offset: Frag page offset should be moved by offset. 4843 * +Ve - Move offset forward. 4844 * -Ve - Move offset backward. 4845 * @func: Caller function name 4846 * @line: Caller function line no. 4847 * 4848 * Return: QDF_STATUS 4849 */ 4850 QDF_STATUS qdf_nbuf_move_frag_page_offset_debug(qdf_nbuf_t nbuf, uint8_t idx, 4851 int offset, const char *func, 4852 uint32_t line); 4853 4854 #define qdf_nbuf_remove_frag(n, i, t) \ 4855 qdf_nbuf_remove_frag_debug(n, i, t, __func__, __LINE__) 4856 4857 /** 4858 * qdf_nbuf_remove_frag_debug - Remove frag from nbuf 4859 * @nbuf: nbuf where frag will be removed 4860 * @idx: frag index 4861 * @truesize: truesize of frag 4862 * @func: Caller function name 4863 * @line: Caller function line no. 4864 * 4865 * Return: QDF_STATUS 4866 * 4867 */ 4868 QDF_STATUS 4869 qdf_nbuf_remove_frag_debug(qdf_nbuf_t nbuf, 4870 uint16_t idx, 4871 uint16_t truesize, 4872 const char *func, 4873 uint32_t line); 4874 4875 #define qdf_nbuf_add_rx_frag(f, b, o, l, s, r) \ 4876 qdf_nbuf_add_rx_frag_debug(f, b, o, l, s, r, __func__, __LINE__) 4877 4878 /** 4879 * qdf_nbuf_add_rx_frag_debug() - Add frag to nbuf at index frag_idx 4880 * @buf: Frag pointer needs to be added in nbuf 4881 * @nbuf: qdf_nbuf_t where frag will be added 4882 * @offset: Offset in frag to be added to nbuf_frags 4883 * @frag_len: Frag length 4884 * @truesize: truesize 4885 * @take_frag_ref: Whether to take ref for frag or not 4886 * This bool must be set as per below comdition: 4887 * 1. False: If this frag is being added in any nbuf 4888 * for the first time after allocation 4889 * 2. True: If frag is already attached part of any 4890 * nbuf 4891 * @func: Caller function name 4892 * @line: Caller function line no. 4893 * 4894 * Return: none 4895 */ 4896 void qdf_nbuf_add_rx_frag_debug(qdf_frag_t buf, qdf_nbuf_t nbuf, 4897 int offset, int frag_len, 4898 unsigned int truesize, bool take_frag_ref, 4899 const char *func, uint32_t line); 4900 4901 #define qdf_nbuf_ref_frag(f) \ 4902 qdf_nbuf_ref_frag_debug(f, __func__, __LINE__) 4903 4904 /** 4905 * qdf_nbuf_ref_frag_debug() - get frag reference 4906 * @buf: Frag pointer needs to be taken reference. 4907 * @func: Caller function name 4908 * @line: Caller function line no. 4909 * 4910 * Return: none 4911 */ 4912 void qdf_nbuf_ref_frag_debug(qdf_frag_t buf, const char *func, uint32_t line); 4913 4914 /** 4915 * qdf_net_buf_debug_acquire_frag() - Add frag nodes to frag debug tracker 4916 * when nbuf is received from network stack 4917 * @buf: qdf_nbuf_t 4918 * @func: Caller function name 4919 * @line: Caller function line no. 4920 * 4921 * Return: none 4922 */ 4923 void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf, const char *func, 4924 uint32_t line); 4925 4926 /** 4927 * qdf_net_buf_debug_release_frag() - Update frag nodes in frag debug tracker 4928 * when nbuf is sent to network stack 4929 * @buf: qdf_nbuf_t 4930 * @func: Caller function name 4931 * @line: Caller function line no. 4932 * 4933 * Return: none 4934 */ 4935 void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf, const char *func, 4936 uint32_t line); 4937 4938 /** 4939 * qdf_nbuf_frag_count_inc() - Increment global frag counter 4940 * @buf: qdf_nbuf_t 4941 * 4942 * Return: none 4943 */ 4944 void qdf_nbuf_frag_count_inc(qdf_nbuf_t buf); 4945 4946 /** 4947 * qdf_nbuf_frag_count_dec() - Decrement global frag counter 4948 * @buf: qdf_nbuf_t 4949 * 4950 * Return: none 4951 */ 4952 void qdf_nbuf_frag_count_dec(qdf_nbuf_t buf); 4953 4954 #else /* NBUF_FRAG_MEMORY_DEBUG */ 4955 4956 /** 4957 * qdf_nbuf_move_frag_page_offset() - Move frag page_offset by size 4958 * and adjust length by size. 4959 * @nbuf: qdf_nbuf_t 4960 * @idx: Frag index 4961 * @offset: Frag page offset should be moved by offset. 4962 * +Ve - Move offset forward. 4963 * -Ve - Move offset backward. 4964 */ 4965 static inline QDF_STATUS qdf_nbuf_move_frag_page_offset(qdf_nbuf_t nbuf, 4966 uint8_t idx, 4967 int offset) 4968 { 4969 return __qdf_nbuf_move_frag_page_offset(nbuf, idx, offset); 4970 } 4971 4972 /** 4973 * qdf_nbuf_remove_frag() - Remove frag from nbuf 4974 * 4975 * @nbuf: nbuf pointer 4976 * @idx: idx at which frag need to be removed 4977 * @truesize: truesize of frag 4978 * 4979 * Return: void 4980 */ 4981 static inline void qdf_nbuf_remove_frag(qdf_nbuf_t nbuf, 4982 uint16_t idx, 4983 uint16_t truesize) 4984 { 4985 return __qdf_nbuf_remove_frag(nbuf, idx, truesize); 4986 } 4987 4988 /** 4989 * qdf_nbuf_add_rx_frag() - Add frag to nbuf at index frag_idx 4990 * @buf: Frag pointer needs to be added in nbuf frag 4991 * @nbuf: qdf_nbuf_t where frag will be added 4992 * @offset: Offset in frag to be added to nbuf_frags 4993 * @frag_len: Frag length 4994 * @truesize: truesize 4995 * @take_frag_ref: Whether to take ref for frag or not 4996 * This bool must be set as per below comdition: 4997 * 1. False: If this frag is being added in any nbuf 4998 * for the first time after allocation 4999 * 2. True: If frag is already attached part of any 5000 * nbuf 5001 * 5002 * qdf_nbuf_add_rx_frag takes ref_count based on boolean flag take_frag_ref 5003 */ 5004 static inline void qdf_nbuf_add_rx_frag(qdf_frag_t buf, qdf_nbuf_t nbuf, 5005 int offset, int frag_len, 5006 unsigned int truesize, 5007 bool take_frag_ref) 5008 { 5009 __qdf_nbuf_add_rx_frag(buf, nbuf, offset, 5010 frag_len, truesize, take_frag_ref); 5011 } 5012 5013 /** 5014 * qdf_nbuf_ref_frag() - get frag reference 5015 * @buf: Frag pointer needs to be taken reference. 5016 * 5017 * Return: void 5018 */ 5019 static inline void qdf_nbuf_ref_frag(qdf_frag_t buf) 5020 { 5021 __qdf_nbuf_ref_frag(buf); 5022 } 5023 5024 static inline void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf, 5025 const char *func, 5026 uint32_t line) 5027 { 5028 } 5029 5030 static inline void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf, 5031 const char *func, 5032 uint32_t line) 5033 { 5034 } 5035 5036 static inline void qdf_nbuf_frag_count_inc(qdf_nbuf_t buf) 5037 { 5038 } 5039 5040 static inline void qdf_nbuf_frag_count_dec(qdf_nbuf_t buf) 5041 { 5042 } 5043 5044 #endif /* NBUF_FRAG_MEMORY_DEBUG */ 5045 5046 #define qdf_nbuf_add_frag(dev, f, n, o, f_l, t_sz, f_r, sz) \ 5047 qdf_nbuf_add_frag_debug(dev, f, n, o, f_l, t_sz, \ 5048 f_r, sz, __func__, __LINE__) 5049 5050 /** 5051 * qdf_nbuf_add_frag_debug() - Add frag to nbuf 5052 * @osdev: Device handle 5053 * @buf: Frag pointer needs to be added in nbuf frag 5054 * @nbuf: qdf_nbuf_t where frag will be added 5055 * @offset: Offset in frag to be added to nbuf_frags 5056 * @frag_len: Frag length 5057 * @truesize: truesize 5058 * @take_frag_ref: Whether to take ref for frag or not 5059 * This bool must be set as per below comdition: 5060 * 1. False: If this frag is being added in any nbuf 5061 * for the first time after allocation 5062 * 2. True: If frag is already attached part of any 5063 * nbuf 5064 * @minsize: Minimum size to allocate 5065 * @func: Caller function name 5066 * @line: Caller function line no. 5067 * 5068 * if number of frag exceed maximum frag array. A new nbuf is allocated 5069 * with minimum headroom and frag it added to that nbuf. 5070 * new nbuf is added as frag_list to the master nbuf. 5071 * 5072 * Return: QDF_STATUS 5073 */ 5074 QDF_STATUS 5075 qdf_nbuf_add_frag_debug(qdf_device_t osdev, qdf_frag_t buf, 5076 qdf_nbuf_t nbuf, int offset, 5077 int frag_len, unsigned int truesize, 5078 bool take_frag_ref, unsigned int minsize, 5079 const char *func, uint32_t line); 5080 5081 #ifdef MEMORY_DEBUG 5082 /** 5083 * qdf_nbuf_acquire_track_lock - acquire the nbuf spinlock at the 5084 * specified index 5085 * @index: index to get the lock 5086 * @irq_flag: lock flag for using nbuf lock 5087 * 5088 * Return: none 5089 */ 5090 void qdf_nbuf_acquire_track_lock(uint32_t index, 5091 unsigned long irq_flag); 5092 5093 /** 5094 * qdf_nbuf_release_track_lock - release the nbuf spinlock at the 5095 * specified index 5096 * @index: index of the lock to be released 5097 * @irq_flag: lock flag for using nbuf lock 5098 * 5099 * Return: none 5100 */ 5101 void qdf_nbuf_release_track_lock(uint32_t index, 5102 unsigned long irq_flag); 5103 5104 /** 5105 * qdf_nbuf_get_track_tbl - get the QDF_NBUF_TRACK entry from the track 5106 * table at the specified index 5107 * @index: index to get the table entry 5108 * 5109 * Return: the QDF_NBUF_TRACK entry at the specified index in the table 5110 */ 5111 QDF_NBUF_TRACK *qdf_nbuf_get_track_tbl(uint32_t index); 5112 #endif /* MEMORY_DEBUG */ 5113 5114 #ifdef CONFIG_WLAN_SYSFS_MEM_STATS 5115 /** 5116 * qdf_record_nbuf_nbytes() - add or subtract the size of the nbuf 5117 * from the total skb mem and DP tx/rx skb mem 5118 * @nbytes: number of bytes 5119 * @dir: direction 5120 * @is_mapped: is mapped or unmapped memory 5121 * 5122 * Return: none 5123 */ 5124 void qdf_record_nbuf_nbytes( 5125 uint32_t nbytes, qdf_dma_dir_t dir, bool is_mapped); 5126 5127 #else /* CONFIG_WLAN_SYSFS_MEM_STATS */ 5128 static inline void qdf_record_nbuf_nbytes( 5129 int nbytes, qdf_dma_dir_t dir, bool is_mapped) 5130 { 5131 } 5132 #endif /* CONFIG_WLAN_SYSFS_MEM_STATS */ 5133 5134 #ifdef ENHANCED_OS_ABSTRACTION 5135 /** 5136 * qdf_nbuf_set_timestamp() - set the timestamp for frame 5137 * @buf: pointer to network buffer 5138 * 5139 * Return: none 5140 */ 5141 void qdf_nbuf_set_timestamp(qdf_nbuf_t buf); 5142 5143 /** 5144 * qdf_nbuf_get_timestamp() - get the timestamp for frame 5145 * @buf: pointer to network buffer 5146 * 5147 * Return: timestamp stored in skb in ms 5148 */ 5149 uint64_t qdf_nbuf_get_timestamp(qdf_nbuf_t buf); 5150 5151 /** 5152 * qdf_nbuf_get_timestamp_us() - get the timestamp for frame 5153 * @buf: pointer to network buffer 5154 * 5155 * Return: timestamp stored in nbuf in us 5156 */ 5157 uint64_t qdf_nbuf_get_timestamp_us(qdf_nbuf_t buf); 5158 5159 /** 5160 * qdf_nbuf_get_timedelta_ms() - get time difference in ms 5161 * @buf: pointer to network buffer 5162 * 5163 * Return: time difference ms 5164 */ 5165 uint64_t qdf_nbuf_get_timedelta_ms(qdf_nbuf_t buf); 5166 5167 /** 5168 * qdf_nbuf_get_timedelta_us() - get time difference in micro seconds 5169 * @buf: pointer to network buffer 5170 * 5171 * Return: time difference in micro seconds 5172 */ 5173 uint64_t qdf_nbuf_get_timedelta_us(qdf_nbuf_t buf); 5174 5175 /** 5176 * qdf_nbuf_net_timedelta() - get time delta 5177 * @t: time as qdf_ktime_t object 5178 * 5179 * Return: time delta as ktime_t object 5180 */ 5181 qdf_ktime_t qdf_nbuf_net_timedelta(qdf_ktime_t t); 5182 #else 5183 static inline void 5184 qdf_nbuf_set_timestamp(struct sk_buff *skb) 5185 { 5186 __qdf_nbuf_set_timestamp(skb); 5187 } 5188 5189 static inline uint64_t 5190 qdf_nbuf_get_timestamp(struct sk_buff *skb) 5191 { 5192 return __qdf_nbuf_get_timestamp(skb); 5193 } 5194 5195 static inline uint64_t 5196 qdf_nbuf_get_timestamp_us(qdf_nbuf_t buf) 5197 { 5198 return __qdf_nbuf_get_timestamp_us(buf); 5199 } 5200 5201 static inline uint64_t 5202 qdf_nbuf_get_timedelta_ms(struct sk_buff *skb) 5203 { 5204 return __qdf_nbuf_get_timedelta_ms(skb); 5205 } 5206 5207 static inline uint64_t 5208 qdf_nbuf_get_timedelta_us(struct sk_buff *skb) 5209 { 5210 return __qdf_nbuf_get_timedelta_us(skb); 5211 } 5212 5213 static inline qdf_ktime_t qdf_nbuf_net_timedelta(qdf_ktime_t t) 5214 { 5215 return __qdf_nbuf_net_timedelta(t); 5216 } 5217 #endif /* ENHANCED_OS_ABSTRACTION */ 5218 5219 #ifdef NBUF_MEMORY_DEBUG 5220 /** 5221 * qdf_set_smmu_fault_state() - Set smmu fault state 5222 * @smmu_fault_state: state of the wlan smmu 5223 * 5224 * Return: void 5225 */ 5226 void qdf_set_smmu_fault_state(bool smmu_fault_state); 5227 #else 5228 static inline void qdf_set_smmu_fault_state(bool smmu_fault_state) 5229 { 5230 } 5231 #endif 5232 5233 #ifdef CONFIG_NBUF_AP_PLATFORM 5234 #include <i_qdf_nbuf_api_w.h> 5235 #else 5236 #include <i_qdf_nbuf_api_m.h> 5237 #endif 5238 5239 /** 5240 * qdf_nbuf_stop_replenish_timer - Stop alloc fail replenish timer 5241 * 5242 * This function stops the alloc fail replenish timer. 5243 * 5244 * Return: void 5245 */ 5246 void qdf_nbuf_stop_replenish_timer(void); 5247 /** 5248 * qdf_get_nbuf_valid_frag() - Get nbuf to store frag 5249 * @nbuf: qdf_nbuf_t master nbuf 5250 * 5251 * Return: qdf_nbuf_t 5252 */ 5253 qdf_nbuf_t qdf_get_nbuf_valid_frag(qdf_nbuf_t nbuf); 5254 5255 #endif /* _QDF_NBUF_H */ 5256