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