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