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