xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/qdf_nbuf.h (revision 3ef9a59299d9bb33e4d5aa0839c86670ab929b8f)
1 /*
2  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: qdf_nbuf_public network buffer API
22  * This file defines the network buffer abstraction.
23  */
24 
25 #ifndef _QDF_NBUF_H
26 #define _QDF_NBUF_H
27 
28 #include <qdf_util.h>
29 #include <qdf_types.h>
30 #include <qdf_lock.h>
31 #include <i_qdf_trace.h>
32 #include <i_qdf_nbuf.h>
33 #include <qdf_net_types.h>
34 
35 #define IPA_NBUF_OWNER_ID			0xaa55aa55
36 #define QDF_NBUF_PKT_TRAC_TYPE_DNS		0x01
37 #define QDF_NBUF_PKT_TRAC_TYPE_EAPOL		0x02
38 #define QDF_NBUF_PKT_TRAC_TYPE_DHCP		0x04
39 #define QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION	0x08
40 #define QDF_NBUF_PKT_TRAC_TYPE_ARP		0x10
41 #define QDF_NBUF_PKT_TRAC_TYPE_ICMP		0x20
42 #define QDF_NBUF_PKT_TRAC_TYPE_ICMPv6		0x40
43 #define QDF_HL_CREDIT_TRACKING			0x80
44 
45 #define QDF_NBUF_PKT_TRAC_MAX_STRING		12
46 #define QDF_NBUF_PKT_TRAC_PROTO_STRING		4
47 #define QDF_NBUF_PKT_ERROR			1
48 
49 #define QDF_NBUF_TRAC_IPV4_OFFSET		14
50 #define QDF_NBUF_TRAC_IPV4_HEADER_MASK		0xF
51 #define QDF_NBUF_TRAC_IPV4_HEADER_SIZE		20
52 #define QDF_NBUF_TRAC_DHCP_SRV_PORT		67
53 #define QDF_NBUF_TRAC_DHCP_CLI_PORT		68
54 #define QDF_NBUF_TRAC_ETH_TYPE_OFFSET		12
55 #define QDF_NBUF_TRAC_VLAN_ETH_TYPE_OFFSET	16
56 #define QDF_NBUF_TRAC_DOUBLE_VLAN_ETH_TYPE_OFFSET	20
57 #define QDF_NBUF_TRAC_EAPOL_ETH_TYPE		0x888E
58 #define QDF_NBUF_TRAC_WAPI_ETH_TYPE		0x88b4
59 #define QDF_NBUF_TRAC_ARP_ETH_TYPE		0x0806
60 #define QDF_NBUF_PKT_IPV4_DSCP_MASK     0xFC
61 #define QDF_NBUF_PKT_IPV4_DSCP_SHIFT  0x02
62 #define QDF_NBUF_TRAC_TDLS_ETH_TYPE		0x890D
63 #define QDF_NBUF_TRAC_IPV4_ETH_TYPE     0x0800
64 #define QDF_NBUF_TRAC_IPV6_ETH_TYPE     0x86dd
65 #define QDF_NBUF_DEST_MAC_OFFSET		0
66 #define QDF_NBUF_SRC_MAC_OFFSET			6
67 #define QDF_NBUF_TRAC_IPV4_TOS_OFFSET		15
68 #define QDF_NBUF_TRAC_IPV4_PROTO_TYPE_OFFSET  23
69 #define QDF_NBUF_TRAC_VLAN_IPV4_PROTO_TYPE_OFFSET  27
70 #define QDF_NBUF_TRAC_IPV4_DEST_ADDR_OFFSET   30
71 #define QDF_NBUF_TRAC_IPV4_SRC_ADDR_OFFSET    26
72 #define QDF_NBUF_TRAC_IPV6_PROTO_TYPE_OFFSET  20
73 #define QDF_NBUF_TRAC_VLAN_IPV6_PROTO_TYPE_OFFSET  24
74 #define QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK    0xE0000000
75 #define QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK    0xF0000000
76 #define QDF_NBUF_TRAC_IPV6_DEST_ADDR_OFFSET   38
77 #define QDF_NBUF_TRAC_IPV6_DEST_ADDR          0xFF00
78 #define QDF_NBUF_TRAC_IPV6_OFFSET		14
79 #define QDF_NBUF_TRAC_VLAN_IPV6_OFFSET		18
80 #define QDF_NBUF_TRAC_IPV6_HEADER_SIZE   40
81 #define QDF_NBUF_TRAC_ICMP_TYPE         1
82 #define QDF_NBUF_TRAC_IGMP_TYPE         2
83 #define QDF_NBUF_TRAC_TCP_TYPE          6
84 #define QDF_NBUF_TRAC_TCP_FLAGS_OFFSET       (47 - 34)
85 #define QDF_NBUF_TRAC_TCP_ACK_OFFSET         (42 - 34)
86 #define QDF_NBUF_TRAC_TCP_HEADER_LEN_OFFSET  (46 - 34)
87 #define QDF_NBUF_TRAC_TCP_ACK_MASK           0x10
88 #define QDF_NBUF_TRAC_TCP_SPORT_OFFSET       (34 - 34)
89 #define QDF_NBUF_TRAC_TCP_DPORT_OFFSET       (36 - 34)
90 #define QDF_NBUF_TRAC_UDP_TYPE          17
91 #define QDF_NBUF_TRAC_ICMPV6_TYPE       0x3a
92 #define QDF_NBUF_TRAC_HOPOPTS_TYPE      0
93 #define QDF_NBUF_TRAC_DHCP6_SRV_PORT		547
94 #define QDF_NBUF_TRAC_DHCP6_CLI_PORT		546
95 #define QDF_NBUF_TRAC_MDNS_SRC_N_DST_PORT	5353
96 #define QDF_NBUF_TRAC_IP_OFFSET		14
97 #define QDF_NBUF_TRAC_VLAN_IP_OFFSET		18
98 #define QDF_NBUF_TRAC_DOUBLE_VLAN_IP_OFFSET	22
99 /* One dword for IPv4 header size unit */
100 #define QDF_NBUF_IPV4_HDR_SIZE_UNIT	4
101 #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 
1655 
1656 static inline uint8_t
1657 qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf)
1658 {
1659 	return  __qdf_nbuf_get_vdev_ctx(buf);
1660 }
1661 
1662 static inline enum cb_ftype qdf_nbuf_get_tx_ftype(qdf_nbuf_t buf)
1663 {
1664 	return  __qdf_nbuf_get_tx_ftype(buf);
1665 }
1666 
1667 static inline enum cb_ftype qdf_nbuf_get_rx_ftype(qdf_nbuf_t buf)
1668 {
1669 	return  __qdf_nbuf_get_rx_ftype(buf);
1670 }
1671 
1672 
1673 static inline qdf_dma_addr_t
1674 qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf)
1675 {
1676 	return __qdf_nbuf_mapped_paddr_get(buf);
1677 }
1678 
1679 static inline void
1680 qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr)
1681 {
1682 	__qdf_nbuf_mapped_paddr_set(buf, paddr);
1683 }
1684 
1685 static inline void
1686 qdf_nbuf_frag_push_head(qdf_nbuf_t buf,
1687 			int frag_len, unsigned char *frag_vaddr,
1688 			qdf_dma_addr_t frag_paddr)
1689 {
1690 	__qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr);
1691 }
1692 
1693 #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf))
1694 
1695 /**
1696  * qdf_nbuf_set_rx_chfrag_start() - set msdu start bit
1697  * @buf: Network buffer
1698  * @val: 0/1
1699  *
1700  * Return: void
1701  */
1702 static inline void
1703 qdf_nbuf_set_rx_chfrag_start(qdf_nbuf_t buf, uint8_t val)
1704 {
1705 	__qdf_nbuf_set_rx_chfrag_start(buf, val);
1706 }
1707 
1708 /**
1709  * qdf_nbuf_is_rx_chfrag_start() - get msdu start bit
1710  * @buf: Network buffer
1711  *
1712  * Return: integer value - 0/1
1713  */
1714 static inline int qdf_nbuf_is_rx_chfrag_start(qdf_nbuf_t buf)
1715 {
1716 	return __qdf_nbuf_is_rx_chfrag_start(buf);
1717 }
1718 
1719 /**
1720  * qdf_nbuf_set_rx_chfrag_cont() - set msdu continuation bit
1721  * @buf: Network buffer
1722  * @val: 0/1
1723  *
1724  * Return: void
1725  */
1726 static inline void
1727 qdf_nbuf_set_rx_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
1728 {
1729 	__qdf_nbuf_set_rx_chfrag_cont(buf, val);
1730 }
1731 
1732 /**
1733  * qdf_nbuf_is_rx_chfrag_cont() - get msdu continuation bit
1734  * @buf: Network buffer
1735  *
1736  * Return: integer value - 0/1
1737  */
1738 static inline int qdf_nbuf_is_rx_chfrag_cont(qdf_nbuf_t buf)
1739 {
1740 	return __qdf_nbuf_is_rx_chfrag_cont(buf);
1741 }
1742 
1743 /**
1744  * qdf_nbuf_set_rx_chfrag_end() - set msdu end bit
1745  * @buf: Network buffer
1746  * @val: 0/1
1747  *
1748  * Return: void
1749  */
1750 static inline void qdf_nbuf_set_rx_chfrag_end(qdf_nbuf_t buf, uint8_t val)
1751 {
1752 	__qdf_nbuf_set_rx_chfrag_end(buf, val);
1753 }
1754 
1755 /**
1756  * qdf_nbuf_is_rx_chfrag_end() - set msdu end bit
1757  * @buf: Network buffer
1758  *
1759  * Return: integer value - 0/1
1760  */
1761 static inline int qdf_nbuf_is_rx_chfrag_end(qdf_nbuf_t buf)
1762 {
1763 	return __qdf_nbuf_is_rx_chfrag_end(buf);
1764 }
1765 
1766 /**
1767  * qdf_nbuf_set_da_mcbc() - set da is mcbc
1768  * @buf: Network buffer
1769  * @val: 0/1
1770  *
1771  * Return: void
1772  */
1773 static inline void
1774 qdf_nbuf_set_da_mcbc(qdf_nbuf_t buf, uint8_t val)
1775 {
1776 	__qdf_nbuf_set_da_mcbc(buf, val);
1777 }
1778 
1779 /**
1780  * qdf_nbuf_is_da_mcbc() - get da is mcbc bit
1781  * @buf: Network buffer
1782  *
1783  * Return: integer value - 0/1
1784  */
1785 static inline int qdf_nbuf_is_da_mcbc(qdf_nbuf_t buf)
1786 {
1787 	return __qdf_nbuf_is_da_mcbc(buf);
1788 }
1789 
1790 /**
1791  * qdf_nbuf_set_da_valid() - set  da valid bit
1792  * @buf: Network buffer
1793  * @val: 0/1
1794  *
1795  * Return: void
1796  */
1797 static inline void qdf_nbuf_set_da_valid(qdf_nbuf_t buf, uint8_t val)
1798 {
1799 	__qdf_nbuf_set_da_valid(buf, val);
1800 }
1801 
1802 /**
1803  * qdf_nbuf_is_da_valid() - get da valid bit
1804  * @buf: Network buffer
1805  *
1806  * Return: integer value - 0/1
1807  */
1808 static inline int qdf_nbuf_is_da_valid(qdf_nbuf_t buf)
1809 {
1810 	return __qdf_nbuf_is_da_valid(buf);
1811 }
1812 
1813 /**
1814  * qdf_nbuf_set_sa_valid() - set  sa valid bit
1815  * @buf: Network buffer
1816  * @val: 0/1
1817  *
1818  * Return: void
1819  */
1820 static inline void qdf_nbuf_set_sa_valid(qdf_nbuf_t buf, uint8_t val)
1821 {
1822 	__qdf_nbuf_set_sa_valid(buf, val);
1823 }
1824 
1825 /**
1826  * qdf_nbuf_is_sa_valid() - get da valid bit
1827  * @buf: Network buffer
1828  *
1829  * Return: integer value - 0/1
1830  */
1831 static inline int qdf_nbuf_is_sa_valid(qdf_nbuf_t buf)
1832 {
1833 	return __qdf_nbuf_is_sa_valid(buf);
1834 }
1835 
1836 /**
1837  * qdf_nbuf_set_rx_retry_flag() - set rx retry flag bit
1838  * @buf: Network buffer
1839  * @val: 0/1
1840  *
1841  * Return: void
1842  */
1843 static inline void qdf_nbuf_set_rx_retry_flag(qdf_nbuf_t buf, uint8_t val)
1844 {
1845 	__qdf_nbuf_set_rx_retry_flag(buf, val);
1846 }
1847 
1848 /**
1849  * qdf_nbuf_is_rx_retry_flag() - get rx retry flag bit
1850  * @buf: Network buffer
1851  *
1852  * Return: integer value - 0/1
1853  */
1854 static inline int qdf_nbuf_is_rx_retry_flag(qdf_nbuf_t buf)
1855 {
1856 	return __qdf_nbuf_is_rx_retry_flag(buf);
1857 }
1858 
1859 /**
1860  * qdf_nbuf_set_raw_frame() - set  raw_frame bit
1861  * @buf: Network buffer
1862  * @val: 0/1
1863  *
1864  * Return: void
1865  */
1866 static inline void qdf_nbuf_set_raw_frame(qdf_nbuf_t buf, uint8_t val)
1867 {
1868 	__qdf_nbuf_set_raw_frame(buf, val);
1869 }
1870 
1871 /**
1872  * qdf_nbuf_is_raw_frame() -  get raw_frame bit
1873  * @buf: Network buffer
1874  *
1875  * Return: integer value - 0/1
1876  */
1877 static inline int qdf_nbuf_is_raw_frame(qdf_nbuf_t buf)
1878 {
1879 	return __qdf_nbuf_is_raw_frame(buf);
1880 }
1881 
1882 /**
1883  * qdf_nbuf_is_fr_ds_set() - get from DS bit
1884  * @buf: Network buffer
1885  *
1886  * Return: integer value - 0/1
1887  */
1888 static inline int qdf_nbuf_is_fr_ds_set(qdf_nbuf_t buf)
1889 {
1890 	return __qdf_nbuf_is_fr_ds_set(buf);
1891 }
1892 
1893 /**
1894  * qdf_nbuf_is_to_ds_set() - get to DS bit
1895  * @buf: Network buffer
1896  *
1897  * Return: integer value - 0/1
1898  */
1899 static inline int qdf_nbuf_is_to_ds_set(qdf_nbuf_t buf)
1900 {
1901 	return __qdf_nbuf_is_to_ds_set(buf);
1902 }
1903 
1904 /**
1905  * qdf_nbuf_set_tid_val() - set  tid_val
1906  * @buf: Network buffer
1907  * @val: 4 bits tid value
1908  */
1909 static inline void qdf_nbuf_set_tid_val(qdf_nbuf_t buf, uint8_t val)
1910 {
1911 	__qdf_nbuf_set_tid_val(buf, val);
1912 }
1913 
1914 /**
1915  * qdf_nbuf_get_tid_val() - get  tid_val
1916  * @buf: Network buffer
1917  *
1918  * Return: integer value[4 bits tid value]
1919  */
1920 static inline uint8_t qdf_nbuf_get_tid_val(qdf_nbuf_t buf)
1921 {
1922 	return __qdf_nbuf_get_tid_val(buf);
1923 }
1924 
1925 /**
1926  * qdf_nbuf_set_is_frag() - set  frag list bit
1927  * @buf: Network buffer
1928  * @val: 0/1
1929  *
1930  * Return: void
1931  */
1932 static inline void qdf_nbuf_set_is_frag(qdf_nbuf_t buf, uint8_t val)
1933 {
1934 	__qdf_nbuf_set_is_frag(buf, val);
1935 }
1936 
1937 /**
1938  * qdf_nbuf_is_frag() - get da frag list bit
1939  * @buf: Network buffer
1940  *
1941  * Return: integer value - 0/1
1942  */
1943 static inline int qdf_nbuf_is_frag(qdf_nbuf_t buf)
1944 {
1945 	return __qdf_nbuf_is_frag(buf);
1946 }
1947 
1948 /**
1949  * qdf_nbuf_set_tx_chfrag_start() - set msdu start bit
1950  * @buf: Network buffer
1951  * @val: 0/1
1952  *
1953  * Return: void
1954  */
1955 static inline void
1956 qdf_nbuf_set_tx_chfrag_start(qdf_nbuf_t buf, uint8_t val)
1957 {
1958 	__qdf_nbuf_set_tx_chfrag_start(buf, val);
1959 }
1960 
1961 /**
1962  * qdf_nbuf_is_tx_chfrag_start() - get msdu start bit
1963  * @buf: Network buffer
1964  *
1965  * Return: integer value - 0/1
1966  */
1967 static inline int qdf_nbuf_is_tx_chfrag_start(qdf_nbuf_t buf)
1968 {
1969 	return __qdf_nbuf_is_tx_chfrag_start(buf);
1970 }
1971 
1972 /**
1973  * qdf_nbuf_set_tx_chfrag_cont() - set msdu continuation bit
1974  * @buf: Network buffer
1975  * @val: 0/1
1976  *
1977  * Return: void
1978  */
1979 static inline void
1980 qdf_nbuf_set_tx_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
1981 {
1982 	__qdf_nbuf_set_tx_chfrag_cont(buf, val);
1983 }
1984 
1985 /**
1986  * qdf_nbuf_is_tx_chfrag_cont() - get msdu continuation bit
1987  * @buf: Network buffer
1988  *
1989  * Return: integer value - 0/1
1990  */
1991 static inline int qdf_nbuf_is_tx_chfrag_cont(qdf_nbuf_t buf)
1992 {
1993 	return __qdf_nbuf_is_tx_chfrag_cont(buf);
1994 }
1995 
1996 /**
1997  * qdf_nbuf_set_tx_chfrag_end() - set msdu end bit
1998  * @buf: Network buffer
1999  * @val: 0/1
2000  *
2001  * Return: void
2002  */
2003 static inline void qdf_nbuf_set_tx_chfrag_end(qdf_nbuf_t buf, uint8_t val)
2004 {
2005 	__qdf_nbuf_set_tx_chfrag_end(buf, val);
2006 }
2007 
2008 /**
2009  * qdf_nbuf_is_tx_chfrag_end() - set msdu end bit
2010  * @buf: Network buffer
2011  *
2012  * Return: integer value - 0/1
2013  */
2014 static inline int qdf_nbuf_is_tx_chfrag_end(qdf_nbuf_t buf)
2015 {
2016 	return __qdf_nbuf_is_tx_chfrag_end(buf);
2017 }
2018 
2019 static inline void
2020 qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
2021 {
2022 	__qdf_nbuf_dma_map_info(bmap, sg);
2023 }
2024 
2025 /**
2026  * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
2027  * @nbuf: Network buffer
2028  *
2029  * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
2030  */
2031 static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
2032 {
2033 	return __qdf_nbuf_is_tso(nbuf);
2034 }
2035 
2036 /**
2037  * qdf_nbuf_get_users() - function to get the number of users referencing this
2038  * network buffer
2039  *
2040  * @nbuf:   network buffer
2041  *
2042  * Return: number of user references to nbuf.
2043  */
2044 static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
2045 {
2046 	return __qdf_nbuf_get_users(nbuf);
2047 }
2048 
2049 /**
2050  * qdf_nbuf_next() - get the next packet in the linked list
2051  * @buf: Network buffer
2052  *
2053  * This function can be used when nbufs are directly linked into a list,
2054  * rather than using a separate network buffer queue object.
2055  *
2056  * Return: next network buffer in the linked list
2057  */
2058 static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
2059 {
2060 	return __qdf_nbuf_next(buf);
2061 }
2062 
2063 #ifdef IPA_OFFLOAD
2064 /**
2065  * qdf_nbuf_smmu_map_debug() - map smmu buffer
2066  * @nbuf: network buffer
2067  * @hdl: ipa handle
2068  * @num_buffers: number of buffers
2069  * @info: memory info
2070  * @func: function name
2071  * @line: line number
2072  *
2073  * Return: QDF_STATUS
2074  */
2075 QDF_STATUS qdf_nbuf_smmu_map_debug(qdf_nbuf_t nbuf,
2076 				   uint8_t hdl,
2077 				   uint8_t num_buffers,
2078 				   qdf_mem_info_t *info,
2079 				   const char *func,
2080 				   uint32_t line);
2081 
2082 /**
2083  * qdf_nbuf_smmu_unmap_debug() - unmap smmu buffer
2084  * @nbuf: network buffer
2085  * @hdl: ipa handle
2086  * @num_buffers: number of buffers
2087  * @info: memory info
2088  * @func: function name
2089  * @line: line number
2090  *
2091  * Return: QDF_STATUS
2092  */
2093 QDF_STATUS qdf_nbuf_smmu_unmap_debug(qdf_nbuf_t nbuf,
2094 				     uint8_t hdl,
2095 				     uint8_t num_buffers,
2096 				     qdf_mem_info_t *info,
2097 				     const char *func,
2098 				     uint32_t line);
2099 
2100 #endif /* IPA_OFFLOAD */
2101 
2102 #ifdef NBUF_MEMORY_DEBUG
2103 
2104 #define QDF_NET_BUF_TRACK_MAX_SIZE    (1024)
2105 
2106 enum qdf_nbuf_event_type {
2107 	QDF_NBUF_ALLOC,
2108 	QDF_NBUF_ALLOC_CLONE,
2109 	QDF_NBUF_ALLOC_COPY,
2110 	QDF_NBUF_ALLOC_FAILURE,
2111 	QDF_NBUF_FREE,
2112 	QDF_NBUF_MAP,
2113 	QDF_NBUF_UNMAP,
2114 	QDF_NBUF_ALLOC_COPY_EXPAND,
2115 	QDF_NBUF_SMMU_MAP,
2116 	QDF_NBUF_SMMU_UNMAP,
2117 };
2118 
2119 /**
2120  * qdf_net_buf_debug_init() - initialize network buffer debug functionality
2121  *
2122  * QDF network buffer debug feature tracks all SKBs allocated by WLAN driver
2123  * in a hash table and when driver is unloaded it reports about leaked SKBs.
2124  * WLAN driver module whose allocated SKB is freed by network stack are
2125  * suppose to call qdf_net_buf_debug_release_skb() such that the SKB is not
2126  * reported as memory leak.
2127  *
2128  * Return: none
2129  */
2130 void qdf_net_buf_debug_init(void);
2131 
2132 /**
2133  * qdf_net_buf_debug_exit() - exit network buffer debug functionality
2134  *
2135  * Exit network buffer tracking debug functionality and log SKB memory leaks
2136  * As part of exiting the functionality, free the leaked memory and
2137  * cleanup the tracking buffers.
2138  *
2139  * Return: none
2140  */
2141 void qdf_net_buf_debug_exit(void);
2142 
2143 void qdf_net_buf_debug_clean(void);
2144 void qdf_nbuf_history_add(qdf_nbuf_t nbuf, const char *func, uint32_t line,
2145 			  enum qdf_nbuf_event_type type);
2146 
2147 /**
2148  * qdf_net_buf_debug_add_node() - store skb in debug hash table
2149  * @net_buf: network buffer
2150  * @size: buffer size
2151  * @func_name: function name that requests for mapping the nbuf
2152  * @line_num: function line number
2153  *
2154  * Return: none
2155  */
2156 void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
2157 				const char *func_name, uint32_t line_num);
2158 
2159 /**
2160  * qdf_net_buf_debug_update_node() - update nbuf in debug hash table
2161  * @net_buf: network buffer
2162  * @func_name: function name that requests for mapping the nbuf
2163  * @line_num: function line number
2164  *
2165  * Return: none
2166  */
2167 void qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name,
2168 				   uint32_t line_num);
2169 
2170 /**
2171  * qdf_net_buf_debug_delete_node() - remove skb from debug hash table
2172  * @net_buf: network buffer
2173  *
2174  * Return: none
2175  */
2176 void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
2177 
2178 /**
2179  * qdf_net_buf_debug_update_map_node() - update nbuf in debug
2180  * hash table with the mapping function info
2181  * @net_buf: network buffer
2182  * @func_name: function name that requests for mapping the nbuf
2183  * @line_num: function line number
2184  *
2185  * Return: none
2186  */
2187 void qdf_net_buf_debug_update_map_node(qdf_nbuf_t net_buf,
2188 				       const char *func_name,
2189 				       uint32_t line_num);
2190 
2191 #ifdef NBUF_SMMU_MAP_UNMAP_DEBUG
2192 /**
2193  * qdf_nbuf_map_check_for_smmu_leaks() - check for nbuf smmu map leaks
2194  *
2195  * Check for net buffers that have been smmu mapped, but never smmu unmapped.
2196  *
2197  * Returns: None
2198  */
2199 void qdf_nbuf_map_check_for_smmu_leaks(void);
2200 
2201 /**
2202  * qdf_net_buf_debug_update_smmu_map_node() - update nbuf in debug
2203  * hash table with the mapping function info
2204  * @nbuf: network buffer
2205  * @iova: Virtual address of buffer
2206  * @pa: Physical address of buffer
2207  * @func: function name that requests for mapping the nbuf
2208  * @line: function line number
2209  *
2210  * Return: none
2211  */
2212 void qdf_net_buf_debug_update_smmu_map_node(qdf_nbuf_t nbuf,
2213 					    unsigned long iova,
2214 					    unsigned long pa,
2215 					    const char *func,
2216 					    uint32_t line);
2217 
2218 /**
2219  * qdf_net_buf_debug_update_smmu_unmap_node() - update nbuf in debug
2220  * hash table with the unmapping function info
2221  * @nbuf: network buffer
2222  * @iova: Virtual address of buffer
2223  * @pa: Physical address of buffer
2224  * @func: function name that requests for unmapping the nbuf
2225  * @line: function line number
2226  *
2227  * Return: none
2228  */
2229 void qdf_net_buf_debug_update_smmu_unmap_node(qdf_nbuf_t nbuf,
2230 					      unsigned long iova,
2231 					      unsigned long pa,
2232 					      const char *func,
2233 					      uint32_t line);
2234 #endif /* NBUF_SMMU_MAP_UNMAP_DEBUG */
2235 
2236 /**
2237  * qdf_net_buf_debug_update_unmap_node() - update nbuf in debug
2238  * hash table with the unmap function info
2239  * @net_buf:   network buffer
2240  * @func_name: function name that requests for unmapping the nbuf
2241  * @line_num: function line number
2242  *
2243  * Return: none
2244  */
2245 void qdf_net_buf_debug_update_unmap_node(qdf_nbuf_t net_buf,
2246 					 const char *func_name,
2247 					 uint32_t line_num);
2248 
2249 /**
2250  * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak
2251  * @net_buf: Network buf holding head segment (single)
2252  * @func_name: pointer to function name
2253  * @line_num: line number
2254  *
2255  * WLAN driver module's SKB which are allocated by network stack are
2256  * suppose to call this API before freeing it such that the SKB
2257  * is not reported as memory leak.
2258  *
2259  * Return: none
2260  */
2261 void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
2262 				   const char *func_name,
2263 				   uint32_t line_num);
2264 
2265 /**
2266  * qdf_net_buf_debug_release_skb() - release skb to avoid memory leak
2267  * @net_buf: Network buf holding head segment (single)
2268  *
2269  * WLAN driver module whose allocated SKB is freed by network stack are
2270  * suppose to call this API before returning SKB to network stack such
2271  * that the SKB is not reported as memory leak.
2272  *
2273  * Return: none
2274  */
2275 void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
2276 
2277 /* nbuf allocation routines */
2278 
2279 #define qdf_nbuf_alloc_simple(d, s, r, a, p) \
2280 	__qdf_nbuf_alloc_simple(d, s, __func__, __LINE__)
2281 
2282 #define qdf_nbuf_alloc(d, s, r, a, p) \
2283 	qdf_nbuf_alloc_debug(d, s, r, a, p, __func__, __LINE__)
2284 
2285 qdf_nbuf_t qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size,
2286 				int reserve, int align, int prio,
2287 				const char *func, uint32_t line);
2288 
2289 #define qdf_nbuf_frag_alloc(d, s, r, a, p) \
2290 	qdf_nbuf_frag_alloc_debug(d, s, r, a, p, __func__, __LINE__)
2291 
2292 qdf_nbuf_t qdf_nbuf_frag_alloc_debug(qdf_device_t osdev, qdf_size_t size,
2293 				     int reserve, int align, int prio,
2294 				     const char *func, uint32_t line);
2295 
2296 /**
2297  * qdf_nbuf_alloc_no_recycler() - Allocates skb
2298  * @size: Size to be allocated for skb
2299  * @reserve: Reserved headroom size
2300  * @align: Align
2301  *
2302  * This API allocates skb of required size and aligns if needed and reserves
2303  * some space in the front. This skb allocation is not from skb recycler pool.
2304  *
2305  * Return: Allocated nbuf pointer
2306  */
2307 #define qdf_nbuf_alloc_no_recycler(size, reserve, align) \
2308 	qdf_nbuf_alloc_no_recycler_debug(size, reserve, align, __func__, __LINE__)
2309 
2310 /**
2311  * qdf_nbuf_alloc_no_recycler_debug() - Allocates skb
2312  * @size: Size to be allocated for skb
2313  * @reserve: Reserved headroom size
2314  * @align: Align
2315  * @func: Function name of the call site
2316  * @line: Line number of the callsite
2317  *
2318  * This API allocates skb of required size and aligns if needed and reserves
2319  * some space in the front. This skb allocation is not from skb recycler pool.
2320  *
2321  * Return: Allocated nbuf pointer
2322  */
2323 qdf_nbuf_t qdf_nbuf_alloc_no_recycler_debug(size_t size, int reserve, int align,
2324 					    const char *func, uint32_t line);
2325 #define qdf_nbuf_free(d) \
2326 	qdf_nbuf_free_debug(d, __func__, __LINE__)
2327 
2328 void qdf_nbuf_free_debug(qdf_nbuf_t nbuf, const char *func, uint32_t line);
2329 
2330 #define qdf_nbuf_free_simple(d) \
2331 	qdf_nbuf_free_debug_simple(d, __func__, __LINE__)
2332 
2333 void qdf_nbuf_free_debug_simple(qdf_nbuf_t nbuf, const char *func,
2334 				uint32_t line);
2335 
2336 #define qdf_nbuf_clone(buf)     \
2337 	qdf_nbuf_clone_debug(buf, __func__, __LINE__)
2338 
2339 /**
2340  * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly)
2341  * @buf: nbuf to clone from
2342  * @func: name of the calling function
2343  * @line: line number of the callsite
2344  *
2345  * This function clones the nbuf and creates a memory tracking
2346  * node corresponding to that cloned skbuff structure.
2347  *
2348  * Return: cloned buffer
2349  */
2350 qdf_nbuf_t qdf_nbuf_clone_debug(qdf_nbuf_t buf, const char *func,
2351 				uint32_t line);
2352 
2353 #define qdf_nbuf_copy(buf)     \
2354 	qdf_nbuf_copy_debug(buf, __func__, __LINE__)
2355 
2356 /**
2357  * qdf_nbuf_copy_debug() - returns a private copy of the buf
2358  * @buf: nbuf to copy from
2359  * @func: name of the calling function
2360  * @line: line number of the callsite
2361  *
2362  * This API returns a private copy of the buf, the buf returned is completely
2363  * modifiable by callers. It also creates a memory tracking node corresponding
2364  * to that new skbuff structure.
2365  *
2366  * Return: copied buffer
2367  */
2368 qdf_nbuf_t qdf_nbuf_copy_debug(qdf_nbuf_t buf, const char *func, uint32_t line);
2369 
2370 #define qdf_nbuf_copy_expand(buf, headroom, tailroom)     \
2371 	qdf_nbuf_copy_expand_debug(buf, headroom, tailroom, __func__, __LINE__)
2372 
2373 /**
2374  * qdf_nbuf_copy_expand_debug() - copy and expand nbuf
2375  * @buf: Network buf instance
2376  * @headroom: Additional headroom to be added
2377  * @tailroom: Additional tailroom to be added
2378  * @func: name of the calling function
2379  * @line: line number of the callsite
2380  *
2381  * Return: New nbuf that is a copy of buf, with additional head and tailroom
2382  *	or NULL if there is no memory
2383  */
2384 qdf_nbuf_t
2385 qdf_nbuf_copy_expand_debug(qdf_nbuf_t buf, int headroom, int tailroom,
2386 			   const char *func, uint32_t line);
2387 
2388 /**
2389  * qdf_nbuf_unshare() - make a copy of the shared nbuf
2390  * @buf: Network buf instance
2391  *
2392  * Return: New nbuf which is a copy of the received nbuf if it is cloned,
2393  *      else, return the original nbuf
2394  */
2395 #define qdf_nbuf_unshare(buf) \
2396 	qdf_nbuf_unshare_debug(buf, __func__, __LINE__)
2397 
2398 qdf_nbuf_t
2399 qdf_nbuf_unshare_debug(qdf_nbuf_t buf, const char *func_name,
2400 		       uint32_t line_num);
2401 
2402 /**
2403  * qdf_nbuf_dev_kfree_list() - Free nbuf list using kfree
2404  * @buf: Pointer to network buffer head
2405  *
2406  * This function is called to free the nbuf list on failure cases
2407  *
2408  * Return: None
2409  */
2410 #define qdf_nbuf_dev_kfree_list(buf) \
2411 	qdf_nbuf_dev_kfree_list_debug(buf, __func__, __LINE__)
2412 
2413 void
2414 qdf_nbuf_dev_kfree_list_debug(qdf_nbuf_queue_head_t *nbuf_queue_head,
2415 			      const char *func_name,
2416 			      uint32_t line_num);
2417 
2418 #define qdf_nbuf_page_frag_alloc(d, s, r, a, p) \
2419 	qdf_nbuf_page_frag_alloc_debug(d, s, r, a, p, __func__, __LINE__)
2420 
2421 qdf_nbuf_t
2422 qdf_nbuf_page_frag_alloc_debug(qdf_device_t osdev, qdf_size_t size, int reserve,
2423 			       int align, qdf_frag_cache_t *pf_cache,
2424 			       const char *func, uint32_t line);
2425 #else /* NBUF_MEMORY_DEBUG */
2426 
2427 static inline void qdf_net_buf_debug_init(void) {}
2428 static inline void qdf_net_buf_debug_exit(void) {}
2429 
2430 static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
2431 						 const char *func_name,
2432 						 uint32_t line_num)
2433 {
2434 }
2435 
2436 static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
2437 {
2438 }
2439 
2440 static inline void
2441 qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name,
2442 			      uint32_t line_num)
2443 {
2444 }
2445 
2446 static inline void
2447 qdf_net_buf_debug_update_map_node(qdf_nbuf_t net_buf,
2448 				  const char *func_name,
2449 				  uint32_t line_num)
2450 {
2451 }
2452 
2453 static inline void
2454 qdf_net_buf_debug_update_unmap_node(qdf_nbuf_t net_buf,
2455 				    const char *func_name,
2456 				    uint32_t line_num)
2457 {
2458 }
2459 /* Nbuf allocation routines */
2460 
2461 #define qdf_nbuf_alloc_simple(osdev, size, reserve, align, prio) \
2462 	qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \
2463 			  __func__, __LINE__)
2464 
2465 #define qdf_nbuf_alloc(osdev, size, reserve, align, prio) \
2466 	qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \
2467 			  __func__, __LINE__)
2468 
2469 #define qdf_nbuf_alloc_no_recycler(size, reserve, align) \
2470 	qdf_nbuf_alloc_no_recycler_fl(size, reserve, align, __func__, __LINE__)
2471 
2472 static inline qdf_nbuf_t
2473 qdf_nbuf_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve, int align,
2474 		  int prio, const char *func, uint32_t line)
2475 {
2476 	return __qdf_nbuf_alloc(osdev, size, reserve, align, prio, func, line);
2477 }
2478 
2479 #define qdf_nbuf_frag_alloc(osdev, size, reserve, align, prio) \
2480 	qdf_nbuf_frag_alloc_fl(osdev, size, reserve, align, prio, \
2481 			  __func__, __LINE__)
2482 
2483 static inline qdf_nbuf_t
2484 qdf_nbuf_frag_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve,
2485 		       int align, int prio, const char *func, uint32_t line)
2486 {
2487 	return __qdf_nbuf_frag_alloc(osdev, size, reserve, align, prio,
2488 				     func, line);
2489 }
2490 
2491 /**
2492  * qdf_nbuf_alloc_no_recycler_fl() - Allocate SKB
2493  * @size: Size to be allocated for skb
2494  * @reserve: Reserved headroom size
2495  * @align: Align
2496  * @func: Function name of the call site
2497  * @line: Line number of the callsite
2498  *
2499  * This API allocates skb of required size and aligns if needed and reserves
2500  * some space in the front. This skb allocation is not from skb recycler pool.
2501  *
2502  * Return: Allocated nbuf pointer
2503  */
2504 static inline qdf_nbuf_t
2505 qdf_nbuf_alloc_no_recycler_fl(size_t size, int reserve, int align,
2506 			      const char *func, uint32_t line)
2507 {
2508 	return __qdf_nbuf_alloc_no_recycler(size, reserve, align, func, line);
2509 }
2510 
2511 #define qdf_nbuf_free_simple(d) qdf_nbuf_free(d)
2512 
2513 static inline void qdf_nbuf_free(qdf_nbuf_t buf)
2514 {
2515 	if (qdf_likely(buf))
2516 		__qdf_nbuf_free(buf);
2517 }
2518 
2519 /**
2520  * qdf_nbuf_clone() - clone the nbuf (copy is readonly)
2521  * @buf: Pointer to network buffer
2522  *
2523  * This function clones the nbuf and returns new sk_buff
2524  * structure.
2525  *
2526  * Return: cloned skb
2527  */
2528 static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf)
2529 {
2530 	return __qdf_nbuf_clone(buf);
2531 }
2532 
2533 /**
2534  * qdf_nbuf_copy() - returns a private copy of the buf
2535  * @buf: Pointer to network buffer
2536  *
2537  * This API returns a private copy of the buf, the buf returned is completely
2538  *  modifiable by callers
2539  *
2540  * Return: skb or NULL
2541  */
2542 static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
2543 {
2544 	return __qdf_nbuf_copy(buf);
2545 }
2546 
2547 /**
2548  * qdf_nbuf_copy_expand() - copy and expand nbuf
2549  * @buf: Network buf instance
2550  * @headroom: Additional headroom to be added
2551  * @tailroom: Additional tailroom to be added
2552  *
2553  * Return: New nbuf that is a copy of buf, with additional head and tailroom
2554  *	or NULL if there is no memory
2555  */
2556 static inline qdf_nbuf_t qdf_nbuf_copy_expand(qdf_nbuf_t buf, int headroom,
2557 					      int tailroom)
2558 {
2559 	return __qdf_nbuf_copy_expand(buf, headroom, tailroom);
2560 }
2561 
2562 static inline qdf_nbuf_t qdf_nbuf_unshare(qdf_nbuf_t buf)
2563 {
2564 	return __qdf_nbuf_unshare(buf);
2565 }
2566 
2567 /**
2568  * qdf_nbuf_dev_kfree_list() - Free nbuf list using kfree
2569  * @nbuf_queue_head: Pointer to buffer list head
2570  *
2571  * This function is called to free the nbuf list on failure cases
2572  *
2573  * Return: None
2574  */
2575 static inline void
2576 qdf_nbuf_dev_kfree_list(qdf_nbuf_queue_head_t *nbuf_queue_head)
2577 {
2578 	__qdf_nbuf_dev_kfree_list(nbuf_queue_head);
2579 }
2580 
2581 #define qdf_nbuf_page_frag_alloc(osdev, size, reserve, align, pf_cache) \
2582 	qdf_nbuf_page_frag_alloc_fl(osdev, size, reserve, align, pf_cache, \
2583 			  __func__, __LINE__)
2584 
2585 static inline qdf_nbuf_t
2586 qdf_nbuf_page_frag_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve,
2587 			    int align, qdf_frag_cache_t *pf_cache,
2588 			    const char *func, uint32_t line)
2589 {
2590 	return __qdf_nbuf_page_frag_alloc(osdev, size, reserve, align, pf_cache,
2591 					  func, line);
2592 }
2593 #endif /* NBUF_MEMORY_DEBUG */
2594 
2595 #if defined(QCA_DP_NBUF_FAST_PPEDS)
2596 #define qdf_nbuf_alloc_ppe_ds(d, s, r, a, p) \
2597 	__qdf_nbuf_alloc_ppe_ds(d, s, __func__, __LINE__)
2598 #endif /* QCA_DP_NBUF_FAST_PPEDS */
2599 
2600 /**
2601  * qdf_nbuf_dev_queue_head() - Queue a buffer at the list head
2602  * @nbuf_queue_head: Pointer to buffer list head
2603  * @buf: Pointer to network buffer head
2604  *
2605  * This function is called to queue a buffer at the list head
2606  *
2607  * Return: None
2608  */
2609 static inline void
2610 qdf_nbuf_dev_queue_head(qdf_nbuf_queue_head_t *nbuf_queue_head,
2611 			qdf_nbuf_t buf)
2612 {
2613 	__qdf_nbuf_dev_queue_head(nbuf_queue_head, buf);
2614 }
2615 
2616 /**
2617  * qdf_nbuf_kfree() - Free nbuf using kfree
2618  * @buf: Pointer to network buffer
2619  *
2620  * This function is called to free the skb on failure cases
2621  *
2622  * Return: None
2623  */
2624 static inline void qdf_nbuf_kfree(qdf_nbuf_t buf)
2625 {
2626 	__qdf_nbuf_kfree(buf);
2627 }
2628 
2629 /**
2630  * qdf_nbuf_dev_kfree() - Free nbuf using dev based os call
2631  * @buf: Pointer to network buffer
2632  *
2633  * This function is called to free the skb on failure cases
2634  *
2635  * Return: None
2636  */
2637 static inline void qdf_nbuf_dev_kfree(qdf_nbuf_t buf)
2638 {
2639 	__qdf_nbuf_dev_kfree(buf);
2640 }
2641 
2642 /**
2643  * qdf_nbuf_copy_expand_fraglist() - copy and expand nbuf and
2644  * get reference of the fraglist.
2645  * @buf: Network buf instance
2646  * @headroom: Additional headroom to be added
2647  * @tailroom: Additional tailroom to be added
2648  *
2649  * Return: New nbuf that is a copy of buf, with additional head and tailroom
2650  *	or NULL if there is no memory
2651  */
2652 static inline qdf_nbuf_t
2653 qdf_nbuf_copy_expand_fraglist(qdf_nbuf_t buf, int headroom,
2654 			      int tailroom)
2655 {
2656 	buf = qdf_nbuf_copy_expand(buf, headroom, tailroom);
2657 
2658 	/* get fraglist reference */
2659 	if (buf)
2660 		__qdf_nbuf_get_ref_fraglist(buf);
2661 
2662 	return buf;
2663 }
2664 
2665 #ifdef WLAN_FEATURE_FASTPATH
2666 /**
2667  * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state
2668  * @nbuf: buf instance
2669  *
2670  * Return: data pointer of this buf where new data has to be
2671  *         put, or NULL if there is not enough room in this buf.
2672  */
2673 void qdf_nbuf_init_fast(qdf_nbuf_t nbuf);
2674 #endif /* WLAN_FEATURE_FASTPATH */
2675 
2676 /**
2677  * qdf_nbuf_list_free() - free a list of nbufs
2678  * @buf_list: A list of nbufs to be freed
2679  *
2680  * Return: none
2681  */
2682 static inline void qdf_nbuf_list_free(qdf_nbuf_t buf_list)
2683 {
2684 	while (buf_list) {
2685 		qdf_nbuf_t next = qdf_nbuf_next(buf_list);
2686 		qdf_nbuf_free(buf_list);
2687 		buf_list = next;
2688 	}
2689 }
2690 
2691 static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
2692 {
2693 	qdf_nbuf_list_free(buf_list);
2694 }
2695 
2696 static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
2697 {
2698 	__qdf_nbuf_ref(buf);
2699 }
2700 
2701 static inline int qdf_nbuf_shared(qdf_nbuf_t buf)
2702 {
2703 	return __qdf_nbuf_shared(buf);
2704 }
2705 
2706 static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src)
2707 {
2708 	return __qdf_nbuf_cat(dst, src);
2709 }
2710 
2711 /**
2712  * qdf_nbuf_copy_bits() - return the length of the copy bits for skb
2713  * @nbuf: netbuf
2714  * @offset: offset
2715  * @len: Length
2716  * @to: To
2717  *
2718  * Return: int32_t
2719  */
2720 static inline int32_t
2721 qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to)
2722 {
2723 	return __qdf_nbuf_copy_bits(nbuf, offset, len, to);
2724 }
2725 
2726 
2727 /* nbuf manipulation routines */
2728 
2729 /**
2730  * qdf_nbuf_head() - return the address of an nbuf's buffer
2731  * @buf: netbuf
2732  *
2733  * Return: head address
2734  */
2735 static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf)
2736 {
2737 	return __qdf_nbuf_head(buf);
2738 }
2739 
2740 /**
2741  * qdf_nbuf_data() - Return the address of the start of data within an nbuf
2742  * @buf: Network buffer
2743  *
2744  * Return: Data address
2745  */
2746 static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf)
2747 {
2748 	return __qdf_nbuf_data(buf);
2749 }
2750 
2751 /**
2752  * qdf_nbuf_data_addr() - Return the address of skb->data
2753  * @buf: Network buffer
2754  *
2755  * Return: Data address
2756  */
2757 static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf)
2758 {
2759 	return __qdf_nbuf_data_addr(buf);
2760 }
2761 
2762 /**
2763  * qdf_nbuf_headroom() - amount of headroom int the current nbuf
2764  * @buf: Network buffer
2765  *
2766  * Return: Amount of head room
2767  */
2768 static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf)
2769 {
2770 	return __qdf_nbuf_headroom(buf);
2771 }
2772 
2773 /**
2774  * qdf_nbuf_tailroom() - amount of tail space available
2775  * @buf: Network buffer
2776  *
2777  * Return: amount of tail room
2778  */
2779 static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf)
2780 {
2781 	return __qdf_nbuf_tailroom(buf);
2782 }
2783 
2784 /**
2785  * qdf_nbuf_push_head() - push data in the front
2786  * @buf: Network buf instance
2787  * @size: Size to be pushed
2788  *
2789  * Return: New data pointer of this buf after data has been pushed,
2790  *	or NULL if there is not enough room in this buf.
2791  */
2792 static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size)
2793 {
2794 	return __qdf_nbuf_push_head(buf, size);
2795 }
2796 
2797 /**
2798  * qdf_nbuf_put_tail() - puts data in the end
2799  * @buf: Network buf instance
2800  * @size: Size to be pushed
2801  *
2802  * Return: Data pointer of this buf where new data has to be
2803  *	put, or NULL if there is not enough room in this buf.
2804  */
2805 static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size)
2806 {
2807 	return __qdf_nbuf_put_tail(buf, size);
2808 }
2809 
2810 /**
2811  * qdf_nbuf_pull_head() - pull data out from the front
2812  * @buf: Network buf instance
2813  * @size: Size to be popped
2814  *
2815  * Return: New data pointer of this buf after data has been popped,
2816  *	or NULL if there is not sufficient data to pull.
2817  */
2818 static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size)
2819 {
2820 	return __qdf_nbuf_pull_head(buf, size);
2821 }
2822 
2823 /**
2824  * qdf_nbuf_trim_tail() - trim data out from the end
2825  * @buf: Network buf instance
2826  * @size: Size to be popped
2827  *
2828  * Return: none
2829  */
2830 static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size)
2831 {
2832 	__qdf_nbuf_trim_tail(buf, size);
2833 }
2834 
2835 /**
2836  * qdf_nbuf_len() - get the length of the buf
2837  * @buf: Network buf instance
2838  *
2839  * Return: total length of this buf.
2840  */
2841 static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf)
2842 {
2843 	return __qdf_nbuf_len(buf);
2844 }
2845 
2846 /**
2847  * qdf_nbuf_set_pktlen() - set the length of the buf
2848  * @buf: Network buf instance
2849  * @len: Size to be set
2850  *
2851  * Return: none
2852  */
2853 static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len)
2854 {
2855 	__qdf_nbuf_set_pktlen(buf, len);
2856 }
2857 
2858 /**
2859  * qdf_nbuf_reserve() - trim data out from the end
2860  * @buf: Network buf instance
2861  * @size: Size to be popped
2862  *
2863  * Return: none
2864  */
2865 static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size)
2866 {
2867 	__qdf_nbuf_reserve(buf, size);
2868 }
2869 
2870 /**
2871  * qdf_nbuf_set_data_pointer() - set data pointer
2872  * @buf: Network buf instance
2873  * @data: data pointer
2874  *
2875  * Return: none
2876  */
2877 static inline void qdf_nbuf_set_data_pointer(qdf_nbuf_t buf, uint8_t *data)
2878 {
2879 	__qdf_nbuf_set_data_pointer(buf, data);
2880 }
2881 
2882 /**
2883  * qdf_nbuf_set_len() - set data length
2884  * @buf: Network buf instance
2885  * @len: data length
2886  * Return: none
2887  */
2888 static inline void qdf_nbuf_set_len(qdf_nbuf_t buf, uint32_t len)
2889 {
2890 	__qdf_nbuf_set_len(buf, len);
2891 }
2892 
2893 /**
2894  * qdf_nbuf_set_tail_pointer() - set data tail pointer
2895  * @buf: Network buf instance
2896  * @len: length of data
2897  *
2898  * Return: none
2899  */
2900 static inline void qdf_nbuf_set_tail_pointer(qdf_nbuf_t buf, int len)
2901 {
2902 	__qdf_nbuf_set_tail_pointer(buf, len);
2903 }
2904 
2905 /**
2906  * qdf_nbuf_unlink_no_lock() - unlink a nbuf from nbuf list
2907  * @buf: Network buf instance
2908  * @list: list to use
2909  *
2910  * This is a lockless version, driver must acquire locks if it
2911  * needs to synchronize
2912  *
2913  * Return: none
2914  */
2915 static inline void
2916 qdf_nbuf_unlink_no_lock(qdf_nbuf_t buf, qdf_nbuf_queue_head_t *list)
2917 {
2918 	__qdf_nbuf_unlink_no_lock(buf, list);
2919 }
2920 
2921 /**
2922  * qdf_nbuf_reset() - reset the buffer data and pointer
2923  * @buf: Network buf instance
2924  * @reserve: reserve
2925  * @align: align
2926  *
2927  * Return: none
2928  */
2929 static inline void qdf_nbuf_reset(qdf_nbuf_t buf, int reserve, int align)
2930 {
2931 	__qdf_nbuf_reset(buf, reserve, align);
2932 }
2933 
2934 /**
2935  * qdf_nbuf_is_dev_scratch_supported() - dev_scratch support for network buffer
2936  *                                       in kernel
2937  *
2938  * Return: true if dev_scratch is supported
2939  *         false if dev_scratch is not supported
2940  */
2941 static inline bool qdf_nbuf_is_dev_scratch_supported(void)
2942 {
2943 	return __qdf_nbuf_is_dev_scratch_supported();
2944 }
2945 
2946 /**
2947  * qdf_nbuf_get_dev_scratch() - get dev_scratch of network buffer
2948  * @buf: Pointer to network buffer
2949  *
2950  * Return: dev_scratch if dev_scratch supported
2951  *         0 if dev_scratch not supported
2952  */
2953 static inline unsigned long qdf_nbuf_get_dev_scratch(qdf_nbuf_t buf)
2954 {
2955 	return __qdf_nbuf_get_dev_scratch(buf);
2956 }
2957 
2958 /**
2959  * qdf_nbuf_set_dev_scratch() - set dev_scratch of network buffer
2960  * @buf: Pointer to network buffer
2961  * @value: value to be set in dev_scratch of network buffer
2962  *
2963  * Return: void
2964  */
2965 static inline void qdf_nbuf_set_dev_scratch(qdf_nbuf_t buf, unsigned long value)
2966 {
2967 	__qdf_nbuf_set_dev_scratch(buf, value);
2968 }
2969 
2970 /**
2971  * qdf_nbuf_set_dev() - set dev in network buffer
2972  * @nbuf: Pointer to network buffer
2973  * @dev: netdev to be set in network buffer
2974  *
2975  * Return: void
2976  */
2977 static inline
2978 void qdf_nbuf_set_dev(qdf_nbuf_t nbuf, qdf_netdev_t dev)
2979 {
2980 	__qdf_nbuf_set_dev(nbuf, dev);
2981 }
2982 
2983 /**
2984  * qdf_nbuf_get_dev_mtu() - get dev mtu in n/w buffer
2985  * @nbuf: Pointer to network buffer
2986  *
2987  * Return: dev mtu value in nbuf
2988  */
2989 static inline
2990 unsigned int qdf_nbuf_get_dev_mtu(qdf_nbuf_t nbuf)
2991 {
2992 	return __qdf_nbuf_get_dev_mtu(nbuf);
2993 }
2994 
2995 /**
2996  * qdf_nbuf_set_protocol_eth_tye_trans() - set protocol using eth trans os API
2997  * @nbuf: Pointer to network buffer
2998  *
2999  * Return: None
3000  */
3001 static inline
3002 void qdf_nbuf_set_protocol_eth_tye_trans(qdf_nbuf_t nbuf)
3003 {
3004 	__qdf_nbuf_set_protocol_eth_type_trans(nbuf);
3005 }
3006 
3007 /**
3008  * qdf_nbuf_peek_header() - return the data pointer & length of the header
3009  * @buf: Network nbuf
3010  * @addr: Data pointer
3011  * @len: Length of the data
3012  *
3013  * Return: none
3014  */
3015 static inline void
3016 qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len)
3017 {
3018 	__qdf_nbuf_peek_header(buf, addr, len);
3019 }
3020 
3021 /* nbuf queue routines */
3022 
3023 /**
3024  * qdf_nbuf_queue_init() - initialize buf queue
3025  * @head: Network buf queue head
3026  *
3027  * Return: none
3028  */
3029 static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head)
3030 {
3031 	__qdf_nbuf_queue_init(head);
3032 }
3033 
3034 /**
3035  * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue
3036  * @head: Network buf queue head
3037  * @buf: Network buf
3038  *
3039  * Return: none
3040  */
3041 static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
3042 {
3043 	__qdf_nbuf_queue_add(head, buf);
3044 }
3045 
3046 /**
3047  * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue
3048  * @head: Network buf queue head
3049  * @buf: Network buf
3050  *
3051  * Return: none
3052  */
3053 static inline void
3054 qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
3055 {
3056 	__qdf_nbuf_queue_insert_head(head, buf);
3057 }
3058 
3059 /**
3060  * qdf_nbuf_queue_remove_last() - remove last nbuf from queue
3061  * @head: Network buf queue head
3062  *
3063  * Return: none
3064  */
3065 static inline qdf_nbuf_t qdf_nbuf_queue_remove_last(qdf_nbuf_queue_t *head)
3066 {
3067 	return __qdf_nbuf_queue_remove_last(head);
3068 }
3069 
3070 /**
3071  * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue
3072  * @head: Network buf queue head
3073  *
3074  * Return: The head buf in the buf queue.
3075  */
3076 static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head)
3077 {
3078 	return __qdf_nbuf_queue_remove(head);
3079 }
3080 
3081 /**
3082  * qdf_nbuf_queue_len() - get the length of the queue
3083  * @head: Network buf queue head
3084  *
3085  * Return: length of the queue
3086  */
3087 static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head)
3088 {
3089 	return __qdf_nbuf_queue_len(head);
3090 }
3091 
3092 /**
3093  * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer
3094  * @buf: Network buffer
3095  *
3096  * Return: next buffer/packet
3097  */
3098 static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf)
3099 {
3100 	return __qdf_nbuf_queue_next(buf);
3101 }
3102 
3103 /**
3104  * qdf_nbuf_is_queue_empty() - check if the buf queue is empty
3105  * @nbq: Network buf queue handle
3106  *
3107  * Return: true  if queue is empty
3108  *	   false if queue is not empty
3109  */
3110 static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq)
3111 {
3112 	return __qdf_nbuf_is_queue_empty(nbq);
3113 }
3114 
3115 static inline qdf_nbuf_queue_t *
3116 qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src)
3117 {
3118 	return __qdf_nbuf_queue_append(dest, src);
3119 }
3120 
3121 static inline void
3122 qdf_nbuf_queue_free(qdf_nbuf_queue_t *head)
3123 {
3124 	qdf_nbuf_t  buf = NULL;
3125 
3126 	while ((buf = qdf_nbuf_queue_remove(head)) != NULL)
3127 		qdf_nbuf_free(buf);
3128 }
3129 
3130 static inline qdf_nbuf_t
3131 qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
3132 {
3133 	return __qdf_nbuf_queue_first(head);
3134 }
3135 
3136 static inline qdf_nbuf_t
3137 qdf_nbuf_queue_last(qdf_nbuf_queue_t *head)
3138 {
3139 	return __qdf_nbuf_queue_last(head);
3140 }
3141 
3142 /**
3143  * qdf_nbuf_get_protocol() - return the protocol value of the skb
3144  * @skb: Pointer to network buffer
3145  *
3146  * Return: skb protocol
3147  */
3148 static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb)
3149 {
3150 	return __qdf_nbuf_get_protocol(skb);
3151 }
3152 
3153 /**
3154  * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb
3155  * @skb: Pointer to network buffer
3156  *
3157  * Return: skb ip_summed
3158  */
3159 static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb)
3160 {
3161 	return __qdf_nbuf_get_ip_summed(skb);
3162 }
3163 
3164 /**
3165  * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb
3166  * @skb: Pointer to network buffer
3167  * @ip_summed: ip checksum
3168  *
3169  * Return: none
3170  */
3171 static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb,
3172 	uint8_t ip_summed)
3173 {
3174 	__qdf_nbuf_set_ip_summed(skb, ip_summed);
3175 }
3176 
3177 /**
3178  * qdf_nbuf_set_next() - add a packet to a linked list
3179  * @this_buf: Predecessor buffer
3180  * @next_buf: Successor buffer
3181  *
3182  * This function can be used to directly link nbufs, rather than using
3183  * a separate network buffer queue object.
3184  *
3185  * Return: none
3186  */
3187 static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
3188 {
3189 	__qdf_nbuf_set_next(this_buf, next_buf);
3190 }
3191 
3192 /* nbuf extension routines */
3193 
3194 /**
3195  * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new
3196  *			nbuf
3197  * @this_buf: predecessor buffer
3198  * @next_buf: successor buffer
3199  *
3200  * This function is used to link up many nbufs containing a single logical
3201  * packet - not a collection of packets. Do not use for linking the first
3202  * extension to the head
3203  *
3204  * Return: none
3205  */
3206 static inline void
3207 qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
3208 {
3209 	__qdf_nbuf_set_next_ext(this_buf, next_buf);
3210 }
3211 
3212 /**
3213  * qdf_nbuf_next_ext() - get the next packet extension in the linked list
3214  * @buf: Network buffer
3215  *
3216  * Return: Next network buffer in the linked list
3217  */
3218 static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf)
3219 {
3220 	return __qdf_nbuf_next_ext(buf);
3221 }
3222 
3223 /**
3224  * qdf_nbuf_append_ext_list() - link list of packet extensions to the head
3225  *				segment
3226  * @head_buf: Network buf holding head segment (single)
3227  * @ext_list: Network buf list holding linked extensions to the head
3228  * @ext_len: Total length of all buffers in the extension list
3229  *
3230  * This function is used to link up a list of packet extensions (seg1, 2,
3231  * ...) to the nbuf holding the head segment (seg0)
3232  *
3233  * Return: none
3234  */
3235 static inline void
3236 qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
3237 			qdf_size_t ext_len)
3238 {
3239 	__qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
3240 }
3241 
3242 /**
3243  * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
3244  * @head_buf: Network buf holding head segment (single)
3245  *
3246  * This ext_list is populated when we have Jumbo packet, for example in case of
3247  * monitor mode amsdu packet reception, and are stiched using frags_list.
3248  *
3249  * Return: Network buf list holding linked extensions from head buf.
3250  */
3251 static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
3252 {
3253 	return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
3254 }
3255 
3256 /**
3257  * qdf_nbuf_get_shinfo() - gets the shared info of head buf
3258  * @head_buf: Network buffer
3259  *
3260  * Return: shared info of head buf
3261  */
3262 static inline qdf_nbuf_shared_info_t qdf_nbuf_get_shinfo(qdf_nbuf_t head_buf)
3263 {
3264 	return (qdf_nbuf_shared_info_t)__qdf_nbuf_get_shinfo(head_buf);
3265 }
3266 
3267 /**
3268  * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
3269  * @buf: Network buffer
3270  *
3271  * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame
3272  */
3273 static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf)
3274 {
3275 	return __qdf_nbuf_get_tx_cksum(buf);
3276 }
3277 
3278 /**
3279  * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to
3280  *			indicate checksum info to the stack.
3281  * @buf: Network buffer
3282  * @cksum: Checksum
3283  *
3284  * Return: none
3285  */
3286 static inline void
3287 qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum)
3288 {
3289 	__qdf_nbuf_set_rx_cksum(buf, cksum);
3290 }
3291 
3292 /**
3293  * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf
3294  * @buf: Network buffer
3295  *
3296  * Return: TID value
3297  */
3298 static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf)
3299 {
3300 	return __qdf_nbuf_get_tid(buf);
3301 }
3302 
3303 /**
3304  * qdf_nbuf_set_tid() - this function sets the TID value in nbuf
3305  * @buf: Network buffer
3306  * @tid: TID value
3307  *
3308  * Return: none
3309  */
3310 static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid)
3311 {
3312 	__qdf_nbuf_set_tid(buf, tid);
3313 }
3314 
3315 /**
3316  * qdf_nbuf_get_exemption_type() - this function extracts the exemption type
3317  *				from nbuf
3318  * @buf: Network buffer
3319  *
3320  * Return: Exemption type
3321  */
3322 static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf)
3323 {
3324 	return __qdf_nbuf_get_exemption_type(buf);
3325 }
3326 
3327 /**
3328  * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given
3329  *			offset
3330  * @buf: Network buffer
3331  * @proto: Protocol
3332  *
3333  * Return: none
3334  */
3335 static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto)
3336 {
3337 	__qdf_nbuf_set_protocol(buf, proto);
3338 }
3339 
3340 /**
3341  * qdf_nbuf_trace_get_proto_type() - this function return packet proto type
3342  * @buf: Network buffer
3343  *
3344  * Return: Packet protocol type
3345  */
3346 static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
3347 {
3348 	return __qdf_nbuf_trace_get_proto_type(buf);
3349 }
3350 
3351 /**
3352  * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
3353  * @cb_func_ptr: Callback pointer
3354  *
3355  * Return: none
3356  */
3357 static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
3358 {
3359 	__qdf_nbuf_reg_trace_cb(cb_func_ptr);
3360 }
3361 
3362 
3363 /**
3364  * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download
3365  * @buf: Network buffer
3366  * @candi: Candidate of parallel download frame
3367  *
3368  * This function stores a flag specifying this TX frame is suitable for
3369  * downloading though a 2nd TX data pipe that is used for short frames for
3370  * protocols that can accept out-of-order delivery.
3371  *
3372  * Return: none
3373  */
3374 static inline void
3375 qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi)
3376 {
3377 	__qdf_nbuf_set_tx_htt2_frm(buf, candi);
3378 }
3379 
3380 /**
3381  * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download
3382  * @buf: Network buffer
3383  *
3384  * This function return whether this TX frame is allow to download though a 2nd
3385  * TX data pipe or not.
3386  *
3387  * Return: none
3388  */
3389 static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf)
3390 {
3391 	return __qdf_nbuf_get_tx_htt2_frm(buf);
3392 }
3393 
3394 /**
3395  * qdf_nbuf_get_dhcp_subtype() - get the subtype
3396  *              of DHCP packet.
3397  * @buf: Pointer to DHCP packet buffer
3398  *
3399  * This func. returns the subtype of DHCP packet.
3400  *
3401  * Return: subtype of the DHCP packet.
3402  */
3403 static inline enum qdf_proto_subtype
3404 qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf)
3405 {
3406 	return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf));
3407 }
3408 
3409 /**
3410  * qdf_nbuf_data_get_dhcp_subtype() - get the subtype
3411  *              of DHCP packet.
3412  * @data: Pointer to DHCP packet data buffer
3413  *
3414  * This func. returns the subtype of DHCP packet.
3415  *
3416  * Return: subtype of the DHCP packet.
3417  */
3418 static inline enum qdf_proto_subtype
3419 qdf_nbuf_data_get_dhcp_subtype(uint8_t *data)
3420 {
3421 	return __qdf_nbuf_data_get_dhcp_subtype(data);
3422 }
3423 
3424 /**
3425  * qdf_nbuf_get_eapol_subtype() - get the subtype
3426  *            of EAPOL packet.
3427  * @buf: Pointer to EAPOL packet buffer
3428  *
3429  * This func. returns the subtype of EAPOL packet.
3430  *
3431  * Return: subtype of the EAPOL packet.
3432  */
3433 static inline enum qdf_proto_subtype
3434 qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf)
3435 {
3436 	return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf));
3437 }
3438 
3439 /**
3440  * qdf_nbuf_data_get_eapol_subtype() - get the subtype
3441  *            of EAPOL packet.
3442  * @data: Pointer to EAPOL packet data buffer
3443  *
3444  * This func. returns the subtype of EAPOL packet.
3445  *
3446  * Return: subtype of the EAPOL packet.
3447  */
3448 static inline enum qdf_proto_subtype
3449 qdf_nbuf_data_get_eapol_subtype(uint8_t *data)
3450 {
3451 	return __qdf_nbuf_data_get_eapol_subtype(data);
3452 }
3453 
3454 /**
3455  * qdf_nbuf_get_arp_subtype() - get the subtype
3456  *            of ARP packet.
3457  * @buf: Pointer to ARP packet buffer
3458  *
3459  * This func. returns the subtype of ARP packet.
3460  *
3461  * Return: subtype of the ARP packet.
3462  */
3463 static inline enum qdf_proto_subtype
3464 qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf)
3465 {
3466 	return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf));
3467 }
3468 
3469 /**
3470  * qdf_nbuf_data_get_arp_subtype() - get the subtype
3471  *            of ARP packet.
3472  * @data: Pointer to ARP packet data buffer
3473  *
3474  * This func. returns the subtype of ARP packet.
3475  *
3476  * Return: subtype of the ARP packet.
3477  */
3478 static inline enum qdf_proto_subtype
3479 qdf_nbuf_data_get_arp_subtype(uint8_t *data)
3480 {
3481 	return __qdf_nbuf_data_get_arp_subtype(data);
3482 }
3483 
3484 /**
3485  * qdf_nbuf_get_icmp_subtype() - get the subtype
3486  *            of IPV4 ICMP packet.
3487  * @buf: Pointer to IPV4 ICMP packet buffer
3488  *
3489  * This func. returns the subtype of ICMP packet.
3490  *
3491  * Return: subtype of the ICMP packet.
3492  */
3493 static inline enum qdf_proto_subtype
3494 qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf)
3495 {
3496 	return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf));
3497 }
3498 
3499 /**
3500  * qdf_nbuf_data_get_icmp_subtype() - get the subtype
3501  *            of IPV4 ICMP packet.
3502  * @data: Pointer to IPV4 ICMP packet data buffer
3503  *
3504  * This func. returns the subtype of ICMP packet.
3505  *
3506  * Return: subtype of the ICMP packet.
3507  */
3508 static inline enum qdf_proto_subtype
3509 qdf_nbuf_data_get_icmp_subtype(uint8_t *data)
3510 {
3511 	return __qdf_nbuf_data_get_icmp_subtype(data);
3512 }
3513 
3514 /**
3515  * qdf_nbuf_get_icmpv6_subtype() - get the subtype
3516  *            of IPV6 ICMPV6 packet.
3517  * @buf: Pointer to IPV6 ICMPV6 packet buffer
3518  *
3519  * This func. returns the subtype of ICMPV6 packet.
3520  *
3521  * Return: subtype of the ICMPV6 packet.
3522  */
3523 static inline enum qdf_proto_subtype
3524 qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf)
3525 {
3526 	return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf));
3527 }
3528 
3529 /**
3530  * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype
3531  *            of IPV6 ICMPV6 packet.
3532  * @data: Pointer to IPV6 ICMPV6 packet data buffer
3533  *
3534  * This func. returns the subtype of ICMPV6 packet.
3535  *
3536  * Return: subtype of the ICMPV6 packet.
3537  */
3538 static inline enum qdf_proto_subtype
3539 qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data)
3540 {
3541 	return __qdf_nbuf_data_get_icmpv6_subtype(data);
3542 }
3543 
3544 /**
3545  * qdf_nbuf_is_ipv4_last_fragment() - Check if IPV4 packet is last fragment
3546  * @nbuf: Network buffer
3547  *
3548  * This function check if IPV4 packet is last fragment or not.
3549  * Caller has to call this function for ipv4 packets only.
3550  *
3551  * Return: True if ipv4 packet is last fragment otherwise false
3552  */
3553 static inline bool
3554 qdf_nbuf_is_ipv4_last_fragment(qdf_nbuf_t nbuf)
3555 {
3556 	return __qdf_nbuf_is_ipv4_last_fragment(nbuf);
3557 }
3558 
3559 /**
3560  * qdf_nbuf_data_set_ipv4_tos() - set the TOS field of IPV4 packet.
3561  *
3562  * @data: Pointer to IPV4 packet data buffer
3563  * @tos: TOS value to be set in IPV4 packet
3564  *
3565  * This func. set the TOS field of IPV4 packet.
3566  *
3567  * Return: None
3568  */
3569 static inline void
3570 qdf_nbuf_data_set_ipv4_tos(uint8_t *data, uint8_t tos)
3571 {
3572 	__qdf_nbuf_data_set_ipv4_tos(data, tos);
3573 }
3574 
3575 /**
3576  * qdf_nbuf_data_get_ipv4_tos() - get the TOS field of IPV4 packet.
3577  *
3578  * @data: Pointer to IPV4 packet data buffer
3579  *
3580  * This func. returns the TOS field of IPV4 packet.
3581  *
3582  * Return: TOS of IPV4 packet.
3583  */
3584 static inline uint8_t
3585 qdf_nbuf_data_get_ipv4_tos(uint8_t *data)
3586 {
3587 	return __qdf_nbuf_data_get_ipv4_tos(data);
3588 }
3589 
3590 /**
3591  * qdf_nbuf_data_get_ipv4_proto() - get the proto type
3592  *            of IPV4 packet.
3593  * @data: Pointer to IPV4 packet data buffer
3594  *
3595  * This func. returns the proto type of IPV4 packet.
3596  *
3597  * Return: proto type of IPV4 packet.
3598  */
3599 static inline uint8_t
3600 qdf_nbuf_data_get_ipv4_proto(uint8_t *data)
3601 {
3602 	return __qdf_nbuf_data_get_ipv4_proto(data);
3603 }
3604 
3605 /**
3606  * qdf_nbuf_data_set_ipv6_tc() - set the TC field
3607  *                               of IPV6 packet.
3608  * @data: Pointer to IPV6 packet data buffer
3609  * @tc: Value to IPV6 packet TC field
3610  *
3611  * This func. set the TC field of IPV6 packet.
3612  *
3613  * Return: None
3614  */
3615 static inline void
3616 qdf_nbuf_data_set_ipv6_tc(uint8_t *data, uint8_t tc)
3617 {
3618 	__qdf_nbuf_data_set_ipv6_tc(data, tc);
3619 }
3620 
3621 /**
3622  * qdf_nbuf_data_get_ipv6_tc() - get the TC field
3623  *                               of IPV6 packet.
3624  * @data: Pointer to IPV6 packet data buffer
3625  *
3626  * This func. returns the TC field of IPV6 packet.
3627  *
3628  * Return: Traffic classification field of IPV6 packet.
3629  */
3630 static inline uint8_t
3631 qdf_nbuf_data_get_ipv6_tc(uint8_t *data)
3632 {
3633 	return __qdf_nbuf_data_get_ipv6_tc(data);
3634 }
3635 
3636 /**
3637  * qdf_nbuf_data_get_ipv6_proto() - get the proto type
3638  *            of IPV6 packet.
3639  * @data: Pointer to IPV6 packet data buffer
3640  *
3641  * This func. returns the proto type of IPV6 packet.
3642  *
3643  * Return: proto type of IPV6 packet.
3644  */
3645 static inline uint8_t
3646 qdf_nbuf_data_get_ipv6_proto(uint8_t *data)
3647 {
3648 	return __qdf_nbuf_data_get_ipv6_proto(data);
3649 }
3650 
3651 /**
3652  * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not
3653  * @buf:  buffer
3654  *
3655  * This api is for Tx packets.
3656  *
3657  * Return: true if packet is ipv4 packet
3658  */
3659 static inline
3660 bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf)
3661 {
3662 	return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf));
3663 }
3664 
3665 /**
3666  * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not
3667  * @data:  data
3668  *
3669  * This api is for Tx packets.
3670  *
3671  * Return: true if packet is ipv4 packet
3672  */
3673 static inline
3674 bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data)
3675 {
3676 	return __qdf_nbuf_data_is_ipv4_pkt(data);
3677 }
3678 
3679 /**
3680  * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not
3681  * @buf:  buffer
3682  *
3683  * This api is for ipv4 packet.
3684  *
3685  * Return: true if packet is DHCP packet
3686  */
3687 static inline
3688 bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf)
3689 {
3690 	return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf));
3691 }
3692 
3693 /**
3694  * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet.
3695  * @data: Pointer to DHCP packet data buffer
3696  *
3697  * This func. checks whether it is a DHCP packet or not.
3698  *
3699  * Return: true if it is a DHCP packet
3700  *         false if not
3701  */
3702 static inline
3703 bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data)
3704 {
3705 	return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data);
3706 }
3707 
3708 /**
3709  * qdf_nbuf_is_ipv6_mdns_pkt() - check if it is MDNS packet.
3710  * @buf: Pointer to packet data buffer
3711  *
3712  * This func. checks whether it is a MDNS packet or not.
3713  *
3714  * Return: true if it is a MDNS packet, false if not
3715  */
3716 static inline
3717 bool qdf_nbuf_is_ipv6_mdns_pkt(qdf_nbuf_t buf)
3718 {
3719 	return __qdf_nbuf_data_is_ipv6_mdns_pkt(qdf_nbuf_data(buf));
3720 }
3721 
3722 /**
3723  * qdf_nbuf_is_ipv6_dhcp_pkt() - check if it is DHCP packet.
3724  * @buf: Pointer to DHCP packet data buffer
3725  *
3726  * This func. checks whether it is a DHCP packet or not.
3727  *
3728  * Return: true if it is a DHCP packet
3729  *         false if not
3730  */
3731 static inline
3732 bool qdf_nbuf_is_ipv6_dhcp_pkt(qdf_nbuf_t buf)
3733 {
3734 	return __qdf_nbuf_data_is_ipv6_dhcp_pkt(qdf_nbuf_data(buf));
3735 }
3736 
3737 /**
3738  * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not
3739  * @buf:  buffer
3740  *
3741  * This api is for ipv4 packet.
3742  *
3743  * Return: true if packet is EAPOL packet
3744  */
3745 static inline
3746 bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf)
3747 {
3748 	return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf));
3749 }
3750 
3751 /**
3752  * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet.
3753  * @data: Pointer to EAPOL packet data buffer
3754  *
3755  * This func. checks whether it is a EAPOL packet or not.
3756  *
3757  * Return: true if it is a EAPOL packet
3758  *         false if not
3759  */
3760 static inline
3761 bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data)
3762 {
3763 	return __qdf_nbuf_data_is_ipv4_eapol_pkt(data);
3764 }
3765 
3766 /**
3767  * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not
3768  * @buf:  buffer
3769  *
3770  * This api is for ipv4 packet.
3771  *
3772  * Return: true if packet is WAPI packet
3773  */
3774 static inline
3775 bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf)
3776 {
3777 	return __qdf_nbuf_is_ipv4_wapi_pkt(buf);
3778 }
3779 
3780 /**
3781  * qdf_nbuf_is_ipv4_igmp_pkt() - check if packet is a igmp packet or not
3782  * @buf:  buffer
3783  *
3784  * This api is for ipv4 packet.
3785  *
3786  * Return: true if packet is igmp packet
3787  */
3788 static inline
3789 bool qdf_nbuf_is_ipv4_igmp_pkt(qdf_nbuf_t buf)
3790 {
3791 	return __qdf_nbuf_data_is_ipv4_igmp_pkt(qdf_nbuf_data(buf));
3792 }
3793 
3794 /**
3795  * qdf_nbuf_is_ipv6_igmp_pkt() - check if packet is a igmp packet or not
3796  * @buf:  buffer
3797  *
3798  * This api is for ipv6 packet.
3799  *
3800  * Return: true if packet is igmp packet
3801  */
3802 static inline
3803 bool qdf_nbuf_is_ipv6_igmp_pkt(qdf_nbuf_t buf)
3804 {
3805 	return __qdf_nbuf_data_is_ipv6_igmp_pkt(qdf_nbuf_data(buf));
3806 }
3807 
3808 /**
3809  * qdf_nbuf_is_ipv4_igmp_leave_pkt() - check if it is a igmp leave packet or not
3810  * @buf:  buffer
3811  *
3812  * This api is for ipv4 packet.
3813  *
3814  * Return: true if packet is igmp packet
3815  */
3816 static inline
3817 bool qdf_nbuf_is_ipv4_igmp_leave_pkt(qdf_nbuf_t buf)
3818 {
3819 	return __qdf_nbuf_is_ipv4_igmp_leave_pkt(buf);
3820 }
3821 
3822 /**
3823  * qdf_nbuf_is_ipv6_igmp_leave_pkt() - check if it is a igmp leave packet or not
3824  * @buf:  buffer
3825  *
3826  * This api is for ipv6 packet.
3827  *
3828  * Return: true if packet is igmp packet
3829  */
3830 static inline
3831 bool qdf_nbuf_is_ipv6_igmp_leave_pkt(qdf_nbuf_t buf)
3832 {
3833 	return __qdf_nbuf_is_ipv6_igmp_leave_pkt(buf);
3834 }
3835 
3836 /**
3837  * qdf_nbuf_is_ipv4_tdls_pkt() - check if packet is a tdls packet or not
3838  * @buf:  buffer
3839  *
3840  * This api is for ipv4 packet.
3841  *
3842  * Return: true if packet is TDLS packet
3843  */
3844 static inline
3845 bool qdf_nbuf_is_ipv4_tdls_pkt(qdf_nbuf_t buf)
3846 {
3847 	return __qdf_nbuf_is_ipv4_tdls_pkt(buf);
3848 }
3849 
3850 /**
3851  * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not
3852  * @buf:  buffer
3853  *
3854  * This api is for ipv4 packet.
3855  *
3856  * Return: true if packet is ARP packet
3857  */
3858 static inline
3859 bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf)
3860 {
3861 	return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf));
3862 }
3863 
3864 /**
3865  * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet.
3866  * @data: Pointer to ARP packet data buffer
3867  *
3868  * This func. checks whether it is a ARP packet or not.
3869  *
3870  * Return: TRUE if it is a ARP packet
3871  *         FALSE if not
3872  */
3873 static inline
3874 bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data)
3875 {
3876 	return __qdf_nbuf_data_is_ipv4_arp_pkt(data);
3877 }
3878 
3879 /**
3880  * qdf_nbuf_data_is_arp_req() - check if ARP packet is request.
3881  * @buf:  buffer
3882  *
3883  * This func. checks whether it is a ARP request or not.
3884  *
3885  * Return: true if it is a ARP request or FALSE if not
3886  */
3887 static inline
3888 bool qdf_nbuf_data_is_arp_req(qdf_nbuf_t buf)
3889 {
3890 	return __qdf_nbuf_data_is_arp_req(qdf_nbuf_data(buf));
3891 }
3892 
3893 /**
3894  * qdf_nbuf_data_is_arp_rsp() - check if ARP packet is response.
3895  * @buf:  buffer
3896  *
3897  * This func. checks whether it is a ARP response or not.
3898  *
3899  * Return: true if it is a ARP response or FALSE if not
3900  */
3901 static inline
3902 bool qdf_nbuf_data_is_arp_rsp(qdf_nbuf_t buf)
3903 {
3904 	return __qdf_nbuf_data_is_arp_rsp(qdf_nbuf_data(buf));
3905 }
3906 
3907 /**
3908  * qdf_nbuf_get_arp_src_ip() - get ARP packet source IP gateway.
3909  * @buf:  buffer
3910  *
3911  * Return: ARP packet source IP value.
3912  */
3913 static inline
3914 uint32_t qdf_nbuf_get_arp_src_ip(qdf_nbuf_t buf)
3915 {
3916 	return __qdf_nbuf_get_arp_src_ip(qdf_nbuf_data(buf));
3917 }
3918 
3919 /**
3920  * qdf_nbuf_get_arp_tgt_ip() - get ARP packet target IP gateway.
3921  * @buf:  buffer
3922  *
3923  * Return: ARP packet target IP value.
3924  */
3925 static inline
3926 uint32_t qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_t buf)
3927 {
3928 	return __qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_data(buf));
3929 }
3930 
3931 /**
3932  * qdf_nbuf_get_dns_domain_name() - get dns domain name of required length
3933  * @buf: buffer
3934  * @len: length to copy
3935  *
3936  * Return: dns domain name
3937  */
3938 static inline
3939 uint8_t *qdf_nbuf_get_dns_domain_name(qdf_nbuf_t buf, uint32_t len)
3940 {
3941 	return __qdf_nbuf_get_dns_domain_name(qdf_nbuf_data(buf), len);
3942 }
3943 
3944 /**
3945  * qdf_nbuf_data_is_dns_query() - check if skb data is a dns query
3946  * @buf: buffer
3947  *
3948  * Return: true if packet is dns query packet.
3949  *	   false otherwise.
3950  */
3951 static inline
3952 bool qdf_nbuf_data_is_dns_query(qdf_nbuf_t buf)
3953 {
3954 	return __qdf_nbuf_data_is_dns_query(qdf_nbuf_data(buf));
3955 }
3956 
3957 /**
3958  * qdf_nbuf_data_is_dns_response() - check if skb data is a dns response
3959  * @buf:  buffer
3960  *
3961  * Return: true if packet is dns response packet.
3962  *	   false otherwise.
3963  */
3964 static inline
3965 bool qdf_nbuf_data_is_dns_response(qdf_nbuf_t buf)
3966 {
3967 	return __qdf_nbuf_data_is_dns_response(qdf_nbuf_data(buf));
3968 }
3969 
3970 /**
3971  * qdf_nbuf_data_is_tcp_fin() - check if skb data is a tcp fin
3972  * @buf:  buffer
3973  *
3974  * Return: true if packet is tcp fin packet.
3975  *	   false otherwise.
3976  */
3977 static inline
3978 bool qdf_nbuf_data_is_tcp_fin(qdf_nbuf_t buf)
3979 {
3980 	return __qdf_nbuf_data_is_tcp_fin(qdf_nbuf_data(buf));
3981 }
3982 
3983 /**
3984  * qdf_nbuf_data_is_tcp_fin_ack() - check if skb data is a tcp fin ack
3985  * @buf:  buffer
3986  *
3987  * Return: true if packet is tcp fin ack packet.
3988  *	   false otherwise.
3989  */
3990 static inline
3991 bool qdf_nbuf_data_is_tcp_fin_ack(qdf_nbuf_t buf)
3992 {
3993 	return __qdf_nbuf_data_is_tcp_fin_ack(qdf_nbuf_data(buf));
3994 }
3995 
3996 /**
3997  * qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn
3998  * @buf:  buffer
3999  *
4000  * Return: true if packet is tcp syn packet.
4001  *	   false otherwise.
4002  */
4003 static inline
4004 bool qdf_nbuf_data_is_tcp_syn(qdf_nbuf_t buf)
4005 {
4006 	return __qdf_nbuf_data_is_tcp_syn(qdf_nbuf_data(buf));
4007 }
4008 
4009 /**
4010  * qdf_nbuf_data_is_tcp_syn_ack() - check if skb data is a tcp syn ack
4011  * @buf:  buffer
4012  *
4013  * Return: true if packet is tcp syn ack packet.
4014  *	   false otherwise.
4015  */
4016 static inline
4017 bool qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_t buf)
4018 {
4019 	return __qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_data(buf));
4020 }
4021 
4022 /**
4023  * qdf_nbuf_data_is_tcp_rst() - check if skb data is a tcp rst
4024  * @buf:  buffer
4025  *
4026  * Return: true if packet is tcp rst packet.
4027  *	   false otherwise.
4028  */
4029 static inline
4030 bool qdf_nbuf_data_is_tcp_rst(qdf_nbuf_t buf)
4031 {
4032 	return __qdf_nbuf_data_is_tcp_rst(qdf_nbuf_data(buf));
4033 }
4034 
4035 /**
4036  * qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack
4037  * @buf:  buffer
4038  *
4039  * Return: true if packet is tcp ack packet.
4040  *	   false otherwise.
4041  */
4042 static inline
4043 bool qdf_nbuf_data_is_tcp_ack(qdf_nbuf_t buf)
4044 {
4045 	return __qdf_nbuf_data_is_tcp_ack(qdf_nbuf_data(buf));
4046 }
4047 
4048 /**
4049  * qdf_nbuf_data_get_tcp_src_port() - get tcp src port
4050  * @buf:  buffer
4051  *
4052  * Return: tcp source port value.
4053  */
4054 static inline
4055 uint16_t qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_t buf)
4056 {
4057 	return __qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_data(buf));
4058 }
4059 
4060 /**
4061  * qdf_nbuf_data_get_tcp_dst_port() - get tcp dst port
4062  * @buf:  buffer
4063  *
4064  * Return: tcp destination port value.
4065  */
4066 static inline
4067 uint16_t qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_t buf)
4068 {
4069 	return __qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_data(buf));
4070 }
4071 
4072 /**
4073  * qdf_nbuf_data_is_icmpv4_req() - check if ICMPv4 packet is request.
4074  * @buf:  buffer
4075  *
4076  * This func. checks whether it is a ICMPv4 request or not.
4077  *
4078  * Return: true if it is a ICMPv4 request or fALSE if not
4079  */
4080 static inline
4081 bool qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_t buf)
4082 {
4083 	return __qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_data(buf));
4084 }
4085 
4086 /**
4087  * qdf_nbuf_data_is_icmpv4_rsp() - check if ICMPv4 packet is res
4088  * @buf:  buffer
4089  *
4090  * Return: true if packet is icmpv4 response
4091  *	   false otherwise.
4092  */
4093 static inline
4094 bool qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_t buf)
4095 {
4096 	return __qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_data(buf));
4097 }
4098 
4099 static inline
4100 bool qdf_nbuf_is_icmpv4_redirect(qdf_nbuf_t buf)
4101 {
4102 	return __qdf_nbuf_data_is_icmpv4_redirect(qdf_nbuf_data(buf));
4103 }
4104 
4105 /**
4106  * qdf_nbuf_get_icmpv4_src_ip() - get icmpv4 src IP
4107  * @buf:  buffer
4108  *
4109  * Return: icmpv4 packet source IP value.
4110  */
4111 static inline
4112 uint32_t qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_t buf)
4113 {
4114 	return __qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_data(buf));
4115 }
4116 
4117 /**
4118  * qdf_nbuf_get_icmpv4_tgt_ip() - get icmpv4 target IP
4119  * @buf:  buffer
4120  *
4121  * Return: icmpv4 packet target IP value.
4122  */
4123 static inline
4124 uint32_t qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_t buf)
4125 {
4126 	return __qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_data(buf));
4127 }
4128 
4129 /**
4130  * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet.
4131  * @buf: Pointer to IPV6 packet buffer
4132  *
4133  * This func. checks whether it is a IPV6 packet or not.
4134  *
4135  * Return: TRUE if it is a IPV6 packet
4136  *         FALSE if not
4137  */
4138 static inline
4139 bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf)
4140 {
4141 	return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf));
4142 }
4143 
4144 static inline
4145 bool qdf_nbuf_is_icmpv6_redirect(qdf_nbuf_t buf)
4146 {
4147 	return __qdf_nbuf_data_is_icmpv6_redirect(qdf_nbuf_data(buf));
4148 }
4149 /**
4150  * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet.
4151  * @data: Pointer to IPV6 packet data buffer
4152  *
4153  * This func. checks whether it is a IPV6 packet or not.
4154  *
4155  * Return: TRUE if it is a IPV6 packet
4156  *         FALSE if not
4157  */
4158 static inline
4159 bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data)
4160 {
4161 	return __qdf_nbuf_data_is_ipv6_pkt(data);
4162 }
4163 
4164 /**
4165  * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet.
4166  * @data: Pointer to IPV4 packet data buffer
4167  *
4168  * This func. checks whether it is a IPV4 multicast packet or not.
4169  *
4170  * Return: TRUE if it is a IPV4 multicast packet
4171  *         FALSE if not
4172  */
4173 static inline
4174 bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data)
4175 {
4176 	return __qdf_nbuf_data_is_ipv4_mcast_pkt(data);
4177 }
4178 
4179 /**
4180  * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet.
4181  * @data: Pointer to IPV6 packet data buffer
4182  *
4183  * This func. checks whether it is a IPV6 multicast packet or not.
4184  *
4185  * Return: TRUE if it is a IPV6 multicast packet
4186  *         FALSE if not
4187  */
4188 static inline
4189 bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data)
4190 {
4191 	return __qdf_nbuf_data_is_ipv6_mcast_pkt(data);
4192 }
4193 
4194 /**
4195  * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet.
4196  * @buf: Pointer to IPV4 ICMP packet buffer
4197  *
4198  * This func. checks whether it is a ICMP packet or not.
4199  *
4200  * Return: TRUE if it is a ICMP packet
4201  *         FALSE if not
4202  */
4203 static inline
4204 bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf)
4205 {
4206 	return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf));
4207 }
4208 
4209 /**
4210  * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet.
4211  * @data: Pointer to IPV4 ICMP packet data buffer
4212  *
4213  * This func. checks whether it is a ICMP packet or not.
4214  *
4215  * Return: TRUE if it is a ICMP packet
4216  *         FALSE if not
4217  */
4218 static inline
4219 bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data)
4220 {
4221 	return __qdf_nbuf_data_is_icmp_pkt(data);
4222 }
4223 
4224 /**
4225  * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
4226  * @buf: Pointer to IPV6 ICMPV6 packet buffer
4227  *
4228  * This func. checks whether it is a ICMPV6 packet or not.
4229  *
4230  * Return: TRUE if it is a ICMPV6 packet
4231  *         FALSE if not
4232  */
4233 static inline
4234 bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf)
4235 {
4236 	return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf));
4237 }
4238 
4239 /**
4240  * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
4241  * @data: Pointer to IPV6 ICMPV6 packet data buffer
4242  *
4243  * This func. checks whether it is a ICMPV6 packet or not.
4244  *
4245  * Return: TRUE if it is a ICMPV6 packet
4246  *         FALSE if not
4247  */
4248 static inline
4249 bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data)
4250 {
4251 	return __qdf_nbuf_data_is_icmpv6_pkt(data);
4252 }
4253 
4254 /**
4255  * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
4256  * @buf: Pointer to IPV4 UDP packet buffer
4257  *
4258  * This func. checks whether it is a IPV4 UDP packet or not.
4259  *
4260  * Return: TRUE if it is a IPV4 UDP packet
4261  *         FALSE if not
4262  */
4263 static inline
4264 bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf)
4265 {
4266 	return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf));
4267 }
4268 
4269 /**
4270  * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
4271  * @data: Pointer to IPV4 UDP packet data buffer
4272  *
4273  * This func. checks whether it is a IPV4 UDP packet or not.
4274  *
4275  * Return: TRUE if it is a IPV4 UDP packet
4276  *         FALSE if not
4277  */
4278 static inline
4279 bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data)
4280 {
4281 	return __qdf_nbuf_data_is_ipv4_udp_pkt(data);
4282 }
4283 
4284 /**
4285  * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
4286  * @buf: Pointer to IPV4 TCP packet buffer
4287  *
4288  * This func. checks whether it is a IPV4 TCP packet or not.
4289  *
4290  * Return: TRUE if it is a IPV4 TCP packet
4291  *         FALSE if not
4292  */
4293 static inline
4294 bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf)
4295 {
4296 	return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf));
4297 }
4298 
4299 /**
4300  * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
4301  * @data: Pointer to IPV4 TCP packet data buffer
4302  *
4303  * This func. checks whether it is a IPV4 TCP packet or not.
4304  *
4305  * Return: TRUE if it is a IPV4 TCP packet
4306  *         FALSE if not
4307  */
4308 static inline
4309 bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data)
4310 {
4311 	return __qdf_nbuf_data_is_ipv4_tcp_pkt(data);
4312 }
4313 
4314 /**
4315  * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
4316  * @buf: Pointer to IPV6 UDP packet buffer
4317  *
4318  * This func. checks whether it is a IPV6 UDP packet or not.
4319  *
4320  * Return: TRUE if it is a IPV6 UDP packet
4321  *         FALSE if not
4322  */
4323 static inline
4324 bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf)
4325 {
4326 	return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf));
4327 }
4328 
4329 /**
4330  * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
4331  * @data: Pointer to IPV6 UDP packet data buffer
4332  *
4333  * This func. checks whether it is a IPV6 UDP packet or not.
4334  *
4335  * Return: TRUE if it is a IPV6 UDP packet
4336  *         FALSE if not
4337  */
4338 static inline
4339 bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data)
4340 {
4341 	return __qdf_nbuf_data_is_ipv6_udp_pkt(data);
4342 }
4343 
4344 /**
4345  * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
4346  * @buf: Pointer to IPV6 TCP packet buffer
4347  *
4348  * This func. checks whether it is a IPV6 TCP packet or not.
4349  *
4350  * Return: TRUE if it is a IPV6 TCP packet
4351  *         FALSE if not
4352  */
4353 static inline
4354 bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf)
4355 {
4356 	return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf));
4357 }
4358 
4359 /**
4360  * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
4361  * @data: Pointer to IPV6 TCP packet data buffer
4362  *
4363  * This func. checks whether it is a IPV6 TCP packet or not.
4364  *
4365  * Return: TRUE if it is a IPV6 TCP packet
4366  *         FALSE if not
4367  */
4368 static inline
4369 bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data)
4370 {
4371 	return __qdf_nbuf_data_is_ipv6_tcp_pkt(data);
4372 }
4373 
4374 /**
4375  * qdf_nbuf_is_bcast_pkt() - check if it is broadcast packet.
4376  * @buf: Network buffer
4377  *
4378  * This func. checks whether packet is broadcast or not.
4379  *
4380  * Return: TRUE if it is broadcast packet
4381  *         FALSE if not
4382  */
4383 static inline
4384 bool qdf_nbuf_is_bcast_pkt(qdf_nbuf_t buf)
4385 {
4386 	return __qdf_nbuf_is_bcast_pkt(buf);
4387 }
4388 
4389 /**
4390  * qdf_nbuf_pkt_type_is_mcast() - check if skb pkt type is mcast
4391  * @buf: Network buffer
4392  *
4393  * Return: TRUE if skb pkt type is mcast
4394  *         FALSE if not
4395  */
4396 static inline
4397 bool qdf_nbuf_pkt_type_is_mcast(qdf_nbuf_t buf)
4398 {
4399 	return __qdf_nbuf_pkt_type_is_mcast(buf);
4400 }
4401 
4402 /**
4403  * qdf_nbuf_pkt_type_is_bcast() - check if skb pkt type is bcast
4404  * @buf: Network buffer
4405  *
4406  * Return: TRUE if skb pkt type is mcast
4407  *         FALSE if not
4408  */
4409 static inline
4410 bool qdf_nbuf_pkt_type_is_bcast(qdf_nbuf_t buf)
4411 {
4412 	return __qdf_nbuf_pkt_type_is_bcast(buf);
4413 }
4414 
4415 /**
4416  * qdf_nbuf_is_mcast_replay() - check if it is multicast replay packet.
4417  * @buf: Network buffer
4418  *
4419  * This func. checks whether packet is multicast replay packet or not.
4420  *
4421  * Return: TRUE if it is multicast packet
4422  *         FALSE if not
4423  */
4424 static inline
4425 bool qdf_nbuf_is_mcast_replay(qdf_nbuf_t buf)
4426 {
4427 	return __qdf_nbuf_is_mcast_replay(buf);
4428 }
4429 
4430 #ifdef DP_TX_PACKET_INSPECT_FOR_ILP
4431 /* Reuse bit24~31 in skb->priority for packet type */
4432 #define QDF_NBUF_PRIORITY_PKT_TYPE_MASK 0xFF000000
4433 #define QDF_NBUF_PRIORITY_PKT_TYPE_LSB 24
4434 /* TCP ACK */
4435 #define QDF_NBUF_PRIORITY_PKT_TCP_ACK 0x1
4436 
4437 #define QDF_NBUF_GET_PRIORITY_PKT_TYPE(_pri) \
4438 	(((_pri) & QDF_NBUF_PRIORITY_PKT_TYPE_MASK) >> \
4439 	 QDF_NBUF_PRIORITY_PKT_TYPE_LSB)
4440 
4441 #define QDF_NBUF_PRIORITY_PKT_TYPE(_pkt_type) \
4442 	(((_pkt_type) << QDF_NBUF_PRIORITY_PKT_TYPE_LSB) & \
4443 	 QDF_NBUF_PRIORITY_PKT_TYPE_MASK)
4444 
4445 /**
4446  * qdf_nbuf_get_priority_pkt_type() - Get packet type from priority
4447  * @nbuf: pointer to network buffer
4448  *
4449  * Return: packet type
4450  */
4451 static inline
4452 uint8_t qdf_nbuf_get_priority_pkt_type(qdf_nbuf_t nbuf)
4453 {
4454 	return QDF_NBUF_GET_PRIORITY_PKT_TYPE(nbuf->priority);
4455 }
4456 
4457 /**
4458  * qdf_nbuf_set_priority_pkt_type() - Set packet type to priority
4459  * @nbuf: pointer to network buffer
4460  * @pkt_type: packet type to be set
4461  *
4462  * Return: none
4463  */
4464 static inline
4465 void qdf_nbuf_set_priority_pkt_type(qdf_nbuf_t nbuf, uint8_t pkt_type)
4466 {
4467 	nbuf->priority |= QDF_NBUF_PRIORITY_PKT_TYPE(pkt_type);
4468 }
4469 
4470 /**
4471  * qdf_nbuf_remove_priority_pkt_type() - Remove the packet type bits
4472  *					 from priority
4473  * @nbuf: pointer to network buffer
4474  *
4475  * Return: none
4476  */
4477 static inline
4478 void qdf_nbuf_remove_priority_pkt_type(qdf_nbuf_t nbuf)
4479 {
4480 	nbuf->priority &= ~QDF_NBUF_PRIORITY_PKT_TYPE_MASK;
4481 }
4482 #endif
4483 
4484 /**
4485  * qdf_nbuf_is_ipv4_v6_pure_tcp_ack() - check if it is pure tcp ack
4486  *					without data payload
4487  * @buf: Network buffer
4488  *
4489  * Check whether the packet is pure TCP ack without data payload.
4490  *
4491  * Return : true if TCP ack, else return false
4492  */
4493 static inline
4494 bool qdf_nbuf_is_ipv4_v6_pure_tcp_ack(qdf_nbuf_t buf)
4495 {
4496 	return __qdf_nbuf_is_ipv4_v6_pure_tcp_ack(buf);
4497 }
4498 
4499 /**
4500  * qdf_nbuf_is_arp_local() - check if it is local or no local arp
4501  * @buf: Network buffer
4502  *
4503  * This func. checks whether packet is local or no local arp.
4504  *
4505  * Return: TRUE if it is broadcast packet
4506  *         FALSE if not
4507  */
4508 static inline
4509 bool qdf_nbuf_is_arp_local(qdf_nbuf_t buf)
4510 {
4511 	return __qdf_nbuf_is_arp_local(buf);
4512 }
4513 
4514 /**
4515  * qdf_nbuf_reset_num_frags() - decrement the number of fragments
4516  * @buf: Network buffer
4517  *
4518  * Return: Number of fragments
4519  */
4520 static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
4521 {
4522 	__qdf_nbuf_reset_num_frags(buf);
4523 }
4524 
4525 /**
4526  * qdf_dmaaddr_to_32s - return high and low parts of dma_addr
4527  * @dmaaddr: DMA address
4528  * @lo: low 32-bits of @dmaaddr
4529  * @hi: high 32-bits of @dmaaddr
4530  *
4531  * Returns the high and low 32-bits of the DMA addr in the provided ptrs
4532  *
4533  * Return: N/A
4534  */
4535 static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
4536 				      uint32_t *lo, uint32_t *hi)
4537 {
4538 	return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi);
4539 }
4540 
4541 /**
4542  * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
4543  *                           network buffer into segments
4544  * @osdev: qdf device handle
4545  * @nbuf:   network buffer to be segmented
4546  * @tso_info:  This is the output. The information about the
4547  *             TSO segments will be populated within this.
4548  *
4549  * This function fragments a TCP jumbo packet into smaller
4550  * segments to be transmitted by the driver. It chains the TSO
4551  * segments created into a list.
4552  *
4553  * Return: number of TSO segments
4554  */
4555 static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev,
4556 		 qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info)
4557 {
4558 	return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info);
4559 }
4560 
4561 /**
4562  * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element
4563  *
4564  * @osdev: qdf device handle
4565  * @tso_seg: TSO segment element to be unmapped
4566  * @is_last_seg: whether this is last tso seg or not
4567  *
4568  * Return: none
4569  */
4570 static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev,
4571 			  struct qdf_tso_seg_elem_t *tso_seg,
4572 			  bool is_last_seg)
4573 {
4574 	return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg);
4575 }
4576 
4577 /**
4578  * qdf_nbuf_get_tcp_payload_len() - function to return the tso payload len
4579  * @nbuf: network buffer
4580  *
4581  * Return: size of the tso packet
4582  */
4583 static inline size_t qdf_nbuf_get_tcp_payload_len(qdf_nbuf_t nbuf)
4584 {
4585 	return __qdf_nbuf_get_tcp_payload_len(nbuf);
4586 }
4587 
4588 /**
4589  * qdf_nbuf_get_tso_num_seg() - function to calculate the number
4590  * of TCP segments within the TSO jumbo packet
4591  * @nbuf:   TSO jumbo network buffer to be segmented
4592  *
4593  * This function calculates the number of TCP segments that the
4594  * network buffer can be divided into.
4595  *
4596  * Return: number of TCP segments
4597  */
4598 static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf)
4599 {
4600 	return __qdf_nbuf_get_tso_num_seg(nbuf);
4601 }
4602 
4603 /**
4604  * qdf_nbuf_get_gso_segs() - Return the number of gso segments in nbuf
4605  * @nbuf: Network buffer
4606  *
4607  * Return: number of gso segments in nbuf
4608  */
4609 static inline uint16_t qdf_nbuf_get_gso_segs(qdf_nbuf_t nbuf)
4610 {
4611 	return __qdf_nbuf_get_gso_segs(nbuf);
4612 }
4613 
4614 /**
4615  * qdf_nbuf_set_gso_segs() - set the number of gso segments in nbuf
4616  * @nbuf: Network buffer
4617  * @val: val to be set
4618  *
4619  * Return: None
4620  */
4621 static inline void qdf_nbuf_set_gso_segs(qdf_nbuf_t nbuf, uint16_t val)
4622 {
4623 	__qdf_nbuf_set_gso_segs(nbuf, val);
4624 }
4625 
4626 /**
4627  * qdf_nbuf_set_gso_type_udp_l4() - set the gso type to GSO UDP L4
4628  * @nbuf: Network buffer
4629  *
4630  * Return: None
4631  */
4632 static inline void qdf_nbuf_set_gso_type_udp_l4(qdf_nbuf_t nbuf)
4633 {
4634 	__qdf_nbuf_set_gso_type_udp_l4(nbuf);
4635 }
4636 
4637 /**
4638  * qdf_nbuf_set_ip_summed_partial() - set the ip summed to CHECKSUM_PARTIAL
4639  * @nbuf: Network buffer
4640  *
4641  * Return: None
4642  */
4643 static inline void qdf_nbuf_set_ip_summed_partial(qdf_nbuf_t nbuf)
4644 {
4645 	__qdf_nbuf_set_ip_summed_partial(nbuf);
4646 }
4647 
4648 /**
4649  * qdf_nbuf_get_gso_size() - Return the number of gso size in nbuf
4650  * @nbuf: Network buffer
4651  *
4652  * Return: number of gso segments in nbuf
4653  */
4654 static inline unsigned int qdf_nbuf_get_gso_size(qdf_nbuf_t nbuf)
4655 {
4656 	return __qdf_nbuf_get_gso_size(nbuf);
4657 }
4658 
4659 /**
4660  * qdf_nbuf_set_gso_size() - Set the gso size in nbuf
4661  * @nbuf: Pointer to network buffer
4662  * @val: number of gso segments in nbuf
4663  *
4664  * Return: None
4665  */
4666 static inline void  qdf_nbuf_set_gso_size(qdf_nbuf_t nbuf, unsigned int val)
4667 {
4668 	__qdf_nbuf_set_gso_size(nbuf, val);
4669 }
4670 
4671 /**
4672  * qdf_nbuf_inc_users() - function to increment the number of
4673  *                        users referencing this network buffer
4674  * @nbuf:   network buffer
4675  *
4676  * This function increments the number of users referencing this
4677  * network buffer
4678  *
4679  * Return: the network buffer
4680  */
4681 static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
4682 {
4683 	return __qdf_nbuf_inc_users(nbuf);
4684 }
4685 
4686 /**
4687  * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
4688  * @buf: Network buffer (skb on linux)
4689  *
4690  * This function returns the values of data_attr field
4691  * in struct cvg_nbuf_cb{}, to which skb->cb is typecast.
4692  * This value is actually the value programmed in CE descriptor.
4693  *
4694  * Return: Value of data_attr
4695  */
4696 static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf)
4697 {
4698 	return __qdf_nbuf_data_attr_get(buf);
4699 }
4700 
4701 /**
4702  * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb
4703  * @buf: Network buffer (skb on linux)
4704  * @data_attr: Value to be stored cvg_nbuf_cb->data_attr
4705  *
4706  * This function stores the value to be programmed in CE
4707  * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{}
4708  *
4709  * Return: void
4710  */
4711 static inline
4712 void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr)
4713 {
4714 	__qdf_nbuf_data_attr_set(buf, data_attr);
4715 }
4716 
4717 /**
4718  * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata
4719  * @nbuf:		Network buffer
4720  * @pkt_type:		Pkt type (from enum htt_pkt_type)
4721  * @pkt_subtype:	Bit 4 of this field in HTT descriptor
4722  *			needs to be set in case of CE classification support
4723  *			Is set by this macro.
4724  * @hw_classify:	This is a flag which is set to indicate
4725  *			CE classification is enabled.
4726  *			Do not set this bit for VLAN packets
4727  *			OR for mcast / bcast frames.
4728  *
4729  * This function parses the payload to figure out relevant
4730  * Tx meta-data e.g. whether to enable tx_classify bit
4731  * in CE.
4732  *
4733  * Return:     void
4734  */
4735 #define qdf_nbuf_tx_info_get(nbuf, pkt_type, pkt_subtype, hw_classify)	\
4736 		__qdf_nbuf_tx_info_get(nbuf, pkt_type,			\
4737 				       pkt_subtype, hw_classify)
4738 
4739 /**
4740  * qdf_nbuf_set_state() - Updates the packet state
4741  * @nbuf:            network buffer
4742  * @current_state :  layer at which the packet currently is
4743  *
4744  * This function updates the packet state to the layer at which the packet
4745  * currently is
4746  *
4747  * Return: none
4748  */
4749 void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state);
4750 
4751 /**
4752  * qdf_nbuf_tx_desc_count_display() - Displays the packet counter
4753  *
4754  * Return: none
4755  */
4756 void qdf_nbuf_tx_desc_count_display(void);
4757 
4758 /**
4759  * qdf_nbuf_tx_desc_count_clear() - Clears packet counter for both data, mgmt
4760  *
4761  * Return: none
4762  */
4763 void qdf_nbuf_tx_desc_count_clear(void);
4764 
4765 static inline qdf_nbuf_t
4766 qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom)
4767 {
4768 	return __qdf_nbuf_realloc_headroom(buf, headroom);
4769 }
4770 
4771 static inline qdf_nbuf_t
4772 qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom)
4773 {
4774 	return __qdf_nbuf_realloc_tailroom(buf, tailroom);
4775 }
4776 
4777 static inline qdf_nbuf_t
4778 qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom)
4779 {
4780 	return __qdf_nbuf_expand(buf, headroom, tailroom);
4781 }
4782 
4783 static inline int
4784 qdf_nbuf_linearize(qdf_nbuf_t buf)
4785 {
4786 	return __qdf_nbuf_linearize(buf);
4787 }
4788 
4789 static inline bool
4790 qdf_nbuf_is_cloned(qdf_nbuf_t buf)
4791 {
4792 	return __qdf_nbuf_is_cloned(buf);
4793 }
4794 
4795 static inline void
4796 qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg)
4797 {
4798 	__qdf_nbuf_frag_info(buf, sg);
4799 }
4800 
4801 static inline qdf_nbuf_tx_cksum_t
4802 qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where)
4803 {
4804 	return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where);
4805 }
4806 
4807 static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf)
4808 {
4809 	__qdf_nbuf_reset_ctxt(nbuf);
4810 }
4811 
4812 static inline void qdf_nbuf_init(qdf_nbuf_t buf)
4813 {
4814 	__qdf_nbuf_init(buf);
4815 }
4816 
4817 static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf)
4818 {
4819 	return __qdf_nbuf_network_header(buf);
4820 }
4821 
4822 static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf)
4823 {
4824 	return __qdf_nbuf_transport_header(buf);
4825 }
4826 
4827 static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf)
4828 {
4829 	return __qdf_nbuf_tcp_tso_size(buf);
4830 }
4831 
4832 static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf)
4833 {
4834 	return __qdf_nbuf_get_cb(nbuf);
4835 }
4836 
4837 static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf)
4838 {
4839 	return __qdf_nbuf_get_nr_frags(nbuf);
4840 }
4841 
4842 static inline uint32_t qdf_nbuf_get_nr_frags_in_fraglist(qdf_nbuf_t nbuf)
4843 {
4844 	return __qdf_nbuf_get_nr_frags_in_fraglist(nbuf);
4845 }
4846 
4847 static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf)
4848 {
4849 	return __qdf_nbuf_headlen(buf);
4850 }
4851 
4852 static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev,
4853 	qdf_nbuf_t buf, int offset,
4854 	qdf_dma_dir_t dir, int cur_frag)
4855 {
4856 	return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag);
4857 }
4858 
4859 static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf)
4860 {
4861 	return __qdf_nbuf_tso_tcp_v4(buf);
4862 }
4863 
4864 static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf)
4865 {
4866 	return __qdf_nbuf_tso_tcp_v6(buf);
4867 }
4868 
4869 static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf)
4870 {
4871 	return __qdf_nbuf_tcp_seq(buf);
4872 }
4873 
4874 static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf)
4875 {
4876 	return __qdf_nbuf_l2l3l4_hdr_len(buf);
4877 }
4878 
4879 /**
4880  * qdf_nbuf_get_tcp_hdr_len() - return TCP header length of the skb
4881  * @nbuf: sk buff
4882  *
4883  * Return: size of TCP header length
4884  */
4885 static inline size_t qdf_nbuf_get_tcp_hdr_len(qdf_nbuf_t nbuf)
4886 {
4887 	return __qdf_nbuf_get_tcp_hdr_len(nbuf);
4888 }
4889 
4890 static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf)
4891 {
4892 	return __qdf_nbuf_is_nonlinear(buf);
4893 }
4894 
4895 static inline uint32_t
4896 qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num)
4897 {
4898 	return __qdf_nbuf_get_frag_size(buf, frag_num);
4899 }
4900 
4901 static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf)
4902 {
4903 	return __qdf_nbuf_get_priority(buf);
4904 }
4905 
4906 static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p)
4907 {
4908 	__qdf_nbuf_set_priority(buf, p);
4909 }
4910 
4911 static inline void qdf_nbuf_record_rx_queue(qdf_nbuf_t buf, uint32_t queue_id)
4912 {
4913 	__qdf_nbuf_record_rx_queue(buf, queue_id);
4914 }
4915 
4916 static inline uint16_t
4917 qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf)
4918 {
4919 	return __qdf_nbuf_get_queue_mapping(buf);
4920 }
4921 
4922 static inline void
4923 qdf_nbuf_set_queue_mapping(qdf_nbuf_t buf, uint16_t val)
4924 {
4925 	__qdf_nbuf_set_queue_mapping(buf, val);
4926 }
4927 
4928 static inline char *
4929 qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf)
4930 {
4931 	return __qdf_nbuf_get_priv_ptr(buf);
4932 }
4933 
4934 /**
4935  * qdf_nbuf_has_fraglist() - check if nbuf has attached frag list
4936  * @nbuf: Pointer to nbuf
4937  *
4938  * Return: bool
4939  */
4940 static inline bool
4941 qdf_nbuf_has_fraglist(qdf_nbuf_t nbuf)
4942 {
4943 	return __qdf_nbuf_has_fraglist(nbuf);
4944 }
4945 
4946 /**
4947  * qdf_nbuf_get_last_frag_list_nbuf() - Fetch pointer to last nbuf in frag list
4948  * @nbuf: Pointer to nbuf
4949  *
4950  * Return: Pointer to last nbuf in frag list if parent nbuf has extended frag
4951  *         list or else return NULL
4952  */
4953 static inline qdf_nbuf_t
4954 qdf_nbuf_get_last_frag_list_nbuf(qdf_nbuf_t nbuf)
4955 {
4956 	return __qdf_nbuf_get_last_frag_list_nbuf(nbuf);
4957 }
4958 
4959 /**
4960  * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf.
4961  * @rx_status: rx_status containing required info to update radiotap
4962  * @nbuf: Pointer to nbuf
4963  * @headroom_sz: Available headroom size
4964  *
4965  * Return: radiotap length.
4966  */
4967 unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status,
4968 				      qdf_nbuf_t nbuf, uint32_t headroom_sz);
4969 
4970 /**
4971  * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame.
4972  * @buf: Pointer to nbuf
4973  *
4974  * Return: None
4975  */
4976 static inline void
4977 qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf)
4978 {
4979 	 __qdf_nbuf_mark_wakeup_frame(buf);
4980 }
4981 
4982 /**
4983  * qdf_nbuf_reg_free_cb - Registers nbuf free callback
4984  * @cb_func_ptr: Callback pointer
4985  *
4986  * This function registers nbuf free callback
4987  *
4988  * Return: void
4989  */
4990 static inline void
4991 qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr)
4992 {
4993 	 __qdf_nbuf_reg_free_cb(cb_func_ptr);
4994 }
4995 
4996 /**
4997  * qdf_nbuf_count_get() - get global nbuf gauge
4998  *
4999  * Return: global nbuf gauge
5000  */
5001 static inline int qdf_nbuf_count_get(void)
5002 {
5003 	return __qdf_nbuf_count_get();
5004 }
5005 
5006 /**
5007  * qdf_nbuf_count_inc() - increment nbuf global count
5008  *
5009  * @buf: sk buff
5010  *
5011  * Return: void
5012  */
5013 static inline void qdf_nbuf_count_inc(qdf_nbuf_t buf)
5014 {
5015 	return __qdf_nbuf_count_inc(buf);
5016 }
5017 
5018 /**
5019  * qdf_nbuf_count_dec() - decrement nbuf global count
5020  *
5021  * @buf: sk buff
5022  *
5023  * Return: void
5024  */
5025 static inline void qdf_nbuf_count_dec(qdf_nbuf_t buf)
5026 {
5027 	return __qdf_nbuf_count_dec(buf);
5028 }
5029 
5030 /**
5031  * qdf_nbuf_mod_init() - Initialization routine for qdf_nbuf
5032  *
5033  * Return void
5034  */
5035 static inline void qdf_nbuf_mod_init(void)
5036 {
5037 	return __qdf_nbuf_mod_init();
5038 }
5039 
5040 /**
5041  * qdf_nbuf_mod_exit() - Unintialization routine for qdf_nbuf
5042  *
5043  * Return void
5044  */
5045 static inline void qdf_nbuf_mod_exit(void)
5046 {
5047 	return __qdf_nbuf_mod_exit();
5048 }
5049 
5050 /**
5051  * qdf_nbuf_orphan() - orphan a nbuf
5052  * @buf: Pointer to network buffer
5053  *
5054  * If a buffer currently has an owner then we call the
5055  * owner's destructor function
5056  *
5057  * Return: void
5058  */
5059 static inline void qdf_nbuf_orphan(qdf_nbuf_t buf)
5060 {
5061 	return __qdf_nbuf_orphan(buf);
5062 }
5063 
5064 /**
5065  * qdf_nbuf_get_frag_size_by_idx() - Get size of nbuf frag at index idx
5066  * @nbuf: qdf_nbuf_t
5067  * @idx: Frag index for which frag size is requested
5068  *
5069  * Return: Frag size
5070  */
5071 static inline unsigned int qdf_nbuf_get_frag_size_by_idx(qdf_nbuf_t nbuf,
5072 							 uint8_t idx)
5073 {
5074 	return __qdf_nbuf_get_frag_size_by_idx(nbuf, idx);
5075 }
5076 
5077 /**
5078  * qdf_nbuf_get_frag_addr() - Get nbuf frag address at index idx
5079  * @nbuf: qdf_nbuf_t
5080  * @idx: Frag index for which frag address is requested
5081  *
5082  * Return: Frag address
5083  */
5084 static inline qdf_frag_t qdf_nbuf_get_frag_addr(qdf_nbuf_t nbuf, uint8_t idx)
5085 {
5086 	return __qdf_nbuf_get_frag_addr(nbuf, idx);
5087 }
5088 
5089 /**
5090  * qdf_nbuf_trim_add_frag_size() - Increase/Decrease frag_size by size
5091  * @nbuf: qdf_nbuf_t
5092  * @idx: Frag index
5093  * @size: Size by which frag_size needs to be increased/decreased
5094  *        +Ve means increase, -Ve means decrease
5095  * @truesize: truesize
5096  */
5097 static inline void qdf_nbuf_trim_add_frag_size(qdf_nbuf_t nbuf, uint8_t idx,
5098 					       int size, unsigned int truesize)
5099 {
5100 	__qdf_nbuf_trim_add_frag_size(nbuf, idx, size, truesize);
5101 }
5102 
5103 /**
5104  * qdf_nbuf_set_mark() - Set nbuf mark
5105  * @nbuf: qdf_nbuf_t
5106  * @mark: Value to set mark
5107  *
5108  * Return: none
5109  */
5110 static inline void qdf_nbuf_set_mark(qdf_nbuf_t nbuf, uint32_t mark)
5111 {
5112 	__qdf_nbuf_set_mark(nbuf, mark);
5113 }
5114 
5115 /**
5116  * qdf_nbuf_get_mark() - Get nbuf mark
5117  * @nbuf: qdf_nbuf_t
5118  *
5119  * Return: mark value
5120  */
5121 static inline uint32_t qdf_nbuf_get_mark(qdf_nbuf_t nbuf)
5122 {
5123 	return __qdf_nbuf_get_mark(nbuf);
5124 }
5125 
5126 /**
5127  * qdf_nbuf_get_data_len() - Return the size of the nbuf from
5128  * data pointer to end pointer
5129  * @nbuf: qdf_nbuf_t
5130  *
5131  * Return: size of network buffer from data pointer to end
5132  * pointer
5133  */
5134 static inline qdf_size_t qdf_nbuf_get_data_len(qdf_nbuf_t nbuf)
5135 {
5136 	return __qdf_nbuf_get_data_len(nbuf);
5137 }
5138 
5139 /**
5140  * qdf_nbuf_set_data_len() - Return the data_len of the nbuf
5141  * @nbuf: qdf_nbuf_t
5142  * @len: data_len to be set
5143  *
5144  * Return: set data_len value
5145  */
5146 static inline qdf_size_t qdf_nbuf_set_data_len(qdf_nbuf_t nbuf, uint32_t len)
5147 {
5148 	return __qdf_nbuf_set_data_len(nbuf, len);
5149 }
5150 
5151 /**
5152  * qdf_nbuf_get_only_data_len() - Return the data_len of the nbuf
5153  * @nbuf: qdf_nbuf_t
5154  *
5155  * Return: data_len value
5156  */
5157 static inline qdf_size_t qdf_nbuf_get_only_data_len(qdf_nbuf_t nbuf)
5158 {
5159 	return __qdf_nbuf_get_only_data_len(nbuf);
5160 }
5161 
5162 /**
5163  * qdf_nbuf_set_hash() - set the hash of the buf
5164  * @buf: Network buf instance
5165  * @len: len to be set
5166  *
5167  * Return: none
5168  */
5169 static inline void qdf_nbuf_set_hash(qdf_nbuf_t buf, uint32_t len)
5170 {
5171 	__qdf_nbuf_set_hash(buf, len);
5172 }
5173 
5174 /**
5175  * qdf_nbuf_set_sw_hash() - set the sw hash of the buf
5176  * @buf: Network buf instance
5177  * @len: len to be set
5178  *
5179  * Return: none
5180  */
5181 static inline void qdf_nbuf_set_sw_hash(qdf_nbuf_t buf, uint32_t len)
5182 {
5183 	__qdf_nbuf_set_sw_hash(buf, len);
5184 }
5185 
5186 /**
5187  * qdf_nbuf_set_csum_start() - set the csum start of the buf
5188  * @buf: Network buf instance
5189  * @len: len to be set
5190  *
5191  * Return: none
5192  */
5193 static inline void qdf_nbuf_set_csum_start(qdf_nbuf_t buf, uint16_t len)
5194 {
5195 	__qdf_nbuf_set_csum_start(buf, len);
5196 }
5197 
5198 /**
5199  * qdf_nbuf_set_csum_offset() - set the csum offset of the buf
5200  * @buf: Network buf instance
5201  * @len: len to be set
5202  *
5203  * Return: none
5204  */
5205 static inline void qdf_nbuf_set_csum_offset(qdf_nbuf_t buf, uint16_t len)
5206 {
5207 	__qdf_nbuf_set_csum_offset(buf, len);
5208 }
5209 
5210 /**
5211  * qdf_nbuf_get_end_offset() - Return the size of the nbuf from
5212  * head pointer to end pointer
5213  * @nbuf: qdf_nbuf_t
5214  *
5215  * Return: size of network buffer from head pointer to end
5216  * pointer
5217  */
5218 static inline qdf_size_t qdf_nbuf_get_end_offset(qdf_nbuf_t nbuf)
5219 {
5220 	return __qdf_nbuf_get_end_offset(nbuf);
5221 }
5222 
5223 /**
5224  * qdf_nbuf_get_truesize() - Return the true size of the nbuf
5225  * including the header and variable data area
5226  * @nbuf: qdf_nbuf_t
5227  *
5228  * Return: size of network buffer
5229  */
5230 static inline qdf_size_t qdf_nbuf_get_truesize(qdf_nbuf_t nbuf)
5231 {
5232 	return __qdf_nbuf_get_truesize(nbuf);
5233 }
5234 
5235 /**
5236  * qdf_nbuf_get_allocsize() - Return the actual size of the skb->head
5237  * excluding the header and variable data area
5238  * @nbuf: qdf_nbuf_t
5239  *
5240  * Return: actual allocated size of network buffer
5241  */
5242 static inline qdf_size_t qdf_nbuf_get_allocsize(qdf_nbuf_t nbuf)
5243 {
5244 	return __qdf_nbuf_get_allocsize(nbuf);
5245 }
5246 
5247 #ifdef NBUF_FRAG_MEMORY_DEBUG
5248 
5249 #define qdf_nbuf_move_frag_page_offset(f, i, o) \
5250 	qdf_nbuf_move_frag_page_offset_debug(f, i, o, __func__, __LINE__)
5251 
5252 /**
5253  * qdf_nbuf_move_frag_page_offset_debug() - Move frag page_offset by size
5254  *          and adjust length by size.
5255  * @nbuf: qdf_nbuf_t
5256  * @idx: Frag index
5257  * @offset: Frag page offset should be moved by offset.
5258  *      +Ve - Move offset forward.
5259  *      -Ve - Move offset backward.
5260  * @func: Caller function name
5261  * @line: Caller function line no.
5262  *
5263  * Return: QDF_STATUS
5264  */
5265 QDF_STATUS qdf_nbuf_move_frag_page_offset_debug(qdf_nbuf_t nbuf, uint8_t idx,
5266 						int offset, const char *func,
5267 						uint32_t line);
5268 
5269 #define qdf_nbuf_remove_frag(n, i, t) \
5270 	qdf_nbuf_remove_frag_debug(n, i, t, __func__, __LINE__)
5271 
5272 /**
5273  * qdf_nbuf_remove_frag_debug - Remove frag from nbuf
5274  * @nbuf: nbuf where frag will be removed
5275  * @idx: frag index
5276  * @truesize: truesize of frag
5277  * @func: Caller function name
5278  * @line:  Caller function line no.
5279  *
5280  * Return: QDF_STATUS
5281  *
5282  */
5283 QDF_STATUS
5284 qdf_nbuf_remove_frag_debug(qdf_nbuf_t nbuf,
5285 			   uint16_t idx,
5286 			   uint16_t truesize,
5287 			   const char *func,
5288 			   uint32_t line);
5289 
5290 #define qdf_nbuf_add_rx_frag(f, b, o, l, s, r) \
5291 	qdf_nbuf_add_rx_frag_debug(f, b, o, l, s, r, __func__, __LINE__)
5292 
5293 /**
5294  * qdf_nbuf_add_rx_frag_debug() - Add frag to nbuf at index frag_idx
5295  * @buf: Frag pointer needs to be added in nbuf
5296  * @nbuf: qdf_nbuf_t where frag will be added
5297  * @offset: Offset in frag to be added to nbuf_frags
5298  * @frag_len: Frag length
5299  * @truesize: truesize
5300  * @take_frag_ref: Whether to take ref for frag or not
5301  *      This bool must be set as per below comdition:
5302  *      1. False: If this frag is being added in any nbuf
5303  *              for the first time after allocation
5304  *      2. True: If frag is already attached part of any
5305  *              nbuf
5306  * @func: Caller function name
5307  * @line: Caller function line no.
5308  *
5309  * Return: none
5310  */
5311 void qdf_nbuf_add_rx_frag_debug(qdf_frag_t buf, qdf_nbuf_t nbuf,
5312 				int offset, int frag_len,
5313 				unsigned int truesize, bool take_frag_ref,
5314 				const char *func, uint32_t line);
5315 
5316 #define qdf_nbuf_ref_frag(f) \
5317 	qdf_nbuf_ref_frag_debug(f, __func__, __LINE__)
5318 
5319 /**
5320  * qdf_nbuf_ref_frag_debug() - get frag reference
5321  * @buf: Frag pointer needs to be taken reference.
5322  * @func: Caller function name
5323  * @line: Caller function line no.
5324  *
5325  * Return: none
5326  */
5327 void qdf_nbuf_ref_frag_debug(qdf_frag_t buf, const char *func, uint32_t line);
5328 
5329 /**
5330  * qdf_net_buf_debug_acquire_frag() - Add frag nodes to frag debug tracker
5331  *	when nbuf is received from network stack
5332  * @buf: qdf_nbuf_t
5333  * @func: Caller function name
5334  * @line: Caller function line no.
5335  *
5336  * Return: none
5337  */
5338 void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf, const char *func,
5339 				    uint32_t line);
5340 
5341 /**
5342  * qdf_net_buf_debug_release_frag() - Update frag nodes in frag debug tracker
5343  *	when nbuf is sent to network stack
5344  * @buf: qdf_nbuf_t
5345  * @func: Caller function name
5346  * @line: Caller function line no.
5347  *
5348  * Return: none
5349  */
5350 void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf, const char *func,
5351 				    uint32_t line);
5352 
5353 /**
5354  * qdf_nbuf_frag_count_inc() - Increment global frag counter
5355  * @buf: qdf_nbuf_t
5356  *
5357  * Return: none
5358  */
5359 void qdf_nbuf_frag_count_inc(qdf_nbuf_t buf);
5360 
5361 /**
5362  * qdf_nbuf_frag_count_dec() - Decrement global frag counter
5363  * @buf: qdf_nbuf_t
5364  *
5365  * Return: none
5366  */
5367 void qdf_nbuf_frag_count_dec(qdf_nbuf_t buf);
5368 
5369 #else /* NBUF_FRAG_MEMORY_DEBUG */
5370 
5371 /**
5372  * qdf_nbuf_move_frag_page_offset() - Move frag page_offset by size
5373  *          and adjust length by size.
5374  * @nbuf: qdf_nbuf_t
5375  * @idx: Frag index
5376  * @offset: Frag page offset should be moved by offset.
5377  *      +Ve - Move offset forward.
5378  *      -Ve - Move offset backward.
5379  */
5380 static inline QDF_STATUS qdf_nbuf_move_frag_page_offset(qdf_nbuf_t nbuf,
5381 							uint8_t idx,
5382 							int offset)
5383 {
5384 	return __qdf_nbuf_move_frag_page_offset(nbuf, idx, offset);
5385 }
5386 
5387 /**
5388  * qdf_nbuf_remove_frag() - Remove frag from nbuf
5389  *
5390  * @nbuf: nbuf pointer
5391  * @idx: idx at which frag need to be removed
5392  * @truesize: truesize of frag
5393  *
5394  * Return: void
5395  */
5396 static inline void qdf_nbuf_remove_frag(qdf_nbuf_t nbuf,
5397 					uint16_t idx,
5398 					uint16_t truesize)
5399 {
5400 	return __qdf_nbuf_remove_frag(nbuf, idx, truesize);
5401 }
5402 
5403 /**
5404  * qdf_nbuf_add_rx_frag() - Add frag to nbuf at index frag_idx
5405  * @buf: Frag pointer needs to be added in nbuf frag
5406  * @nbuf: qdf_nbuf_t where frag will be added
5407  * @offset: Offset in frag to be added to nbuf_frags
5408  * @frag_len: Frag length
5409  * @truesize: truesize
5410  * @take_frag_ref: Whether to take ref for frag or not
5411  *      This bool must be set as per below comdition:
5412  *      1. False: If this frag is being added in any nbuf
5413  *              for the first time after allocation
5414  *      2. True: If frag is already attached part of any
5415  *              nbuf
5416  *
5417  * qdf_nbuf_add_rx_frag takes ref_count based on boolean flag take_frag_ref
5418  */
5419 static inline void qdf_nbuf_add_rx_frag(qdf_frag_t buf, qdf_nbuf_t nbuf,
5420 					int offset, int frag_len,
5421 					unsigned int truesize,
5422 					bool take_frag_ref)
5423 {
5424 	__qdf_nbuf_add_rx_frag(buf, nbuf, offset,
5425 			       frag_len, truesize, take_frag_ref);
5426 }
5427 
5428 /**
5429  * qdf_nbuf_ref_frag() - get frag reference
5430  * @buf: Frag pointer needs to be taken reference.
5431  *
5432  * Return: void
5433  */
5434 static inline void qdf_nbuf_ref_frag(qdf_frag_t buf)
5435 {
5436 	__qdf_nbuf_ref_frag(buf);
5437 }
5438 
5439 static inline void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf,
5440 						  const char *func,
5441 						  uint32_t line)
5442 {
5443 }
5444 
5445 static inline void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf,
5446 						  const char *func,
5447 						  uint32_t line)
5448 {
5449 }
5450 
5451 static inline void qdf_nbuf_frag_count_inc(qdf_nbuf_t buf)
5452 {
5453 }
5454 
5455 static inline void qdf_nbuf_frag_count_dec(qdf_nbuf_t buf)
5456 {
5457 }
5458 
5459 #endif /* NBUF_FRAG_MEMORY_DEBUG */
5460 
5461 #define qdf_nbuf_add_frag(dev, f, n, o, f_l, t_sz, f_r, sz) \
5462 	qdf_nbuf_add_frag_debug(dev, f, n, o, f_l, t_sz,	\
5463 				f_r, sz, __func__, __LINE__)
5464 
5465 /**
5466  * qdf_nbuf_add_frag_debug() - Add frag to nbuf
5467  * @osdev: Device handle
5468  * @buf: Frag pointer needs to be added in nbuf frag
5469  * @nbuf: qdf_nbuf_t where frag will be added
5470  * @offset: Offset in frag to be added to nbuf_frags
5471  * @frag_len: Frag length
5472  * @truesize: truesize
5473  * @take_frag_ref: Whether to take ref for frag or not
5474  *      This bool must be set as per below comdition:
5475  *      1. False: If this frag is being added in any nbuf
5476  *              for the first time after allocation
5477  *      2. True: If frag is already attached part of any
5478  *              nbuf
5479  * @minsize: Minimum size to allocate
5480  * @func: Caller function name
5481  * @line: Caller function line no.
5482  *
5483  * if number of frag exceed maximum frag array. A new nbuf is allocated
5484  * with minimum headroom and frag it added to that nbuf.
5485  * new nbuf is added as frag_list to the master nbuf.
5486  *
5487  * Return: QDF_STATUS
5488  */
5489 QDF_STATUS
5490 qdf_nbuf_add_frag_debug(qdf_device_t osdev, qdf_frag_t buf,
5491 			qdf_nbuf_t nbuf, int offset,
5492 			int frag_len, unsigned int truesize,
5493 			bool take_frag_ref, unsigned int minsize,
5494 			const char *func, uint32_t line);
5495 
5496 #ifdef MEMORY_DEBUG
5497 /**
5498  * qdf_nbuf_acquire_track_lock - acquire the nbuf spinlock at the
5499  * specified index
5500  * @index: index to get the lock
5501  * @irq_flag: lock flag for using nbuf lock
5502  *
5503  * Return: none
5504  */
5505 void qdf_nbuf_acquire_track_lock(uint32_t index,
5506 				 unsigned long irq_flag);
5507 
5508 /**
5509  * qdf_nbuf_release_track_lock - release the nbuf spinlock at the
5510  * specified index
5511  * @index: index of the lock to be released
5512  * @irq_flag: lock flag for using nbuf lock
5513  *
5514  * Return: none
5515  */
5516 void qdf_nbuf_release_track_lock(uint32_t index,
5517 				 unsigned long irq_flag);
5518 
5519 /**
5520  * qdf_nbuf_get_track_tbl - get the QDF_NBUF_TRACK entry from the track
5521  * table at the specified index
5522  * @index: index to get the table entry
5523  *
5524  * Return: the QDF_NBUF_TRACK entry at the specified index in the table
5525  */
5526 QDF_NBUF_TRACK *qdf_nbuf_get_track_tbl(uint32_t index);
5527 #endif /* MEMORY_DEBUG */
5528 
5529 #ifdef CONFIG_WLAN_SYSFS_MEM_STATS
5530 /**
5531  * qdf_record_nbuf_nbytes() - add or subtract the size of the nbuf
5532  * from the total skb mem and DP tx/rx skb mem
5533  * @nbytes: number of bytes
5534  * @dir: direction
5535  * @is_mapped: is mapped or unmapped memory
5536  *
5537  * Return: none
5538  */
5539 void qdf_record_nbuf_nbytes(
5540 	uint32_t nbytes, qdf_dma_dir_t dir, bool is_mapped);
5541 
5542 #else /* CONFIG_WLAN_SYSFS_MEM_STATS */
5543 static inline void qdf_record_nbuf_nbytes(
5544 	int nbytes, qdf_dma_dir_t dir, bool is_mapped)
5545 {
5546 }
5547 #endif /* CONFIG_WLAN_SYSFS_MEM_STATS */
5548 
5549 #ifdef ENHANCED_OS_ABSTRACTION
5550 /**
5551  * qdf_nbuf_set_timestamp() - set the timestamp for frame
5552  * @buf: pointer to network buffer
5553  *
5554  * Return: none
5555  */
5556 void qdf_nbuf_set_timestamp(qdf_nbuf_t buf);
5557 
5558 /**
5559  * qdf_nbuf_get_timestamp() - get the timestamp for frame
5560  * @buf: pointer to network buffer
5561  *
5562  * Return: timestamp stored in skb in ms
5563  */
5564 uint64_t qdf_nbuf_get_timestamp(qdf_nbuf_t buf);
5565 
5566 /**
5567  * qdf_nbuf_get_timestamp_us() - get the timestamp for frame
5568  * @buf: pointer to network buffer
5569  *
5570  * Return: timestamp stored in nbuf in us
5571  */
5572 uint64_t qdf_nbuf_get_timestamp_us(qdf_nbuf_t buf);
5573 
5574 /**
5575  * qdf_nbuf_get_timedelta_ms() - get time difference in ms
5576  * @buf: pointer to network buffer
5577  *
5578  * Return: time difference ms
5579  */
5580 uint64_t qdf_nbuf_get_timedelta_ms(qdf_nbuf_t buf);
5581 
5582 /**
5583  * qdf_nbuf_get_timedelta_us() - get time difference in micro seconds
5584  * @buf: pointer to network buffer
5585  *
5586  * Return: time difference in micro seconds
5587  */
5588 uint64_t qdf_nbuf_get_timedelta_us(qdf_nbuf_t buf);
5589 
5590 /**
5591  * qdf_nbuf_net_timedelta() - get time delta
5592  * @t: time as qdf_ktime_t object
5593  *
5594  * Return: time delta as ktime_t object
5595  */
5596 qdf_ktime_t qdf_nbuf_net_timedelta(qdf_ktime_t t);
5597 #else
5598 static inline void
5599 qdf_nbuf_set_timestamp(struct sk_buff *skb)
5600 {
5601 	__qdf_nbuf_set_timestamp(skb);
5602 }
5603 
5604 static inline uint64_t
5605 qdf_nbuf_get_timestamp(struct sk_buff *skb)
5606 {
5607 	return __qdf_nbuf_get_timestamp(skb);
5608 }
5609 
5610 static inline uint64_t
5611 qdf_nbuf_get_timestamp_us(qdf_nbuf_t buf)
5612 {
5613 	return __qdf_nbuf_get_timestamp_us(buf);
5614 }
5615 
5616 static inline uint64_t
5617 qdf_nbuf_get_timedelta_ms(struct sk_buff *skb)
5618 {
5619 	return __qdf_nbuf_get_timedelta_ms(skb);
5620 }
5621 
5622 static inline uint64_t
5623 qdf_nbuf_get_timedelta_us(struct sk_buff *skb)
5624 {
5625 	return __qdf_nbuf_get_timedelta_us(skb);
5626 }
5627 
5628 static inline qdf_ktime_t qdf_nbuf_net_timedelta(qdf_ktime_t t)
5629 {
5630 	return __qdf_nbuf_net_timedelta(t);
5631 }
5632 #endif /* ENHANCED_OS_ABSTRACTION */
5633 
5634 #ifdef NBUF_MEMORY_DEBUG
5635 /**
5636  * qdf_set_smmu_fault_state() - Set smmu fault state
5637  * @smmu_fault_state: state of the wlan smmu
5638  *
5639  * Return: void
5640  */
5641 void qdf_set_smmu_fault_state(bool smmu_fault_state);
5642 #else
5643 static inline void qdf_set_smmu_fault_state(bool smmu_fault_state)
5644 {
5645 }
5646 #endif
5647 
5648 #ifdef CONFIG_NBUF_AP_PLATFORM
5649 #include <i_qdf_nbuf_api_w.h>
5650 #else
5651 #include <i_qdf_nbuf_api_m.h>
5652 #endif
5653 
5654 /**
5655  * qdf_nbuf_stop_replenish_timer - Stop alloc fail replenish timer
5656  *
5657  * This function stops the alloc fail replenish timer.
5658  *
5659  * Return: void
5660  */
5661 void qdf_nbuf_stop_replenish_timer(void);
5662 
5663 /**
5664  * qdf_get_nbuf_valid_frag() - Get nbuf to store frag
5665  * @nbuf: qdf_nbuf_t master nbuf
5666  *
5667  * Return: qdf_nbuf_t
5668  */
5669 qdf_nbuf_t qdf_get_nbuf_valid_frag(qdf_nbuf_t nbuf);
5670 
5671 /**
5672  * qdf_nbuf_fast_xmit() - Check if packet has fast_xmit support
5673  * @nbuf: qdf_nbuf_t master nbuf
5674  *
5675  * This function checks if skb has fast_xmit or not.
5676  *
5677  * Return: True if skb support fast_xmit otherwise false
5678  */
5679 bool qdf_nbuf_fast_xmit(qdf_nbuf_t nbuf);
5680 
5681 /**
5682  * qdf_nbuf_set_fast_xmit() - Set fast_xmit in SKB
5683  * @nbuf: qdf_nbuf_t master nbuf
5684  * @value: value to set in fast_xmit
5685  *
5686  * This function set fast_xmit in SKB if it exist.
5687  *
5688  * Return: void
5689  */
5690 void qdf_nbuf_set_fast_xmit(qdf_nbuf_t nbuf, int value);
5691 
5692 #endif /* _QDF_NBUF_H */
5693