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