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