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