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