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