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