1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * O(1) TX queue with built-in allocator.
5 * Copyright (c) 2017-2018, Silicon Laboratories, Inc.
6 * Copyright (c) 2010, ST-Ericsson
11 #include <linux/skbuff.h>
13 #include "hif_api_cmd.h"
15 #define WFX_MAX_STA_IN_AP_MODE 14
16 #define WFX_LINK_ID_NO_ASSOC 15
17 #define WFX_LINK_ID_AFTER_DTIM (WFX_LINK_ID_NO_ASSOC + 1)
18 #define WFX_LINK_ID_UAPSD (WFX_LINK_ID_NO_ASSOC + 2)
19 #define WFX_LINK_ID_MAX (WFX_LINK_ID_NO_ASSOC + 3)
25 struct sk_buff_head queue
;
27 int link_map_cache
[WFX_LINK_ID_MAX
];
31 struct wfx_queue_stats
{
32 int link_map_cache
[WFX_LINK_ID_MAX
];
33 struct sk_buff_head pending
;
34 wait_queue_head_t wait_link_id_empty
;
37 void wfx_tx_lock(struct wfx_dev
*wdev
);
38 void wfx_tx_unlock(struct wfx_dev
*wdev
);
39 void wfx_tx_flush(struct wfx_dev
*wdev
);
40 void wfx_tx_lock_flush(struct wfx_dev
*wdev
);
42 void wfx_tx_queues_init(struct wfx_dev
*wdev
);
43 void wfx_tx_queues_deinit(struct wfx_dev
*wdev
);
44 void wfx_tx_queues_lock(struct wfx_dev
*wdev
);
45 void wfx_tx_queues_unlock(struct wfx_dev
*wdev
);
46 void wfx_tx_queues_clear(struct wfx_dev
*wdev
);
47 bool wfx_tx_queues_is_empty(struct wfx_dev
*wdev
);
48 void wfx_tx_queues_wait_empty_vif(struct wfx_vif
*wvif
);
49 struct hif_msg
*wfx_tx_queues_get(struct wfx_dev
*wdev
);
50 struct hif_msg
*wfx_tx_queues_get_after_dtim(struct wfx_vif
*wvif
);
52 void wfx_tx_queue_put(struct wfx_dev
*wdev
, struct wfx_queue
*queue
,
54 int wfx_tx_queue_get_num_queued(struct wfx_queue
*queue
, u32 link_id_map
);
56 struct sk_buff
*wfx_pending_get(struct wfx_dev
*wdev
, u32 packet_id
);
57 int wfx_pending_remove(struct wfx_dev
*wdev
, struct sk_buff
*skb
);
58 int wfx_pending_requeue(struct wfx_dev
*wdev
, struct sk_buff
*skb
);
59 unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev
*wdev
,
61 void wfx_pending_dump_old_frames(struct wfx_dev
*wdev
, unsigned int limit_ms
);
63 #endif /* WFX_QUEUE_H */