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