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