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_dev_scratch_is_supported() - dev_scratch support for network buffer 1593 * in kernel 1594 * 1595 * Return: true if dev_scratch is supported 1596 * false if dev_scratch is not supported 1597 */ 1598 static inline bool qdf_nbuf_is_dev_scratch_supported(void) 1599 { 1600 return __qdf_nbuf_is_dev_scratch_supported(); 1601 } 1602 1603 /** 1604 * qdf_nbuf_get_dev_scratch() - get dev_scratch of network buffer 1605 * @buf: Pointer to network buffer 1606 * 1607 * Return: dev_scratch if dev_scratch supported 1608 * 0 if dev_scratch not supported 1609 */ 1610 static inline unsigned long qdf_nbuf_get_dev_scratch(qdf_nbuf_t buf) 1611 { 1612 return __qdf_nbuf_get_dev_scratch(buf); 1613 } 1614 1615 /** 1616 * qdf_nbuf_set_dev_scratch() - set dev_scratch of network buffer 1617 * @buf: Pointer to network buffer 1618 * @value: value to be set in dev_scratch of network buffer 1619 * 1620 * Return: void 1621 */ 1622 static inline void qdf_nbuf_set_dev_scratch(qdf_nbuf_t buf, unsigned long value) 1623 { 1624 __qdf_nbuf_set_dev_scratch(buf, value); 1625 } 1626 1627 /** 1628 * qdf_nbuf_peek_header() - return the data pointer & length of the header 1629 * @buf: Network nbuf 1630 * @addr: Data pointer 1631 * @len: Length of the data 1632 * 1633 * Return: none 1634 */ 1635 static inline void 1636 qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len) 1637 { 1638 __qdf_nbuf_peek_header(buf, addr, len); 1639 } 1640 1641 /* nbuf queue routines */ 1642 1643 /** 1644 * qdf_nbuf_queue_init() - initialize buf queue 1645 * @head: Network buf queue head 1646 * 1647 * Return: none 1648 */ 1649 static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head) 1650 { 1651 __qdf_nbuf_queue_init(head); 1652 } 1653 1654 /** 1655 * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue 1656 * @head: Network buf queue head 1657 * @buf: Network buf 1658 * 1659 * Return: none 1660 */ 1661 static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf) 1662 { 1663 __qdf_nbuf_queue_add(head, buf); 1664 } 1665 1666 /** 1667 * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue 1668 * @head: Network buf queue head 1669 * @buf: Network buf 1670 * 1671 * Return: none 1672 */ 1673 static inline void 1674 qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf) 1675 { 1676 __qdf_nbuf_queue_insert_head(head, buf); 1677 } 1678 1679 /** 1680 * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue 1681 * @head: Network buf queue head 1682 * 1683 * Return: The head buf in the buf queue. 1684 */ 1685 static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head) 1686 { 1687 return __qdf_nbuf_queue_remove(head); 1688 } 1689 1690 /** 1691 * qdf_nbuf_queue_len() - get the length of the queue 1692 * @head: Network buf queue head 1693 * 1694 * Return: length of the queue 1695 */ 1696 static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head) 1697 { 1698 return __qdf_nbuf_queue_len(head); 1699 } 1700 1701 /** 1702 * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer 1703 * @buf: Network buffer 1704 * 1705 * Return: next buffer/packet 1706 */ 1707 static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf) 1708 { 1709 return __qdf_nbuf_queue_next(buf); 1710 } 1711 1712 /** 1713 * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty 1714 * @nbq: Network buf queue handle 1715 * 1716 * Return: true if queue is empty 1717 * false if queue is not emty 1718 */ 1719 static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq) 1720 { 1721 return __qdf_nbuf_is_queue_empty(nbq); 1722 } 1723 1724 static inline qdf_nbuf_queue_t * 1725 qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src) 1726 { 1727 return __qdf_nbuf_queue_append(dest, src); 1728 } 1729 1730 static inline void 1731 qdf_nbuf_queue_free(qdf_nbuf_queue_t *head) 1732 { 1733 __qdf_nbuf_queue_free(head); 1734 } 1735 1736 static inline qdf_nbuf_t 1737 qdf_nbuf_queue_first(qdf_nbuf_queue_t *head) 1738 { 1739 return __qdf_nbuf_queue_first(head); 1740 } 1741 1742 /** 1743 * qdf_nbuf_get_protocol() - return the protocol value of the skb 1744 * @skb: Pointer to network buffer 1745 * 1746 * Return: skb protocol 1747 */ 1748 static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb) 1749 { 1750 return __qdf_nbuf_get_protocol(skb); 1751 } 1752 1753 /** 1754 * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb 1755 * @skb: Pointer to network buffer 1756 * 1757 * Return: skb ip_summed 1758 */ 1759 static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb) 1760 { 1761 return __qdf_nbuf_get_ip_summed(skb); 1762 } 1763 1764 /** 1765 * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb 1766 * @skb: Pointer to network buffer 1767 * @ip_summed: ip checksum 1768 * 1769 * Return: none 1770 */ 1771 static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb, 1772 uint8_t ip_summed) 1773 { 1774 __qdf_nbuf_set_ip_summed(skb, ip_summed); 1775 } 1776 1777 /** 1778 * qdf_nbuf_set_next() - add a packet to a linked list 1779 * @this_buf: Predecessor buffer 1780 * @next_buf: Successor buffer 1781 * 1782 * This function can be used to directly link nbufs, rather than using 1783 * a separate network buffer queue object. 1784 * 1785 * Return: none 1786 */ 1787 static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf) 1788 { 1789 __qdf_nbuf_set_next(this_buf, next_buf); 1790 } 1791 1792 /* nbuf extension routines */ 1793 1794 /** 1795 * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new 1796 * nbuf 1797 * @this_buf: predecessor buffer 1798 * @next_buf: successor buffer 1799 * 1800 * This function is used to link up many nbufs containing a single logical 1801 * packet - not a collection of packets. Do not use for linking the first 1802 * extension to the head 1803 * 1804 * Return: none 1805 */ 1806 static inline void 1807 qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf) 1808 { 1809 __qdf_nbuf_set_next_ext(this_buf, next_buf); 1810 } 1811 1812 /** 1813 * qdf_nbuf_next_ext() - get the next packet extension in the linked list 1814 * @buf: Network buffer 1815 * 1816 * Return: Next network buffer in the linked list 1817 */ 1818 static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf) 1819 { 1820 return __qdf_nbuf_next_ext(buf); 1821 } 1822 1823 /** 1824 * qdf_nbuf_append_ext_list() - link list of packet extensions to the head 1825 * segment 1826 * @head_buf: Network buf holding head segment (single) 1827 * @ext_list: Network buf list holding linked extensions to the head 1828 * @ext_len: Total length of all buffers in the extension list 1829 * 1830 * This function is used to link up a list of packet extensions (seg1, 2, 1831 * ...) to the nbuf holding the head segment (seg0) 1832 * 1833 * Return: none 1834 */ 1835 static inline void 1836 qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list, 1837 qdf_size_t ext_len) 1838 { 1839 __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len); 1840 } 1841 1842 /** 1843 * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list. 1844 * @head_buf: Network buf holding head segment (single) 1845 * 1846 * This ext_list is populated when we have Jumbo packet, for example in case of 1847 * monitor mode amsdu packet reception, and are stiched using frags_list. 1848 * 1849 * Return: Network buf list holding linked extensions from head buf. 1850 */ 1851 static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf) 1852 { 1853 return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf); 1854 } 1855 1856 /** 1857 * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand 1858 * @buf: Network buffer 1859 * 1860 * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame 1861 */ 1862 static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf) 1863 { 1864 return __qdf_nbuf_get_tx_cksum(buf); 1865 } 1866 1867 /** 1868 * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to 1869 * indicate checksum info to the stack. 1870 * @buf: Network buffer 1871 * @cksum: Checksum 1872 * 1873 * Return: none 1874 */ 1875 static inline void 1876 qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum) 1877 { 1878 __qdf_nbuf_set_rx_cksum(buf, cksum); 1879 } 1880 1881 /** 1882 * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf 1883 * @buf: Network buffer 1884 * 1885 * Return: TID value 1886 */ 1887 static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf) 1888 { 1889 return __qdf_nbuf_get_tid(buf); 1890 } 1891 1892 /** 1893 * qdf_nbuf_set_tid() - this function sets the TID value in nbuf 1894 * @buf: Network buffer 1895 * @tid: TID value 1896 * 1897 * Return: none 1898 */ 1899 static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid) 1900 { 1901 __qdf_nbuf_set_tid(buf, tid); 1902 } 1903 1904 /** 1905 * qdf_nbuf_get_exemption_type() - this function extracts the exemption type 1906 * from nbuf 1907 * @buf: Network buffer 1908 * 1909 * Return: Exemption type 1910 */ 1911 static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf) 1912 { 1913 return __qdf_nbuf_get_exemption_type(buf); 1914 } 1915 1916 /** 1917 * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given 1918 * offset 1919 * @buf: Network buffer 1920 * @proto: Protocol 1921 * 1922 * Return: none 1923 */ 1924 static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto) 1925 { 1926 __qdf_nbuf_set_protocol(buf, proto); 1927 } 1928 1929 /** 1930 * qdf_nbuf_trace_get_proto_type() - this function return packet proto type 1931 * @buf: Network buffer 1932 * 1933 * Return: Packet protocol type 1934 */ 1935 static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf) 1936 { 1937 return __qdf_nbuf_trace_get_proto_type(buf); 1938 } 1939 1940 /** 1941 * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback 1942 * @cb_func_ptr: Callback pointer 1943 * 1944 * Return: none 1945 */ 1946 static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr) 1947 { 1948 __qdf_nbuf_reg_trace_cb(cb_func_ptr); 1949 } 1950 1951 1952 /** 1953 * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download 1954 * @buf: Network buffer 1955 * @candi: Candidate of parallel download frame 1956 * 1957 * This function stores a flag specifying this TX frame is suitable for 1958 * downloading though a 2nd TX data pipe that is used for short frames for 1959 * protocols that can accept out-of-order delivery. 1960 * 1961 * Return: none 1962 */ 1963 static inline void 1964 qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi) 1965 { 1966 __qdf_nbuf_set_tx_htt2_frm(buf, candi); 1967 } 1968 1969 /** 1970 * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download 1971 * @buf: Network buffer 1972 * 1973 * This function return whether this TX frame is allow to download though a 2nd 1974 * TX data pipe or not. 1975 * 1976 * Return: none 1977 */ 1978 static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf) 1979 { 1980 return __qdf_nbuf_get_tx_htt2_frm(buf); 1981 } 1982 1983 /** 1984 * qdf_nbuf_get_dhcp_subtype() - get the subtype 1985 * of DHCP packet. 1986 * @buf: Pointer to DHCP packet buffer 1987 * 1988 * This func. returns the subtype of DHCP packet. 1989 * 1990 * Return: subtype of the DHCP packet. 1991 */ 1992 static inline enum qdf_proto_subtype 1993 qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf) 1994 { 1995 return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf)); 1996 } 1997 1998 /** 1999 * qdf_nbuf_data_get_dhcp_subtype() - get the subtype 2000 * of DHCP packet. 2001 * @buf: Pointer to DHCP packet data buffer 2002 * 2003 * This func. returns the subtype of DHCP packet. 2004 * 2005 * Return: subtype of the DHCP packet. 2006 */ 2007 static inline enum qdf_proto_subtype 2008 qdf_nbuf_data_get_dhcp_subtype(uint8_t *data) 2009 { 2010 return __qdf_nbuf_data_get_dhcp_subtype(data); 2011 } 2012 2013 /** 2014 * qdf_nbuf_get_eapol_subtype() - get the subtype 2015 * of EAPOL packet. 2016 * @buf: Pointer to EAPOL packet buffer 2017 * 2018 * This func. returns the subtype of EAPOL packet. 2019 * 2020 * Return: subtype of the EAPOL packet. 2021 */ 2022 static inline enum qdf_proto_subtype 2023 qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf) 2024 { 2025 return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf)); 2026 } 2027 2028 /** 2029 * qdf_nbuf_data_get_eapol_subtype() - get the subtype 2030 * of EAPOL packet. 2031 * @data: Pointer to EAPOL packet data buffer 2032 * 2033 * This func. returns the subtype of EAPOL packet. 2034 * 2035 * Return: subtype of the EAPOL packet. 2036 */ 2037 static inline enum qdf_proto_subtype 2038 qdf_nbuf_data_get_eapol_subtype(uint8_t *data) 2039 { 2040 return __qdf_nbuf_data_get_eapol_subtype(data); 2041 } 2042 2043 /** 2044 * qdf_nbuf_get_arp_subtype() - get the subtype 2045 * of ARP packet. 2046 * @buf: Pointer to ARP packet buffer 2047 * 2048 * This func. returns the subtype of ARP packet. 2049 * 2050 * Return: subtype of the ARP packet. 2051 */ 2052 static inline enum qdf_proto_subtype 2053 qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf) 2054 { 2055 return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf)); 2056 } 2057 2058 /** 2059 * qdf_nbuf_data_get_arp_subtype() - get the subtype 2060 * of ARP packet. 2061 * @data: Pointer to ARP packet data buffer 2062 * 2063 * This func. returns the subtype of ARP packet. 2064 * 2065 * Return: subtype of the ARP packet. 2066 */ 2067 static inline enum qdf_proto_subtype 2068 qdf_nbuf_data_get_arp_subtype(uint8_t *data) 2069 { 2070 return __qdf_nbuf_data_get_arp_subtype(data); 2071 } 2072 2073 /** 2074 * qdf_nbuf_get_icmp_subtype() - get the subtype 2075 * of IPV4 ICMP packet. 2076 * @buf: Pointer to IPV4 ICMP packet buffer 2077 * 2078 * This func. returns the subtype of ICMP packet. 2079 * 2080 * Return: subtype of the ICMP packet. 2081 */ 2082 static inline enum qdf_proto_subtype 2083 qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf) 2084 { 2085 return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf)); 2086 } 2087 2088 /** 2089 * qdf_nbuf_data_get_icmp_subtype() - get the subtype 2090 * of IPV4 ICMP packet. 2091 * @data: Pointer to IPV4 ICMP packet data buffer 2092 * 2093 * This func. returns the subtype of ICMP packet. 2094 * 2095 * Return: subtype of the ICMP packet. 2096 */ 2097 static inline enum qdf_proto_subtype 2098 qdf_nbuf_data_get_icmp_subtype(uint8_t *data) 2099 { 2100 return __qdf_nbuf_data_get_icmp_subtype(data); 2101 } 2102 2103 /** 2104 * qdf_nbuf_get_icmpv6_subtype() - get the subtype 2105 * of IPV6 ICMPV6 packet. 2106 * @buf: Pointer to IPV6 ICMPV6 packet buffer 2107 * 2108 * This func. returns the subtype of ICMPV6 packet. 2109 * 2110 * Return: subtype of the ICMPV6 packet. 2111 */ 2112 static inline enum qdf_proto_subtype 2113 qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf) 2114 { 2115 return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf)); 2116 } 2117 2118 /** 2119 * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype 2120 * of IPV6 ICMPV6 packet. 2121 * @data: Pointer to IPV6 ICMPV6 packet data buffer 2122 * 2123 * This func. returns the subtype of ICMPV6 packet. 2124 * 2125 * Return: subtype of the ICMPV6 packet. 2126 */ 2127 static inline enum qdf_proto_subtype 2128 qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data) 2129 { 2130 return __qdf_nbuf_data_get_icmpv6_subtype(data); 2131 } 2132 2133 /** 2134 * qdf_nbuf_data_get_ipv4_proto() - get the proto type 2135 * of IPV4 packet. 2136 * @data: Pointer to IPV4 packet data buffer 2137 * 2138 * This func. returns the proto type of IPV4 packet. 2139 * 2140 * Return: proto type of IPV4 packet. 2141 */ 2142 static inline uint8_t 2143 qdf_nbuf_data_get_ipv4_proto(uint8_t *data) 2144 { 2145 return __qdf_nbuf_data_get_ipv4_proto(data); 2146 } 2147 2148 /** 2149 * qdf_nbuf_data_get_ipv6_proto() - get the proto type 2150 * of IPV6 packet. 2151 * @data: Pointer to IPV6 packet data buffer 2152 * 2153 * This func. returns the proto type of IPV6 packet. 2154 * 2155 * Return: proto type of IPV6 packet. 2156 */ 2157 static inline uint8_t 2158 qdf_nbuf_data_get_ipv6_proto(uint8_t *data) 2159 { 2160 return __qdf_nbuf_data_get_ipv6_proto(data); 2161 } 2162 2163 /** 2164 * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not 2165 * @buf: buffer 2166 * 2167 * This api is for Tx packets. 2168 * 2169 * Return: true if packet is ipv4 packet 2170 */ 2171 static inline 2172 bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf) 2173 { 2174 return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf)); 2175 } 2176 2177 /** 2178 * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not 2179 * @data: data 2180 * 2181 * This api is for Tx packets. 2182 * 2183 * Return: true if packet is ipv4 packet 2184 */ 2185 static inline 2186 bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data) 2187 { 2188 return __qdf_nbuf_data_is_ipv4_pkt(data); 2189 } 2190 2191 /** 2192 * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not 2193 * @buf: buffer 2194 * 2195 * This api is for ipv4 packet. 2196 * 2197 * Return: true if packet is DHCP packet 2198 */ 2199 static inline 2200 bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf) 2201 { 2202 return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf)); 2203 } 2204 2205 /** 2206 * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet. 2207 * @data: Pointer to DHCP packet data buffer 2208 * 2209 * This func. checks whether it is a DHCP packet or not. 2210 * 2211 * Return: true if it is a DHCP packet 2212 * false if not 2213 */ 2214 static inline 2215 bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data) 2216 { 2217 return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data); 2218 } 2219 2220 /** 2221 * qdf_nbuf_data_is_ipv6_dhcp_pkt() - check if it is DHCP packet. 2222 * @data: Pointer to DHCP packet data buffer 2223 * 2224 * This func. checks whether it is a DHCP packet or not. 2225 * 2226 * Return: true if it is a DHCP packet 2227 * false if not 2228 */ 2229 static inline 2230 bool qdf_nbuf_is_ipv6_dhcp_pkt(qdf_nbuf_t buf) 2231 { 2232 return __qdf_nbuf_data_is_ipv6_dhcp_pkt(qdf_nbuf_data(buf)); 2233 } 2234 2235 /** 2236 * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not 2237 * @buf: buffer 2238 * 2239 * This api is for ipv4 packet. 2240 * 2241 * Return: true if packet is EAPOL packet 2242 */ 2243 static inline 2244 bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf) 2245 { 2246 return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf)); 2247 } 2248 2249 /** 2250 * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet. 2251 * @data: Pointer to EAPOL packet data buffer 2252 * 2253 * This func. checks whether it is a EAPOL packet or not. 2254 * 2255 * Return: true if it is a EAPOL packet 2256 * false if not 2257 */ 2258 static inline 2259 bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data) 2260 { 2261 return __qdf_nbuf_data_is_ipv4_eapol_pkt(data); 2262 } 2263 2264 /** 2265 * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not 2266 * @buf: buffer 2267 * 2268 * This api is for ipv4 packet. 2269 * 2270 * Return: true if packet is WAPI packet 2271 */ 2272 static inline 2273 bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf) 2274 { 2275 return __qdf_nbuf_is_ipv4_wapi_pkt(buf); 2276 } 2277 2278 /** 2279 * qdf_nbuf_is_ipv4_tdls_pkt() - check if packet is a tdls packet or not 2280 * @buf: buffer 2281 * 2282 * This api is for ipv4 packet. 2283 * 2284 * Return: true if packet is TDLS packet 2285 */ 2286 static inline 2287 bool qdf_nbuf_is_ipv4_tdls_pkt(qdf_nbuf_t buf) 2288 { 2289 return __qdf_nbuf_is_ipv4_tdls_pkt(buf); 2290 } 2291 2292 /** 2293 * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not 2294 * @buf: buffer 2295 * 2296 * This api is for ipv4 packet. 2297 * 2298 * Return: true if packet is ARP packet 2299 */ 2300 static inline 2301 bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf) 2302 { 2303 return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf)); 2304 } 2305 2306 /** 2307 * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet. 2308 * @data: Pointer to ARP packet data buffer 2309 * 2310 * This func. checks whether it is a ARP packet or not. 2311 * 2312 * Return: TRUE if it is a ARP packet 2313 * FALSE if not 2314 */ 2315 static inline 2316 bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data) 2317 { 2318 return __qdf_nbuf_data_is_ipv4_arp_pkt(data); 2319 } 2320 2321 /** 2322 * qdf_nbuf_data_is_arp_req() - check if ARP packet is request. 2323 * @buf: buffer 2324 * 2325 * This func. checks whether it is a ARP request or not. 2326 * 2327 * Return: true if it is a ARP request or FALSE if not 2328 */ 2329 static inline 2330 bool qdf_nbuf_data_is_arp_req(qdf_nbuf_t buf) 2331 { 2332 return __qdf_nbuf_data_is_arp_req(qdf_nbuf_data(buf)); 2333 } 2334 2335 /** 2336 * qdf_nbuf_data_is_arp_rsp() - check if ARP packet is response. 2337 * @buf: buffer 2338 * 2339 * This func. checks whether it is a ARP response or not. 2340 * 2341 * Return: true if it is a ARP response or FALSE if not 2342 */ 2343 static inline 2344 bool qdf_nbuf_data_is_arp_rsp(qdf_nbuf_t buf) 2345 { 2346 return __qdf_nbuf_data_is_arp_rsp(qdf_nbuf_data(buf)); 2347 } 2348 2349 /** 2350 * qdf_nbuf_data_get_arp_src_ip() - get ARP packet source IP gateway. 2351 * @buf: buffer 2352 * 2353 * Return: ARP packet source IP value. 2354 */ 2355 static inline 2356 uint32_t qdf_nbuf_get_arp_src_ip(qdf_nbuf_t buf) 2357 { 2358 return __qdf_nbuf_get_arp_src_ip(qdf_nbuf_data(buf)); 2359 } 2360 2361 /** 2362 * qdf_nbuf_data_get_arp_tgt_ip() - get ARP packet target IP gateway. 2363 * @buf: buffer 2364 * 2365 * Return: ARP packet target IP value. 2366 */ 2367 static inline 2368 uint32_t qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_t buf) 2369 { 2370 return __qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_data(buf)); 2371 } 2372 2373 /** 2374 * qdf_nbuf_get_dns_domain_name() - get dns domain name of required length 2375 * @buf: buffer 2376 * @len: length to copy 2377 * 2378 * Return: dns domain name 2379 */ 2380 static inline 2381 uint8_t *qdf_nbuf_get_dns_domain_name(qdf_nbuf_t buf, uint32_t len) 2382 { 2383 return __qdf_nbuf_get_dns_domain_name(qdf_nbuf_data(buf), len); 2384 } 2385 2386 /** 2387 * qdf_nbuf_data_is_dns_query() - check if skb data is a dns query 2388 * @buf: buffer 2389 * 2390 * Return: true if packet is dns query packet. 2391 * false otherwise. 2392 */ 2393 static inline 2394 bool qdf_nbuf_data_is_dns_query(qdf_nbuf_t buf) 2395 { 2396 return __qdf_nbuf_data_is_dns_query(qdf_nbuf_data(buf)); 2397 } 2398 2399 /** 2400 * qdf_nbuf_data_is_dns_response() - check if skb data is a dns response 2401 * @buf: buffer 2402 * 2403 * Return: true if packet is dns response packet. 2404 * false otherwise. 2405 */ 2406 static inline 2407 bool qdf_nbuf_data_is_dns_response(qdf_nbuf_t buf) 2408 { 2409 return __qdf_nbuf_data_is_dns_response(qdf_nbuf_data(buf)); 2410 } 2411 2412 /** 2413 * qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn 2414 * @buf: buffer 2415 * 2416 * Return: true if packet is tcp syn packet. 2417 * false otherwise. 2418 */ 2419 static inline 2420 bool qdf_nbuf_data_is_tcp_syn(qdf_nbuf_t buf) 2421 { 2422 return __qdf_nbuf_data_is_tcp_syn(qdf_nbuf_data(buf)); 2423 } 2424 2425 /** 2426 * qdf_nbuf_data_is_tcp_syn_ack() - check if skb data is a tcp syn ack 2427 * @buf: buffer 2428 * 2429 * Return: true if packet is tcp syn ack packet. 2430 * false otherwise. 2431 */ 2432 static inline 2433 bool qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_t buf) 2434 { 2435 return __qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_data(buf)); 2436 } 2437 2438 /** 2439 * qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack 2440 * @buf: buffer 2441 * 2442 * Return: true if packet is tcp ack packet. 2443 * false otherwise. 2444 */ 2445 static inline 2446 bool qdf_nbuf_data_is_tcp_ack(qdf_nbuf_t buf) 2447 { 2448 return __qdf_nbuf_data_is_tcp_ack(qdf_nbuf_data(buf)); 2449 } 2450 2451 /** 2452 * qdf_nbuf_data_get_tcp_src_port() - get tcp src port 2453 * @buf: buffer 2454 * 2455 * Return: tcp source port value. 2456 */ 2457 static inline 2458 uint16_t qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_t buf) 2459 { 2460 return __qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_data(buf)); 2461 } 2462 2463 /** 2464 * qdf_nbuf_data_get_tcp_dst_port() - get tcp dst port 2465 * @buf: buffer 2466 * 2467 * Return: tcp destination port value. 2468 */ 2469 static inline 2470 uint16_t qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_t buf) 2471 { 2472 return __qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_data(buf)); 2473 } 2474 2475 /** 2476 * qdf_nbuf_data_is_icmpv4_req() - check if ICMPv4 packet is request. 2477 * @buf: buffer 2478 * 2479 * This func. checks whether it is a ICMPv4 request or not. 2480 * 2481 * Return: true if it is a ICMPv4 request or fALSE if not 2482 */ 2483 static inline 2484 bool qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_t buf) 2485 { 2486 return __qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_data(buf)); 2487 } 2488 2489 /** 2490 * qdf_nbuf_data_is_icmpv4_rsp() - check if ICMPv4 packet is res 2491 * @buf: buffer 2492 * 2493 * Return: true if packet is icmpv4 response 2494 * false otherwise. 2495 */ 2496 static inline 2497 bool qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_t buf) 2498 { 2499 return __qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_data(buf)); 2500 } 2501 2502 /** 2503 * qdf_nbuf_get_icmpv4_src_ip() - get icmpv4 src IP 2504 * @buf: buffer 2505 * 2506 * Return: icmpv4 packet source IP value. 2507 */ 2508 static inline 2509 uint32_t qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_t buf) 2510 { 2511 return __qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_data(buf)); 2512 } 2513 2514 /** 2515 * qdf_nbuf_data_get_icmpv4_tgt_ip() - get icmpv4 target IP 2516 * @buf: buffer 2517 * 2518 * Return: icmpv4 packet target IP value. 2519 */ 2520 static inline 2521 uint32_t qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_t buf) 2522 { 2523 return __qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_data(buf)); 2524 } 2525 2526 /** 2527 * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet. 2528 * @buf: Pointer to IPV6 packet buffer 2529 * 2530 * This func. checks whether it is a IPV6 packet or not. 2531 * 2532 * Return: TRUE if it is a IPV6 packet 2533 * FALSE if not 2534 */ 2535 static inline 2536 bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf) 2537 { 2538 return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf)); 2539 } 2540 2541 /** 2542 * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet. 2543 * @data: Pointer to IPV6 packet data buffer 2544 * 2545 * This func. checks whether it is a IPV6 packet or not. 2546 * 2547 * Return: TRUE if it is a IPV6 packet 2548 * FALSE if not 2549 */ 2550 static inline 2551 bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data) 2552 { 2553 return __qdf_nbuf_data_is_ipv6_pkt(data); 2554 } 2555 2556 /** 2557 * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet. 2558 * @data: Pointer to IPV4 packet data buffer 2559 * 2560 * This func. checks whether it is a IPV4 multicast packet or not. 2561 * 2562 * Return: TRUE if it is a IPV4 multicast packet 2563 * FALSE if not 2564 */ 2565 static inline 2566 bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data) 2567 { 2568 return __qdf_nbuf_data_is_ipv4_mcast_pkt(data); 2569 } 2570 2571 /** 2572 * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet. 2573 * @data: Pointer to IPV6 packet data buffer 2574 * 2575 * This func. checks whether it is a IPV6 multicast packet or not. 2576 * 2577 * Return: TRUE if it is a IPV6 multicast packet 2578 * FALSE if not 2579 */ 2580 static inline 2581 bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data) 2582 { 2583 return __qdf_nbuf_data_is_ipv6_mcast_pkt(data); 2584 } 2585 2586 /** 2587 * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet. 2588 * @buf: Pointer to IPV4 ICMP packet buffer 2589 * 2590 * This func. checks whether it is a ICMP packet or not. 2591 * 2592 * Return: TRUE if it is a ICMP packet 2593 * FALSE if not 2594 */ 2595 static inline 2596 bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf) 2597 { 2598 return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf)); 2599 } 2600 2601 /** 2602 * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet. 2603 * @data: Pointer to IPV4 ICMP packet data buffer 2604 * 2605 * This func. checks whether it is a ICMP packet or not. 2606 * 2607 * Return: TRUE if it is a ICMP packet 2608 * FALSE if not 2609 */ 2610 static inline 2611 bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data) 2612 { 2613 return __qdf_nbuf_data_is_icmp_pkt(data); 2614 } 2615 2616 /** 2617 * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet. 2618 * @buf: Pointer to IPV6 ICMPV6 packet buffer 2619 * 2620 * This func. checks whether it is a ICMPV6 packet or not. 2621 * 2622 * Return: TRUE if it is a ICMPV6 packet 2623 * FALSE if not 2624 */ 2625 static inline 2626 bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf) 2627 { 2628 return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf)); 2629 } 2630 2631 /** 2632 * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet. 2633 * @data: Pointer to IPV6 ICMPV6 packet data buffer 2634 * 2635 * This func. checks whether it is a ICMPV6 packet or not. 2636 * 2637 * Return: TRUE if it is a ICMPV6 packet 2638 * FALSE if not 2639 */ 2640 static inline 2641 bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data) 2642 { 2643 return __qdf_nbuf_data_is_icmpv6_pkt(data); 2644 } 2645 2646 /** 2647 * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet. 2648 * @buf: Pointer to IPV4 UDP packet buffer 2649 * 2650 * This func. checks whether it is a IPV4 UDP packet or not. 2651 * 2652 * Return: TRUE if it is a IPV4 UDP packet 2653 * FALSE if not 2654 */ 2655 static inline 2656 bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf) 2657 { 2658 return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf)); 2659 } 2660 2661 /** 2662 * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet. 2663 * @data: Pointer to IPV4 UDP packet data buffer 2664 * 2665 * This func. checks whether it is a IPV4 UDP packet or not. 2666 * 2667 * Return: TRUE if it is a IPV4 UDP packet 2668 * FALSE if not 2669 */ 2670 static inline 2671 bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data) 2672 { 2673 return __qdf_nbuf_data_is_ipv4_udp_pkt(data); 2674 } 2675 2676 /** 2677 * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet. 2678 * @buf: Pointer to IPV4 TCP packet buffer 2679 * 2680 * This func. checks whether it is a IPV4 TCP packet or not. 2681 * 2682 * Return: TRUE if it is a IPV4 TCP packet 2683 * FALSE if not 2684 */ 2685 static inline 2686 bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf) 2687 { 2688 return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf)); 2689 } 2690 2691 /** 2692 * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet. 2693 * @data: Pointer to IPV4 TCP packet data buffer 2694 * 2695 * This func. checks whether it is a IPV4 TCP packet or not. 2696 * 2697 * Return: TRUE if it is a IPV4 TCP packet 2698 * FALSE if not 2699 */ 2700 static inline 2701 bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data) 2702 { 2703 return __qdf_nbuf_data_is_ipv4_tcp_pkt(data); 2704 } 2705 2706 /** 2707 * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet. 2708 * @buf: Pointer to IPV6 UDP packet buffer 2709 * 2710 * This func. checks whether it is a IPV6 UDP packet or not. 2711 * 2712 * Return: TRUE if it is a IPV6 UDP packet 2713 * FALSE if not 2714 */ 2715 static inline 2716 bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf) 2717 { 2718 return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf)); 2719 } 2720 2721 /** 2722 * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet. 2723 * @data: Pointer to IPV6 UDP packet data buffer 2724 * 2725 * This func. checks whether it is a IPV6 UDP packet or not. 2726 * 2727 * Return: TRUE if it is a IPV6 UDP packet 2728 * FALSE if not 2729 */ 2730 static inline 2731 bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data) 2732 { 2733 return __qdf_nbuf_data_is_ipv6_udp_pkt(data); 2734 } 2735 2736 /** 2737 * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet. 2738 * @buf: Pointer to IPV6 TCP packet buffer 2739 * 2740 * This func. checks whether it is a IPV6 TCP packet or not. 2741 * 2742 * Return: TRUE if it is a IPV6 TCP packet 2743 * FALSE if not 2744 */ 2745 static inline 2746 bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf) 2747 { 2748 return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf)); 2749 } 2750 2751 /** 2752 * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet. 2753 * @data: Pointer to IPV6 TCP packet data buffer 2754 * 2755 * This func. checks whether it is a IPV6 TCP packet or not. 2756 * 2757 * Return: TRUE if it is a IPV6 TCP packet 2758 * FALSE if not 2759 */ 2760 static inline 2761 bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data) 2762 { 2763 return __qdf_nbuf_data_is_ipv6_tcp_pkt(data); 2764 } 2765 2766 /** 2767 * qdf_nbuf_is_bcast_pkt() - check if it is broadcast packet. 2768 * @buf: Network buffer 2769 * 2770 * This func. checks whether packet is broadcast or not. 2771 * 2772 * Return: TRUE if it is broadcast packet 2773 * FALSE if not 2774 */ 2775 static inline 2776 bool qdf_nbuf_is_bcast_pkt(qdf_nbuf_t buf) 2777 { 2778 return __qdf_nbuf_is_bcast_pkt(buf); 2779 } 2780 2781 /** 2782 * qdf_nbuf_reset_num_frags() - decrement the number of fragments 2783 * @buf: Network buffer 2784 * 2785 * Return: Number of fragments 2786 */ 2787 static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf) 2788 { 2789 __qdf_nbuf_reset_num_frags(buf); 2790 } 2791 2792 /** 2793 * qdf_dmaaddr_to_32s - return high and low parts of dma_addr 2794 * 2795 * Returns the high and low 32-bits of the DMA addr in the provided ptrs 2796 * 2797 * Return: N/A 2798 */ 2799 static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr, 2800 uint32_t *lo, uint32_t *hi) 2801 { 2802 return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi); 2803 } 2804 2805 /** 2806 * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO 2807 * network buffer into segments 2808 * @nbuf: network buffer to be segmented 2809 * @tso_info: This is the output. The information about the 2810 * TSO segments will be populated within this. 2811 * 2812 * This function fragments a TCP jumbo packet into smaller 2813 * segments to be transmitted by the driver. It chains the TSO 2814 * segments created into a list. 2815 * 2816 * Return: number of TSO segments 2817 */ 2818 static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev, 2819 qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info) 2820 { 2821 return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info); 2822 } 2823 2824 /** 2825 * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element 2826 * 2827 * @osdev: qdf device handle 2828 * @tso_seg: TSO segment element to be unmapped 2829 * @is_last_seg: whether this is last tso seg or not 2830 * 2831 * Return: none 2832 */ 2833 static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev, 2834 struct qdf_tso_seg_elem_t *tso_seg, 2835 bool is_last_seg) 2836 { 2837 return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg); 2838 } 2839 2840 /** 2841 * qdf_nbuf_get_tso_num_seg() - function to calculate the number 2842 * of TCP segments within the TSO jumbo packet 2843 * @nbuf: TSO jumbo network buffer to be segmented 2844 * 2845 * This function calculates the number of TCP segments that the 2846 network buffer can be divided into. 2847 * 2848 * Return: number of TCP segments 2849 */ 2850 static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf) 2851 { 2852 return __qdf_nbuf_get_tso_num_seg(nbuf); 2853 } 2854 2855 /** 2856 * qdf_nbuf_inc_users() - function to increment the number of 2857 * users referencing this network buffer 2858 * 2859 * @nbuf: network buffer 2860 * 2861 * This function increments the number of users referencing this 2862 * network buffer 2863 * 2864 * Return: the network buffer 2865 */ 2866 static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf) 2867 { 2868 return __qdf_nbuf_inc_users(nbuf); 2869 } 2870 2871 /** 2872 * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb 2873 * 2874 * @nbuf: Network buffer (skb on linux) 2875 * 2876 * This function returns the values of data_attr field 2877 * in struct cvg_nbuf_cb{}, to which skb->cb is typecast. 2878 * This value is actually the value programmed in CE descriptor. 2879 * 2880 * Return: Value of data_attr 2881 */ 2882 static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf) 2883 { 2884 return __qdf_nbuf_data_attr_get(buf); 2885 } 2886 2887 /** 2888 * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb 2889 * 2890 * @nbuf: Network buffer (skb on linux) 2891 * @data_attr: Value to be stored cvg_nbuf_cb->data_attr 2892 * 2893 * This function stores the value to be programmed in CE 2894 * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{} 2895 * 2896 * Return: void 2897 */ 2898 static inline 2899 void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr) 2900 { 2901 __qdf_nbuf_data_attr_set(buf, data_attr); 2902 } 2903 2904 /** 2905 * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata 2906 * 2907 * @nbuf: Network buffer (skb on linux) 2908 * 2909 * This function parses the payload to figure out relevant 2910 * Tx meta-data e.g. whether to enable tx_classify bit 2911 * in CE. 2912 * 2913 * Return: void 2914 */ 2915 #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get 2916 2917 void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state); 2918 void qdf_nbuf_tx_desc_count_display(void); 2919 void qdf_nbuf_tx_desc_count_clear(void); 2920 2921 static inline qdf_nbuf_t 2922 qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom) 2923 { 2924 return __qdf_nbuf_realloc_headroom(buf, headroom); 2925 } 2926 2927 static inline qdf_nbuf_t 2928 qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom) 2929 { 2930 return __qdf_nbuf_realloc_tailroom(buf, tailroom); 2931 } 2932 2933 static inline qdf_nbuf_t 2934 qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom) 2935 { 2936 return __qdf_nbuf_expand(buf, headroom, tailroom); 2937 } 2938 2939 static inline int 2940 qdf_nbuf_linearize(qdf_nbuf_t buf) 2941 { 2942 return __qdf_nbuf_linearize(buf); 2943 } 2944 2945 #ifdef NBUF_MEMORY_DEBUG 2946 #define qdf_nbuf_unshare(d) \ 2947 qdf_nbuf_unshare_debug(d, __FILE__, __LINE__) 2948 2949 static inline qdf_nbuf_t 2950 qdf_nbuf_unshare_debug(qdf_nbuf_t buf, uint8_t *file_name, uint32_t line_num) 2951 { 2952 qdf_nbuf_t unshared_buf; 2953 2954 unshared_buf = __qdf_nbuf_unshare(buf); 2955 2956 if (qdf_likely(buf != unshared_buf)) { 2957 qdf_net_buf_debug_delete_node(buf); 2958 2959 qdf_net_buf_debug_add_node(unshared_buf, 0, 2960 file_name, line_num); 2961 } 2962 2963 return unshared_buf; 2964 } 2965 2966 #else 2967 static inline qdf_nbuf_t 2968 qdf_nbuf_unshare(qdf_nbuf_t buf) 2969 { 2970 return __qdf_nbuf_unshare(buf); 2971 } 2972 #endif 2973 2974 static inline bool 2975 qdf_nbuf_is_cloned(qdf_nbuf_t buf) 2976 { 2977 return __qdf_nbuf_is_cloned(buf); 2978 } 2979 2980 static inline void 2981 qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg) 2982 { 2983 __qdf_nbuf_frag_info(buf, sg); 2984 } 2985 2986 static inline qdf_nbuf_tx_cksum_t 2987 qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where) 2988 { 2989 return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where); 2990 } 2991 2992 static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf) 2993 { 2994 __qdf_nbuf_reset_ctxt(nbuf); 2995 } 2996 2997 static inline void qdf_nbuf_init(qdf_nbuf_t buf) 2998 { 2999 __qdf_nbuf_init(buf); 3000 } 3001 3002 static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf) 3003 { 3004 return __qdf_nbuf_network_header(buf); 3005 } 3006 3007 static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf) 3008 { 3009 return __qdf_nbuf_transport_header(buf); 3010 } 3011 3012 static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf) 3013 { 3014 return __qdf_nbuf_tcp_tso_size(buf); 3015 } 3016 3017 static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf) 3018 { 3019 return __qdf_nbuf_get_cb(nbuf); 3020 } 3021 3022 static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf) 3023 { 3024 return __qdf_nbuf_get_nr_frags(nbuf); 3025 } 3026 3027 static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf) 3028 { 3029 return __qdf_nbuf_headlen(buf); 3030 } 3031 3032 static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev, 3033 qdf_nbuf_t buf, int offset, 3034 qdf_dma_dir_t dir, int cur_frag) 3035 { 3036 return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag); 3037 } 3038 3039 static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf) 3040 { 3041 return __qdf_nbuf_tso_tcp_v4(buf); 3042 } 3043 3044 static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf) 3045 { 3046 return __qdf_nbuf_tso_tcp_v6(buf); 3047 } 3048 3049 static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf) 3050 { 3051 return __qdf_nbuf_tcp_seq(buf); 3052 } 3053 3054 static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf) 3055 { 3056 return __qdf_nbuf_l2l3l4_hdr_len(buf); 3057 } 3058 3059 static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf) 3060 { 3061 return __qdf_nbuf_is_nonlinear(buf); 3062 } 3063 3064 static inline uint32_t 3065 qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num) 3066 { 3067 return __qdf_nbuf_get_frag_size(buf, frag_num); 3068 } 3069 3070 static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf) 3071 { 3072 return __qdf_nbuf_get_priority(buf); 3073 } 3074 3075 static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p) 3076 { 3077 __qdf_nbuf_set_priority(buf, p); 3078 } 3079 3080 static inline void qdf_nbuf_record_rx_queue(qdf_nbuf_t buf, uint32_t queue_id) 3081 { 3082 __qdf_nbuf_record_rx_queue(buf, queue_id); 3083 } 3084 3085 static inline uint16_t 3086 qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf) 3087 { 3088 return __qdf_nbuf_get_queue_mapping(buf); 3089 } 3090 3091 static inline uint8_t * 3092 qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf) 3093 { 3094 return __qdf_nbuf_get_priv_ptr(buf); 3095 } 3096 3097 /** 3098 * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf. 3099 * @rx_status: rx_status containing required info to update radiotap 3100 * @nbuf: Pointer to nbuf 3101 * @headroom_sz: Available headroom size 3102 * 3103 * Return: radiotap length. 3104 */ 3105 unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status, 3106 qdf_nbuf_t nbuf, uint32_t headroom_sz); 3107 3108 /** 3109 * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame. 3110 * @buf: Pointer to nbuf 3111 * 3112 * Return: None 3113 */ 3114 static inline void 3115 qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf) 3116 { 3117 __qdf_nbuf_mark_wakeup_frame(buf); 3118 } 3119 3120 /** 3121 * qdf_nbuf_reg_free_cb - Registers nbuf free callback 3122 * @cb_func_ptr: Callback pointer 3123 * 3124 * This function registers nbuf free callback 3125 * 3126 * Return: void 3127 */ 3128 static inline void 3129 qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr) 3130 { 3131 __qdf_nbuf_reg_free_cb(cb_func_ptr); 3132 } 3133 3134 /** 3135 * qdf_nbuf_set_timestamp() - set the timestamp for frame 3136 * 3137 * @buf: sk buff 3138 * 3139 * Return: void 3140 */ 3141 static inline void 3142 qdf_nbuf_set_timestamp(struct sk_buff *skb) 3143 { 3144 __qdf_nbuf_set_timestamp(skb); 3145 } 3146 3147 /** 3148 * qdf_nbuf_get_timedelta_ms() - get time difference in ms 3149 * 3150 * @buf: sk buff 3151 * 3152 * Return: time difference ms 3153 */ 3154 static inline uint64_t 3155 qdf_nbuf_get_timedelta_ms(struct sk_buff *skb) 3156 { 3157 return __qdf_nbuf_get_timedelta_ms(skb); 3158 } 3159 3160 /** 3161 * qdf_nbuf_get_timedelta_us() - get time difference in micro seconds 3162 * 3163 * @buf: sk buff 3164 * 3165 * Return: time difference in micro seconds 3166 */ 3167 static inline uint64_t 3168 qdf_nbuf_get_timedelta_us(struct sk_buff *skb) 3169 { 3170 return __qdf_nbuf_get_timedelta_us(skb); 3171 } 3172 3173 /** 3174 * qdf_nbuf_count_get() - get global nbuf gauge 3175 * 3176 * Return: global nbuf gauge 3177 */ 3178 static inline int qdf_nbuf_count_get(void) 3179 { 3180 return __qdf_nbuf_count_get(); 3181 } 3182 3183 /** 3184 * qdf_nbuf_count_inc() - increment nbuf global count 3185 * 3186 * @buf: sk buff 3187 * 3188 * Return: void 3189 */ 3190 static inline void qdf_nbuf_count_inc(qdf_nbuf_t buf) 3191 { 3192 return __qdf_nbuf_count_inc(buf); 3193 } 3194 3195 /** 3196 * qdf_nbuf_count_dec() - decrement nbuf global count 3197 * 3198 * @buf: sk buff 3199 * 3200 * Return: void 3201 */ 3202 static inline void qdf_nbuf_count_dec(qdf_nbuf_t buf) 3203 { 3204 return __qdf_nbuf_count_dec(buf); 3205 } 3206 3207 /** 3208 * qdf_nbuf_mod_init() - Intialization routine for qdf_nbuf 3209 * 3210 * Return void 3211 */ 3212 static inline void qdf_nbuf_mod_init(void) 3213 { 3214 return __qdf_nbuf_mod_init(); 3215 } 3216 3217 /** 3218 * qdf_nbuf_mod_init() - Unintialization routine for qdf_nbuf 3219 * 3220 * Return void 3221 */ 3222 static inline void qdf_nbuf_mod_exit(void) 3223 { 3224 return __qdf_nbuf_mod_exit(); 3225 } 3226 3227 /** 3228 * qdf_nbuf_orphan() - orphan a nbuf 3229 * @buf: Pointer to network buffer 3230 * 3231 * If a buffer currently has an owner then we call the 3232 * owner's destructor function 3233 * 3234 * Return: void 3235 */ 3236 static inline void qdf_nbuf_orphan(qdf_nbuf_t buf) 3237 { 3238 return __qdf_nbuf_orphan(buf); 3239 } 3240 3241 #ifdef CONFIG_WIN 3242 #include <i_qdf_nbuf_api_w.h> 3243 #else 3244 #include <i_qdf_nbuf_api_m.h> 3245 #endif 3246 #endif /* _QDF_NBUF_H */ 3247