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