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