1 /* 2 * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: qdf_nbuf_public network buffer API 21 * This file defines the network buffer abstraction. 22 */ 23 24 #ifndef _QDF_NBUF_H 25 #define _QDF_NBUF_H 26 27 #include <qdf_util.h> 28 #include <qdf_types.h> 29 #include <qdf_lock.h> 30 #include <i_qdf_trace.h> 31 #include <i_qdf_nbuf.h> 32 #include <qdf_net_types.h> 33 34 #define IPA_NBUF_OWNER_ID 0xaa55aa55 35 #define QDF_NBUF_PKT_TRAC_TYPE_EAPOL 0x02 36 #define QDF_NBUF_PKT_TRAC_TYPE_DHCP 0x04 37 #define QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION 0x08 38 #define QDF_NBUF_PKT_TRAC_TYPE_ARP 0x10 39 #define QDF_NBUF_PKT_TRAC_TYPE_ICMP 0x20 40 #define QDF_NBUF_PKT_TRAC_TYPE_ICMPv6 0x40 41 42 #define QDF_NBUF_PKT_TRAC_MAX_STRING 12 43 #define QDF_NBUF_PKT_TRAC_PROTO_STRING 4 44 #define QDF_NBUF_PKT_ERROR 1 45 46 #define QDF_NBUF_TRAC_IPV4_OFFSET 14 47 #define QDF_NBUF_TRAC_IPV4_HEADER_SIZE 20 48 #define QDF_NBUF_TRAC_DHCP_SRV_PORT 67 49 #define QDF_NBUF_TRAC_DHCP_CLI_PORT 68 50 #define QDF_NBUF_TRAC_ETH_TYPE_OFFSET 12 51 #define QDF_NBUF_TRAC_EAPOL_ETH_TYPE 0x888E 52 #define QDF_NBUF_TRAC_WAPI_ETH_TYPE 0x88b4 53 #define QDF_NBUF_TRAC_ARP_ETH_TYPE 0x0806 54 #define QDF_NBUF_PKT_IPV4_DSCP_MASK 0xFC 55 #define QDF_NBUF_PKT_IPV4_DSCP_SHIFT 0x02 56 #define QDF_NBUF_TRAC_TDLS_ETH_TYPE 0x890D 57 #define QDF_NBUF_TRAC_IPV4_ETH_TYPE 0x0800 58 #define QDF_NBUF_TRAC_IPV6_ETH_TYPE 0x86dd 59 #define QDF_NBUF_DEST_MAC_OFFSET 0 60 #define QDF_NBUF_SRC_MAC_OFFSET 6 61 #define QDF_NBUF_TRAC_IPV4_PROTO_TYPE_OFFSET 23 62 #define QDF_NBUF_TRAC_IPV4_DEST_ADDR_OFFSET 30 63 #define QDF_NBUF_TRAC_IPV6_PROTO_TYPE_OFFSET 20 64 #define QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK 0xE0000000 65 #define QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK 0xF0000000 66 #define QDF_NBUF_TRAC_IPV6_DEST_ADDR_OFFSET 38 67 #define QDF_NBUF_TRAC_IPV6_DEST_ADDR 0xFF00 68 #define QDF_NBUF_TRAC_IPV6_OFFSET 14 69 #define QDF_NBUF_TRAC_IPV6_HEADER_SIZE 40 70 #define QDF_NBUF_TRAC_ICMP_TYPE 1 71 #define QDF_NBUF_TRAC_TCP_TYPE 6 72 #define QDF_NBUF_TRAC_UDP_TYPE 17 73 #define QDF_NBUF_TRAC_ICMPV6_TYPE 0x3a 74 #define QDF_NBUF_TRAC_DHCP6_SRV_PORT 547 75 #define QDF_NBUF_TRAC_DHCP6_CLI_PORT 546 76 77 /* EAPOL Related MASK */ 78 #define EAPOL_PACKET_TYPE_OFFSET 15 79 #define EAPOL_KEY_INFO_OFFSET 19 80 #define EAPOL_PKT_LEN_OFFSET 16 81 #define EAPOL_KEY_LEN_OFFSET 21 82 #define EAPOL_MASK 0x8013 83 #define EAPOL_M1_BIT_MASK 0x8000 84 #define EAPOL_M2_BIT_MASK 0x0001 85 #define EAPOL_M3_BIT_MASK 0x8013 86 #define EAPOL_M4_BIT_MASK 0x0003 87 88 /* ARP Related MASK */ 89 #define QDF_NBUF_PKT_ARP_OPCODE_OFFSET 20 90 #define QDF_NBUF_PKT_ARPOP_REQ 1 91 #define QDF_NBUF_PKT_ARPOP_REPLY 2 92 #define QDF_NBUF_PKT_ARP_SRC_IP_OFFSET 28 93 #define QDF_NBUF_PKT_ARP_TGT_IP_OFFSET 38 94 95 /* ICMPv4 Related MASK */ 96 #define QDF_NBUF_PKT_ICMPv4_OPCODE_OFFSET 34 97 #define QDF_NBUF_PKT_ICMPv4OP_REQ 0x08 98 #define QDF_NBUF_PKT_ICMPv4OP_REPLY 0x00 99 #define QDF_NBUF_PKT_ICMPv4_SRC_IP_OFFSET 26 100 #define QDF_NBUF_PKT_ICMPv4_TGT_IP_OFFSET 30 101 102 /* TCP Related MASK */ 103 #define QDF_NBUF_PKT_TCP_OPCODE_OFFSET 47 104 #define QDF_NBUF_PKT_TCPOP_SYN 0x02 105 #define QDF_NBUF_PKT_TCPOP_SYN_ACK 0x12 106 #define QDF_NBUF_PKT_TCPOP_ACK 0x10 107 #define QDF_NBUF_PKT_TCP_SRC_PORT_OFFSET 34 108 #define QDF_NBUF_PKT_TCP_DST_PORT_OFFSET 36 109 110 /* DNS Related MASK */ 111 #define QDF_NBUF_PKT_DNS_OVER_UDP_OPCODE_OFFSET 44 112 #define QDF_NBUF_PKT_DNSOP_BITMAP 0xF800 113 #define QDF_NBUF_PKT_DNSOP_STANDARD_QUERY 0x0000 114 #define QDF_NBUF_PKT_DNSOP_STANDARD_RESPONSE 0x8000 115 #define QDF_NBUF_PKT_DNS_SRC_PORT_OFFSET 34 116 #define QDF_NBUF_PKT_DNS_DST_PORT_OFFSET 36 117 #define QDF_NBUF_PKT_DNS_NAME_OVER_UDP_OFFSET 54 118 #define QDF_NBUF_PKT_DNS_STANDARD_PORT 53 119 120 /* Tracked Packet types */ 121 #define QDF_NBUF_TX_PKT_INVALID 0 122 #define QDF_NBUF_TX_PKT_DATA_TRACK 1 123 #define QDF_NBUF_TX_PKT_MGMT_TRACK 2 124 #define QDF_NBUF_RX_PKT_DATA_TRACK 3 125 126 /* Different Packet states */ 127 #define QDF_NBUF_TX_PKT_HDD 1 128 #define QDF_NBUF_TX_PKT_TXRX_ENQUEUE 2 129 #define QDF_NBUF_TX_PKT_TXRX_DEQUEUE 3 130 #define QDF_NBUF_TX_PKT_TXRX 4 131 #define QDF_NBUF_TX_PKT_HTT 5 132 #define QDF_NBUF_TX_PKT_HTC 6 133 #define QDF_NBUF_TX_PKT_HIF 7 134 #define QDF_NBUF_TX_PKT_CE 8 135 #define QDF_NBUF_TX_PKT_FREE 9 136 #define QDF_NBUF_TX_PKT_STATE_MAX 10 137 #define QDF_NBUF_TX_PKT_LI_DP 11 138 139 /* qdf_nbuf allocate and map max retry threshold when failed */ 140 #define QDF_NBUF_ALLOC_MAP_RETRY_THRESHOLD 20 141 142 /* Enable flag to print TSO specific prints in datapath */ 143 #ifdef TSO_DEBUG_LOG_ENABLE 144 #define TSO_DEBUG(fmt, args ...) \ 145 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_NONE, \ 146 fmt, ## args) 147 #else 148 #define TSO_DEBUG(fmt, args ...) 149 #endif 150 151 #define IEEE80211_AMPDU_FLAG 0x01 152 153 #ifdef GET_MSDU_AGGREGATION 154 #define IEEE80211_AMSDU_FLAG 0x02 155 #endif 156 157 /** 158 * struct mon_rx_status - This will have monitor mode rx_status extracted from 159 * htt_rx_desc used later to update radiotap information. 160 * @tsft: Time Synchronization Function timer 161 * @ppdu_timestamp: Timestamp in the PPDU_START TLV 162 * @preamble_type: Preamble type in radio header 163 * @chan_freq: Capture channel frequency 164 * @chan_num: Capture channel number 165 * @chan_flags: Bitmap of Channel flags, IEEE80211_CHAN_TURBO, 166 * IEEE80211_CHAN_CCK... 167 * @ht_flags: HT flags, only present for HT frames. 168 * @vht_flags: VHT flags, only present for VHT frames. 169 * @vht_flag_values1-5: Contains corresponding data for flags field 170 * @he_flags: HE (11ax) flags, only present in HE frames 171 * @he_mu_flags: HE-MU (11ax) flags, only present in HE frames 172 * @he_mu_other_flags: HE-MU-OTHER (11ax) flags, only present in HE frames 173 * @he_sig_A1_known: HE (11ax) sig A1 known field 174 * @he_sig_A2_known: HE (11ax) sig A2 known field 175 * @he_sig_b_common: HE (11ax) sig B common field 176 * @he_sig_b_common_known: HE (11ax) sig B common known field 177 * @l_sig_a_info: L_SIG_A value coming in Rx descriptor 178 * @l_sig_b_info: L_SIG_B value coming in Rx descriptor 179 * @rate: Rate in terms 500Kbps 180 * @rtap_flags: Bit map of available fields in the radiotap 181 * @ant_signal_db: Rx packet RSSI 182 * @nr_ant: Number of Antennas used for streaming 183 * @mcs: MCS index of Rx frame 184 * @nss: Number of spatial streams 185 * @bw: bandwidth of rx frame 186 * @is_stbc: Is STBC enabled 187 * @sgi: Rx frame short guard interval 188 * @he_re: HE range extension 189 * @ldpc: ldpc enabled 190 * @beamformed: Is frame beamformed. 191 * @he_sig_b_common_RU[4]: HE (11ax) common RU assignment index 192 * @rssi_comb: Combined RSSI 193 * @duration: 802.11 Duration 194 * @first_data_seq_ctrl: Sequence ctrl field of first data frame 195 * @ast_index: AST table hash index 196 * @tid: QoS traffic tid number 197 * @rs_fcs_err: FCS error flag 198 * @rs_flags: Flags to indicate AMPDU or AMSDU aggregation 199 * @cck_flag: Flag to indicate CCK modulation 200 * @ofdm_flag: Flag to indicate OFDM modulation 201 * @he_per_user_1: HE per user info1 202 * @he_per_user_2: HE per user info2 203 * @he_per_user_position: HE per user position info 204 * @he_per_user_known: HE per user known info 205 * @he_flags1: HE flags 206 * @he_flags2: HE flags 207 * @he_RU[4]: HE RU assignment index 208 * @he_data1: HE property of received frame 209 * @he_data2: HE property of received frame 210 * @he_data3: HE property of received frame 211 * @he_data4: HE property of received frame 212 * @he_data5: HE property of received frame 213 * @prev_ppdu_id: ppdu_id in previously received message 214 * @ppdu_id: Id of the PLCP protocol data unit 215 * 216 * The following variables are not coming from the TLVs. 217 * These variables are placeholders for passing information to update_radiotap 218 * function. 219 * @device_id: Device ID coming from sub-system (PCI, AHB etc..) 220 * @chan_noise_floor: Channel Noise Floor for the pdev 221 */ 222 struct mon_rx_status { 223 uint64_t tsft; 224 uint32_t ppdu_timestamp; 225 uint32_t preamble_type; 226 uint16_t chan_freq; 227 uint16_t chan_num; 228 uint16_t chan_flags; 229 uint16_t ht_flags; 230 uint16_t vht_flags; 231 uint16_t vht_flag_values6; 232 uint16_t he_flags; 233 uint16_t he_mu_flags; 234 uint16_t he_mu_other_flags; 235 uint16_t he_sig_A1_known; 236 uint16_t he_sig_A2_known; 237 uint16_t he_sig_b_common; 238 uint16_t he_sig_b_common_known; 239 uint32_t l_sig_a_info; 240 uint32_t l_sig_b_info; 241 uint8_t rate; 242 uint8_t rtap_flags; 243 uint8_t ant_signal_db; 244 uint8_t nr_ant; 245 uint8_t mcs; 246 uint8_t nss; 247 uint16_t tcp_msdu_count; 248 uint16_t udp_msdu_count; 249 uint16_t other_msdu_count; 250 uint8_t bw; 251 uint8_t vht_flag_values1; 252 uint8_t vht_flag_values2; 253 uint8_t vht_flag_values3[4]; 254 uint8_t vht_flag_values4; 255 uint8_t vht_flag_values5; 256 uint8_t is_stbc; 257 uint8_t sgi; 258 uint8_t he_re; 259 uint8_t ldpc; 260 uint8_t beamformed; 261 uint8_t he_sig_b_common_RU[4]; 262 int8_t rssi_comb; 263 uint8_t reception_type; 264 uint16_t duration; 265 uint8_t frame_control_info_valid; 266 int16_t first_data_seq_ctrl; 267 uint32_t ast_index; 268 uint32_t tid; 269 uint8_t rs_fcs_err; 270 uint8_t rs_flags; 271 uint8_t cck_flag; 272 uint8_t ofdm_flag; 273 /* New HE radiotap fields */ 274 uint16_t he_per_user_1; 275 uint16_t he_per_user_2; 276 uint8_t he_per_user_position; 277 uint8_t he_per_user_known; 278 uint16_t he_flags1; 279 uint16_t he_flags2; 280 uint8_t he_RU[4]; 281 uint16_t he_data1; 282 uint16_t he_data2; 283 uint16_t he_data3; 284 uint16_t he_data4; 285 uint16_t he_data5; 286 uint16_t he_data6; 287 uint32_t ppdu_len; 288 uint32_t prev_ppdu_id; 289 uint32_t ppdu_id; 290 uint32_t device_id; 291 int16_t chan_noise_floor; 292 uint8_t monitor_direct_used; 293 }; 294 295 /** 296 * struct qdf_radiotap_vendor_ns - Vendor Namespace header as per 297 * Radiotap spec: https://www.radiotap.org/fields/Vendor%20Namespace.html 298 * @oui: Vendor OUI 299 * @selector: sub_namespace selector 300 * @skip_length: How many bytes of Vendor Namespace data that follows 301 */ 302 struct qdf_radiotap_vendor_ns { 303 uint8_t oui[3]; 304 uint8_t selector; 305 uint16_t skip_length; 306 } __attribute__((__packed__)); 307 308 /** 309 * strcut qdf_radiotap_vendor_ns_ath - Combined QTI Vendor NS 310 * including the Radiotap specified Vendor Namespace header and 311 * QTI specific Vendor Namespace data 312 * @lsig: L_SIG_A (or L_SIG) 313 * @device_id: Device Identification 314 * @lsig_b: L_SIG_B 315 * @ppdu_start_timestamp: Timestamp from RX_PPDU_START TLV 316 */ 317 struct qdf_radiotap_vendor_ns_ath { 318 struct qdf_radiotap_vendor_ns hdr; 319 /* QTI specific data follows */ 320 uint32_t lsig; 321 uint32_t device_id; 322 uint32_t lsig_b; 323 uint32_t ppdu_start_timestamp; 324 } __attribute__((__packed__)); 325 326 /* Masks for HE SIG known fields in mon_rx_status structure */ 327 #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU0 0x00000001 328 #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU1 0x00000002 329 #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU2 0x00000004 330 #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU3 0x00000008 331 #define QDF_MON_STATUS_HE_SIG_B_USER_KNOWN_SIG_B_ALL 0x00fe0000 332 #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_SU 0x00000000 333 #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_EXT_SU 0x40000000 334 #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_TRIG 0xc0000000 335 336 /* DHCP Related Mask */ 337 #define QDF_DHCP_OPTION53 (0x35) 338 #define QDF_DHCP_OPTION53_LENGTH (1) 339 #define QDF_DHCP_OPTION53_OFFSET (0x11A) 340 #define QDF_DHCP_OPTION53_LENGTH_OFFSET (0x11B) 341 #define QDF_DHCP_OPTION53_STATUS_OFFSET (0x11C) 342 #define DHCP_PKT_LEN_OFFSET 16 343 #define DHCP_TRANSACTION_ID_OFFSET 46 344 #define QDF_DHCP_DISCOVER (1) 345 #define QDF_DHCP_OFFER (2) 346 #define QDF_DHCP_REQUEST (3) 347 #define QDF_DHCP_DECLINE (4) 348 #define QDF_DHCP_ACK (5) 349 #define QDF_DHCP_NAK (6) 350 #define QDF_DHCP_RELEASE (7) 351 #define QDF_DHCP_INFORM (8) 352 353 /* ARP Related Mask */ 354 #define ARP_SUB_TYPE_OFFSET 20 355 #define ARP_REQUEST (1) 356 #define ARP_RESPONSE (2) 357 358 /* IPV4 header fields offset values */ 359 #define IPV4_PKT_LEN_OFFSET 16 360 #define IPV4_TCP_SEQ_NUM_OFFSET 38 361 #define IPV4_SRC_ADDR_OFFSET 26 362 #define IPV4_DST_ADDR_OFFSET 30 363 #define IPV4_SRC_PORT_OFFSET 34 364 #define IPV4_DST_PORT_OFFSET 36 365 366 /* IPV4 ICMP Related Mask */ 367 #define ICMP_SEQ_NUM_OFFSET 40 368 #define ICMP_SUBTYPE_OFFSET 34 369 #define ICMP_REQUEST 0x08 370 #define ICMP_RESPONSE 0x00 371 372 #define IPV6_ADDR_STR "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:"\ 373 "%02x%02x:%02x%02x" 374 375 /* IPV6 header fields offset values */ 376 #define IPV6_PKT_LEN_OFFSET 18 377 #define IPV6_TCP_SEQ_NUM_OFFSET 58 378 #define IPV6_SRC_ADDR_OFFSET 22 379 #define IPV6_DST_ADDR_OFFSET 38 380 #define IPV6_SRC_PORT_OFFSET 54 381 #define IPV6_DST_PORT_OFFSET 56 382 383 /* IPV6 ICMPV6 Related Mask */ 384 #define ICMPV6_SEQ_NUM_OFFSET 60 385 #define ICMPV6_SUBTYPE_OFFSET 54 386 #define ICMPV6_REQUEST 0x80 387 #define ICMPV6_RESPONSE 0x81 388 #define ICMPV6_RS 0x85 389 #define ICMPV6_RA 0x86 390 #define ICMPV6_NS 0x87 391 #define ICMPV6_NA 0x88 392 393 #define QDF_NBUF_IPA_CHECK_MASK 0x80000000 394 395 /* HE Radiotap data1 Mask */ 396 #define QDF_MON_STATUS_HE_SU_FORMAT_TYPE 0x0000 397 #define QDF_MON_STATUS_HE_EXT_SU_FORMAT_TYPE 0x0001 398 #define QDF_MON_STATUS_HE_MU_FORMAT_TYPE 0x0002 399 #define QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE 0x0003 400 401 402 #define QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN 0x0008 403 #define QDF_MON_STATUS_HE_DL_UL_KNOWN 0x0010 404 #define QDF_MON_STATUS_HE_MCS_KNOWN 0x0020 405 #define QDF_MON_STATUS_HE_DCM_KNOWN 0x0040 406 #define QDF_MON_STATUS_HE_CODING_KNOWN 0x0080 407 #define QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN 0x0100 408 #define QDF_MON_STATUS_HE_STBC_KNOWN 0x0200 409 #define QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN 0x4000 410 #define QDF_MON_STATUS_HE_DOPPLER_KNOWN 0x8000 411 #define QDF_MON_STATUS_HE_BSS_COLOR_KNOWN 0x0004 412 413 /* HE Radiotap data2 Mask */ 414 #define QDF_MON_STATUS_HE_GI_KNOWN 0x0002 415 #define QDF_MON_STATUS_TXBF_KNOWN 0x0010 416 #define QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN 0x0020 417 #define QDF_MON_STATUS_TXOP_KNOWN 0x0040 418 #define QDF_MON_STATUS_LTF_SYMBOLS_KNOWN 0x0004 419 #define QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN 0x0008 420 #define QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN 0x0080 421 422 /* HE radiotap data3 shift values */ 423 #define QDF_MON_STATUS_BEAM_CHANGE_SHIFT 6 424 #define QDF_MON_STATUS_DL_UL_SHIFT 7 425 #define QDF_MON_STATUS_TRANSMIT_MCS_SHIFT 8 426 #define QDF_MON_STATUS_DCM_SHIFT 12 427 #define QDF_MON_STATUS_CODING_SHIFT 13 428 #define QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT 14 429 #define QDF_MON_STATUS_STBC_SHIFT 15 430 431 /* HE radiotap data4 shift values */ 432 #define QDF_MON_STATUS_STA_ID_SHIFT 4 433 434 /* HE radiotap data5 */ 435 #define QDF_MON_STATUS_GI_SHIFT 4 436 #define QDF_MON_STATUS_HE_LTF_SIZE_SHIFT 6 437 #define QDF_MON_STATUS_HE_LTF_SYM_SHIFT 8 438 #define QDF_MON_STATUS_TXBF_SHIFT 14 439 #define QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT 15 440 #define QDF_MON_STATUS_PRE_FEC_PAD_SHIFT 12 441 442 /* HE radiotap data6 */ 443 #define QDF_MON_STATUS_DOPPLER_SHIFT 4 444 #define QDF_MON_STATUS_TXOP_SHIFT 8 445 446 /* HE radiotap HE-MU flags1 */ 447 #define QDF_MON_STATUS_SIG_B_MCS_KNOWN 0x0010 448 #define QDF_MON_STATUS_SIG_B_DCM_KNOWN 0x0040 449 #define QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN 0x8000 450 #define QDF_MON_STATUS_RU_0_KNOWN 0x0100 451 #define QDF_MON_STATUS_RU_1_KNOWN 0x0200 452 #define QDF_MON_STATUS_RU_2_KNOWN 0x0400 453 #define QDF_MON_STATUS_RU_3_KNOWN 0x0800 454 #define QDF_MON_STATUS_DCM_FLAG_1_SHIFT 5 455 #define QDF_MON_STATUS_SPATIAL_REUSE_MU_KNOWN 0x0100 456 #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN 0x4000 457 458 /* HE radiotap HE-MU flags2 */ 459 #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT 3 460 #define QDF_MON_STATUS_BW_KNOWN 0x0004 461 #define QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT 4 462 #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_KNOWN 0x0100 463 #define QDF_MON_STATUS_NUM_SIG_B_FLAG_2_SHIFT 9 464 #define QDF_MON_STATUS_LTF_FLAG_2_SYMBOLS_SHIFT 12 465 #define QDF_MON_STATUS_LTF_KNOWN 0x8000 466 467 /* HE radiotap per_user_1 */ 468 #define QDF_MON_STATUS_STA_SPATIAL_SHIFT 11 469 #define QDF_MON_STATUS_TXBF_SHIFT 14 470 #define QDF_MON_STATUS_RESERVED_SET_TO_1_SHIFT 19 471 #define QDF_MON_STATUS_STA_CODING_SHIFT 20 472 473 /* HE radiotap per_user_2 */ 474 #define QDF_MON_STATUS_STA_MCS_SHIFT 4 475 #define QDF_MON_STATUS_STA_DCM_SHIFT 5 476 477 /* HE radiotap per user known */ 478 #define QDF_MON_STATUS_USER_FIELD_POSITION_KNOWN 0x01 479 #define QDF_MON_STATUS_STA_ID_PER_USER_KNOWN 0x02 480 #define QDF_MON_STATUS_STA_NSTS_KNOWN 0x04 481 #define QDF_MON_STATUS_STA_TX_BF_KNOWN 0x08 482 #define QDF_MON_STATUS_STA_SPATIAL_CONFIG_KNOWN 0x10 483 #define QDF_MON_STATUS_STA_MCS_KNOWN 0x20 484 #define QDF_MON_STATUS_STA_DCM_KNOWN 0x40 485 #define QDF_MON_STATUS_STA_CODING_KNOWN 0x80 486 487 /** 488 * qdf_proto_type - protocol type 489 * @QDF_PROTO_TYPE_DHCP - DHCP 490 * @QDF_PROTO_TYPE_EAPOL - EAPOL 491 * @QDF_PROTO_TYPE_ARP - ARP 492 * @QDF_PROTO_TYPE_MGMT - MGMT 493 * @QDF_PROTO_TYPE_ICMP - ICMP 494 * @QDF_PROTO_TYPE_ICMPv6 - ICMPv6 495 * QDF_PROTO_TYPE_EVENT - EVENT 496 */ 497 enum qdf_proto_type { 498 QDF_PROTO_TYPE_DHCP, 499 QDF_PROTO_TYPE_EAPOL, 500 QDF_PROTO_TYPE_ARP, 501 QDF_PROTO_TYPE_MGMT, 502 QDF_PROTO_TYPE_ICMP, 503 QDF_PROTO_TYPE_ICMPv6, 504 QDF_PROTO_TYPE_EVENT, 505 QDF_PROTO_TYPE_MAX 506 }; 507 508 /** 509 * cb_ftype - Frame type information in skb cb 510 * @CB_FTYPE_INVALID - Invalid 511 * @CB_FTYPE_MCAST2UCAST - Multicast to Unicast converted packet 512 * @CB_FTYPE_TSO - TCP Segmentation Offload 513 * @CB_FTYPE_TSO_SG - TSO Scatter Gather 514 * @CB_FTYPE_SG - Scatter Gather 515 * @CB_FTYPE_INTRABSS_FWD - Intra BSS forwarding 516 * @CB_FTYPE_RX_INFO - Rx information 517 * @CB_FTYPE_MESH_RX_INFO - Mesh Rx information 518 * @CB_FTYPE_MESH_TX_INFO - Mesh Tx information 519 * @CB_FTYPE_DMS - Directed Multicast Service 520 */ 521 enum cb_ftype { 522 CB_FTYPE_INVALID = 0, 523 CB_FTYPE_MCAST2UCAST = 1, 524 CB_FTYPE_TSO = 2, 525 CB_FTYPE_TSO_SG = 3, 526 CB_FTYPE_SG = 4, 527 CB_FTYPE_INTRABSS_FWD = 5, 528 CB_FTYPE_RX_INFO = 6, 529 CB_FTYPE_MESH_RX_INFO = 7, 530 CB_FTYPE_MESH_TX_INFO = 8, 531 CB_FTYPE_DMS = 9, 532 }; 533 534 /** 535 * qdf_proto_subtype - subtype of packet 536 * @QDF_PROTO_EAPOL_M1 - EAPOL 1/4 537 * @QDF_PROTO_EAPOL_M2 - EAPOL 2/4 538 * @QDF_PROTO_EAPOL_M3 - EAPOL 3/4 539 * @QDF_PROTO_EAPOL_M4 - EAPOL 4/4 540 * @QDF_PROTO_DHCP_DISCOVER - discover 541 * @QDF_PROTO_DHCP_REQUEST - request 542 * @QDF_PROTO_DHCP_OFFER - offer 543 * @QDF_PROTO_DHCP_ACK - ACK 544 * @QDF_PROTO_DHCP_NACK - NACK 545 * @QDF_PROTO_DHCP_RELEASE - release 546 * @QDF_PROTO_DHCP_INFORM - inform 547 * @QDF_PROTO_DHCP_DECLINE - decline 548 * @QDF_PROTO_ARP_REQ - arp request 549 * @QDF_PROTO_ARP_RES - arp response 550 * @QDF_PROTO_ICMP_REQ - icmp request 551 * @QDF_PROTO_ICMP_RES - icmp response 552 * @QDF_PROTO_ICMPV6_REQ - icmpv6 request 553 * @QDF_PROTO_ICMPV6_RES - icmpv6 response 554 * @QDF_PROTO_ICMPV6_RS - icmpv6 rs packet 555 * @QDF_PROTO_ICMPV6_RA - icmpv6 ra packet 556 * @QDF_PROTO_ICMPV6_NS - icmpv6 ns packet 557 * @QDF_PROTO_ICMPV6_NA - icmpv6 na packet 558 * @QDF_PROTO_IPV4_UDP - ipv4 udp 559 * @QDF_PROTO_IPV4_TCP - ipv4 tcp 560 * @QDF_PROTO_IPV6_UDP - ipv6 udp 561 * @QDF_PROTO_IPV6_TCP - ipv6 tcp 562 * @QDF_PROTO_MGMT_ASSOC -assoc 563 * @QDF_PROTO_MGMT_DISASSOC - disassoc 564 * @QDF_PROTO_MGMT_AUTH - auth 565 * @QDF_PROTO_MGMT_DEAUTH - deauth 566 * QDF_ROAM_SYNCH - roam synch indication from fw 567 * QDF_ROAM_COMPLETE - roam complete cmd to fw 568 * QDF_ROAM_EVENTID - roam eventid from fw 569 */ 570 enum qdf_proto_subtype { 571 QDF_PROTO_INVALID, 572 QDF_PROTO_EAPOL_M1, 573 QDF_PROTO_EAPOL_M2, 574 QDF_PROTO_EAPOL_M3, 575 QDF_PROTO_EAPOL_M4, 576 QDF_PROTO_DHCP_DISCOVER, 577 QDF_PROTO_DHCP_REQUEST, 578 QDF_PROTO_DHCP_OFFER, 579 QDF_PROTO_DHCP_ACK, 580 QDF_PROTO_DHCP_NACK, 581 QDF_PROTO_DHCP_RELEASE, 582 QDF_PROTO_DHCP_INFORM, 583 QDF_PROTO_DHCP_DECLINE, 584 QDF_PROTO_ARP_REQ, 585 QDF_PROTO_ARP_RES, 586 QDF_PROTO_ICMP_REQ, 587 QDF_PROTO_ICMP_RES, 588 QDF_PROTO_ICMPV6_REQ, 589 QDF_PROTO_ICMPV6_RES, 590 QDF_PROTO_ICMPV6_RS, 591 QDF_PROTO_ICMPV6_RA, 592 QDF_PROTO_ICMPV6_NS, 593 QDF_PROTO_ICMPV6_NA, 594 QDF_PROTO_IPV4_UDP, 595 QDF_PROTO_IPV4_TCP, 596 QDF_PROTO_IPV6_UDP, 597 QDF_PROTO_IPV6_TCP, 598 QDF_PROTO_MGMT_ASSOC, 599 QDF_PROTO_MGMT_DISASSOC, 600 QDF_PROTO_MGMT_AUTH, 601 QDF_PROTO_MGMT_DEAUTH, 602 QDF_ROAM_SYNCH, 603 QDF_ROAM_COMPLETE, 604 QDF_ROAM_EVENTID, 605 QDF_PROTO_SUBTYPE_MAX 606 }; 607 608 /** 609 * @qdf_nbuf_t - Platform indepedent packet abstraction 610 */ 611 typedef __qdf_nbuf_t qdf_nbuf_t; 612 613 /** 614 * typedef qdf_nbuf_queue_head_t - Platform indepedent nbuf queue head 615 */ 616 typedef __qdf_nbuf_queue_head_t qdf_nbuf_queue_head_t; 617 618 /** 619 * @qdf_dma_map_cb_t - Dma map callback prototype 620 */ 621 typedef void (*qdf_dma_map_cb_t)(void *arg, qdf_nbuf_t buf, 622 qdf_dma_map_t dmap); 623 624 /** 625 * @qdf_nbuf_queue_t - Platform independent packet queue abstraction 626 */ 627 typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t; 628 629 /* BUS/DMA mapping routines */ 630 631 static inline QDF_STATUS 632 qdf_nbuf_dmamap_create(qdf_device_t osdev, qdf_dma_map_t *dmap) 633 { 634 return __qdf_nbuf_dmamap_create(osdev, dmap); 635 } 636 637 static inline void 638 qdf_nbuf_dmamap_destroy(qdf_device_t osdev, qdf_dma_map_t dmap) 639 { 640 __qdf_nbuf_dmamap_destroy(osdev, dmap); 641 } 642 643 static inline void 644 qdf_nbuf_dmamap_set_cb(qdf_dma_map_t dmap, qdf_dma_map_cb_t cb, void *arg) 645 { 646 __qdf_nbuf_dmamap_set_cb(dmap, cb, arg); 647 } 648 649 static inline void 650 qdf_nbuf_set_send_complete_flag(qdf_nbuf_t buf, bool flag) 651 { 652 __qdf_nbuf_set_send_complete_flag(buf, flag); 653 } 654 655 #ifdef NBUF_MAP_UNMAP_DEBUG 656 /** 657 * qdf_nbuf_map_check_for_leaks() - check for nbut map leaks 658 * 659 * Check for net buffers that have been mapped, but never unmapped. 660 * 661 * Returns: None 662 */ 663 void qdf_nbuf_map_check_for_leaks(void); 664 665 QDF_STATUS qdf_nbuf_map_debug(qdf_device_t osdev, 666 qdf_nbuf_t buf, 667 qdf_dma_dir_t dir, 668 const char *file, 669 uint32_t line); 670 671 #define qdf_nbuf_map(osdev, buf, dir) \ 672 qdf_nbuf_map_debug(osdev, buf, dir, __FILE__, __LINE__) 673 674 void qdf_nbuf_unmap_debug(qdf_device_t osdev, 675 qdf_nbuf_t buf, 676 qdf_dma_dir_t dir, 677 const char *file, 678 uint32_t line); 679 680 #define qdf_nbuf_unmap(osdev, buf, dir) \ 681 qdf_nbuf_unmap_debug(osdev, buf, dir, __FILE__, __LINE__) 682 683 QDF_STATUS qdf_nbuf_map_single_debug(qdf_device_t osdev, 684 qdf_nbuf_t buf, 685 qdf_dma_dir_t dir, 686 const char *file, 687 uint32_t line); 688 689 #define qdf_nbuf_map_single(osdev, buf, dir) \ 690 qdf_nbuf_map_single_debug(osdev, buf, dir, __FILE__, __LINE__) 691 692 void qdf_nbuf_unmap_single_debug(qdf_device_t osdev, 693 qdf_nbuf_t buf, 694 qdf_dma_dir_t dir, 695 const char *file, 696 uint32_t line); 697 698 #define qdf_nbuf_unmap_single(osdev, buf, dir) \ 699 qdf_nbuf_unmap_single_debug(osdev, buf, dir, __FILE__, __LINE__) 700 701 QDF_STATUS qdf_nbuf_map_nbytes_debug(qdf_device_t osdev, 702 qdf_nbuf_t buf, 703 qdf_dma_dir_t dir, 704 int nbytes, 705 const char *file, 706 uint32_t line); 707 708 #define qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes) \ 709 qdf_nbuf_map_nbytes_debug(osdev, buf, dir, nbytes, __FILE__, __LINE__) 710 711 void qdf_nbuf_unmap_nbytes_debug(qdf_device_t osdev, 712 qdf_nbuf_t buf, 713 qdf_dma_dir_t dir, 714 int nbytes, 715 const char *file, 716 uint32_t line); 717 718 #define qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes) \ 719 qdf_nbuf_unmap_nbytes_debug(osdev, buf, dir, nbytes, __FILE__, __LINE__) 720 721 QDF_STATUS qdf_nbuf_map_nbytes_single_debug(qdf_device_t osdev, 722 qdf_nbuf_t buf, 723 qdf_dma_dir_t dir, 724 int nbytes, 725 const char *file, 726 uint32_t line); 727 728 #define qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes) \ 729 qdf_nbuf_map_nbytes_single_debug(osdev, buf, dir, nbytes, \ 730 __FILE__, __LINE__) 731 732 void qdf_nbuf_unmap_nbytes_single_debug(qdf_device_t osdev, 733 qdf_nbuf_t buf, 734 qdf_dma_dir_t dir, 735 int nbytes, 736 const char *file, 737 uint32_t line); 738 739 #define qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes) \ 740 qdf_nbuf_unmap_nbytes_single_debug(osdev, buf, dir, nbytes, \ 741 __FILE__, __LINE__) 742 743 #else /* NBUF_MAP_UNMAP_DEBUG */ 744 745 static inline void qdf_nbuf_map_check_for_leaks(void) {} 746 747 static inline QDF_STATUS 748 qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 749 { 750 return __qdf_nbuf_map(osdev, buf, dir); 751 } 752 753 static inline void 754 qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 755 { 756 __qdf_nbuf_unmap(osdev, buf, dir); 757 } 758 759 static inline QDF_STATUS 760 qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 761 { 762 return __qdf_nbuf_map_single(osdev, buf, dir); 763 } 764 765 static inline void 766 qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 767 { 768 __qdf_nbuf_unmap_single(osdev, buf, dir); 769 } 770 771 static inline QDF_STATUS 772 qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf, 773 qdf_dma_dir_t dir, int nbytes) 774 { 775 return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes); 776 } 777 778 static inline void 779 qdf_nbuf_unmap_nbytes(qdf_device_t osdev, 780 qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes) 781 { 782 __qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes); 783 } 784 785 static inline QDF_STATUS 786 qdf_nbuf_map_nbytes_single( 787 qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes) 788 { 789 return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes); 790 } 791 792 static inline void 793 qdf_nbuf_unmap_nbytes_single( 794 qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes) 795 { 796 return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes); 797 } 798 #endif /* NBUF_MAP_UNMAP_DEBUG */ 799 800 /** 801 * qdf_nbuf_queue_head_dequeue() - dequeue nbuf from the head of queue 802 * @nbuf_queue_head: pointer to nbuf queue head 803 * 804 * Return: pointer to network buffer dequeued 805 */ 806 static inline 807 qdf_nbuf_t qdf_nbuf_queue_head_dequeue(qdf_nbuf_queue_head_t *nbuf_queue_head) 808 { 809 return __qdf_nbuf_queue_head_dequeue(nbuf_queue_head); 810 } 811 812 /** 813 * qdf_nbuf_queue_head_qlen() - length of the queue 814 * @nbuf_queue_head: pointer to nbuf queue head 815 * 816 * Return: length of queue (number of nbufs) pointed by qdf_nbuf_queue_head_t 817 */ 818 static inline 819 uint32_t qdf_nbuf_queue_head_qlen(qdf_nbuf_queue_head_t *nbuf_queue_head) 820 { 821 return __qdf_nbuf_queue_head_qlen(nbuf_queue_head); 822 } 823 824 /** 825 * qdf_nbuf_queue_head_enqueue_tail() - enqueue nbuf into queue tail 826 * @nbuf_queue_head: pointer to nbuf queue head 827 * @nbuf: nbuf to be enqueued 828 * 829 * Return: None 830 */ 831 static inline 832 void qdf_nbuf_queue_head_enqueue_tail(qdf_nbuf_queue_head_t *nbuf_queue_head, 833 qdf_nbuf_t nbuf) 834 { 835 return __qdf_nbuf_queue_head_enqueue_tail(nbuf_queue_head, nbuf); 836 } 837 838 /** 839 * qdf_nbuf_queue_head_init() - initialize qdf_nbuf_queue_head_t 840 * @nbuf_queue_head: pointer to nbuf queue head to be initialized 841 * 842 * Return: None 843 */ 844 static inline 845 void qdf_nbuf_queue_head_init(qdf_nbuf_queue_head_t *nbuf_queue_head) 846 { 847 return __qdf_nbuf_queue_head_init(nbuf_queue_head); 848 } 849 850 /** 851 * qdf_nbuf_queue_head_purge() - purge qdf_nbuf_queue_head_t 852 * @nbuf_queue_head: pointer to nbuf queue head to be purged 853 * 854 * Return: None 855 */ 856 static inline 857 void qdf_nbuf_queue_head_purge(qdf_nbuf_queue_head_t *nbuf_queue_head) 858 { 859 return __qdf_nbuf_queue_head_purge(nbuf_queue_head); 860 } 861 862 static inline void 863 qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir) 864 { 865 __qdf_nbuf_sync_for_cpu(osdev, buf, dir); 866 } 867 868 static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf) 869 { 870 return __qdf_nbuf_get_num_frags(buf); 871 } 872 873 /** 874 * qdf_nbuf_get_frag_len() - get fragment length 875 * @buf: Network buffer 876 * @frag_num: Fragment number 877 * 878 * Return: Fragment length 879 */ 880 static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num) 881 { 882 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 883 return __qdf_nbuf_get_frag_len(buf, frag_num); 884 } 885 886 /** 887 * qdf_nbuf_get_frag_vaddr() - get fragment virtual address 888 * @buf: Network buffer 889 * @frag_num: Fragment number 890 * 891 * Return: Fragment virtual address 892 */ 893 static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf, 894 int frag_num) 895 { 896 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 897 return __qdf_nbuf_get_frag_vaddr(buf, frag_num); 898 } 899 900 /** 901 * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address 902 * @buf: Network buffer 903 * 904 * Return: Fragment virtual address 905 */ 906 static inline unsigned char * 907 qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf) 908 { 909 return __qdf_nbuf_get_frag_vaddr_always(buf); 910 } 911 912 /** 913 * qdf_nbuf_get_frag_paddr() - get physical address for skb linear buffer 914 * or skb fragment, based on frag_num passed 915 * @buf: Network buffer 916 * @frag_num: Fragment number 917 * 918 * Return: Fragment physical address 919 */ 920 static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf, 921 unsigned int frag_num) 922 { 923 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 924 return __qdf_nbuf_get_frag_paddr(buf, frag_num); 925 } 926 927 /** 928 * qdf_nbuf_get_tx_frag_paddr() - get physical address for skb fragments only 929 * @buf: Network buffer 930 * 931 * Return: Fragment physical address 932 * Usage guideline: Use “qdf_nbuf_frag_map()” to dma map the specific 933 * skb fragment , followed by “qdf_nbuf_get_tx_frag_paddr” 934 */ 935 static inline qdf_dma_addr_t qdf_nbuf_get_tx_frag_paddr(qdf_nbuf_t buf) 936 { 937 return __qdf_nbuf_get_tx_frag_paddr(buf); 938 } 939 940 /** 941 * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream 942 * @buf: Network buffer 943 * @frag_num: Fragment number 944 * 945 * Return: Fragment wordstream or not 946 */ 947 static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num) 948 { 949 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 950 return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num); 951 } 952 953 /** 954 * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream 955 * @buf: Network buffer 956 * @frag_num: Fragment number 957 * @is_wordstream: Wordstream 958 * 959 * Return: none 960 */ 961 static inline void 962 qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf, 963 int frag_num, int is_wordstream) 964 { 965 QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS)); 966 __qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream); 967 } 968 969 static inline void 970 qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, uint8_t vdev_id) 971 { 972 __qdf_nbuf_set_vdev_ctx(buf, vdev_id); 973 } 974 975 static inline void 976 qdf_nbuf_set_tx_ftype(qdf_nbuf_t buf, enum cb_ftype type) 977 { 978 __qdf_nbuf_set_tx_ftype(buf, type); 979 } 980 981 static inline void 982 qdf_nbuf_set_rx_ftype(qdf_nbuf_t buf, enum cb_ftype type) 983 { 984 __qdf_nbuf_set_rx_ftype(buf, type); 985 } 986 987 988 989 static inline uint8_t 990 qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf) 991 { 992 return __qdf_nbuf_get_vdev_ctx(buf); 993 } 994 995 static inline enum cb_ftype qdf_nbuf_get_tx_ftype(qdf_nbuf_t buf) 996 { 997 return __qdf_nbuf_get_tx_ftype(buf); 998 } 999 1000 static inline enum cb_ftype qdf_nbuf_get_rx_ftype(qdf_nbuf_t buf) 1001 { 1002 return __qdf_nbuf_get_rx_ftype(buf); 1003 } 1004 1005 1006 static inline qdf_dma_addr_t 1007 qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf) 1008 { 1009 return __qdf_nbuf_mapped_paddr_get(buf); 1010 } 1011 1012 static inline void 1013 qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr) 1014 { 1015 __qdf_nbuf_mapped_paddr_set(buf, paddr); 1016 } 1017 1018 static inline void 1019 qdf_nbuf_frag_push_head(qdf_nbuf_t buf, 1020 int frag_len, char *frag_vaddr, 1021 qdf_dma_addr_t frag_paddr) 1022 { 1023 __qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr); 1024 } 1025 1026 #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf)) 1027 1028 /** 1029 * qdf_nbuf_set_rx_chfrag_start() - set msdu start bit 1030 * @buf: Network buffer 1031 * @val: 0/1 1032 * 1033 * Return: void 1034 */ 1035 static inline void 1036 qdf_nbuf_set_rx_chfrag_start(qdf_nbuf_t buf, uint8_t val) 1037 { 1038 __qdf_nbuf_set_rx_chfrag_start(buf, val); 1039 } 1040 1041 /** 1042 * qdf_nbuf_is_rx_chfrag_start() - get msdu start bit 1043 * @buf: Network buffer 1044 * 1045 * Return: integer value - 0/1 1046 */ 1047 static inline int qdf_nbuf_is_rx_chfrag_start(qdf_nbuf_t buf) 1048 { 1049 return __qdf_nbuf_is_rx_chfrag_start(buf); 1050 } 1051 1052 /** 1053 * qdf_nbuf_set_rx_chfrag_cont() - set msdu continuation bit 1054 * @buf: Network buffer 1055 * @val: 0/1 1056 * 1057 * Return: void 1058 */ 1059 static inline void 1060 qdf_nbuf_set_rx_chfrag_cont(qdf_nbuf_t buf, uint8_t val) 1061 { 1062 __qdf_nbuf_set_rx_chfrag_cont(buf, val); 1063 } 1064 1065 /** 1066 * qdf_nbuf_is_rx_chfrag_cont() - get msdu continuation bit 1067 * @buf: Network buffer 1068 * 1069 * Return: integer value - 0/1 1070 */ 1071 static inline int qdf_nbuf_is_rx_chfrag_cont(qdf_nbuf_t buf) 1072 { 1073 return __qdf_nbuf_is_rx_chfrag_cont(buf); 1074 } 1075 1076 /** 1077 * qdf_nbuf_set_rx_chfrag_end() - set msdu end bit 1078 * @buf: Network buffer 1079 * @val: 0/1 1080 * 1081 * Return: void 1082 */ 1083 static inline void qdf_nbuf_set_rx_chfrag_end(qdf_nbuf_t buf, uint8_t val) 1084 { 1085 __qdf_nbuf_set_rx_chfrag_end(buf, val); 1086 } 1087 1088 /** 1089 * qdf_nbuf_is_rx_chfrag_end() - set msdu end bit 1090 * @buf: Network buffer 1091 * 1092 * Return: integer value - 0/1 1093 */ 1094 static inline int qdf_nbuf_is_rx_chfrag_end(qdf_nbuf_t buf) 1095 { 1096 return __qdf_nbuf_is_rx_chfrag_end(buf); 1097 } 1098 1099 /** 1100 * qdf_nbuf_set_tx_chfrag_start() - set msdu start bit 1101 * @buf: Network buffer 1102 * @val: 0/1 1103 * 1104 * Return: void 1105 */ 1106 static inline void 1107 qdf_nbuf_set_tx_chfrag_start(qdf_nbuf_t buf, uint8_t val) 1108 { 1109 __qdf_nbuf_set_tx_chfrag_start(buf, val); 1110 } 1111 1112 /** 1113 * qdf_nbuf_is_tx_chfrag_start() - get msdu start bit 1114 * @buf: Network buffer 1115 * 1116 * Return: integer value - 0/1 1117 */ 1118 static inline int qdf_nbuf_is_tx_chfrag_start(qdf_nbuf_t buf) 1119 { 1120 return __qdf_nbuf_is_tx_chfrag_start(buf); 1121 } 1122 1123 /** 1124 * qdf_nbuf_set_tx_chfrag_cont() - set msdu continuation bit 1125 * @buf: Network buffer 1126 * @val: 0/1 1127 * 1128 * Return: void 1129 */ 1130 static inline void 1131 qdf_nbuf_set_tx_chfrag_cont(qdf_nbuf_t buf, uint8_t val) 1132 { 1133 __qdf_nbuf_set_tx_chfrag_cont(buf, val); 1134 } 1135 1136 /** 1137 * qdf_nbuf_is_tx_chfrag_cont() - get msdu continuation bit 1138 * @buf: Network buffer 1139 * 1140 * Return: integer value - 0/1 1141 */ 1142 static inline int qdf_nbuf_is_tx_chfrag_cont(qdf_nbuf_t buf) 1143 { 1144 return __qdf_nbuf_is_tx_chfrag_cont(buf); 1145 } 1146 1147 /** 1148 * qdf_nbuf_set_tx_chfrag_end() - set msdu end bit 1149 * @buf: Network buffer 1150 * @val: 0/1 1151 * 1152 * Return: void 1153 */ 1154 static inline void qdf_nbuf_set_tx_chfrag_end(qdf_nbuf_t buf, uint8_t val) 1155 { 1156 __qdf_nbuf_set_tx_chfrag_end(buf, val); 1157 } 1158 1159 /** 1160 * qdf_nbuf_is_tx_chfrag_end() - set msdu end bit 1161 * @buf: Network buffer 1162 * 1163 * Return: integer value - 0/1 1164 */ 1165 static inline int qdf_nbuf_is_tx_chfrag_end(qdf_nbuf_t buf) 1166 { 1167 return __qdf_nbuf_is_tx_chfrag_end(buf); 1168 } 1169 1170 static inline void 1171 qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg) 1172 { 1173 __qdf_nbuf_dma_map_info(bmap, sg); 1174 } 1175 1176 /** 1177 * qdf_nbuf_is_tso() - is the network buffer a jumbo packet? 1178 * @buf: Network buffer 1179 * 1180 * Return: 1 - this is a jumbo packet 0 - not a jumbo packet 1181 */ 1182 static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf) 1183 { 1184 return __qdf_nbuf_is_tso(nbuf); 1185 } 1186 1187 /** 1188 * qdf_nbuf_get_users() - function to get the number of users referencing this 1189 * network buffer 1190 * 1191 * @nbuf: network buffer 1192 * 1193 * Return: number of user references to nbuf. 1194 */ 1195 static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf) 1196 { 1197 return __qdf_nbuf_get_users(nbuf); 1198 } 1199 1200 /** 1201 * qdf_nbuf_next() - get the next packet in the linked list 1202 * @buf: Network buffer 1203 * 1204 * This function can be used when nbufs are directly linked into a list, 1205 * rather than using a separate network buffer queue object. 1206 * 1207 * Return: next network buffer in the linked list 1208 */ 1209 static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf) 1210 { 1211 return __qdf_nbuf_next(buf); 1212 } 1213 1214 #ifdef NBUF_MEMORY_DEBUG 1215 void qdf_net_buf_debug_init(void); 1216 void qdf_net_buf_debug_exit(void); 1217 void qdf_net_buf_debug_clean(void); 1218 void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size, 1219 uint8_t *file_name, uint32_t line_num); 1220 void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf); 1221 1222 /** 1223 * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak 1224 * @net_buf: Network buf holding head segment (single) 1225 * @file_name: pointer to file name 1226 * @line_num: line number 1227 * 1228 * WLAN driver module's SKB which are allocated by network stack are 1229 * suppose to call this API before freeing it such that the SKB 1230 * is not reported as memory leak. 1231 * 1232 * Return: none 1233 */ 1234 void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf, 1235 uint8_t *file_name, uint32_t line_num); 1236 void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf); 1237 1238 /* nbuf allocation rouines */ 1239 1240 #define qdf_nbuf_alloc(d, s, r, a, p) \ 1241 qdf_nbuf_alloc_debug(d, s, r, a, p, __FILE__, __LINE__) 1242 1243 qdf_nbuf_t qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size, 1244 int reserve, int align, int prio, 1245 uint8_t *file, uint32_t line); 1246 1247 #define qdf_nbuf_free(d) \ 1248 qdf_nbuf_free_debug(d, __FILE__, __LINE__) 1249 1250 void qdf_nbuf_free_debug(qdf_nbuf_t nbuf, uint8_t *file, uint32_t line); 1251 1252 #define qdf_nbuf_clone(buf) \ 1253 qdf_nbuf_clone_debug(buf, __FILE__, __LINE__) 1254 1255 /** 1256 * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly) 1257 * @buf: nbuf to clone from 1258 * @file_name: pointer to file name 1259 * @line_num: line number 1260 * 1261 * This function clones the nbuf and creates a memory tracking 1262 * node corresponding to that cloned skbuff structure. 1263 * 1264 * Return: cloned buffer 1265 */ 1266 static inline qdf_nbuf_t 1267 qdf_nbuf_clone_debug(qdf_nbuf_t buf, uint8_t *file_name, 1268 uint32_t line_num) 1269 { 1270 qdf_nbuf_t cloned_buf; 1271 1272 cloned_buf = __qdf_nbuf_clone(buf); 1273 1274 /* Store SKB in internal QDF tracking table */ 1275 if (qdf_likely(cloned_buf)) 1276 qdf_net_buf_debug_add_node(cloned_buf, 0, file_name, line_num); 1277 1278 return cloned_buf; 1279 } 1280 1281 #define qdf_nbuf_copy(buf) \ 1282 qdf_nbuf_copy_debug(buf, __FILE__, __LINE__) 1283 1284 /** 1285 * qdf_nbuf_copy_debug() - returns a private copy of the buf 1286 * @buf: nbuf to copy from 1287 * @file_name: pointer to file name 1288 * @line_num: line number 1289 * 1290 * This API returns a private copy of the buf, the buf returned is completely 1291 * modifiable by callers. It also creates a memory tracking node corresponding 1292 * to that new skbuff structure. 1293 * 1294 * Return: copied buffer 1295 */ 1296 static inline qdf_nbuf_t 1297 qdf_nbuf_copy_debug(qdf_nbuf_t buf, uint8_t *file_name, 1298 uint32_t line_num) 1299 { 1300 qdf_nbuf_t copied_buf; 1301 1302 copied_buf = __qdf_nbuf_copy(buf); 1303 1304 /* Store SKB in internal QDF tracking table */ 1305 if (qdf_likely(copied_buf)) 1306 qdf_net_buf_debug_add_node(copied_buf, 0, file_name, line_num); 1307 1308 return copied_buf; 1309 } 1310 1311 #else /* NBUF_MEMORY_DEBUG */ 1312 1313 static inline void qdf_net_buf_debug_init(void) {} 1314 static inline void qdf_net_buf_debug_exit(void) {} 1315 1316 static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf, 1317 uint8_t *file_name, uint32_t line_num) 1318 { 1319 } 1320 1321 static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf) 1322 { 1323 } 1324 1325 /* Nbuf allocation rouines */ 1326 1327 #define qdf_nbuf_alloc(osdev, size, reserve, align, prio) \ 1328 qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \ 1329 __func__, __LINE__) 1330 static inline qdf_nbuf_t 1331 qdf_nbuf_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve, int align, 1332 int prio, const char *func, uint32_t line) 1333 { 1334 return __qdf_nbuf_alloc(osdev, size, reserve, align, prio, func, line); 1335 } 1336 1337 static inline void qdf_nbuf_free(qdf_nbuf_t buf) 1338 { 1339 __qdf_nbuf_free(buf); 1340 } 1341 1342 /** 1343 * qdf_nbuf_clone() - clone the nbuf (copy is readonly) 1344 * @buf: Pointer to network buffer 1345 * 1346 * This function clones the nbuf and returns new sk_buff 1347 * structure. 1348 * 1349 * Return: cloned skb 1350 */ 1351 static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf) 1352 { 1353 return __qdf_nbuf_clone(buf); 1354 } 1355 1356 /** 1357 * qdf_nbuf_copy() - returns a private copy of the buf 1358 * @buf: Pointer to network buffer 1359 * 1360 * This API returns a private copy of the buf, the buf returned is completely 1361 * modifiable by callers 1362 * 1363 * Return: skb or NULL 1364 */ 1365 static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf) 1366 { 1367 return __qdf_nbuf_copy(buf); 1368 } 1369 1370 #endif /* NBUF_MEMORY_DEBUG */ 1371 1372 #ifdef WLAN_FEATURE_FASTPATH 1373 /** 1374 * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state 1375 * 1376 * @buf: buf instance 1377 * Return: data pointer of this buf where new data has to be 1378 * put, or NULL if there is not enough room in this buf. 1379 */ 1380 void qdf_nbuf_init_fast(qdf_nbuf_t nbuf); 1381 #endif /* WLAN_FEATURE_FASTPATH */ 1382 1383 /** 1384 * @qdf_nbuf_list_free() - free a list of nbufs 1385 * @buf_list: A list of nbufs to be freed 1386 * 1387 * Return: none 1388 */ 1389 1390 static inline void qdf_nbuf_list_free(qdf_nbuf_t buf_list) 1391 { 1392 while (buf_list) { 1393 qdf_nbuf_t next = qdf_nbuf_next(buf_list); 1394 qdf_nbuf_free(buf_list); 1395 buf_list = next; 1396 } 1397 } 1398 1399 static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err) 1400 { 1401 qdf_nbuf_list_free(buf_list); 1402 } 1403 1404 static inline void qdf_nbuf_ref(qdf_nbuf_t buf) 1405 { 1406 __qdf_nbuf_ref(buf); 1407 } 1408 1409 static inline int qdf_nbuf_shared(qdf_nbuf_t buf) 1410 { 1411 return __qdf_nbuf_shared(buf); 1412 } 1413 1414 static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src) 1415 { 1416 return __qdf_nbuf_cat(dst, src); 1417 } 1418 1419 /** 1420 * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb 1421 * @skb: SKB pointer 1422 * @offset: offset 1423 * @len: Length 1424 * @to: To 1425 * 1426 * Return: int32_t 1427 */ 1428 static inline int32_t 1429 qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to) 1430 { 1431 return __qdf_nbuf_copy_bits(nbuf, offset, len, to); 1432 } 1433 1434 1435 /* nbuf manipulation routines */ 1436 1437 /** 1438 * @qdf_nbuf_head() - return the address of an nbuf's buffer 1439 * @buf: netbuf 1440 * 1441 * Return: head address 1442 */ 1443 static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf) 1444 { 1445 return __qdf_nbuf_head(buf); 1446 } 1447 1448 /** 1449 * qdf_nbuf_data() - Return the address of the start of data within an nbuf 1450 * @buf: Network buffer 1451 * 1452 * Return: Data address 1453 */ 1454 static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf) 1455 { 1456 return __qdf_nbuf_data(buf); 1457 } 1458 1459 /** 1460 * qdf_nbuf_data_addr() - Return the address of skb->data 1461 * @buf: Network buffer 1462 * 1463 * Return: Data address 1464 */ 1465 static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf) 1466 { 1467 return __qdf_nbuf_data_addr(buf); 1468 } 1469 1470 /** 1471 * qdf_nbuf_headroom() - amount of headroom int the current nbuf 1472 * @buf: Network buffer 1473 * 1474 * Return: Amount of head room 1475 */ 1476 static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf) 1477 { 1478 return __qdf_nbuf_headroom(buf); 1479 } 1480 1481 /** 1482 * qdf_nbuf_tailroom() - amount of tail space available 1483 * @buf: Network buffer 1484 * 1485 * Return: amount of tail room 1486 */ 1487 static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf) 1488 { 1489 return __qdf_nbuf_tailroom(buf); 1490 } 1491 1492 /** 1493 * qdf_nbuf_push_head() - push data in the front 1494 * @buf: Network buf instance 1495 * @size: Size to be pushed 1496 * 1497 * Return: New data pointer of this buf after data has been pushed, 1498 * or NULL if there is not enough room in this buf. 1499 */ 1500 static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size) 1501 { 1502 return __qdf_nbuf_push_head(buf, size); 1503 } 1504 1505 /** 1506 * qdf_nbuf_put_tail() - puts data in the end 1507 * @buf: Network buf instance 1508 * @size: Size to be pushed 1509 * 1510 * Return: Data pointer of this buf where new data has to be 1511 * put, or NULL if there is not enough room in this buf. 1512 */ 1513 static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size) 1514 { 1515 return __qdf_nbuf_put_tail(buf, size); 1516 } 1517 1518 /** 1519 * qdf_nbuf_pull_head() - pull data out from the front 1520 * @buf: Network buf instance 1521 * @size: Size to be popped 1522 * 1523 * Return: New data pointer of this buf after data has been popped, 1524 * or NULL if there is not sufficient data to pull. 1525 */ 1526 static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size) 1527 { 1528 return __qdf_nbuf_pull_head(buf, size); 1529 } 1530 1531 /** 1532 * qdf_nbuf_trim_tail() - trim data out from the end 1533 * @buf: Network buf instance 1534 * @size: Size to be popped 1535 * 1536 * Return: none 1537 */ 1538 static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size) 1539 { 1540 __qdf_nbuf_trim_tail(buf, size); 1541 } 1542 1543 /** 1544 * qdf_nbuf_len() - get the length of the buf 1545 * @buf: Network buf instance 1546 * 1547 * Return: total length of this buf. 1548 */ 1549 static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf) 1550 { 1551 return __qdf_nbuf_len(buf); 1552 } 1553 1554 /** 1555 * qdf_nbuf_set_pktlen() - set the length of the buf 1556 * @buf: Network buf instance 1557 * @size: Size to be set 1558 * 1559 * Return: none 1560 */ 1561 static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len) 1562 { 1563 __qdf_nbuf_set_pktlen(buf, len); 1564 } 1565 1566 /** 1567 * qdf_nbuf_reserve() - trim data out from the end 1568 * @buf: Network buf instance 1569 * @size: Size to be popped 1570 * 1571 * Return: none 1572 */ 1573 static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size) 1574 { 1575 __qdf_nbuf_reserve(buf, size); 1576 } 1577 1578 /** 1579 * qdf_nbuf_reset() - reset the buffer data and pointer 1580 * @buf: Network buf instance 1581 * @reserve: reserve 1582 * @align: align 1583 * 1584 * Return: none 1585 */ 1586 static inline void qdf_nbuf_reset(qdf_nbuf_t buf, int reserve, int align) 1587 { 1588 __qdf_nbuf_reset(buf, reserve, align); 1589 } 1590 1591 /** 1592 * qdf_nbuf_peek_header() - return the data pointer & length of the header 1593 * @buf: Network nbuf 1594 * @addr: Data pointer 1595 * @len: Length of the data 1596 * 1597 * Return: none 1598 */ 1599 static inline void 1600 qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len) 1601 { 1602 __qdf_nbuf_peek_header(buf, addr, len); 1603 } 1604 1605 /* nbuf queue routines */ 1606 1607 /** 1608 * qdf_nbuf_queue_init() - initialize buf queue 1609 * @head: Network buf queue head 1610 * 1611 * Return: none 1612 */ 1613 static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head) 1614 { 1615 __qdf_nbuf_queue_init(head); 1616 } 1617 1618 /** 1619 * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue 1620 * @head: Network buf queue head 1621 * @buf: Network buf 1622 * 1623 * Return: none 1624 */ 1625 static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf) 1626 { 1627 __qdf_nbuf_queue_add(head, buf); 1628 } 1629 1630 /** 1631 * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue 1632 * @head: Network buf queue head 1633 * @buf: Network buf 1634 * 1635 * Return: none 1636 */ 1637 static inline void 1638 qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf) 1639 { 1640 __qdf_nbuf_queue_insert_head(head, buf); 1641 } 1642 1643 /** 1644 * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue 1645 * @head: Network buf queue head 1646 * 1647 * Return: The head buf in the buf queue. 1648 */ 1649 static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head) 1650 { 1651 return __qdf_nbuf_queue_remove(head); 1652 } 1653 1654 /** 1655 * qdf_nbuf_queue_len() - get the length of the queue 1656 * @head: Network buf queue head 1657 * 1658 * Return: length of the queue 1659 */ 1660 static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head) 1661 { 1662 return __qdf_nbuf_queue_len(head); 1663 } 1664 1665 /** 1666 * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer 1667 * @buf: Network buffer 1668 * 1669 * Return: next buffer/packet 1670 */ 1671 static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf) 1672 { 1673 return __qdf_nbuf_queue_next(buf); 1674 } 1675 1676 /** 1677 * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty 1678 * @nbq: Network buf queue handle 1679 * 1680 * Return: true if queue is empty 1681 * false if queue is not emty 1682 */ 1683 static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq) 1684 { 1685 return __qdf_nbuf_is_queue_empty(nbq); 1686 } 1687 1688 static inline qdf_nbuf_queue_t * 1689 qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src) 1690 { 1691 return __qdf_nbuf_queue_append(dest, src); 1692 } 1693 1694 static inline void 1695 qdf_nbuf_queue_free(qdf_nbuf_queue_t *head) 1696 { 1697 __qdf_nbuf_queue_free(head); 1698 } 1699 1700 static inline qdf_nbuf_t 1701 qdf_nbuf_queue_first(qdf_nbuf_queue_t *head) 1702 { 1703 return __qdf_nbuf_queue_first(head); 1704 } 1705 1706 /** 1707 * qdf_nbuf_get_protocol() - return the protocol value of the skb 1708 * @skb: Pointer to network buffer 1709 * 1710 * Return: skb protocol 1711 */ 1712 static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb) 1713 { 1714 return __qdf_nbuf_get_protocol(skb); 1715 } 1716 1717 /** 1718 * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb 1719 * @skb: Pointer to network buffer 1720 * 1721 * Return: skb ip_summed 1722 */ 1723 static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb) 1724 { 1725 return __qdf_nbuf_get_ip_summed(skb); 1726 } 1727 1728 /** 1729 * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb 1730 * @skb: Pointer to network buffer 1731 * @ip_summed: ip checksum 1732 * 1733 * Return: none 1734 */ 1735 static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb, 1736 uint8_t ip_summed) 1737 { 1738 __qdf_nbuf_set_ip_summed(skb, ip_summed); 1739 } 1740 1741 /** 1742 * qdf_nbuf_set_next() - add a packet to a linked list 1743 * @this_buf: Predecessor buffer 1744 * @next_buf: Successor buffer 1745 * 1746 * This function can be used to directly link nbufs, rather than using 1747 * a separate network buffer queue object. 1748 * 1749 * Return: none 1750 */ 1751 static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf) 1752 { 1753 __qdf_nbuf_set_next(this_buf, next_buf); 1754 } 1755 1756 /* nbuf extension routines */ 1757 1758 /** 1759 * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new 1760 * nbuf 1761 * @this_buf: predecessor buffer 1762 * @next_buf: successor buffer 1763 * 1764 * This function is used to link up many nbufs containing a single logical 1765 * packet - not a collection of packets. Do not use for linking the first 1766 * extension to the head 1767 * 1768 * Return: none 1769 */ 1770 static inline void 1771 qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf) 1772 { 1773 __qdf_nbuf_set_next_ext(this_buf, next_buf); 1774 } 1775 1776 /** 1777 * qdf_nbuf_next_ext() - get the next packet extension in the linked list 1778 * @buf: Network buffer 1779 * 1780 * Return: Next network buffer in the linked list 1781 */ 1782 static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf) 1783 { 1784 return __qdf_nbuf_next_ext(buf); 1785 } 1786 1787 /** 1788 * qdf_nbuf_append_ext_list() - link list of packet extensions to the head 1789 * segment 1790 * @head_buf: Network buf holding head segment (single) 1791 * @ext_list: Network buf list holding linked extensions to the head 1792 * @ext_len: Total length of all buffers in the extension list 1793 * 1794 * This function is used to link up a list of packet extensions (seg1, 2, 1795 * ...) to the nbuf holding the head segment (seg0) 1796 * 1797 * Return: none 1798 */ 1799 static inline void 1800 qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list, 1801 qdf_size_t ext_len) 1802 { 1803 __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len); 1804 } 1805 1806 /** 1807 * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list. 1808 * @head_buf: Network buf holding head segment (single) 1809 * 1810 * This ext_list is populated when we have Jumbo packet, for example in case of 1811 * monitor mode amsdu packet reception, and are stiched using frags_list. 1812 * 1813 * Return: Network buf list holding linked extensions from head buf. 1814 */ 1815 static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf) 1816 { 1817 return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf); 1818 } 1819 1820 /** 1821 * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand 1822 * @buf: Network buffer 1823 * 1824 * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame 1825 */ 1826 static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf) 1827 { 1828 return __qdf_nbuf_get_tx_cksum(buf); 1829 } 1830 1831 /** 1832 * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to 1833 * indicate checksum info to the stack. 1834 * @buf: Network buffer 1835 * @cksum: Checksum 1836 * 1837 * Return: none 1838 */ 1839 static inline void 1840 qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum) 1841 { 1842 __qdf_nbuf_set_rx_cksum(buf, cksum); 1843 } 1844 1845 /** 1846 * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf 1847 * @buf: Network buffer 1848 * 1849 * Return: TID value 1850 */ 1851 static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf) 1852 { 1853 return __qdf_nbuf_get_tid(buf); 1854 } 1855 1856 /** 1857 * qdf_nbuf_set_tid() - this function sets the TID value in nbuf 1858 * @buf: Network buffer 1859 * @tid: TID value 1860 * 1861 * Return: none 1862 */ 1863 static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid) 1864 { 1865 __qdf_nbuf_set_tid(buf, tid); 1866 } 1867 1868 /** 1869 * qdf_nbuf_get_exemption_type() - this function extracts the exemption type 1870 * from nbuf 1871 * @buf: Network buffer 1872 * 1873 * Return: Exemption type 1874 */ 1875 static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf) 1876 { 1877 return __qdf_nbuf_get_exemption_type(buf); 1878 } 1879 1880 /** 1881 * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given 1882 * offset 1883 * @buf: Network buffer 1884 * @proto: Protocol 1885 * 1886 * Return: none 1887 */ 1888 static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto) 1889 { 1890 __qdf_nbuf_set_protocol(buf, proto); 1891 } 1892 1893 /** 1894 * qdf_nbuf_trace_get_proto_type() - this function return packet proto type 1895 * @buf: Network buffer 1896 * 1897 * Return: Packet protocol type 1898 */ 1899 static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf) 1900 { 1901 return __qdf_nbuf_trace_get_proto_type(buf); 1902 } 1903 1904 /** 1905 * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback 1906 * @cb_func_ptr: Callback pointer 1907 * 1908 * Return: none 1909 */ 1910 static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr) 1911 { 1912 __qdf_nbuf_reg_trace_cb(cb_func_ptr); 1913 } 1914 1915 1916 /** 1917 * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download 1918 * @buf: Network buffer 1919 * @candi: Candidate of parallel download frame 1920 * 1921 * This function stores a flag specifying this TX frame is suitable for 1922 * downloading though a 2nd TX data pipe that is used for short frames for 1923 * protocols that can accept out-of-order delivery. 1924 * 1925 * Return: none 1926 */ 1927 static inline void 1928 qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi) 1929 { 1930 __qdf_nbuf_set_tx_htt2_frm(buf, candi); 1931 } 1932 1933 /** 1934 * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download 1935 * @buf: Network buffer 1936 * 1937 * This function return whether this TX frame is allow to download though a 2nd 1938 * TX data pipe or not. 1939 * 1940 * Return: none 1941 */ 1942 static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf) 1943 { 1944 return __qdf_nbuf_get_tx_htt2_frm(buf); 1945 } 1946 1947 /** 1948 * qdf_nbuf_get_dhcp_subtype() - get the subtype 1949 * of DHCP packet. 1950 * @buf: Pointer to DHCP packet buffer 1951 * 1952 * This func. returns the subtype of DHCP packet. 1953 * 1954 * Return: subtype of the DHCP packet. 1955 */ 1956 static inline enum qdf_proto_subtype 1957 qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf) 1958 { 1959 return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf)); 1960 } 1961 1962 /** 1963 * qdf_nbuf_data_get_dhcp_subtype() - get the subtype 1964 * of DHCP packet. 1965 * @buf: Pointer to DHCP packet data buffer 1966 * 1967 * This func. returns the subtype of DHCP packet. 1968 * 1969 * Return: subtype of the DHCP packet. 1970 */ 1971 static inline enum qdf_proto_subtype 1972 qdf_nbuf_data_get_dhcp_subtype(uint8_t *data) 1973 { 1974 return __qdf_nbuf_data_get_dhcp_subtype(data); 1975 } 1976 1977 /** 1978 * qdf_nbuf_get_eapol_subtype() - get the subtype 1979 * of EAPOL packet. 1980 * @buf: Pointer to EAPOL packet buffer 1981 * 1982 * This func. returns the subtype of EAPOL packet. 1983 * 1984 * Return: subtype of the EAPOL packet. 1985 */ 1986 static inline enum qdf_proto_subtype 1987 qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf) 1988 { 1989 return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf)); 1990 } 1991 1992 /** 1993 * qdf_nbuf_data_get_eapol_subtype() - get the subtype 1994 * of EAPOL packet. 1995 * @data: Pointer to EAPOL packet data buffer 1996 * 1997 * This func. returns the subtype of EAPOL packet. 1998 * 1999 * Return: subtype of the EAPOL packet. 2000 */ 2001 static inline enum qdf_proto_subtype 2002 qdf_nbuf_data_get_eapol_subtype(uint8_t *data) 2003 { 2004 return __qdf_nbuf_data_get_eapol_subtype(data); 2005 } 2006 2007 /** 2008 * qdf_nbuf_get_arp_subtype() - get the subtype 2009 * of ARP packet. 2010 * @buf: Pointer to ARP packet buffer 2011 * 2012 * This func. returns the subtype of ARP packet. 2013 * 2014 * Return: subtype of the ARP packet. 2015 */ 2016 static inline enum qdf_proto_subtype 2017 qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf) 2018 { 2019 return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf)); 2020 } 2021 2022 /** 2023 * qdf_nbuf_data_get_arp_subtype() - get the subtype 2024 * of ARP packet. 2025 * @data: Pointer to ARP packet data buffer 2026 * 2027 * This func. returns the subtype of ARP packet. 2028 * 2029 * Return: subtype of the ARP packet. 2030 */ 2031 static inline enum qdf_proto_subtype 2032 qdf_nbuf_data_get_arp_subtype(uint8_t *data) 2033 { 2034 return __qdf_nbuf_data_get_arp_subtype(data); 2035 } 2036 2037 /** 2038 * qdf_nbuf_get_icmp_subtype() - get the subtype 2039 * of IPV4 ICMP packet. 2040 * @buf: Pointer to IPV4 ICMP packet buffer 2041 * 2042 * This func. returns the subtype of ICMP packet. 2043 * 2044 * Return: subtype of the ICMP packet. 2045 */ 2046 static inline enum qdf_proto_subtype 2047 qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf) 2048 { 2049 return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf)); 2050 } 2051 2052 /** 2053 * qdf_nbuf_data_get_icmp_subtype() - get the subtype 2054 * of IPV4 ICMP packet. 2055 * @data: Pointer to IPV4 ICMP packet data buffer 2056 * 2057 * This func. returns the subtype of ICMP packet. 2058 * 2059 * Return: subtype of the ICMP packet. 2060 */ 2061 static inline enum qdf_proto_subtype 2062 qdf_nbuf_data_get_icmp_subtype(uint8_t *data) 2063 { 2064 return __qdf_nbuf_data_get_icmp_subtype(data); 2065 } 2066 2067 /** 2068 * qdf_nbuf_get_icmpv6_subtype() - get the subtype 2069 * of IPV6 ICMPV6 packet. 2070 * @buf: Pointer to IPV6 ICMPV6 packet buffer 2071 * 2072 * This func. returns the subtype of ICMPV6 packet. 2073 * 2074 * Return: subtype of the ICMPV6 packet. 2075 */ 2076 static inline enum qdf_proto_subtype 2077 qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf) 2078 { 2079 return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf)); 2080 } 2081 2082 /** 2083 * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype 2084 * of IPV6 ICMPV6 packet. 2085 * @data: Pointer to IPV6 ICMPV6 packet data buffer 2086 * 2087 * This func. returns the subtype of ICMPV6 packet. 2088 * 2089 * Return: subtype of the ICMPV6 packet. 2090 */ 2091 static inline enum qdf_proto_subtype 2092 qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data) 2093 { 2094 return __qdf_nbuf_data_get_icmpv6_subtype(data); 2095 } 2096 2097 /** 2098 * qdf_nbuf_data_get_ipv4_proto() - get the proto type 2099 * of IPV4 packet. 2100 * @data: Pointer to IPV4 packet data buffer 2101 * 2102 * This func. returns the proto type of IPV4 packet. 2103 * 2104 * Return: proto type of IPV4 packet. 2105 */ 2106 static inline uint8_t 2107 qdf_nbuf_data_get_ipv4_proto(uint8_t *data) 2108 { 2109 return __qdf_nbuf_data_get_ipv4_proto(data); 2110 } 2111 2112 /** 2113 * qdf_nbuf_data_get_ipv6_proto() - get the proto type 2114 * of IPV6 packet. 2115 * @data: Pointer to IPV6 packet data buffer 2116 * 2117 * This func. returns the proto type of IPV6 packet. 2118 * 2119 * Return: proto type of IPV6 packet. 2120 */ 2121 static inline uint8_t 2122 qdf_nbuf_data_get_ipv6_proto(uint8_t *data) 2123 { 2124 return __qdf_nbuf_data_get_ipv6_proto(data); 2125 } 2126 2127 /** 2128 * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not 2129 * @buf: buffer 2130 * 2131 * This api is for Tx packets. 2132 * 2133 * Return: true if packet is ipv4 packet 2134 */ 2135 static inline 2136 bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf) 2137 { 2138 return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf)); 2139 } 2140 2141 /** 2142 * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not 2143 * @data: data 2144 * 2145 * This api is for Tx packets. 2146 * 2147 * Return: true if packet is ipv4 packet 2148 */ 2149 static inline 2150 bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data) 2151 { 2152 return __qdf_nbuf_data_is_ipv4_pkt(data); 2153 } 2154 2155 /** 2156 * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not 2157 * @buf: buffer 2158 * 2159 * This api is for ipv4 packet. 2160 * 2161 * Return: true if packet is DHCP packet 2162 */ 2163 static inline 2164 bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf) 2165 { 2166 return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf)); 2167 } 2168 2169 /** 2170 * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet. 2171 * @data: Pointer to DHCP packet data buffer 2172 * 2173 * This func. checks whether it is a DHCP packet or not. 2174 * 2175 * Return: true if it is a DHCP packet 2176 * false if not 2177 */ 2178 static inline 2179 bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data) 2180 { 2181 return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data); 2182 } 2183 2184 /** 2185 * qdf_nbuf_data_is_ipv6_dhcp_pkt() - check if it is DHCP packet. 2186 * @data: Pointer to DHCP packet data buffer 2187 * 2188 * This func. checks whether it is a DHCP packet or not. 2189 * 2190 * Return: true if it is a DHCP packet 2191 * false if not 2192 */ 2193 static inline 2194 bool qdf_nbuf_is_ipv6_dhcp_pkt(qdf_nbuf_t buf) 2195 { 2196 return __qdf_nbuf_data_is_ipv6_dhcp_pkt(qdf_nbuf_data(buf)); 2197 } 2198 2199 /** 2200 * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not 2201 * @buf: buffer 2202 * 2203 * This api is for ipv4 packet. 2204 * 2205 * Return: true if packet is EAPOL packet 2206 */ 2207 static inline 2208 bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf) 2209 { 2210 return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf)); 2211 } 2212 2213 /** 2214 * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet. 2215 * @data: Pointer to EAPOL packet data buffer 2216 * 2217 * This func. checks whether it is a EAPOL packet or not. 2218 * 2219 * Return: true if it is a EAPOL packet 2220 * false if not 2221 */ 2222 static inline 2223 bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data) 2224 { 2225 return __qdf_nbuf_data_is_ipv4_eapol_pkt(data); 2226 } 2227 2228 /** 2229 * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not 2230 * @buf: buffer 2231 * 2232 * This api is for ipv4 packet. 2233 * 2234 * Return: true if packet is WAPI packet 2235 */ 2236 static inline 2237 bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf) 2238 { 2239 return __qdf_nbuf_is_ipv4_wapi_pkt(buf); 2240 } 2241 2242 /** 2243 * qdf_nbuf_is_ipv4_tdls_pkt() - check if packet is a tdls packet or not 2244 * @buf: buffer 2245 * 2246 * This api is for ipv4 packet. 2247 * 2248 * Return: true if packet is TDLS packet 2249 */ 2250 static inline 2251 bool qdf_nbuf_is_ipv4_tdls_pkt(qdf_nbuf_t buf) 2252 { 2253 return __qdf_nbuf_is_ipv4_tdls_pkt(buf); 2254 } 2255 2256 /** 2257 * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not 2258 * @buf: buffer 2259 * 2260 * This api is for ipv4 packet. 2261 * 2262 * Return: true if packet is ARP packet 2263 */ 2264 static inline 2265 bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf) 2266 { 2267 return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf)); 2268 } 2269 2270 /** 2271 * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet. 2272 * @data: Pointer to ARP packet data buffer 2273 * 2274 * This func. checks whether it is a ARP packet or not. 2275 * 2276 * Return: TRUE if it is a ARP packet 2277 * FALSE if not 2278 */ 2279 static inline 2280 bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data) 2281 { 2282 return __qdf_nbuf_data_is_ipv4_arp_pkt(data); 2283 } 2284 2285 /** 2286 * qdf_nbuf_data_is_arp_req() - check if ARP packet is request. 2287 * @buf: buffer 2288 * 2289 * This func. checks whether it is a ARP request or not. 2290 * 2291 * Return: true if it is a ARP request or FALSE if not 2292 */ 2293 static inline 2294 bool qdf_nbuf_data_is_arp_req(qdf_nbuf_t buf) 2295 { 2296 return __qdf_nbuf_data_is_arp_req(qdf_nbuf_data(buf)); 2297 } 2298 2299 /** 2300 * qdf_nbuf_data_is_arp_rsp() - check if ARP packet is response. 2301 * @buf: buffer 2302 * 2303 * This func. checks whether it is a ARP response or not. 2304 * 2305 * Return: true if it is a ARP response or FALSE if not 2306 */ 2307 static inline 2308 bool qdf_nbuf_data_is_arp_rsp(qdf_nbuf_t buf) 2309 { 2310 return __qdf_nbuf_data_is_arp_rsp(qdf_nbuf_data(buf)); 2311 } 2312 2313 /** 2314 * qdf_nbuf_data_get_arp_src_ip() - get ARP packet source IP gateway. 2315 * @buf: buffer 2316 * 2317 * Return: ARP packet source IP value. 2318 */ 2319 static inline 2320 uint32_t qdf_nbuf_get_arp_src_ip(qdf_nbuf_t buf) 2321 { 2322 return __qdf_nbuf_get_arp_src_ip(qdf_nbuf_data(buf)); 2323 } 2324 2325 /** 2326 * qdf_nbuf_data_get_arp_tgt_ip() - get ARP packet target IP gateway. 2327 * @buf: buffer 2328 * 2329 * Return: ARP packet target IP value. 2330 */ 2331 static inline 2332 uint32_t qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_t buf) 2333 { 2334 return __qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_data(buf)); 2335 } 2336 2337 /** 2338 * qdf_nbuf_get_dns_domain_name() - get dns domain name of required length 2339 * @buf: buffer 2340 * @len: length to copy 2341 * 2342 * Return: dns domain name 2343 */ 2344 static inline 2345 uint8_t *qdf_nbuf_get_dns_domain_name(qdf_nbuf_t buf, uint32_t len) 2346 { 2347 return __qdf_nbuf_get_dns_domain_name(qdf_nbuf_data(buf), len); 2348 } 2349 2350 /** 2351 * qdf_nbuf_data_is_dns_query() - check if skb data is a dns query 2352 * @buf: buffer 2353 * 2354 * Return: true if packet is dns query packet. 2355 * false otherwise. 2356 */ 2357 static inline 2358 bool qdf_nbuf_data_is_dns_query(qdf_nbuf_t buf) 2359 { 2360 return __qdf_nbuf_data_is_dns_query(qdf_nbuf_data(buf)); 2361 } 2362 2363 /** 2364 * qdf_nbuf_data_is_dns_response() - check if skb data is a dns response 2365 * @buf: buffer 2366 * 2367 * Return: true if packet is dns response packet. 2368 * false otherwise. 2369 */ 2370 static inline 2371 bool qdf_nbuf_data_is_dns_response(qdf_nbuf_t buf) 2372 { 2373 return __qdf_nbuf_data_is_dns_response(qdf_nbuf_data(buf)); 2374 } 2375 2376 /** 2377 * qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn 2378 * @buf: buffer 2379 * 2380 * Return: true if packet is tcp syn packet. 2381 * false otherwise. 2382 */ 2383 static inline 2384 bool qdf_nbuf_data_is_tcp_syn(qdf_nbuf_t buf) 2385 { 2386 return __qdf_nbuf_data_is_tcp_syn(qdf_nbuf_data(buf)); 2387 } 2388 2389 /** 2390 * qdf_nbuf_data_is_tcp_syn_ack() - check if skb data is a tcp syn ack 2391 * @buf: buffer 2392 * 2393 * Return: true if packet is tcp syn ack packet. 2394 * false otherwise. 2395 */ 2396 static inline 2397 bool qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_t buf) 2398 { 2399 return __qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_data(buf)); 2400 } 2401 2402 /** 2403 * qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack 2404 * @buf: buffer 2405 * 2406 * Return: true if packet is tcp ack packet. 2407 * false otherwise. 2408 */ 2409 static inline 2410 bool qdf_nbuf_data_is_tcp_ack(qdf_nbuf_t buf) 2411 { 2412 return __qdf_nbuf_data_is_tcp_ack(qdf_nbuf_data(buf)); 2413 } 2414 2415 /** 2416 * qdf_nbuf_data_get_tcp_src_port() - get tcp src port 2417 * @buf: buffer 2418 * 2419 * Return: tcp source port value. 2420 */ 2421 static inline 2422 uint16_t qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_t buf) 2423 { 2424 return __qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_data(buf)); 2425 } 2426 2427 /** 2428 * qdf_nbuf_data_get_tcp_dst_port() - get tcp dst port 2429 * @buf: buffer 2430 * 2431 * Return: tcp destination port value. 2432 */ 2433 static inline 2434 uint16_t qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_t buf) 2435 { 2436 return __qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_data(buf)); 2437 } 2438 2439 /** 2440 * qdf_nbuf_data_is_icmpv4_req() - check if ICMPv4 packet is request. 2441 * @buf: buffer 2442 * 2443 * This func. checks whether it is a ICMPv4 request or not. 2444 * 2445 * Return: true if it is a ICMPv4 request or fALSE if not 2446 */ 2447 static inline 2448 bool qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_t buf) 2449 { 2450 return __qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_data(buf)); 2451 } 2452 2453 /** 2454 * qdf_nbuf_data_is_icmpv4_rsp() - check if ICMPv4 packet is res 2455 * @buf: buffer 2456 * 2457 * Return: true if packet is icmpv4 response 2458 * false otherwise. 2459 */ 2460 static inline 2461 bool qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_t buf) 2462 { 2463 return __qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_data(buf)); 2464 } 2465 2466 /** 2467 * qdf_nbuf_get_icmpv4_src_ip() - get icmpv4 src IP 2468 * @buf: buffer 2469 * 2470 * Return: icmpv4 packet source IP value. 2471 */ 2472 static inline 2473 uint32_t qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_t buf) 2474 { 2475 return __qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_data(buf)); 2476 } 2477 2478 /** 2479 * qdf_nbuf_data_get_icmpv4_tgt_ip() - get icmpv4 target IP 2480 * @buf: buffer 2481 * 2482 * Return: icmpv4 packet target IP value. 2483 */ 2484 static inline 2485 uint32_t qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_t buf) 2486 { 2487 return __qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_data(buf)); 2488 } 2489 2490 /** 2491 * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet. 2492 * @buf: Pointer to IPV6 packet buffer 2493 * 2494 * This func. checks whether it is a IPV6 packet or not. 2495 * 2496 * Return: TRUE if it is a IPV6 packet 2497 * FALSE if not 2498 */ 2499 static inline 2500 bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf) 2501 { 2502 return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf)); 2503 } 2504 2505 /** 2506 * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet. 2507 * @data: Pointer to IPV6 packet data buffer 2508 * 2509 * This func. checks whether it is a IPV6 packet or not. 2510 * 2511 * Return: TRUE if it is a IPV6 packet 2512 * FALSE if not 2513 */ 2514 static inline 2515 bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data) 2516 { 2517 return __qdf_nbuf_data_is_ipv6_pkt(data); 2518 } 2519 2520 /** 2521 * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet. 2522 * @data: Pointer to IPV4 packet data buffer 2523 * 2524 * This func. checks whether it is a IPV4 multicast packet or not. 2525 * 2526 * Return: TRUE if it is a IPV4 multicast packet 2527 * FALSE if not 2528 */ 2529 static inline 2530 bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data) 2531 { 2532 return __qdf_nbuf_data_is_ipv4_mcast_pkt(data); 2533 } 2534 2535 /** 2536 * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet. 2537 * @data: Pointer to IPV6 packet data buffer 2538 * 2539 * This func. checks whether it is a IPV6 multicast packet or not. 2540 * 2541 * Return: TRUE if it is a IPV6 multicast packet 2542 * FALSE if not 2543 */ 2544 static inline 2545 bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data) 2546 { 2547 return __qdf_nbuf_data_is_ipv6_mcast_pkt(data); 2548 } 2549 2550 /** 2551 * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet. 2552 * @buf: Pointer to IPV4 ICMP packet buffer 2553 * 2554 * This func. checks whether it is a ICMP packet or not. 2555 * 2556 * Return: TRUE if it is a ICMP packet 2557 * FALSE if not 2558 */ 2559 static inline 2560 bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf) 2561 { 2562 return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf)); 2563 } 2564 2565 /** 2566 * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet. 2567 * @data: Pointer to IPV4 ICMP packet data buffer 2568 * 2569 * This func. checks whether it is a ICMP packet or not. 2570 * 2571 * Return: TRUE if it is a ICMP packet 2572 * FALSE if not 2573 */ 2574 static inline 2575 bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data) 2576 { 2577 return __qdf_nbuf_data_is_icmp_pkt(data); 2578 } 2579 2580 /** 2581 * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet. 2582 * @buf: Pointer to IPV6 ICMPV6 packet buffer 2583 * 2584 * This func. checks whether it is a ICMPV6 packet or not. 2585 * 2586 * Return: TRUE if it is a ICMPV6 packet 2587 * FALSE if not 2588 */ 2589 static inline 2590 bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf) 2591 { 2592 return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf)); 2593 } 2594 2595 /** 2596 * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet. 2597 * @data: Pointer to IPV6 ICMPV6 packet data buffer 2598 * 2599 * This func. checks whether it is a ICMPV6 packet or not. 2600 * 2601 * Return: TRUE if it is a ICMPV6 packet 2602 * FALSE if not 2603 */ 2604 static inline 2605 bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data) 2606 { 2607 return __qdf_nbuf_data_is_icmpv6_pkt(data); 2608 } 2609 2610 /** 2611 * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet. 2612 * @buf: Pointer to IPV4 UDP packet buffer 2613 * 2614 * This func. checks whether it is a IPV4 UDP packet or not. 2615 * 2616 * Return: TRUE if it is a IPV4 UDP packet 2617 * FALSE if not 2618 */ 2619 static inline 2620 bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf) 2621 { 2622 return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf)); 2623 } 2624 2625 /** 2626 * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet. 2627 * @data: Pointer to IPV4 UDP packet data buffer 2628 * 2629 * This func. checks whether it is a IPV4 UDP packet or not. 2630 * 2631 * Return: TRUE if it is a IPV4 UDP packet 2632 * FALSE if not 2633 */ 2634 static inline 2635 bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data) 2636 { 2637 return __qdf_nbuf_data_is_ipv4_udp_pkt(data); 2638 } 2639 2640 /** 2641 * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet. 2642 * @buf: Pointer to IPV4 TCP packet buffer 2643 * 2644 * This func. checks whether it is a IPV4 TCP packet or not. 2645 * 2646 * Return: TRUE if it is a IPV4 TCP packet 2647 * FALSE if not 2648 */ 2649 static inline 2650 bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf) 2651 { 2652 return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf)); 2653 } 2654 2655 /** 2656 * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet. 2657 * @data: Pointer to IPV4 TCP packet data buffer 2658 * 2659 * This func. checks whether it is a IPV4 TCP packet or not. 2660 * 2661 * Return: TRUE if it is a IPV4 TCP packet 2662 * FALSE if not 2663 */ 2664 static inline 2665 bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data) 2666 { 2667 return __qdf_nbuf_data_is_ipv4_tcp_pkt(data); 2668 } 2669 2670 /** 2671 * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet. 2672 * @buf: Pointer to IPV6 UDP packet buffer 2673 * 2674 * This func. checks whether it is a IPV6 UDP packet or not. 2675 * 2676 * Return: TRUE if it is a IPV6 UDP packet 2677 * FALSE if not 2678 */ 2679 static inline 2680 bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf) 2681 { 2682 return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf)); 2683 } 2684 2685 /** 2686 * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet. 2687 * @data: Pointer to IPV6 UDP packet data buffer 2688 * 2689 * This func. checks whether it is a IPV6 UDP packet or not. 2690 * 2691 * Return: TRUE if it is a IPV6 UDP packet 2692 * FALSE if not 2693 */ 2694 static inline 2695 bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data) 2696 { 2697 return __qdf_nbuf_data_is_ipv6_udp_pkt(data); 2698 } 2699 2700 /** 2701 * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet. 2702 * @buf: Pointer to IPV6 TCP packet buffer 2703 * 2704 * This func. checks whether it is a IPV6 TCP packet or not. 2705 * 2706 * Return: TRUE if it is a IPV6 TCP packet 2707 * FALSE if not 2708 */ 2709 static inline 2710 bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf) 2711 { 2712 return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf)); 2713 } 2714 2715 /** 2716 * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet. 2717 * @data: Pointer to IPV6 TCP packet data buffer 2718 * 2719 * This func. checks whether it is a IPV6 TCP packet or not. 2720 * 2721 * Return: TRUE if it is a IPV6 TCP packet 2722 * FALSE if not 2723 */ 2724 static inline 2725 bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data) 2726 { 2727 return __qdf_nbuf_data_is_ipv6_tcp_pkt(data); 2728 } 2729 2730 /** 2731 * qdf_nbuf_is_bcast_pkt() - check if it is broadcast packet. 2732 * @buf: Network buffer 2733 * 2734 * This func. checks whether packet is broadcast or not. 2735 * 2736 * Return: TRUE if it is broadcast packet 2737 * FALSE if not 2738 */ 2739 static inline 2740 bool qdf_nbuf_is_bcast_pkt(qdf_nbuf_t buf) 2741 { 2742 return __qdf_nbuf_is_bcast_pkt(buf); 2743 } 2744 2745 /** 2746 * qdf_nbuf_reset_num_frags() - decrement the number of fragments 2747 * @buf: Network buffer 2748 * 2749 * Return: Number of fragments 2750 */ 2751 static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf) 2752 { 2753 __qdf_nbuf_reset_num_frags(buf); 2754 } 2755 2756 /** 2757 * qdf_dmaaddr_to_32s - return high and low parts of dma_addr 2758 * 2759 * Returns the high and low 32-bits of the DMA addr in the provided ptrs 2760 * 2761 * Return: N/A 2762 */ 2763 static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr, 2764 uint32_t *lo, uint32_t *hi) 2765 { 2766 return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi); 2767 } 2768 2769 /** 2770 * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO 2771 * network buffer into segments 2772 * @nbuf: network buffer to be segmented 2773 * @tso_info: This is the output. The information about the 2774 * TSO segments will be populated within this. 2775 * 2776 * This function fragments a TCP jumbo packet into smaller 2777 * segments to be transmitted by the driver. It chains the TSO 2778 * segments created into a list. 2779 * 2780 * Return: number of TSO segments 2781 */ 2782 static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev, 2783 qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info) 2784 { 2785 return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info); 2786 } 2787 2788 /** 2789 * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element 2790 * 2791 * @osdev: qdf device handle 2792 * @tso_seg: TSO segment element to be unmapped 2793 * @is_last_seg: whether this is last tso seg or not 2794 * 2795 * Return: none 2796 */ 2797 static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev, 2798 struct qdf_tso_seg_elem_t *tso_seg, 2799 bool is_last_seg) 2800 { 2801 return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg); 2802 } 2803 2804 /** 2805 * qdf_nbuf_get_tso_num_seg() - function to calculate the number 2806 * of TCP segments within the TSO jumbo packet 2807 * @nbuf: TSO jumbo network buffer to be segmented 2808 * 2809 * This function calculates the number of TCP segments that the 2810 network buffer can be divided into. 2811 * 2812 * Return: number of TCP segments 2813 */ 2814 static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf) 2815 { 2816 return __qdf_nbuf_get_tso_num_seg(nbuf); 2817 } 2818 2819 /** 2820 * qdf_nbuf_inc_users() - function to increment the number of 2821 * users referencing this network buffer 2822 * 2823 * @nbuf: network buffer 2824 * 2825 * This function increments the number of users referencing this 2826 * network buffer 2827 * 2828 * Return: the network buffer 2829 */ 2830 static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf) 2831 { 2832 return __qdf_nbuf_inc_users(nbuf); 2833 } 2834 2835 /** 2836 * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb 2837 * 2838 * @nbuf: Network buffer (skb on linux) 2839 * 2840 * This function returns the values of data_attr field 2841 * in struct cvg_nbuf_cb{}, to which skb->cb is typecast. 2842 * This value is actually the value programmed in CE descriptor. 2843 * 2844 * Return: Value of data_attr 2845 */ 2846 static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf) 2847 { 2848 return __qdf_nbuf_data_attr_get(buf); 2849 } 2850 2851 /** 2852 * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb 2853 * 2854 * @nbuf: Network buffer (skb on linux) 2855 * @data_attr: Value to be stored cvg_nbuf_cb->data_attr 2856 * 2857 * This function stores the value to be programmed in CE 2858 * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{} 2859 * 2860 * Return: void 2861 */ 2862 static inline 2863 void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr) 2864 { 2865 __qdf_nbuf_data_attr_set(buf, data_attr); 2866 } 2867 2868 /** 2869 * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata 2870 * 2871 * @nbuf: Network buffer (skb on linux) 2872 * 2873 * This function parses the payload to figure out relevant 2874 * Tx meta-data e.g. whether to enable tx_classify bit 2875 * in CE. 2876 * 2877 * Return: void 2878 */ 2879 #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get 2880 2881 void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state); 2882 void qdf_nbuf_tx_desc_count_display(void); 2883 void qdf_nbuf_tx_desc_count_clear(void); 2884 2885 static inline qdf_nbuf_t 2886 qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom) 2887 { 2888 return __qdf_nbuf_realloc_headroom(buf, headroom); 2889 } 2890 2891 static inline qdf_nbuf_t 2892 qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom) 2893 { 2894 return __qdf_nbuf_realloc_tailroom(buf, tailroom); 2895 } 2896 2897 static inline qdf_nbuf_t 2898 qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom) 2899 { 2900 return __qdf_nbuf_expand(buf, headroom, tailroom); 2901 } 2902 2903 static inline int 2904 qdf_nbuf_linearize(qdf_nbuf_t buf) 2905 { 2906 return __qdf_nbuf_linearize(buf); 2907 } 2908 2909 #ifdef NBUF_MEMORY_DEBUG 2910 #define qdf_nbuf_unshare(d) \ 2911 qdf_nbuf_unshare_debug(d, __FILE__, __LINE__) 2912 2913 static inline qdf_nbuf_t 2914 qdf_nbuf_unshare_debug(qdf_nbuf_t buf, uint8_t *file_name, uint32_t line_num) 2915 { 2916 qdf_nbuf_t unshared_buf; 2917 2918 unshared_buf = __qdf_nbuf_unshare(buf); 2919 2920 if (qdf_likely(buf != unshared_buf)) { 2921 qdf_net_buf_debug_delete_node(buf); 2922 2923 qdf_net_buf_debug_add_node(unshared_buf, 0, 2924 file_name, line_num); 2925 } 2926 2927 return unshared_buf; 2928 } 2929 2930 #else 2931 static inline qdf_nbuf_t 2932 qdf_nbuf_unshare(qdf_nbuf_t buf) 2933 { 2934 return __qdf_nbuf_unshare(buf); 2935 } 2936 #endif 2937 2938 static inline bool 2939 qdf_nbuf_is_cloned(qdf_nbuf_t buf) 2940 { 2941 return __qdf_nbuf_is_cloned(buf); 2942 } 2943 2944 static inline void 2945 qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg) 2946 { 2947 __qdf_nbuf_frag_info(buf, sg); 2948 } 2949 2950 static inline qdf_nbuf_tx_cksum_t 2951 qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where) 2952 { 2953 return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where); 2954 } 2955 2956 static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf) 2957 { 2958 __qdf_nbuf_reset_ctxt(nbuf); 2959 } 2960 2961 static inline void qdf_nbuf_init(qdf_nbuf_t buf) 2962 { 2963 __qdf_nbuf_init(buf); 2964 } 2965 2966 static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf) 2967 { 2968 return __qdf_nbuf_network_header(buf); 2969 } 2970 2971 static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf) 2972 { 2973 return __qdf_nbuf_transport_header(buf); 2974 } 2975 2976 static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf) 2977 { 2978 return __qdf_nbuf_tcp_tso_size(buf); 2979 } 2980 2981 static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf) 2982 { 2983 return __qdf_nbuf_get_cb(nbuf); 2984 } 2985 2986 static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf) 2987 { 2988 return __qdf_nbuf_get_nr_frags(nbuf); 2989 } 2990 2991 static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf) 2992 { 2993 return __qdf_nbuf_headlen(buf); 2994 } 2995 2996 static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev, 2997 qdf_nbuf_t buf, int offset, 2998 qdf_dma_dir_t dir, int cur_frag) 2999 { 3000 return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag); 3001 } 3002 3003 static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf) 3004 { 3005 return __qdf_nbuf_tso_tcp_v4(buf); 3006 } 3007 3008 static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf) 3009 { 3010 return __qdf_nbuf_tso_tcp_v6(buf); 3011 } 3012 3013 static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf) 3014 { 3015 return __qdf_nbuf_tcp_seq(buf); 3016 } 3017 3018 static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf) 3019 { 3020 return __qdf_nbuf_l2l3l4_hdr_len(buf); 3021 } 3022 3023 static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf) 3024 { 3025 return __qdf_nbuf_is_nonlinear(buf); 3026 } 3027 3028 static inline uint32_t 3029 qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num) 3030 { 3031 return __qdf_nbuf_get_frag_size(buf, frag_num); 3032 } 3033 3034 static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf) 3035 { 3036 return __qdf_nbuf_get_priority(buf); 3037 } 3038 3039 static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p) 3040 { 3041 __qdf_nbuf_set_priority(buf, p); 3042 } 3043 3044 static inline void qdf_nbuf_record_rx_queue(qdf_nbuf_t buf, uint32_t queue_id) 3045 { 3046 __qdf_nbuf_record_rx_queue(buf, queue_id); 3047 } 3048 3049 static inline uint16_t 3050 qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf) 3051 { 3052 return __qdf_nbuf_get_queue_mapping(buf); 3053 } 3054 3055 static inline uint8_t * 3056 qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf) 3057 { 3058 return __qdf_nbuf_get_priv_ptr(buf); 3059 } 3060 3061 /** 3062 * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf. 3063 * @rx_status: rx_status containing required info to update radiotap 3064 * @nbuf: Pointer to nbuf 3065 * @headroom_sz: Available headroom size 3066 * 3067 * Return: radiotap length. 3068 */ 3069 unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status, 3070 qdf_nbuf_t nbuf, uint32_t headroom_sz); 3071 3072 /** 3073 * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame. 3074 * @buf: Pointer to nbuf 3075 * 3076 * Return: None 3077 */ 3078 static inline void 3079 qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf) 3080 { 3081 __qdf_nbuf_mark_wakeup_frame(buf); 3082 } 3083 3084 /** 3085 * qdf_nbuf_reg_free_cb - Registers nbuf free callback 3086 * @cb_func_ptr: Callback pointer 3087 * 3088 * This function registers nbuf free callback 3089 * 3090 * Return: void 3091 */ 3092 static inline void 3093 qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr) 3094 { 3095 __qdf_nbuf_reg_free_cb(cb_func_ptr); 3096 } 3097 3098 /** 3099 * qdf_nbuf_set_timestamp() - set the timestamp for frame 3100 * 3101 * @buf: sk buff 3102 * 3103 * Return: void 3104 */ 3105 static inline void 3106 qdf_nbuf_set_timestamp(struct sk_buff *skb) 3107 { 3108 __qdf_nbuf_set_timestamp(skb); 3109 } 3110 3111 /** 3112 * qdf_nbuf_get_timedelta_ms() - get time difference in ms 3113 * 3114 * @buf: sk buff 3115 * 3116 * Return: time difference ms 3117 */ 3118 static inline uint64_t 3119 qdf_nbuf_get_timedelta_ms(struct sk_buff *skb) 3120 { 3121 return __qdf_nbuf_get_timedelta_ms(skb); 3122 } 3123 3124 /** 3125 * qdf_nbuf_get_timedelta_us() - get time difference in micro seconds 3126 * 3127 * @buf: sk buff 3128 * 3129 * Return: time difference in micro seconds 3130 */ 3131 static inline uint64_t 3132 qdf_nbuf_get_timedelta_us(struct sk_buff *skb) 3133 { 3134 return __qdf_nbuf_get_timedelta_us(skb); 3135 } 3136 3137 /** 3138 * qdf_nbuf_count_get() - get global nbuf gauge 3139 * 3140 * Return: global nbuf gauge 3141 */ 3142 static inline int qdf_nbuf_count_get(void) 3143 { 3144 return __qdf_nbuf_count_get(); 3145 } 3146 3147 /** 3148 * qdf_nbuf_count_inc() - increment nbuf global count 3149 * 3150 * @buf: sk buff 3151 * 3152 * Return: void 3153 */ 3154 static inline void qdf_nbuf_count_inc(qdf_nbuf_t buf) 3155 { 3156 return __qdf_nbuf_count_inc(buf); 3157 } 3158 3159 /** 3160 * qdf_nbuf_count_dec() - decrement nbuf global count 3161 * 3162 * @buf: sk buff 3163 * 3164 * Return: void 3165 */ 3166 static inline void qdf_nbuf_count_dec(qdf_nbuf_t buf) 3167 { 3168 return __qdf_nbuf_count_dec(buf); 3169 } 3170 3171 /** 3172 * qdf_nbuf_mod_init() - Intialization routine for qdf_nbuf 3173 * 3174 * Return void 3175 */ 3176 static inline void qdf_nbuf_mod_init(void) 3177 { 3178 return __qdf_nbuf_mod_init(); 3179 } 3180 3181 /** 3182 * qdf_nbuf_mod_init() - Unintialization routine for qdf_nbuf 3183 * 3184 * Return void 3185 */ 3186 static inline void qdf_nbuf_mod_exit(void) 3187 { 3188 return __qdf_nbuf_mod_exit(); 3189 } 3190 3191 /** 3192 * qdf_nbuf_orphan() - orphan a nbuf 3193 * @buf: Pointer to network buffer 3194 * 3195 * If a buffer currently has an owner then we call the 3196 * owner's destructor function 3197 * 3198 * Return: void 3199 */ 3200 static inline void qdf_nbuf_orphan(qdf_nbuf_t buf) 3201 { 3202 return __qdf_nbuf_orphan(buf); 3203 } 3204 3205 #ifdef CONFIG_WIN 3206 #include <i_qdf_nbuf_api_w.h> 3207 #else 3208 #include <i_qdf_nbuf_api_m.h> 3209 #endif 3210 #endif /* _QDF_NBUF_H */ 3211