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