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