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