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