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