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