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