xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/qdf_nbuf.h (revision 99a10d078d8c08bacd095650c5bfcdcef8f8bf20)
1 /*
2  * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 
28 /**
29  * DOC: qdf_nbuf_public network buffer API
30  * This file defines the network buffer abstraction.
31  */
32 
33 #ifndef _QDF_NBUF_H
34 #define _QDF_NBUF_H
35 
36 #include <qdf_util.h>
37 #include <qdf_types.h>
38 #include <qdf_lock.h>
39 #include <i_qdf_nbuf.h>
40 #include <i_qdf_trace.h>
41 #include <qdf_net_types.h>
42 
43 #define IPA_NBUF_OWNER_ID			0xaa55aa55
44 #define QDF_NBUF_PKT_TRAC_TYPE_EAPOL		0x02
45 #define QDF_NBUF_PKT_TRAC_TYPE_DHCP		0x04
46 #define QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION	0x08
47 #define QDF_NBUF_PKT_TRAC_TYPE_ARP		0x10
48 #define QDF_NBUF_PKT_TRAC_MAX_STRING		12
49 #define QDF_NBUF_PKT_TRAC_PROTO_STRING		4
50 #define QDF_NBUF_PKT_ERROR			1
51 
52 #define QDF_NBUF_TRAC_IPV4_OFFSET		14
53 #define QDF_NBUF_TRAC_IPV4_HEADER_SIZE		20
54 #define QDF_NBUF_TRAC_DHCP_SRV_PORT		67
55 #define QDF_NBUF_TRAC_DHCP_CLI_PORT		68
56 #define QDF_NBUF_TRAC_ETH_TYPE_OFFSET		12
57 #define QDF_NBUF_TRAC_EAPOL_ETH_TYPE		0x888E
58 #define QDF_NBUF_TRAC_WAPI_ETH_TYPE		0x88b4
59 #define QDF_NBUF_TRAC_ARP_ETH_TYPE		0x0806
60 #define QDF_NBUF_TRAC_IPV4_ETH_TYPE     0x0800
61 #define QDF_NBUF_TRAC_IPV6_ETH_TYPE     0x86dd
62 #define QDF_NBUF_DEST_MAC_OFFSET		0
63 #define QDF_NBUF_SRC_MAC_OFFSET			6
64 #define QDF_NBUF_TRAC_IPV4_PROTO_TYPE_OFFSET  23
65 #define QDF_NBUF_TRAC_IPV4_DEST_ADDR_OFFSET   30
66 #define QDF_NBUF_TRAC_IPV6_PROTO_TYPE_OFFSET  20
67 #define QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK    0xE0000000
68 #define QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK    0xF0000000
69 #define QDF_NBUF_TRAC_IPV6_DEST_ADDR_OFFSET   38
70 #define QDF_NBUF_TRAC_IPV6_DEST_ADDR          0xFF00
71 #define QDF_NBUF_TRAC_ICMP_TYPE         1
72 #define QDF_NBUF_TRAC_TCP_TYPE          6
73 #define QDF_NBUF_TRAC_UDP_TYPE          17
74 #define QDF_NBUF_TRAC_ICMPV6_TYPE       0x3a
75 
76 /* EAPOL Related MASK */
77 #define EAPOL_PACKET_TYPE_OFFSET		15
78 #define EAPOL_KEY_INFO_OFFSET			19
79 #define EAPOL_PKT_LEN_OFFSET            16
80 #define EAPOL_KEY_LEN_OFFSET            21
81 #define EAPOL_MASK				0x8013
82 #define EAPOL_M1_BIT_MASK			0x8000
83 #define EAPOL_M2_BIT_MASK			0x0001
84 #define EAPOL_M3_BIT_MASK			0x8013
85 #define EAPOL_M4_BIT_MASK			0x0003
86 
87 /* Tracked Packet types */
88 #define QDF_NBUF_TX_PKT_INVALID              0
89 #define QDF_NBUF_TX_PKT_DATA_TRACK           1
90 #define QDF_NBUF_TX_PKT_MGMT_TRACK           2
91 
92 /* Different Packet states */
93 #define QDF_NBUF_TX_PKT_HDD                  1
94 #define QDF_NBUF_TX_PKT_TXRX_ENQUEUE         2
95 #define QDF_NBUF_TX_PKT_TXRX_DEQUEUE         3
96 #define QDF_NBUF_TX_PKT_TXRX                 4
97 #define QDF_NBUF_TX_PKT_HTT                  5
98 #define QDF_NBUF_TX_PKT_HTC                  6
99 #define QDF_NBUF_TX_PKT_HIF                  7
100 #define QDF_NBUF_TX_PKT_CE                   8
101 #define QDF_NBUF_TX_PKT_FREE                 9
102 #define QDF_NBUF_TX_PKT_STATE_MAX            10
103 
104 /* Enable flag to print TSO specific prints in datapath */
105 #ifdef TSO_DEBUG_LOG_ENABLE
106 #define TSO_DEBUG(args ...) printk(args)
107 #else
108 #define TSO_DEBUG(args ...)
109 #endif
110 
111 /**
112  * struct mon_rx_status - This will have monitor mode rx_status extracted from
113  * htt_rx_desc used later to update radiotap information.
114  * @tsft: Time Synchronization Function timer
115  * @chan_freq: Capture channel frequency
116  * @chan_num: Capture channel number
117  * @chan_flags: Bitmap of Channel flags, IEEE80211_CHAN_TURBO,
118  *              IEEE80211_CHAN_CCK...
119  * @vht_flags: VHT flgs, only present for VHT frames.
120  * @vht_flag_values1-5: Contains corresponding data for flags field
121  * @rate: Rate in terms 500Kbps
122  * @rtap_flags: Bit map of available fields in the radiotap
123  * @ant_signal_db: Rx packet RSSI
124  * @nr_ant: Number of Antennas used for streaming
125  * @mcs: MCS index of Rx frame
126  * @is_stbc: Is STBC enabled
127  * @sgi: Rx frame short guard interval
128  * @ldpc: ldpc enabled
129  * @beamformed: Is frame beamformed.
130  */
131 struct mon_rx_status {
132 	uint64_t tsft;
133 	uint16_t chan_freq;
134 	uint16_t chan_num;
135 	uint16_t chan_flags;
136 	uint16_t vht_flags;
137 	uint16_t vht_flag_values6;
138 	uint8_t  rate;
139 	uint8_t  rtap_flags;
140 	uint8_t  ant_signal_db;
141 	uint8_t  nr_ant;
142 	uint8_t  mcs;
143 	uint8_t  vht_flag_values1;
144 	uint8_t  vht_flag_values2;
145 	uint8_t  vht_flag_values3[4];
146 	uint8_t  vht_flag_values4;
147 	uint8_t  vht_flag_values5;
148 	uint8_t  is_stbc;
149 	uint8_t  sgi;
150 	uint8_t  ldpc;
151 	uint8_t  beamformed;
152 };
153 
154 /* DHCP Related Mask */
155 #define QDF_DHCP_OPTION53			(0x35)
156 #define QDF_DHCP_OPTION53_LENGTH		(1)
157 #define QDF_DHCP_OPTION53_OFFSET		(0x11A)
158 #define QDF_DHCP_OPTION53_LENGTH_OFFSET	(0x11B)
159 #define QDF_DHCP_OPTION53_STATUS_OFFSET	(0x11C)
160 #define DHCP_PKT_LEN_OFFSET           16
161 #define DHCP_TRANSACTION_ID_OFFSET    46
162 #define QDF_DHCP_DISCOVER			(1)
163 #define QDF_DHCP_OFFER				(2)
164 #define QDF_DHCP_REQUEST			(3)
165 #define QDF_DHCP_DECLINE			(4)
166 #define QDF_DHCP_ACK				(5)
167 #define QDF_DHCP_NAK				(6)
168 #define QDF_DHCP_RELEASE			(7)
169 #define QDF_DHCP_INFORM				(8)
170 
171 /* ARP Related Mask */
172 #define ARP_SUB_TYPE_OFFSET  20
173 #define ARP_REQUEST			(1)
174 #define ARP_RESPONSE		(2)
175 
176 /* IPV4 Related Mask */
177 #define IPV4_PKT_LEN_OFFSET           16
178 #define IPV4_TCP_SEQ_NUM_OFFSET       38
179 #define IPV4_SRC_PORT_OFFSET          34
180 #define IPV4_DST_PORT_OFFSET          36
181 
182 /* IPV4 ICMP Related Mask */
183 #define ICMP_SEQ_NUM_OFFSET           40
184 #define ICMP_SUBTYPE_OFFSET           34
185 #define ICMP_REQUEST                  0x08
186 #define ICMP_RESPONSE                 0x00
187 
188 /* IPV6 Related Mask */
189 #define IPV6_PKT_LEN_OFFSET           18
190 #define IPV6_TCP_SEQ_NUM_OFFSET       58
191 #define IPV6_SRC_PORT_OFFSET          54
192 #define IPV6_DST_PORT_OFFSET          56
193 
194 /* IPV6 ICMPV6 Related Mask */
195 #define ICMPV6_SEQ_NUM_OFFSET         60
196 #define ICMPV6_SUBTYPE_OFFSET         54
197 #define ICMPV6_REQUEST                0x80
198 #define ICMPV6_RESPONSE               0x81
199 #define ICMPV6_RS                     0x85
200 #define ICMPV6_RA                     0x86
201 #define ICMPV6_NS                     0x87
202 #define ICMPV6_NA                     0x88
203 
204 #define QDF_NBUF_IPA_CHECK_MASK		0x80000000
205 
206 /**
207  * qdf_proto_type - protocol type
208  * @QDF_PROTO_TYPE_DHCP - DHCP
209  * @QDF_PROTO_TYPE_EAPOL - EAPOL
210  * @QDF_PROTO_TYPE_ARP - ARP
211  * @QDF_PROTO_TYPE_MGMT - MGMT
212  * QDF_PROTO_TYPE_EVENT - EVENT
213  */
214 enum qdf_proto_type {
215 	QDF_PROTO_TYPE_DHCP,
216 	QDF_PROTO_TYPE_EAPOL,
217 	QDF_PROTO_TYPE_ARP,
218 	QDF_PROTO_TYPE_MGMT,
219 	QDF_PROTO_TYPE_EVENT,
220 	QDF_PROTO_TYPE_MAX
221 };
222 
223 /**
224  * qdf_proto_subtype - subtype of packet
225  * @QDF_PROTO_EAPOL_M1 - EAPOL 1/4
226  * @QDF_PROTO_EAPOL_M2 - EAPOL 2/4
227  * @QDF_PROTO_EAPOL_M3 - EAPOL 3/4
228  * @QDF_PROTO_EAPOL_M4 - EAPOL 4/4
229  * @QDF_PROTO_DHCP_DISCOVER - discover
230  * @QDF_PROTO_DHCP_REQUEST - request
231  * @QDF_PROTO_DHCP_OFFER - offer
232  * @QDF_PROTO_DHCP_ACK - ACK
233  * @QDF_PROTO_DHCP_NACK - NACK
234  * @QDF_PROTO_DHCP_RELEASE - release
235  * @QDF_PROTO_DHCP_INFORM - inform
236  * @QDF_PROTO_DHCP_DECLINE - decline
237  * @QDF_PROTO_ARP_REQ - arp request
238  * @QDF_PROTO_ARP_RES - arp response
239  * @QDF_PROTO_ICMP_REQ - icmp request
240  * @QDF_PROTO_ICMP_RES - icmp response
241  * @QDF_PROTO_ICMPV6_REQ - icmpv6 request
242  * @QDF_PROTO_ICMPV6_RES - icmpv6 response
243  * @QDF_PROTO_ICMPV6_RS - icmpv6 rs packet
244  * @QDF_PROTO_ICMPV6_RA - icmpv6 ra packet
245  * @QDF_PROTO_ICMPV6_NS - icmpv6 ns packet
246  * @QDF_PROTO_ICMPV6_NA - icmpv6 na packet
247  * @QDF_PROTO_IPV4_UDP - ipv4 udp
248  * @QDF_PROTO_IPV4_TCP - ipv4 tcp
249  * @QDF_PROTO_IPV6_UDP - ipv6 udp
250  * @QDF_PROTO_IPV6_TCP - ipv6 tcp
251  * @QDF_PROTO_MGMT_ASSOC -assoc
252  * @QDF_PROTO_MGMT_DISASSOC - disassoc
253  * @QDF_PROTO_MGMT_AUTH - auth
254  * @QDF_PROTO_MGMT_DEAUTH - deauth
255  * QDF_ROAM_SYNCH - roam synch indication from fw
256  * QDF_ROAM_COMPLETE - roam complete cmd to fw
257  * QDF_ROAM_EVENTID - roam eventid from fw
258  */
259 enum qdf_proto_subtype {
260 	QDF_PROTO_INVALID,
261 	QDF_PROTO_EAPOL_M1,
262 	QDF_PROTO_EAPOL_M2,
263 	QDF_PROTO_EAPOL_M3,
264 	QDF_PROTO_EAPOL_M4,
265 	QDF_PROTO_DHCP_DISCOVER,
266 	QDF_PROTO_DHCP_REQUEST,
267 	QDF_PROTO_DHCP_OFFER,
268 	QDF_PROTO_DHCP_ACK,
269 	QDF_PROTO_DHCP_NACK,
270 	QDF_PROTO_DHCP_RELEASE,
271 	QDF_PROTO_DHCP_INFORM,
272 	QDF_PROTO_DHCP_DECLINE,
273 	QDF_PROTO_ARP_REQ,
274 	QDF_PROTO_ARP_RES,
275 	QDF_PROTO_ICMP_REQ,
276 	QDF_PROTO_ICMP_RES,
277 	QDF_PROTO_ICMPV6_REQ,
278 	QDF_PROTO_ICMPV6_RES,
279 	QDF_PROTO_ICMPV6_RS,
280 	QDF_PROTO_ICMPV6_RA,
281 	QDF_PROTO_ICMPV6_NS,
282 	QDF_PROTO_ICMPV6_NA,
283 	QDF_PROTO_IPV4_UDP,
284 	QDF_PROTO_IPV4_TCP,
285 	QDF_PROTO_IPV6_UDP,
286 	QDF_PROTO_IPV6_TCP,
287 	QDF_PROTO_MGMT_ASSOC,
288 	QDF_PROTO_MGMT_DISASSOC,
289 	QDF_PROTO_MGMT_AUTH,
290 	QDF_PROTO_MGMT_DEAUTH,
291 	QDF_ROAM_SYNCH,
292 	QDF_ROAM_COMPLETE,
293 	QDF_ROAM_EVENTID,
294 	QDF_PROTO_SUBTYPE_MAX
295 };
296 
297 /**
298  * @qdf_nbuf_t - Platform indepedent packet abstraction
299  */
300 typedef __qdf_nbuf_t qdf_nbuf_t;
301 
302 /**
303  * @qdf_dma_map_cb_t - Dma map callback prototype
304  */
305 typedef void (*qdf_dma_map_cb_t)(void *arg, qdf_nbuf_t buf,
306 				 qdf_dma_map_t dmap);
307 
308 /**
309  * @qdf_nbuf_queue_t - Platform independent packet queue abstraction
310  */
311 typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t;
312 
313 /* BUS/DMA mapping routines */
314 
315 static inline QDF_STATUS
316 qdf_nbuf_dmamap_create(qdf_device_t osdev, qdf_dma_map_t *dmap)
317 {
318 	return __qdf_nbuf_dmamap_create(osdev, dmap);
319 }
320 
321 static inline void
322 qdf_nbuf_dmamap_destroy(qdf_device_t osdev, qdf_dma_map_t dmap)
323 {
324 	__qdf_nbuf_dmamap_destroy(osdev, dmap);
325 }
326 
327 static inline void
328 qdf_nbuf_dmamap_set_cb(qdf_dma_map_t dmap, qdf_dma_map_cb_t cb, void *arg)
329 {
330 	__qdf_nbuf_dmamap_set_cb(dmap, cb, arg);
331 }
332 
333 static inline void
334 qdf_nbuf_set_send_complete_flag(qdf_nbuf_t buf, bool flag)
335 {
336 	__qdf_nbuf_set_send_complete_flag(buf, flag);
337 }
338 
339 static inline QDF_STATUS
340 qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
341 {
342 	return __qdf_nbuf_map(osdev, buf, dir);
343 }
344 
345 static inline void
346 qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
347 {
348 	__qdf_nbuf_unmap(osdev, buf, dir);
349 }
350 
351 static inline QDF_STATUS
352 qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf,
353 		qdf_dma_dir_t dir, int nbytes)
354 {
355 	return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes);
356 }
357 
358 static inline void
359 qdf_nbuf_unmap_nbytes(qdf_device_t osdev,
360 	qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
361 {
362 	__qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes);
363 }
364 
365 #ifndef REMOVE_INIT_DEBUG_CODE
366 static inline void
367 qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
368 {
369 	__qdf_nbuf_sync_for_cpu(osdev, buf, dir);
370 }
371 #endif
372 
373 static inline QDF_STATUS
374 qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
375 {
376 	return __qdf_nbuf_map_single(osdev, buf, dir);
377 }
378 
379 static inline QDF_STATUS
380 qdf_nbuf_map_nbytes_single(
381 	qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
382 {
383 	return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes);
384 }
385 
386 static inline void
387 qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
388 {
389 	__qdf_nbuf_unmap_single(osdev, buf, dir);
390 }
391 
392 static inline void
393 qdf_nbuf_unmap_nbytes_single(
394 	qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
395 {
396 	return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes);
397 }
398 
399 static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf)
400 {
401 	return __qdf_nbuf_get_num_frags(buf);
402 }
403 
404 /**
405  * qdf_nbuf_get_frag_len() - get fragment length
406  * @buf: Network buffer
407  * @frag_num: Fragment number
408  *
409  * Return: Fragment length
410  */
411 static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num)
412 {
413 	QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
414 	return __qdf_nbuf_get_frag_len(buf, frag_num);
415 }
416 
417 /**
418  * qdf_nbuf_get_frag_vaddr() - get fragment virtual address
419  * @buf: Network buffer
420  * @frag_num: Fragment number
421  *
422  * Return: Fragment virtual address
423  */
424 static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf,
425 			int frag_num)
426 {
427 	QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
428 	return __qdf_nbuf_get_frag_vaddr(buf, frag_num);
429 }
430 
431 /**
432  * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address
433  * @buf: Network buffer
434  *
435  * Return: Fragment virtual address
436  */
437 static inline unsigned char *
438 qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf)
439 {
440 	return __qdf_nbuf_get_frag_vaddr_always(buf);
441 }
442 
443 /**
444  * qdf_nbuf_get_frag_paddr() - get fragment physical address
445  * @buf: Network buffer
446  * @frag_num: Fragment number
447  *
448  * Return: Fragment physical address
449  */
450 static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf,
451 			unsigned int frag_num)
452 {
453 	QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
454 	return __qdf_nbuf_get_frag_paddr(buf, frag_num);
455 }
456 
457 /**
458  * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream
459  * @buf: Network buffer
460  * @frag_num: Fragment number
461  *
462  * Return: Fragment wordstream or not
463  */
464 static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num)
465 {
466 	QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
467 	return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num);
468 }
469 
470 static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
471 {
472 	return __qdf_nbuf_ipa_owned_get(buf);
473 }
474 
475 static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
476 {
477 	__qdf_nbuf_ipa_owned_set(buf);
478 }
479 
480 static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
481 {
482 	return __qdf_nbuf_ipa_priv_get(buf);
483 }
484 
485 static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv)
486 {
487 
488 	QDF_BUG(!(priv & QDF_NBUF_IPA_CHECK_MASK));
489 	__qdf_nbuf_ipa_priv_set(buf, priv);
490 }
491 
492 /**
493  * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream
494  * @buf: Network buffer
495  * @frag_num: Fragment number
496  * @is_wordstream: Wordstream
497  *
498  * Return: none
499  */
500 static inline void
501 qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf,
502 		 int frag_num, int is_wordstream)
503 {
504 	QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
505 	__qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream);
506 }
507 
508 static inline void
509 qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, void *vdev_ctx)
510 {
511 	__qdf_nbuf_set_vdev_ctx(buf, vdev_ctx);
512 }
513 
514 static inline void
515 qdf_nbuf_set_fctx_type(qdf_nbuf_t buf, void *ctx, uint8_t type)
516 {
517 	__qdf_nbuf_set_fctx_type(buf, ctx, type);
518 }
519 
520 static inline void *
521 qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf)
522 {
523 	return  __qdf_nbuf_get_vdev_ctx(buf);
524 }
525 
526 static inline void *qdf_nbuf_get_fctx(qdf_nbuf_t buf)
527 {
528 	return  __qdf_nbuf_get_fctx(buf);
529 }
530 
531 static inline uint8_t qdf_nbuf_get_ftype(qdf_nbuf_t buf)
532 {
533 	return  __qdf_nbuf_get_ftype(buf);
534 }
535 
536 static inline qdf_dma_addr_t
537 qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf)
538 {
539 	return __qdf_nbuf_mapped_paddr_get(buf);
540 }
541 
542 static inline void
543 qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr)
544 {
545 	__qdf_nbuf_mapped_paddr_set(buf, paddr);
546 }
547 
548 static inline void
549 qdf_nbuf_frag_push_head(qdf_nbuf_t buf,
550 			int frag_len, char *frag_vaddr,
551 			qdf_dma_addr_t frag_paddr)
552 {
553 	__qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr);
554 }
555 
556 #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf))
557 
558 /**
559  * qdf_nbuf_set_chfrag_start() - set msdu start bit
560  * @buf: Network buffer
561  * @val: 0/1
562  *
563  * Return: void
564  */
565 static inline void
566 qdf_nbuf_set_chfrag_start(qdf_nbuf_t buf, uint8_t val)
567 {
568 	__qdf_nbuf_set_chfrag_start(buf, val);
569 }
570 
571 /**
572  * qdf_nbuf_is_chfrag_start() - get msdu start bit
573  * @buf: Network buffer
574  *
575  * Return: integer value - 0/1
576  */
577 static inline int qdf_nbuf_is_chfrag_start(qdf_nbuf_t buf)
578 {
579 	return __qdf_nbuf_is_chfrag_start(buf);
580 }
581 
582 /**
583  * qdf_nbuf_set_chfrag_cont() - set msdu continuation bit
584  * @buf: Network buffer
585  * @val: 0/1
586  *
587  * Return: void
588  */
589 static inline void
590 qdf_nbuf_set_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
591 {
592 	__qdf_nbuf_set_chfrag_cont(buf, val);
593 }
594 
595 /**
596  * qdf_nbuf_is_chfrag_cont() - get msdu continuation bit
597  * @buf: Network buffer
598  *
599  * Return: integer value - 0/1
600  */
601 static inline int qdf_nbuf_is_chfrag_cont(qdf_nbuf_t buf)
602 {
603 	return __qdf_nbuf_is_chfrag_cont(buf);
604 }
605 
606 /**
607  * qdf_nbuf_set_chfrag_end() - set msdu end bit
608  * @buf: Network buffer
609  * @val: 0/1
610  *
611  * Return: void
612  */
613 static inline void qdf_nbuf_set_chfrag_end(qdf_nbuf_t buf, uint8_t val)
614 {
615 	__qdf_nbuf_set_chfrag_end(buf, val);
616 }
617 
618 /**
619  * qdf_nbuf_is_chfrag_end() - set msdu end bit
620  * @buf: Network buffer
621  *
622  * Return: integer value - 0/1
623  */
624 static inline int qdf_nbuf_is_chfrag_end(qdf_nbuf_t buf)
625 {
626 	return __qdf_nbuf_is_chfrag_end(buf);
627 }
628 
629 static inline void
630 qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
631 {
632 	__qdf_nbuf_dma_map_info(bmap, sg);
633 }
634 
635 #ifdef MEMORY_DEBUG
636 void qdf_net_buf_debug_init(void);
637 void qdf_net_buf_debug_exit(void);
638 void qdf_net_buf_debug_clean(void);
639 void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
640 			uint8_t *file_name, uint32_t line_num);
641 void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
642 void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
643 
644 /* nbuf allocation rouines */
645 
646 #define qdf_nbuf_alloc(d, s, r, a, p)			\
647 	qdf_nbuf_alloc_debug(d, s, r, a, p, __FILE__, __LINE__)
648 static inline qdf_nbuf_t
649 qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size, int reserve,
650 		int align, int prio, uint8_t *file_name,
651 		uint32_t line_num)
652 {
653 	qdf_nbuf_t net_buf;
654 	net_buf = __qdf_nbuf_alloc(osdev, size, reserve, align, prio);
655 
656 	/* Store SKB in internal QDF tracking table */
657 	if (qdf_likely(net_buf))
658 		qdf_net_buf_debug_add_node(net_buf, size, file_name, line_num);
659 
660 	return net_buf;
661 }
662 
663 static inline void qdf_nbuf_free(qdf_nbuf_t net_buf)
664 {
665 	/* Remove SKB from internal QDF tracking table */
666 	if (qdf_likely(net_buf))
667 		qdf_net_buf_debug_delete_node(net_buf);
668 
669 	__qdf_nbuf_free(net_buf);
670 }
671 
672 #define qdf_nbuf_clone(buf)     \
673 	qdf_nbuf_clone_debug(buf, __FILE__, __LINE__)
674 
675 /**
676  * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly)
677  * @buf: nbuf to clone from
678  * @file_name: pointer to file name
679  * @line_num: line number
680  *
681  * This function clones the nbuf and creates a memory tracking
682  * node corresponding to that cloned skbuff structure.
683  *
684  * Return: cloned buffer
685  */
686 static inline qdf_nbuf_t
687 qdf_nbuf_clone_debug(qdf_nbuf_t buf, uint8_t *file_name,
688 			uint32_t line_num)
689 {
690 	qdf_nbuf_t cloned_buf;
691 
692 	cloned_buf = __qdf_nbuf_clone(buf);
693 
694 	/* Store SKB in internal QDF tracking table */
695 	if (qdf_likely(cloned_buf))
696 		qdf_net_buf_debug_add_node(cloned_buf, 0, file_name, line_num);
697 
698 	return cloned_buf;
699 }
700 
701 #define qdf_nbuf_copy(buf)     \
702 	qdf_nbuf_copy_debug(buf, __FILE__, __LINE__)
703 
704 /**
705  * qdf_nbuf_copy_debug() - returns a private copy of the buf
706  * @buf: nbuf to copy from
707  * @file_name: pointer to file name
708  * @line_num: line number
709  *
710  * This API returns a private copy of the buf, the buf returned is completely
711  * modifiable by callers. It also creates a memory tracking node corresponding
712  * to that new skbuff structure.
713  *
714  * Return: copied buffer
715  */
716 static inline qdf_nbuf_t
717 qdf_nbuf_copy_debug(qdf_nbuf_t buf, uint8_t *file_name,
718 			uint32_t line_num)
719 {
720 	qdf_nbuf_t copied_buf;
721 
722 	copied_buf = __qdf_nbuf_copy(buf);
723 
724 	/* Store SKB in internal QDF tracking table */
725 	if (qdf_likely(copied_buf))
726 		qdf_net_buf_debug_add_node(copied_buf, 0, file_name, line_num);
727 
728 	return copied_buf;
729 }
730 
731 #else
732 
733 static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
734 {
735 	return;
736 }
737 
738 /* Nbuf allocation rouines */
739 
740 static inline qdf_nbuf_t
741 qdf_nbuf_alloc(qdf_device_t osdev,
742 		qdf_size_t size, int reserve, int align, int prio)
743 {
744 	return __qdf_nbuf_alloc(osdev, size, reserve, align, prio);
745 }
746 
747 static inline void qdf_nbuf_free(qdf_nbuf_t buf)
748 {
749 	__qdf_nbuf_free(buf);
750 }
751 
752 /**
753  * qdf_nbuf_clone() - clone the nbuf (copy is readonly)
754  * @buf: Pointer to network buffer
755  *
756  * This function clones the nbuf and returns new sk_buff
757  * structure.
758  *
759  * Return: cloned skb
760  */
761 static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf)
762 {
763 	return __qdf_nbuf_clone(buf);
764 }
765 
766 /**
767  * qdf_nbuf_copy() - returns a private copy of the buf
768  * @buf: Pointer to network buffer
769  *
770  * This API returns a private copy of the buf, the buf returned is completely
771  *  modifiable by callers
772  *
773  * Return: skb or NULL
774  */
775 static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
776 {
777 	return __qdf_nbuf_copy(buf);
778 }
779 
780 #endif
781 
782 #ifdef WLAN_FEATURE_FASTPATH
783 /**
784  * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state
785  *
786  * @buf: buf instance
787  * Return: data pointer of this buf where new data has to be
788  *         put, or NULL if there is not enough room in this buf.
789  */
790 
791 static inline void qdf_nbuf_init_fast(qdf_nbuf_t nbuf)
792 {
793 	atomic_set(&nbuf->users, 1);
794 	nbuf->data = nbuf->head + NET_SKB_PAD;
795 	skb_reset_tail_pointer(nbuf);
796 }
797 #endif /* WLAN_FEATURE_FASTPATH */
798 
799 static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
800 {
801 	__qdf_nbuf_tx_free(buf_list, tx_err);
802 }
803 
804 static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
805 {
806 	__qdf_nbuf_ref(buf);
807 }
808 
809 static inline int qdf_nbuf_shared(qdf_nbuf_t buf)
810 {
811 	return __qdf_nbuf_shared(buf);
812 }
813 
814 static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src)
815 {
816 	return __qdf_nbuf_cat(dst, src);
817 }
818 
819 /**
820  * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb
821  * @skb: SKB pointer
822  * @offset: offset
823  * @len: Length
824  * @to: To
825  *
826  * Return: int32_t
827  */
828 static inline int32_t
829 qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to)
830 {
831 	return __qdf_nbuf_copy_bits(nbuf, offset, len, to);
832 }
833 
834 
835 /* nbuf manipulation routines */
836 
837 /**
838  * @qdf_nbuf_head() - return the address of an nbuf's buffer
839  * @buf: netbuf
840  *
841  * Return: head address
842  */
843 static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf)
844 {
845 	return __qdf_nbuf_head(buf);
846 }
847 
848 /**
849  * qdf_nbuf_data() - Return the address of the start of data within an nbuf
850  * @buf: Network buffer
851  *
852  * Return: Data address
853  */
854 static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf)
855 {
856 	return __qdf_nbuf_data(buf);
857 }
858 
859 /**
860  * qdf_nbuf_data_addr() - Return the address of skb->data
861  * @buf: Network buffer
862  *
863  * Return: Data address
864  */
865 static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf)
866 {
867 	return __qdf_nbuf_data_addr(buf);
868 }
869 
870 /**
871  * qdf_nbuf_headroom() - amount of headroom int the current nbuf
872  * @buf: Network buffer
873  *
874  * Return: Amount of head room
875  */
876 static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf)
877 {
878 	return __qdf_nbuf_headroom(buf);
879 }
880 
881 /**
882  * qdf_nbuf_tailroom() - amount of tail space available
883  * @buf: Network buffer
884  *
885  * Return: amount of tail room
886  */
887 static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf)
888 {
889 	return __qdf_nbuf_tailroom(buf);
890 }
891 
892 /**
893  * qdf_nbuf_push_head() - push data in the front
894  * @buf: Network buf instance
895  * @size: Size to be pushed
896  *
897  * Return: New data pointer of this buf after data has been pushed,
898  *	or NULL if there is not enough room in this buf.
899  */
900 static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size)
901 {
902 	return __qdf_nbuf_push_head(buf, size);
903 }
904 
905 /**
906  * qdf_nbuf_put_tail() - puts data in the end
907  * @buf: Network buf instance
908  * @size: Size to be pushed
909  *
910  * Return: Data pointer of this buf where new data has to be
911  *	put, or NULL if there is not enough room in this buf.
912  */
913 static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size)
914 {
915 	return __qdf_nbuf_put_tail(buf, size);
916 }
917 
918 /**
919  * qdf_nbuf_pull_head() - pull data out from the front
920  * @buf: Network buf instance
921  * @size: Size to be popped
922  *
923  * Return: New data pointer of this buf after data has been popped,
924  *	or NULL if there is not sufficient data to pull.
925  */
926 static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size)
927 {
928 	return __qdf_nbuf_pull_head(buf, size);
929 }
930 
931 /**
932  * qdf_nbuf_trim_tail() - trim data out from the end
933  * @buf: Network buf instance
934  * @size: Size to be popped
935  *
936  * Return: none
937  */
938 static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size)
939 {
940 	__qdf_nbuf_trim_tail(buf, size);
941 }
942 
943 /**
944  * qdf_nbuf_len() - get the length of the buf
945  * @buf: Network buf instance
946  *
947  * Return: total length of this buf.
948  */
949 static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf)
950 {
951 	return __qdf_nbuf_len(buf);
952 }
953 
954 /**
955  * qdf_nbuf_set_pktlen() - set the length of the buf
956  * @buf: Network buf instance
957  * @size: Size to be set
958  *
959  * Return: none
960  */
961 static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len)
962 {
963 	__qdf_nbuf_set_pktlen(buf, len);
964 }
965 
966 /**
967  * qdf_nbuf_reserve() - trim data out from the end
968  * @buf: Network buf instance
969  * @size: Size to be popped
970  *
971  * Return: none
972  */
973 static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size)
974 {
975 	__qdf_nbuf_reserve(buf, size);
976 }
977 
978 /**
979  * qdf_nbuf_peek_header() - return the data pointer & length of the header
980  * @buf: Network nbuf
981  * @addr: Data pointer
982  * @len: Length of the data
983  *
984  * Return: none
985  */
986 static inline void
987 qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len)
988 {
989 	__qdf_nbuf_peek_header(buf, addr, len);
990 }
991 
992 /* nbuf queue routines */
993 
994 /**
995  * qdf_nbuf_queue_init() - initialize buf queue
996  * @head: Network buf queue head
997  *
998  * Return: none
999  */
1000 static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head)
1001 {
1002 	__qdf_nbuf_queue_init(head);
1003 }
1004 
1005 /**
1006  * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue
1007  * @head: Network buf queue head
1008  * @buf: Network buf
1009  *
1010  * Return: none
1011  */
1012 static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
1013 {
1014 	__qdf_nbuf_queue_add(head, buf);
1015 }
1016 
1017 /**
1018  * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue
1019  * @head: Network buf queue head
1020  * @buf: Network buf
1021  *
1022  * Return: none
1023  */
1024 static inline void
1025 qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
1026 {
1027 	__qdf_nbuf_queue_insert_head(head, buf);
1028 }
1029 
1030 /**
1031  * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue
1032  * @head: Network buf queue head
1033  *
1034  * Return: The head buf in the buf queue.
1035  */
1036 static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head)
1037 {
1038 	return __qdf_nbuf_queue_remove(head);
1039 }
1040 
1041 /**
1042  * qdf_nbuf_queue_len() - get the length of the queue
1043  * @head: Network buf queue head
1044  *
1045  * Return: length of the queue
1046  */
1047 static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head)
1048 {
1049 	return __qdf_nbuf_queue_len(head);
1050 }
1051 
1052 /**
1053  * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer
1054  * @buf: Network buffer
1055  *
1056  * Return: next buffer/packet
1057  */
1058 static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf)
1059 {
1060 	return __qdf_nbuf_queue_next(buf);
1061 }
1062 
1063 /**
1064  * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty
1065  * @nbq: Network buf queue handle
1066  *
1067  * Return: true  if queue is empty
1068  *	   false if queue is not emty
1069  */
1070 static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq)
1071 {
1072 	return __qdf_nbuf_is_queue_empty(nbq);
1073 }
1074 
1075 static inline qdf_nbuf_queue_t *
1076 qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src)
1077 {
1078 	return __qdf_nbuf_queue_append(dest, src);
1079 }
1080 
1081 static inline void
1082 qdf_nbuf_queue_free(qdf_nbuf_queue_t *head)
1083 {
1084 	__qdf_nbuf_queue_free(head);
1085 }
1086 
1087 static inline qdf_nbuf_t
1088 qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
1089 {
1090 	return __qdf_nbuf_queue_first(head);
1091 }
1092 
1093 /**
1094  * qdf_nbuf_next() - get the next packet in the linked list
1095  * @buf: Network buffer
1096  *
1097  * This function can be used when nbufs are directly linked into a list,
1098  * rather than using a separate network buffer queue object.
1099  *
1100  * Return: next network buffer in the linked list
1101  */
1102 static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
1103 {
1104 	return __qdf_nbuf_next(buf);
1105 }
1106 
1107 /**
1108  * qdf_nbuf_get_protocol() - return the protocol value of the skb
1109  * @skb: Pointer to network buffer
1110  *
1111  * Return: skb protocol
1112  */
1113 static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb)
1114 {
1115 	return __qdf_nbuf_get_protocol(skb);
1116 }
1117 
1118 /**
1119  * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb
1120  * @skb: Pointer to network buffer
1121  *
1122  * Return: skb ip_summed
1123  */
1124 static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb)
1125 {
1126 	return __qdf_nbuf_get_ip_summed(skb);
1127 }
1128 
1129 /**
1130  * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb
1131  * @skb: Pointer to network buffer
1132  * @ip_summed: ip checksum
1133  *
1134  * Return: none
1135  */
1136 static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb,
1137 	uint8_t ip_summed)
1138 {
1139 	__qdf_nbuf_set_ip_summed(skb, ip_summed);
1140 }
1141 
1142 /**
1143  * qdf_nbuf_set_next() - add a packet to a linked list
1144  * @this_buf: Predecessor buffer
1145  * @next_buf: Successor buffer
1146  *
1147  * This function can be used to directly link nbufs, rather than using
1148  * a separate network buffer queue object.
1149  *
1150  * Return: none
1151  */
1152 static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
1153 {
1154 	__qdf_nbuf_set_next(this_buf, next_buf);
1155 }
1156 
1157 /* nbuf extension routines */
1158 
1159 /**
1160  * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new
1161  *			nbuf
1162  * @this_buf: predecessor buffer
1163  * @next_buf: successor buffer
1164  *
1165  * This function is used to link up many nbufs containing a single logical
1166  * packet - not a collection of packets. Do not use for linking the first
1167  * extension to the head
1168  *
1169  * Return: none
1170  */
1171 static inline void
1172 qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
1173 {
1174 	__qdf_nbuf_set_next_ext(this_buf, next_buf);
1175 }
1176 
1177 /**
1178  * qdf_nbuf_next_ext() - get the next packet extension in the linked list
1179  * @buf: Network buffer
1180  *
1181  * Return: Next network buffer in the linked list
1182  */
1183 static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf)
1184 {
1185 	return __qdf_nbuf_next_ext(buf);
1186 }
1187 
1188 /**
1189  * qdf_nbuf_append_ext_list() - link list of packet extensions to the head
1190  *				segment
1191  * @head_buf: Network buf holding head segment (single)
1192  * @ext_list: Network buf list holding linked extensions to the head
1193  * @ext_len: Total length of all buffers in the extension list
1194  *
1195  * This function is used to link up a list of packet extensions (seg1, 2,
1196  * ...) to the nbuf holding the head segment (seg0)
1197  *
1198  * Return: none
1199  */
1200 static inline void
1201 qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
1202 			qdf_size_t ext_len)
1203 {
1204 	__qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
1205 }
1206 
1207 /**
1208  * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
1209  * @head_buf: Network buf holding head segment (single)
1210  *
1211  * This ext_list is populated when we have Jumbo packet, for example in case of
1212  * monitor mode amsdu packet reception, and are stiched using frags_list.
1213  *
1214  * Return: Network buf list holding linked extensions from head buf.
1215  */
1216 static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
1217 {
1218 	return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
1219 }
1220 
1221 /**
1222  * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
1223  * @buf: Network buffer
1224  *
1225  * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame
1226  */
1227 static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf)
1228 {
1229 	return __qdf_nbuf_get_tx_cksum(buf);
1230 }
1231 
1232 /**
1233  * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to
1234  *			indicate checksum info to the stack.
1235  * @buf: Network buffer
1236  * @cksum: Checksum
1237  *
1238  * Return: none
1239  */
1240 static inline void
1241 qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum)
1242 {
1243 	__qdf_nbuf_set_rx_cksum(buf, cksum);
1244 }
1245 
1246 /**
1247  * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf
1248  * @buf: Network buffer
1249  *
1250  * Return: TID value
1251  */
1252 static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf)
1253 {
1254 	return __qdf_nbuf_get_tid(buf);
1255 }
1256 
1257 /**
1258  * qdf_nbuf_set_tid() - this function sets the TID value in nbuf
1259  * @buf: Network buffer
1260  * @tid: TID value
1261  *
1262  * Return: none
1263  */
1264 static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid)
1265 {
1266 	__qdf_nbuf_set_tid(buf, tid);
1267 }
1268 
1269 /**
1270  * qdf_nbuf_get_exemption_type() - this function extracts the exemption type
1271  *				from nbuf
1272  * @buf: Network buffer
1273  *
1274  * Return: Exemption type
1275  */
1276 static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf)
1277 {
1278 	return __qdf_nbuf_get_exemption_type(buf);
1279 }
1280 
1281 /**
1282  * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given
1283  *			offset
1284  * @buf: Network buffer
1285  * @proto: Protocol
1286  *
1287  * Return: none
1288  */
1289 static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto)
1290 {
1291 	__qdf_nbuf_set_protocol(buf, proto);
1292 }
1293 
1294 /**
1295  * qdf_nbuf_trace_get_proto_type() - this function return packet proto type
1296  * @buf: Network buffer
1297  *
1298  * Return: Packet protocol type
1299  */
1300 static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
1301 {
1302 	return __qdf_nbuf_trace_get_proto_type(buf);
1303 }
1304 
1305 /**
1306  * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
1307  * @cb_func_ptr: Callback pointer
1308  *
1309  * Return: none
1310  */
1311 static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
1312 {
1313 	__qdf_nbuf_reg_trace_cb(cb_func_ptr);
1314 }
1315 
1316 
1317 /**
1318  * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download
1319  * @buf: Network buffer
1320  * @candi: Candidate of parallel download frame
1321  *
1322  * This function stores a flag specifying this TX frame is suitable for
1323  * downloading though a 2nd TX data pipe that is used for short frames for
1324  * protocols that can accept out-of-order delivery.
1325  *
1326  * Return: none
1327  */
1328 static inline void
1329 qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi)
1330 {
1331 	__qdf_nbuf_set_tx_htt2_frm(buf, candi);
1332 }
1333 
1334 /**
1335  * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download
1336  * @buf: Network buffer
1337  *
1338  * This function return whether this TX frame is allow to download though a 2nd
1339  * TX data pipe or not.
1340  *
1341  * Return: none
1342  */
1343 static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf)
1344 {
1345 	return __qdf_nbuf_get_tx_htt2_frm(buf);
1346 }
1347 
1348 /**
1349  * qdf_nbuf_get_dhcp_subtype() - get the subtype
1350  *              of DHCP packet.
1351  * @buf: Pointer to DHCP packet buffer
1352  *
1353  * This func. returns the subtype of DHCP packet.
1354  *
1355  * Return: subtype of the DHCP packet.
1356  */
1357 static inline enum qdf_proto_subtype
1358 qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf)
1359 {
1360 	return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf));
1361 }
1362 
1363 /**
1364  * qdf_nbuf_data_get_dhcp_subtype() - get the subtype
1365  *              of DHCP packet.
1366  * @buf: Pointer to DHCP packet data buffer
1367  *
1368  * This func. returns the subtype of DHCP packet.
1369  *
1370  * Return: subtype of the DHCP packet.
1371  */
1372 static inline enum qdf_proto_subtype
1373 qdf_nbuf_data_get_dhcp_subtype(uint8_t *data)
1374 {
1375 	return __qdf_nbuf_data_get_dhcp_subtype(data);
1376 }
1377 
1378 /**
1379  * qdf_nbuf_get_eapol_subtype() - get the subtype
1380  *            of EAPOL packet.
1381  * @buf: Pointer to EAPOL packet buffer
1382  *
1383  * This func. returns the subtype of EAPOL packet.
1384  *
1385  * Return: subtype of the EAPOL packet.
1386  */
1387 static inline enum qdf_proto_subtype
1388 qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf)
1389 {
1390 	return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf));
1391 }
1392 
1393 /**
1394  * qdf_nbuf_data_get_eapol_subtype() - get the subtype
1395  *            of EAPOL packet.
1396  * @data: Pointer to EAPOL packet data buffer
1397  *
1398  * This func. returns the subtype of EAPOL packet.
1399  *
1400  * Return: subtype of the EAPOL packet.
1401  */
1402 static inline enum qdf_proto_subtype
1403 qdf_nbuf_data_get_eapol_subtype(uint8_t *data)
1404 {
1405 	return __qdf_nbuf_data_get_eapol_subtype(data);
1406 }
1407 
1408 /**
1409  * qdf_nbuf_get_arp_subtype() - get the subtype
1410  *            of ARP packet.
1411  * @buf: Pointer to ARP packet buffer
1412  *
1413  * This func. returns the subtype of ARP packet.
1414  *
1415  * Return: subtype of the ARP packet.
1416  */
1417 static inline enum qdf_proto_subtype
1418 qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf)
1419 {
1420 	return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf));
1421 }
1422 
1423 /**
1424  * qdf_nbuf_data_get_arp_subtype() - get the subtype
1425  *            of ARP packet.
1426  * @data: Pointer to ARP packet data buffer
1427  *
1428  * This func. returns the subtype of ARP packet.
1429  *
1430  * Return: subtype of the ARP packet.
1431  */
1432 static inline enum qdf_proto_subtype
1433 qdf_nbuf_data_get_arp_subtype(uint8_t *data)
1434 {
1435 	return __qdf_nbuf_data_get_arp_subtype(data);
1436 }
1437 
1438 /**
1439  * qdf_nbuf_get_icmp_subtype() - get the subtype
1440  *            of IPV4 ICMP packet.
1441  * @buf: Pointer to IPV4 ICMP packet buffer
1442  *
1443  * This func. returns the subtype of ICMP packet.
1444  *
1445  * Return: subtype of the ICMP packet.
1446  */
1447 static inline enum qdf_proto_subtype
1448 qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf)
1449 {
1450 	return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf));
1451 }
1452 
1453 /**
1454  * qdf_nbuf_data_get_icmp_subtype() - get the subtype
1455  *            of IPV4 ICMP packet.
1456  * @data: Pointer to IPV4 ICMP packet data buffer
1457  *
1458  * This func. returns the subtype of ICMP packet.
1459  *
1460  * Return: subtype of the ICMP packet.
1461  */
1462 static inline enum qdf_proto_subtype
1463 qdf_nbuf_data_get_icmp_subtype(uint8_t *data)
1464 {
1465 	return __qdf_nbuf_data_get_icmp_subtype(data);
1466 }
1467 
1468 /**
1469  * qdf_nbuf_get_icmpv6_subtype() - get the subtype
1470  *            of IPV6 ICMPV6 packet.
1471  * @buf: Pointer to IPV6 ICMPV6 packet buffer
1472  *
1473  * This func. returns the subtype of ICMPV6 packet.
1474  *
1475  * Return: subtype of the ICMPV6 packet.
1476  */
1477 static inline enum qdf_proto_subtype
1478 qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf)
1479 {
1480 	return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf));
1481 }
1482 
1483 /**
1484  * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype
1485  *            of IPV6 ICMPV6 packet.
1486  * @data: Pointer to IPV6 ICMPV6 packet data buffer
1487  *
1488  * This func. returns the subtype of ICMPV6 packet.
1489  *
1490  * Return: subtype of the ICMPV6 packet.
1491  */
1492 static inline enum qdf_proto_subtype
1493 qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data)
1494 {
1495 	return __qdf_nbuf_data_get_icmpv6_subtype(data);
1496 }
1497 
1498 /**
1499  * qdf_nbuf_data_get_ipv4_proto() - get the proto type
1500  *            of IPV4 packet.
1501  * @data: Pointer to IPV4 packet data buffer
1502  *
1503  * This func. returns the proto type of IPV4 packet.
1504  *
1505  * Return: proto type of IPV4 packet.
1506  */
1507 static inline uint8_t
1508 qdf_nbuf_data_get_ipv4_proto(uint8_t *data)
1509 {
1510 	return __qdf_nbuf_data_get_ipv4_proto(data);
1511 }
1512 
1513 /**
1514  * qdf_nbuf_data_get_ipv6_proto() - get the proto type
1515  *            of IPV6 packet.
1516  * @data: Pointer to IPV6 packet data buffer
1517  *
1518  * This func. returns the proto type of IPV6 packet.
1519  *
1520  * Return: proto type of IPV6 packet.
1521  */
1522 static inline uint8_t
1523 qdf_nbuf_data_get_ipv6_proto(uint8_t *data)
1524 {
1525 	return __qdf_nbuf_data_get_ipv6_proto(data);
1526 }
1527 
1528 /**
1529  * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not
1530  * @buf:  buffer
1531  *
1532  * This api is for Tx packets.
1533  *
1534  * Return: true if packet is ipv4 packet
1535  */
1536 static inline
1537 bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf)
1538 {
1539 	return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf));
1540 }
1541 
1542 /**
1543  * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not
1544  * @data:  data
1545  *
1546  * This api is for Tx packets.
1547  *
1548  * Return: true if packet is ipv4 packet
1549  */
1550 static inline
1551 bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data)
1552 {
1553 	return __qdf_nbuf_data_is_ipv4_pkt(data);
1554 }
1555 
1556 /**
1557  * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not
1558  * @buf:  buffer
1559  *
1560  * This api is for ipv4 packet.
1561  *
1562  * Return: true if packet is DHCP packet
1563  */
1564 static inline
1565 bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf)
1566 {
1567 	return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf));
1568 }
1569 
1570 /**
1571  * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet.
1572  * @data: Pointer to DHCP packet data buffer
1573  *
1574  * This func. checks whether it is a DHCP packet or not.
1575  *
1576  * Return: true if it is a DHCP packet
1577  *         false if not
1578  */
1579 static inline
1580 bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data)
1581 {
1582 	return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data);
1583 }
1584 
1585 /**
1586  * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not
1587  * @buf:  buffer
1588  *
1589  * This api is for ipv4 packet.
1590  *
1591  * Return: true if packet is EAPOL packet
1592  */
1593 static inline
1594 bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf)
1595 {
1596 	return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf));
1597 }
1598 
1599 /**
1600  * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet.
1601  * @data: Pointer to EAPOL packet data buffer
1602  *
1603  * This func. checks whether it is a EAPOL packet or not.
1604  *
1605  * Return: true if it is a EAPOL packet
1606  *         false if not
1607  */
1608 static inline
1609 bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data)
1610 {
1611 	return __qdf_nbuf_data_is_ipv4_eapol_pkt(data);
1612 }
1613 
1614 /**
1615  * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not
1616  * @buf:  buffer
1617  *
1618  * This api is for ipv4 packet.
1619  *
1620  * Return: true if packet is WAPI packet
1621  */
1622 static inline
1623 bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf)
1624 {
1625 	return __qdf_nbuf_is_ipv4_wapi_pkt(buf);
1626 }
1627 
1628 /**
1629  * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not
1630  * @buf:  buffer
1631  *
1632  * This api is for ipv4 packet.
1633  *
1634  * Return: true if packet is ARP packet
1635  */
1636 static inline
1637 bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf)
1638 {
1639 	return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf));
1640 }
1641 
1642 /**
1643  * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet.
1644  * @data: Pointer to ARP packet data buffer
1645  *
1646  * This func. checks whether it is a ARP packet or not.
1647  *
1648  * Return: TRUE if it is a ARP packet
1649  *         FALSE if not
1650  */
1651 static inline
1652 bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data)
1653 {
1654 	return __qdf_nbuf_data_is_ipv4_arp_pkt(data);
1655 }
1656 
1657 /**
1658  * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet.
1659  * @buf: Pointer to IPV6 packet buffer
1660  *
1661  * This func. checks whether it is a IPV6 packet or not.
1662  *
1663  * Return: TRUE if it is a IPV6 packet
1664  *         FALSE if not
1665  */
1666 static inline
1667 bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf)
1668 {
1669 	return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf));
1670 }
1671 
1672 /**
1673  * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet.
1674  * @data: Pointer to IPV6 packet data buffer
1675  *
1676  * This func. checks whether it is a IPV6 packet or not.
1677  *
1678  * Return: TRUE if it is a IPV6 packet
1679  *         FALSE if not
1680  */
1681 static inline
1682 bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data)
1683 {
1684 	return __qdf_nbuf_data_is_ipv6_pkt(data);
1685 }
1686 
1687 /**
1688  * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet.
1689  * @data: Pointer to IPV4 packet data buffer
1690  *
1691  * This func. checks whether it is a IPV4 multicast packet or not.
1692  *
1693  * Return: TRUE if it is a IPV4 multicast packet
1694  *         FALSE if not
1695  */
1696 static inline
1697 bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data)
1698 {
1699 	return __qdf_nbuf_data_is_ipv4_mcast_pkt(data);
1700 }
1701 
1702 /**
1703  * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet.
1704  * @data: Pointer to IPV6 packet data buffer
1705  *
1706  * This func. checks whether it is a IPV6 multicast packet or not.
1707  *
1708  * Return: TRUE if it is a IPV6 multicast packet
1709  *         FALSE if not
1710  */
1711 static inline
1712 bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data)
1713 {
1714 	return __qdf_nbuf_data_is_ipv6_mcast_pkt(data);
1715 }
1716 
1717 /**
1718  * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet.
1719  * @buf: Pointer to IPV4 ICMP packet buffer
1720  *
1721  * This func. checks whether it is a ICMP packet or not.
1722  *
1723  * Return: TRUE if it is a ICMP packet
1724  *         FALSE if not
1725  */
1726 static inline
1727 bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf)
1728 {
1729 	return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf));
1730 }
1731 
1732 /**
1733  * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet.
1734  * @data: Pointer to IPV4 ICMP packet data buffer
1735  *
1736  * This func. checks whether it is a ICMP packet or not.
1737  *
1738  * Return: TRUE if it is a ICMP packet
1739  *         FALSE if not
1740  */
1741 static inline
1742 bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data)
1743 {
1744 	return __qdf_nbuf_data_is_icmp_pkt(data);
1745 }
1746 
1747 /**
1748  * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
1749  * @buf: Pointer to IPV6 ICMPV6 packet buffer
1750  *
1751  * This func. checks whether it is a ICMPV6 packet or not.
1752  *
1753  * Return: TRUE if it is a ICMPV6 packet
1754  *         FALSE if not
1755  */
1756 static inline
1757 bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf)
1758 {
1759 	return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf));
1760 }
1761 
1762 /**
1763  * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
1764  * @data: Pointer to IPV6 ICMPV6 packet data buffer
1765  *
1766  * This func. checks whether it is a ICMPV6 packet or not.
1767  *
1768  * Return: TRUE if it is a ICMPV6 packet
1769  *         FALSE if not
1770  */
1771 static inline
1772 bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data)
1773 {
1774 	return __qdf_nbuf_data_is_icmpv6_pkt(data);
1775 }
1776 
1777 /**
1778  * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
1779  * @buf: Pointer to IPV4 UDP packet buffer
1780  *
1781  * This func. checks whether it is a IPV4 UDP packet or not.
1782  *
1783  * Return: TRUE if it is a IPV4 UDP packet
1784  *         FALSE if not
1785  */
1786 static inline
1787 bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf)
1788 {
1789 	return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf));
1790 }
1791 
1792 /**
1793  * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
1794  * @data: Pointer to IPV4 UDP packet data buffer
1795  *
1796  * This func. checks whether it is a IPV4 UDP packet or not.
1797  *
1798  * Return: TRUE if it is a IPV4 UDP packet
1799  *         FALSE if not
1800  */
1801 static inline
1802 bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data)
1803 {
1804 	return __qdf_nbuf_data_is_ipv4_udp_pkt(data);
1805 }
1806 
1807 /**
1808  * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
1809  * @buf: Pointer to IPV4 TCP packet buffer
1810  *
1811  * This func. checks whether it is a IPV4 TCP packet or not.
1812  *
1813  * Return: TRUE if it is a IPV4 TCP packet
1814  *         FALSE if not
1815  */
1816 static inline
1817 bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf)
1818 {
1819 	return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf));
1820 }
1821 
1822 /**
1823  * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
1824  * @data: Pointer to IPV4 TCP packet data buffer
1825  *
1826  * This func. checks whether it is a IPV4 TCP packet or not.
1827  *
1828  * Return: TRUE if it is a IPV4 TCP packet
1829  *         FALSE if not
1830  */
1831 static inline
1832 bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data)
1833 {
1834 	return __qdf_nbuf_data_is_ipv4_tcp_pkt(data);
1835 }
1836 
1837 /**
1838  * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
1839  * @buf: Pointer to IPV6 UDP packet buffer
1840  *
1841  * This func. checks whether it is a IPV6 UDP packet or not.
1842  *
1843  * Return: TRUE if it is a IPV6 UDP packet
1844  *         FALSE if not
1845  */
1846 static inline
1847 bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf)
1848 {
1849 	return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf));
1850 }
1851 
1852 /**
1853  * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
1854  * @data: Pointer to IPV6 UDP packet data buffer
1855  *
1856  * This func. checks whether it is a IPV6 UDP packet or not.
1857  *
1858  * Return: TRUE if it is a IPV6 UDP packet
1859  *         FALSE if not
1860  */
1861 static inline
1862 bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data)
1863 {
1864 	return __qdf_nbuf_data_is_ipv6_udp_pkt(data);
1865 }
1866 
1867 /**
1868  * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
1869  * @buf: Pointer to IPV6 TCP packet buffer
1870  *
1871  * This func. checks whether it is a IPV6 TCP packet or not.
1872  *
1873  * Return: TRUE if it is a IPV6 TCP packet
1874  *         FALSE if not
1875  */
1876 static inline
1877 bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf)
1878 {
1879 	return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf));
1880 }
1881 
1882 /**
1883  * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
1884  * @data: Pointer to IPV6 TCP packet data buffer
1885  *
1886  * This func. checks whether it is a IPV6 TCP packet or not.
1887  *
1888  * Return: TRUE if it is a IPV6 TCP packet
1889  *         FALSE if not
1890  */
1891 static inline
1892 bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data)
1893 {
1894 	return __qdf_nbuf_data_is_ipv6_tcp_pkt(data);
1895 }
1896 
1897 /**
1898  * qdf_invalidate_range() - invalidate virtual address range
1899  * @start: start address of the address range
1900  * @end: end address of the address range
1901  *
1902  * Note that this function does not write back the cache entries.
1903  *
1904  * Return: none
1905  */
1906 static inline void qdf_invalidate_range(void *start, void *end)
1907 {
1908 	__qdf_invalidate_range(start, end);
1909 }
1910 
1911 /**
1912  * qdf_nbuf_reset_num_frags() - decrement the number of fragments
1913  * @buf: Network buffer
1914  *
1915  * Return: Number of fragments
1916  */
1917 static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
1918 {
1919 	__qdf_nbuf_reset_num_frags(buf);
1920 }
1921 
1922 /**
1923  * qdf_dmaaddr_to_32s - return high and low parts of dma_addr
1924  *
1925  * Returns the high and low 32-bits of the DMA addr in the provided ptrs
1926  *
1927  * Return: N/A
1928  */
1929 static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
1930 				      uint32_t *lo, uint32_t *hi)
1931 {
1932 	return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi);
1933 }
1934 
1935 /**
1936  * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
1937  * @buf: Network buffer
1938  *
1939  * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
1940  */
1941 static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
1942 {
1943 	return __qdf_nbuf_is_tso(nbuf);
1944 }
1945 
1946 /**
1947  * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
1948  * network buffer into segments
1949  * @nbuf:   network buffer to be segmented
1950  * @tso_info:  This is the output. The information about the
1951  *      TSO segments will be populated within this.
1952  *
1953  * This function fragments a TCP jumbo packet into smaller
1954  * segments to be transmitted by the driver. It chains the TSO
1955  * segments created into a list.
1956  *
1957  * Return: number of TSO segments
1958  */
1959 static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev,
1960 		 qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info)
1961 {
1962 	return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info);
1963 }
1964 
1965 /**
1966  * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element
1967  *
1968  * @osdev: qdf device handle
1969  * @tso_seg: TSO segment element to be unmapped
1970  * @is_last_seg: whether this is last tso seg or not
1971  *
1972  * Return: none
1973  */
1974 static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev,
1975 			  struct qdf_tso_seg_elem_t *tso_seg,
1976 			  bool is_last_seg)
1977 {
1978 	return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg);
1979 }
1980 
1981 /**
1982  * qdf_nbuf_get_tso_num_seg() - function to calculate the number
1983  * of TCP segments within the TSO jumbo packet
1984  * @nbuf:   TSO jumbo network buffer to be segmented
1985  *
1986  * This function calculates the number of TCP segments that the
1987    network buffer can be divided into.
1988  *
1989  * Return: number of TCP segments
1990  */
1991 static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf)
1992 {
1993 	return __qdf_nbuf_get_tso_num_seg(nbuf);
1994 }
1995 
1996 /**
1997  * qdf_nbuf_inc_users() - function to increment the number of
1998  * users referencing this network buffer
1999  *
2000  * @nbuf:   network buffer
2001  *
2002  * This function increments the number of users referencing this
2003  * network buffer
2004  *
2005  * Return: the network buffer
2006  */
2007 static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
2008 {
2009 	return __qdf_nbuf_inc_users(nbuf);
2010 }
2011 
2012 /**
2013  * qdf_nbuf_get_users() - function to get the number of users referencing this
2014  * network buffer
2015  *
2016  * @nbuf:   network buffer
2017  *
2018  * Return: number of user references to nbuf.
2019  */
2020 static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
2021 {
2022 	return __qdf_nbuf_get_users(nbuf);
2023 }
2024 
2025 /**
2026  * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
2027  *
2028  * @nbuf: Network buffer (skb on linux)
2029  *
2030  * This function returns the values of data_attr field
2031  * in struct cvg_nbuf_cb{}, to which skb->cb is typecast.
2032  * This value is actually the value programmed in CE descriptor.
2033  *
2034  * Return: Value of data_attr
2035  */
2036 static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf)
2037 {
2038 	return __qdf_nbuf_data_attr_get(buf);
2039 }
2040 
2041 /**
2042  * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb
2043  *
2044  * @nbuf: Network buffer (skb on linux)
2045  * @data_attr: Value to be stored cvg_nbuf_cb->data_attr
2046  *
2047  * This function stores the value to be programmed in CE
2048  * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{}
2049  *
2050  * Return: void
2051  */
2052 static inline
2053 void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr)
2054 {
2055 	__qdf_nbuf_data_attr_set(buf, data_attr);
2056 }
2057 
2058 /**
2059  * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata
2060  *
2061  * @nbuf: Network buffer (skb on linux)
2062  *
2063  * This function parses the payload to figure out relevant
2064  * Tx meta-data e.g. whether to enable tx_classify bit
2065  * in CE.
2066  *
2067  * Return:     void
2068  */
2069 #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get
2070 
2071 void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state);
2072 void qdf_nbuf_tx_desc_count_display(void);
2073 void qdf_nbuf_tx_desc_count_clear(void);
2074 
2075 static inline qdf_nbuf_t
2076 qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom)
2077 {
2078 	return __qdf_nbuf_realloc_headroom(buf, headroom);
2079 }
2080 
2081 static inline qdf_nbuf_t
2082 qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom)
2083 {
2084 	return __qdf_nbuf_realloc_tailroom(buf, tailroom);
2085 }
2086 
2087 static inline qdf_nbuf_t
2088 qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom)
2089 {
2090 	return __qdf_nbuf_expand(buf, headroom, tailroom);
2091 }
2092 
2093 static inline qdf_nbuf_t
2094 qdf_nbuf_unshare(qdf_nbuf_t buf)
2095 {
2096 	return __qdf_nbuf_unshare(buf);
2097 }
2098 
2099 static inline bool
2100 qdf_nbuf_is_cloned(qdf_nbuf_t buf)
2101 {
2102 	return __qdf_nbuf_is_cloned(buf);
2103 }
2104 
2105 static inline void
2106 qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg)
2107 {
2108 	__qdf_nbuf_frag_info(buf, sg);
2109 }
2110 
2111 static inline qdf_nbuf_tx_cksum_t
2112 qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where)
2113 {
2114 	return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where);
2115 }
2116 
2117 static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf)
2118 {
2119 	__qdf_nbuf_reset_ctxt(nbuf);
2120 }
2121 
2122 static inline void
2123 qdf_nbuf_set_rx_info(__qdf_nbuf_t nbuf, void *info, uint32_t len)
2124 {
2125 	__qdf_nbuf_set_rx_info(nbuf, info, len);
2126 }
2127 
2128 static inline void *qdf_nbuf_get_rx_info(__qdf_nbuf_t nbuf)
2129 {
2130 	return __qdf_nbuf_get_rx_info(nbuf);
2131 }
2132 
2133 static inline void qdf_nbuf_init(qdf_nbuf_t buf)
2134 {
2135 	__qdf_nbuf_init(buf);
2136 }
2137 
2138 static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf)
2139 {
2140 	return __qdf_nbuf_network_header(buf);
2141 }
2142 
2143 static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf)
2144 {
2145 	return __qdf_nbuf_transport_header(buf);
2146 }
2147 
2148 static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf)
2149 {
2150 	return __qdf_nbuf_tcp_tso_size(buf);
2151 }
2152 
2153 static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf)
2154 {
2155 	return __qdf_nbuf_get_cb(nbuf);
2156 }
2157 
2158 static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf)
2159 {
2160 	return __qdf_nbuf_get_nr_frags(nbuf);
2161 }
2162 
2163 static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf)
2164 {
2165 	return __qdf_nbuf_headlen(buf);
2166 }
2167 
2168 static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev,
2169 	qdf_nbuf_t buf, int offset,
2170 	qdf_dma_dir_t dir, int cur_frag)
2171 {
2172 	return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag);
2173 }
2174 
2175 static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf)
2176 {
2177 	return __qdf_nbuf_tso_tcp_v4(buf);
2178 }
2179 
2180 static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf)
2181 {
2182 	return __qdf_nbuf_tso_tcp_v6(buf);
2183 }
2184 
2185 static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf)
2186 {
2187 	return __qdf_nbuf_tcp_seq(buf);
2188 }
2189 
2190 static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf)
2191 {
2192 	return __qdf_nbuf_l2l3l4_hdr_len(buf);
2193 }
2194 
2195 static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf)
2196 {
2197 	return __qdf_nbuf_is_nonlinear(buf);
2198 }
2199 
2200 static inline uint32_t
2201 qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num)
2202 {
2203 	return __qdf_nbuf_get_frag_size(buf, frag_num);
2204 }
2205 
2206 static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf)
2207 {
2208 	return __qdf_nbuf_get_priority(buf);
2209 }
2210 
2211 static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p)
2212 {
2213 	__qdf_nbuf_set_priority(buf, p);
2214 }
2215 
2216 static inline uint16_t
2217 qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf)
2218 {
2219 	return __qdf_nbuf_get_queue_mapping(buf);
2220 }
2221 
2222 static inline uint8_t *
2223 qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf)
2224 {
2225 	return __qdf_nbuf_get_priv_ptr(buf);
2226 }
2227 
2228 /**
2229  * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf.
2230  * @rx_status: rx_status containing required info to update radiotap
2231  * @nbuf: Pointer to nbuf
2232  * @headroom_sz: Available headroom size
2233  *
2234  * Return: radiotap length.
2235  */
2236 unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status,
2237 				      qdf_nbuf_t nbuf, uint32_t headroom_sz);
2238 
2239 /**
2240  * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame.
2241  * @buf: Pointer to nbuf
2242  *
2243  * Return: None
2244  */
2245 static inline void
2246 qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf)
2247 {
2248 	 __qdf_nbuf_mark_wakeup_frame(buf);
2249 }
2250 
2251 #endif /* _QDF_NBUF_H */
2252