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