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