xref: /linux/drivers/net/wireless/silabs/wfx/queue.h (revision 24168c5e6dfbdd5b414f048f47f75d64533296ca)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Queue between the tx operation and the bh workqueue.
4  *
5  * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
6  * Copyright (c) 2010, ST-Ericsson
7  */
8 #ifndef WFX_QUEUE_H
9 #define WFX_QUEUE_H
10 
11 #include <linux/skbuff.h>
12 #include <linux/atomic.h>
13 
14 struct wfx_dev;
15 struct wfx_vif;
16 
17 struct wfx_queue {
18 	struct sk_buff_head normal;
19 	struct sk_buff_head cab; /* Content After (DTIM) Beacon */
20 	struct sk_buff_head offchan;
21 	atomic_t            pending_frames;
22 	int                 priority;
23 };
24 
25 void wfx_tx_lock(struct wfx_dev *wdev);
26 void wfx_tx_unlock(struct wfx_dev *wdev);
27 void wfx_tx_flush(struct wfx_dev *wdev);
28 void wfx_tx_lock_flush(struct wfx_dev *wdev);
29 
30 void wfx_tx_queues_init(struct wfx_vif *wvif);
31 void wfx_tx_queues_check_empty(struct wfx_vif *wvif);
32 bool wfx_tx_queues_has_cab(struct wfx_vif *wvif);
33 void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb);
34 struct wfx_hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev);
35 
36 bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue);
37 void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue,
38 		       struct sk_buff_head *dropped);
39 
40 struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id);
41 void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped);
42 unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb);
43 void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms);
44 
45 #endif
46