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