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