1 /*
2 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef __WLAN_DP_TXRX_H__
20 #define __WLAN_DP_TXRX_H__
21
22 #include <cds_api.h>
23 #include <qdf_tracepoint.h>
24 #include <qdf_pkt_add_timestamp.h>
25 #include <enet.h>
26 #include <qdf_tracepoint.h>
27 #include "wlan_dp_priv.h"
28
29 /** DP Tx Time out value */
30 #define DP_TX_TIMEOUT qdf_system_msecs_to_ticks(5000)
31
32 #define DP_TX_STALL_THRESHOLD 4
33
34 #ifdef FEATURE_WLAN_WAPI
35 #define IS_DP_ETHERTYPE_WAI(_nbuf) (qdf_ntohs(qdf_nbuf_get_protocol(_nbuf)) == \
36 ETHERTYPE_WAI)
37 #else
38 #define IS_DP_ETHERTYPE_WAI(_nbuf) (false)
39 #endif
40
41 #define DP_CONNECTIVITY_CHECK_SET_ARP 1
42 #define DP_CONNECTIVITY_CHECK_SET_DNS 2
43 #define DP_CONNECTIVITY_CHECK_SET_TCP_HANDSHAKE 3
44 #define DP_CONNECTIVITY_CHECK_SET_ICMPV4 4
45 #define DP_CONNECTIVITY_CHECK_SET_ICMPV6 5
46 #define DP_CONNECTIVITY_CHECK_SET_TCP_SYN 6
47 #define DP_CONNECTIVITY_CHECK_SET_TCP_SYN_ACK 7
48 #define DP_CONNECTIVITY_CHECK_SET_TCP_ACK 8
49
50 /**
51 * wlan_dp_intf_get_pkt_type_bitmap_value() - Get packt type bitmap info
52 * @intf_ctx: DP interface context
53 *
54 * Return: bitmap information
55 */
56 uint32_t wlan_dp_intf_get_pkt_type_bitmap_value(void *intf_ctx);
57
58 #if defined(WLAN_SUPPORT_RX_FISA)
59 /**
60 * dp_rx_skip_fisa() - Set flags to skip fisa aggregation
61 * @dp_ctx: DP component handle
62 * @value: allow or skip fisa
63 *
64 * Return: None
65 */
66 void dp_rx_skip_fisa(struct wlan_dp_psoc_context *dp_ctx, uint32_t value);
67 #endif
68
69 /**
70 * dp_reset_all_intfs_connectivity_stats() - reset connectivity stats
71 * @dp_ctx: pointer to DP Context
72 *
73 * Return: None
74 */
75 void dp_reset_all_intfs_connectivity_stats(struct wlan_dp_psoc_context *dp_ctx);
76
77 /**
78 * dp_softap_check_wait_for_tx_eap_pkt() - Check and wait for eap failure
79 * pkt completion event
80 * @dp_intf: pointer to DP interface
81 * @mac_addr: mac address of peer
82 *
83 * Check and wait for eap failure pkt tx completion.
84 *
85 * Return: void
86 */
87 void dp_softap_check_wait_for_tx_eap_pkt(struct wlan_dp_intf *dp_intf,
88 struct qdf_mac_addr *mac_addr);
89
90 #ifdef SAP_DHCP_FW_IND
91 /**
92 * dp_post_dhcp_ind() - Send DHCP START/STOP indication to FW
93 * @dp_link: DP link handle
94 * @mac_addr: mac address
95 * @dhcp_start: true if DHCP start, otherwise DHCP stop
96 *
97 * Return: error number
98 */
99 int dp_post_dhcp_ind(struct wlan_dp_link *dp_link,
100 uint8_t *mac_addr, bool dhcp_start);
101
102 /**
103 * dp_softap_inspect_dhcp_packet() - Inspect DHCP packet
104 * @dp_link: DP link handle
105 * @nbuf: pointer to OS packet (sk_buff)
106 * @dir: direction
107 *
108 * Inspect the Tx/Rx frame, and send DHCP START/STOP notification to the FW
109 * through WMI message, during DHCP based IP address acquisition phase.
110 *
111 * - Send DHCP_START notification to FW when SAP gets DHCP Discovery
112 * - Send DHCP_STOP notification to FW when SAP sends DHCP ACK/NAK
113 *
114 * DHCP subtypes are determined by a status octet in the DHCP Message type
115 * option (option code 53 (0x35)).
116 *
117 * Each peer will be in one of 4 DHCP phases, starts from QDF_DHCP_PHASE_ACK,
118 * and transitioned per DHCP message type as it arrives.
119 *
120 * - QDF_DHCP_PHASE_DISCOVER: upon receiving DHCP_DISCOVER message in ACK phase
121 * - QDF_DHCP_PHASE_OFFER: upon receiving DHCP_OFFER message in DISCOVER phase
122 * - QDF_DHCP_PHASE_REQUEST: upon receiving DHCP_REQUEST message in OFFER phase
123 * or ACK phase (Renewal process)
124 * - QDF_DHCP_PHASE_ACK : upon receiving DHCP_ACK/NAK message in REQUEST phase
125 * or DHCP_DELINE message in OFFER phase
126 *
127 * Return: error number
128 */
129 int dp_softap_inspect_dhcp_packet(struct wlan_dp_link *dp_link,
130 qdf_nbuf_t nbuf,
131 enum qdf_proto_dir dir);
132 #else
133 static inline
dp_post_dhcp_ind(struct wlan_dp_link * dp_link,uint8_t * mac_addr,bool dhcp_start)134 int dp_post_dhcp_ind(struct wlan_dp_link *dp_link,
135 uint8_t *mac_addr, bool dhcp_start)
136 {
137 return 0;
138 }
139
140 static inline
dp_softap_inspect_dhcp_packet(struct wlan_dp_link * dp_link,qdf_nbuf_t nbuf,enum qdf_proto_dir dir)141 int dp_softap_inspect_dhcp_packet(struct wlan_dp_link *dp_link,
142 qdf_nbuf_t nbuf,
143 enum qdf_proto_dir dir)
144 {
145 return 0;
146 }
147 #endif
148
149 /**
150 * dp_rx_flush_packet_cbk() - flush rx packet handler
151 * @dp_link_context: pointer to DP link context
152 * @link_id: vdev_id of the packets to be flushed
153 *
154 * Flush rx packet callback registered with data path. DP will call this to
155 * notify when packets for a particular vdev is to be flushed out.
156 *
157 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
158 * QDF_STATUS_SUCCESS otherwise
159 */
160 QDF_STATUS dp_rx_flush_packet_cbk(void *dp_link_context, uint8_t link_id);
161
162 /**
163 * dp_softap_start_xmit() - Transmit a frame for SAP interface
164 * @nbuf: pointer to Network buffer
165 * @dp_link: DP link handle
166 *
167 * Return: QDF_STATUS_SUCCESS on successful transmission
168 */
169 QDF_STATUS dp_softap_start_xmit(qdf_nbuf_t nbuf, struct wlan_dp_link *dp_link);
170
171 /**
172 * dp_softap_tx_timeout() - TX timeout handler
173 * @dp_intf: pointer to DP interface
174 *
175 * Timeout API called for mode interfaces (SoftAP/P2P GO)
176 * when TX transmission takes too long.
177 * called by the OS_IF layer legacy driver.
178 *
179 * Return: None
180 */
181 void dp_softap_tx_timeout(struct wlan_dp_intf *dp_intf);
182
183 /**
184 * dp_softap_rx_packet_cbk() - Receive packet handler for SAP
185 * @intf_ctx: pointer to DP interface context
186 * @rx_buf: pointer to rx qdf_nbuf
187 *
188 * Receive callback registered with data path. DP will call this to notify
189 * when one or more packets were received for a registered
190 * STA.
191 *
192 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
193 * QDF_STATUS_SUCCESS otherwise
194 */
195 QDF_STATUS
196 dp_softap_rx_packet_cbk(void *intf_ctx, qdf_nbuf_t rx_buf);
197
198 /**
199 * dp_start_xmit() - Transmit a frame for STA interface
200 * @nbuf: pointer to Network buffer
201 * @dp_link: DP link handle
202 *
203 * Return: QDF_STATUS_SUCCESS on successful transmission
204 */
205 QDF_STATUS
206 dp_start_xmit(struct wlan_dp_link *dp_link, qdf_nbuf_t nbuf);
207
208 /**
209 * dp_tx_timeout() - DP Tx timeout API
210 * @dp_intf: Data path interface pointer
211 *
212 * Function called by OS_IF there is any timeout during transmission.
213 *
214 * Return: none
215 */
216 void dp_tx_timeout(struct wlan_dp_intf *dp_intf);
217
218 /**
219 * dp_rx_packet_cbk() - Receive packet handler
220 * @dp_link_context: pointer to DP link context
221 * @rx_buf: pointer to rx qdf_nbuf
222 *
223 * Receive callback registered with data path. DP will call this to notify
224 * when one or more packets were received for a registered
225 * STA.
226 *
227 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
228 * QDF_STATUS_SUCCESS otherwise
229 */
230 QDF_STATUS dp_rx_packet_cbk(void *dp_link_context, qdf_nbuf_t rx_buf);
231
232 #if defined(WLAN_SUPPORT_RX_FISA)
233 /**
234 * wlan_dp_rx_fisa_cbk() - Entry function to FISA to handle aggregation
235 * @dp_soc: core txrx main context
236 * @dp_vdev: Handle DP vdev
237 * @nbuf_list: List nbufs to be aggregated
238 *
239 * Return: Success on aggregation
240 */
241 QDF_STATUS wlan_dp_rx_fisa_cbk(void *dp_soc, void *dp_vdev,
242 qdf_nbuf_t nbuf_list);
243
244 /**
245 * wlan_dp_rx_fisa_flush_by_ctx_id() - Flush function to end of context
246 * flushing of aggregates
247 * @dp_soc: core txrx main context
248 * @ring_num: REO number to flush the flow Rxed on the REO
249 *
250 * Return: Success on flushing the flows for the REO
251 */
252 QDF_STATUS wlan_dp_rx_fisa_flush_by_ctx_id(void *dp_soc, int ring_num);
253
254 /**
255 * wlan_dp_rx_fisa_flush_by_vdev_id() - Flush fisa aggregates per vdev id
256 * @dp_soc: core txrx main context
257 * @vdev_id: vdev ID
258 *
259 * Return: Success on flushing the flows for the vdev
260 */
261 QDF_STATUS wlan_dp_rx_fisa_flush_by_vdev_id(void *dp_soc, uint8_t vdev_id);
262 #else
wlan_dp_rx_fisa_flush_by_vdev_id(void * dp_soc,uint8_t vdev_id)263 static inline QDF_STATUS wlan_dp_rx_fisa_flush_by_vdev_id(void *dp_soc,
264 uint8_t vdev_id)
265 {
266 return QDF_STATUS_SUCCESS;
267 }
268 #endif
269
270 /**
271 * wlan_dp_rx_deliver_to_stack() - DP helper function to deliver RX pkts to
272 * stack
273 * @dp_intf: pointer to DP interface context
274 * @nbuf: pointer to nbuf
275 *
276 * The function calls the appropriate stack function depending upon the packet
277 * type and whether GRO/LRO is enabled.
278 *
279 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
280 * QDF_STATUS_SUCCESS otherwise
281 */
282 QDF_STATUS wlan_dp_rx_deliver_to_stack(struct wlan_dp_intf *dp_intf,
283 qdf_nbuf_t nbuf);
284
285 /**
286 * dp_rx_thread_gro_flush_ind_cbk() - receive handler to flush GRO packets
287 * @link_ctx: pointer to DP interface context
288 * @rx_ctx_id: RX CTX Id for which flush should happen
289 *
290 * Receive callback registered with DP layer which flushes GRO packets
291 * for a given RX CTX ID (RX Thread)
292 *
293 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
294 * QDF_STATUS_SUCCESS otherwise
295 */
296 QDF_STATUS dp_rx_thread_gro_flush_ind_cbk(void *link_ctx, int rx_ctx_id);
297
298 /**
299 * dp_rx_pkt_thread_enqueue_cbk() - receive pkt handler to enqueue into thread
300 * @link_ctx: pointer to DP link context
301 * @nbuf_list: pointer to qdf_nbuf list
302 *
303 * Receive callback registered with DP layer which enqueues packets into dp rx
304 * thread
305 *
306 * Return: QDF_STATUS_E_FAILURE if any errors encountered,
307 * QDF_STATUS_SUCCESS otherwise
308 */
309 QDF_STATUS dp_rx_pkt_thread_enqueue_cbk(void *link_ctx,
310 qdf_nbuf_t nbuf_list);
311
312 /**
313 * dp_disable_rx_ol_for_low_tput() - Disable Rx offload in low TPUT scenario
314 * @dp_ctx: dp context
315 * @disable: true/false to disable/enable the Rx offload
316 *
317 * Return: none
318 */
319 void dp_disable_rx_ol_for_low_tput(struct wlan_dp_psoc_context *dp_ctx,
320 bool disable);
321
322 /**
323 * dp_tx_rx_collect_connectivity_stats_info() - collect connectivity stats
324 * @nbuf: pointer to n/w buffer
325 * @context: pointer to DP interface
326 * @action: action done on pkt.
327 * @pkt_type: data pkt type
328 *
329 * Return: None
330 */
331 void
332 dp_tx_rx_collect_connectivity_stats_info(qdf_nbuf_t nbuf, void *context,
333 enum connectivity_stats_pkt_status action, uint8_t *pkt_type);
334
335 static inline void
dp_nbuf_fill_gso_size(qdf_netdev_t dev,qdf_nbuf_t nbuf)336 dp_nbuf_fill_gso_size(qdf_netdev_t dev, qdf_nbuf_t nbuf)
337 {
338 unsigned long val;
339
340 if (qdf_nbuf_is_cloned(nbuf) && qdf_nbuf_is_nonlinear(nbuf) &&
341 qdf_nbuf_get_gso_size(nbuf) == 0 &&
342 qdf_nbuf_is_ipv4_tcp_pkt(nbuf)) {
343 val = dev->mtu - ((qdf_nbuf_transport_header(nbuf) -
344 qdf_nbuf_network_header(nbuf))
345 + qdf_nbuf_get_tcp_hdr_len(nbuf));
346 qdf_nbuf_set_gso_size(nbuf, val);
347 }
348 }
349
350 #ifdef CONFIG_HL_SUPPORT
351 static inline QDF_STATUS
dp_nbuf_nontso_linearize(qdf_nbuf_t nbuf)352 dp_nbuf_nontso_linearize(qdf_nbuf_t nbuf)
353 {
354 return QDF_STATUS_SUCCESS;
355 }
356 #else
357 static inline QDF_STATUS
dp_nbuf_nontso_linearize(qdf_nbuf_t nbuf)358 dp_nbuf_nontso_linearize(qdf_nbuf_t nbuf)
359 {
360 if (qdf_nbuf_is_nonlinear(nbuf) && qdf_nbuf_is_tso(nbuf) == false) {
361 if (qdf_unlikely(qdf_nbuf_linearize(nbuf)))
362 return QDF_STATUS_E_NOMEM;
363 }
364 return QDF_STATUS_SUCCESS;
365 }
366 #endif
367
368 #ifdef FEATURE_WLAN_DIAG_SUPPORT
369 void dp_event_eapol_log(qdf_nbuf_t nbuf, enum qdf_proto_dir dir);
370 #else
371 static inline
dp_event_eapol_log(qdf_nbuf_t nbuf,enum qdf_proto_dir dir)372 void dp_event_eapol_log(qdf_nbuf_t nbuf, enum qdf_proto_dir dir)
373 {}
374 #endif
375
376 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
377 static inline
dp_nbuf_orphan(struct wlan_dp_intf * dp_intf,qdf_nbuf_t nbuf)378 qdf_nbuf_t dp_nbuf_orphan(struct wlan_dp_intf *dp_intf,
379 qdf_nbuf_t nbuf)
380 {
381 struct wlan_dp_psoc_context *dp_ctx = dp_intf->dp_ctx;
382 struct wlan_dp_psoc_callbacks *dp_ops = &dp_ctx->dp_ops;
383 unsigned int tx_flow_low_watermark;
384 int need_orphan = 0;
385 int cpu;
386
387 tx_flow_low_watermark =
388 dp_ops->dp_get_tx_flow_low_watermark(dp_ops->callback_ctx,
389 dp_intf->dev);
390 if (tx_flow_low_watermark > 0) {
391 #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0))
392 /*
393 * The TCP TX throttling logic is changed a little after
394 * 3.19-rc1 kernel, the TCP sending limit will be smaller,
395 * which will throttle the TCP packets to the host driver.
396 * The TCP UP LINK throughput will drop heavily. In order to
397 * fix this issue, need to orphan the socket buffer asap, which
398 * will call skb's destructor to notify the TCP stack that the
399 * SKB buffer is unowned. And then the TCP stack will pump more
400 * packets to host driver.
401 *
402 * The TX packets might be dropped for UDP case in the iperf
403 * testing. So need to be protected by follow control.
404 */
405 need_orphan = 1;
406 #else
407 if (dp_ctx->dp_cfg.tx_orphan_enable)
408 need_orphan = 1;
409 #endif
410 } else if (dp_ctx->dp_cfg.tx_orphan_enable) {
411 if (qdf_nbuf_is_ipv4_tcp_pkt(nbuf) ||
412 qdf_nbuf_is_ipv6_tcp_pkt(nbuf))
413 need_orphan = 1;
414 }
415
416 if (need_orphan) {
417 qdf_nbuf_orphan(nbuf);
418 cpu = qdf_get_smp_processor_id();
419 ++dp_intf->dp_stats.tx_rx_stats.per_cpu[cpu].tx_orphaned;
420 } else {
421 nbuf = __qdf_nbuf_unshare(nbuf);
422 }
423
424 return nbuf;
425 }
426
427 /**
428 * dp_get_tx_resource() - check tx resources and take action
429 * @dp_link: DP link handle
430 * @mac_addr: mac address
431 *
432 * Return: none
433 */
434 void dp_get_tx_resource(struct wlan_dp_link *dp_link,
435 struct qdf_mac_addr *mac_addr);
436
437 #else
438 #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0))
439 /**
440 * dp_nbuf_orphan() - skb_unshare a cloned packed else skb_orphan
441 * @dp_intf: pointer to DP interface
442 * @nbuf: pointer to nbuf data packet
443 *
444 * Return: pointer to nbuf structure
445 */
446 static inline
dp_nbuf_orphan(struct wlan_dp_intf * dp_intf,qdf_nbuf_t nbuf)447 qdf_nbuf_t dp_nbuf_orphan(struct wlan_dp_intf *dp_intf,
448 qdf_nbuf_t nbuf)
449 {
450 struct wlan_dp_psoc_context *dp_ctx = dp_intf->dp_ctx;
451 int cpu;
452
453 dp_nbuf_fill_gso_size(dp_intf->dev, nbuf);
454
455 if (unlikely(dp_ctx->dp_cfg.tx_orphan_enable) ||
456 qdf_nbuf_is_cloned(nbuf)) {
457 /*
458 * For UDP packets we want to orphan the packet to allow the app
459 * to send more packets. The flow would ultimately be controlled
460 * by the limited number of tx descriptors for the vdev.
461 */
462 cpu = qdf_get_smp_processor_id();
463 ++dp_intf->dp_stats.tx_rx_stats.per_cpu[cpu].tx_orphaned;
464 qdf_nbuf_orphan(nbuf);
465 }
466 return nbuf;
467 }
468 #else
469 static inline
dp_nbuf_orphan(struct wlan_dp_intf * dp_intf,qdf_nbuf_t nbuf)470 qdf_nbuf_t dp_nbuf_orphan(struct wlan_dp_intf *dp_intf,
471 qdf_nbuf_t nbuf)
472 {
473 qdf_nbuf_t nskb;
474
475 dp_nbuf_fill_gso_size(dp_intf->dev, nbuf);
476 nskb = __qdf_nbuf_unshare(nbuf);
477
478 return nskb;
479 }
480 #endif
481
482 /**
483 * dp_get_tx_resource() - check tx resources and take action
484 * @dp_link: DP link handle
485 * @mac_addr: mac address
486 *
487 * Return: none
488 */
489 static inline
dp_get_tx_resource(struct wlan_dp_link * dp_link,struct qdf_mac_addr * mac_addr)490 void dp_get_tx_resource(struct wlan_dp_link *dp_link,
491 struct qdf_mac_addr *mac_addr)
492 {
493 }
494 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
495
496 /**
497 * dp_start_xmit() - Transmit a frame
498 * @dp_link: DP link handle
499 * @nbuf: n/w buffer
500 *
501 * Function called to Transmit a n/w buffer in STA mode.
502 *
503 * Return: Status of the transmission
504 */
505 QDF_STATUS
506 dp_start_xmit(struct wlan_dp_link *dp_link, qdf_nbuf_t nbuf);
507
508 #ifdef FEATURE_MONITOR_MODE_SUPPORT
509 /**
510 * dp_mon_rx_packet_cbk() - Receive callback registered with OL layer.
511 * @context: pointer to qdf context
512 * @rxbuf: pointer to rx qdf_nbuf
513 *
514 * TL will call this to notify the HDD when one or more packets were
515 * received for a registered STA.
516 *
517 * Return: QDF_STATUS
518 */
519 QDF_STATUS dp_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf);
520
521 /**
522 * dp_monitor_set_rx_monitor_cb(): Set rx monitor mode callback function
523 * @txrx: pointer to txrx ops
524 * @rx_monitor_cb: pointer to callback function
525 *
526 * Returns: None
527 */
528 void dp_monitor_set_rx_monitor_cb(struct ol_txrx_ops *txrx,
529 ol_txrx_rx_mon_fp rx_monitor_cb);
530 /**
531 * dp_rx_monitor_callback(): Callback function for receive monitor mode
532 * @vdev: Handle to vdev object
533 * @mpdu: pointer to mpdu to be delivered to os
534 * @rx_status: receive status
535 *
536 * Returns: None
537 */
538 void dp_rx_monitor_callback(ol_osif_vdev_handle vdev,
539 qdf_nbuf_t mpdu,
540 void *rx_status);
541
542 #else
543 static inline
dp_mon_rx_packet_cbk(void * context,qdf_nbuf_t rxbuf)544 QDF_STATUS dp_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf)
545 {
546 return QDF_STATUS_SUCCESS;
547 }
548
549 static inline
dp_monitor_set_rx_monitor_cb(struct ol_txrx_ops * txrx,ol_txrx_rx_mon_fp rx_monitor_cb)550 void dp_monitor_set_rx_monitor_cb(struct ol_txrx_ops *txrx,
551 ol_txrx_rx_mon_fp rx_monitor_cb) { }
552
553 static inline
dp_rx_monitor_callback(ol_osif_vdev_handle vdev,qdf_nbuf_t mpdu,void * rx_status)554 void dp_rx_monitor_callback(ol_osif_vdev_handle vdev, qdf_nbuf_t mpdu,
555 void *rx_status) { }
556 #endif
557
558 /**
559 * dp_sta_notify_tx_comp_cb() - notify tx comp callback registered with dp
560 * @nbuf: pointer to nbuf
561 * @ctx: osif context
562 * @flag: tx status flag
563 *
564 * Return: None
565 */
566 void dp_sta_notify_tx_comp_cb(qdf_nbuf_t nbuf, void *ctx, uint16_t flag);
567
568 /**
569 * dp_softap_notify_tx_compl_cbk() - notify softap tx comp registered with dp
570 * @nbuf: pointer to nbuf
571 * @context: osif context
572 * @flag: tx status flag
573 *
574 * Return: None
575 */
576 void dp_softap_notify_tx_compl_cbk(qdf_nbuf_t nbuf,
577 void *context, uint16_t flag);
578
579 /**
580 * dp_rx_pkt_tracepoints_enabled() - Get the state of rx pkt tracepoint
581 *
582 * Return: True if any rx pkt tracepoint is enabled else false
583 */
dp_rx_pkt_tracepoints_enabled(void)584 static inline bool dp_rx_pkt_tracepoints_enabled(void)
585 {
586 return (qdf_trace_dp_rx_tcp_pkt_enabled() ||
587 qdf_trace_dp_rx_udp_pkt_enabled() ||
588 qdf_trace_dp_rx_pkt_enabled());
589 }
590
591 #ifdef CONFIG_DP_PKT_ADD_TIMESTAMP
592 /**
593 * wlan_dp_pkt_add_timestamp() - add timestamp in data payload
594 * @dp_intf: DP interface
595 * @index: timestamp index which decides offset in payload
596 * @nbuf: Network socket buffer
597 *
598 * Return: none
599 */
600 void wlan_dp_pkt_add_timestamp(struct wlan_dp_intf *dp_intf,
601 enum qdf_pkt_timestamp_index index,
602 qdf_nbuf_t nbuf);
603 #else
604 static inline
wlan_dp_pkt_add_timestamp(struct wlan_dp_intf * dp_intf,enum qdf_pkt_timestamp_index index,qdf_nbuf_t nbuf)605 void wlan_dp_pkt_add_timestamp(struct wlan_dp_intf *dp_intf,
606 enum qdf_pkt_timestamp_index index,
607 qdf_nbuf_t nbuf)
608 {
609 }
610 #endif
611
612 #if defined(FEATURE_LRO)
613 /**
614 * dp_lro_set_reset() - API for Disable/Enable LRO
615 * @dp_intf: DP interface pointer
616 * @enable_flag: enable or disable LRO.
617 *
618 * Return: 0 on success and non zero on failure.
619 */
620 QDF_STATUS dp_lro_set_reset(struct wlan_dp_intf *dp_intf, uint8_t enable_flag);
621 #else
622 static inline
dp_lro_set_reset(struct wlan_dp_intf * dp_intf,uint8_t enable_flag)623 QDF_STATUS dp_lro_set_reset(struct wlan_dp_intf *dp_intf,
624 uint8_t enable_flag)
625 {
626 return QDF_STATUS_E_NOSUPPORT;
627 }
628 #endif /* FEATURE_LRO */
629
630 #ifdef RECEIVE_OFFLOAD
631 /**
632 * dp_rx_ol_init() - Initialize Rx offload mode (LRO or GRO)
633 * @dp_ctx: pointer to DP Context
634 * @is_wifi3_0_target: true if it wifi3.0 target
635 *
636 * Return: 0 on success and non zero on failure.
637 */
638 QDF_STATUS dp_rx_ol_init(struct wlan_dp_psoc_context *dp_ctx,
639 bool is_wifi3_0_target);
640 #else /* RECEIVE_OFFLOAD */
641
642 static inline QDF_STATUS
dp_rx_ol_init(struct wlan_dp_psoc_context * dp_ctx,bool is_wifi3_0_target)643 dp_rx_ol_init(struct wlan_dp_psoc_context *dp_ctx,
644 bool is_wifi3_0_target)
645 {
646 return QDF_STATUS_E_NOSUPPORT;
647 }
648 #endif
649
650 #ifdef WLAN_FEATURE_11BE_MLO
651 static inline
dp_rx_pkt_da_check(struct wlan_dp_intf * dp_intf,qdf_nbuf_t nbuf)652 void dp_rx_pkt_da_check(struct wlan_dp_intf *dp_intf, qdf_nbuf_t nbuf)
653 {
654 /* only do DA check for RX frame from non-regular path */
655 if (!qdf_nbuf_is_exc_frame(nbuf))
656 return;
657
658 if (qdf_mem_cmp(qdf_nbuf_data(nbuf), dp_intf->mac_addr.bytes,
659 ETH_ALEN)) {
660 dp_info("da mac:" QDF_MAC_ADDR_FMT "intf_mac:" QDF_MAC_ADDR_FMT,
661 QDF_MAC_ADDR_REF(qdf_nbuf_data(nbuf)),
662 QDF_MAC_ADDR_REF(dp_intf->mac_addr.bytes));
663 qdf_mem_copy(qdf_nbuf_data(nbuf), dp_intf->mac_addr.bytes,
664 ETH_ALEN);
665 }
666 }
667 #else
668 static inline
dp_rx_pkt_da_check(struct wlan_dp_intf * dp_intf,qdf_nbuf_t nbuf)669 void dp_rx_pkt_da_check(struct wlan_dp_intf *dp_intf, qdf_nbuf_t nbuf)
670 {
671 }
672 #endif
673
674 #endif
675