162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Queue between the tx operation and the bh workqueue.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
662306a36Sopenharmony_ci * Copyright (c) 2010, ST-Ericsson
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#ifndef WFX_QUEUE_H
962306a36Sopenharmony_ci#define WFX_QUEUE_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/skbuff.h>
1262306a36Sopenharmony_ci#include <linux/atomic.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct wfx_dev;
1562306a36Sopenharmony_cistruct wfx_vif;
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistruct wfx_queue {
1862306a36Sopenharmony_ci	struct sk_buff_head normal;
1962306a36Sopenharmony_ci	struct sk_buff_head cab; /* Content After (DTIM) Beacon */
2062306a36Sopenharmony_ci	atomic_t            pending_frames;
2162306a36Sopenharmony_ci	int                 priority;
2262306a36Sopenharmony_ci};
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_civoid wfx_tx_lock(struct wfx_dev *wdev);
2562306a36Sopenharmony_civoid wfx_tx_unlock(struct wfx_dev *wdev);
2662306a36Sopenharmony_civoid wfx_tx_flush(struct wfx_dev *wdev);
2762306a36Sopenharmony_civoid wfx_tx_lock_flush(struct wfx_dev *wdev);
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_civoid wfx_tx_queues_init(struct wfx_vif *wvif);
3062306a36Sopenharmony_civoid wfx_tx_queues_check_empty(struct wfx_vif *wvif);
3162306a36Sopenharmony_cibool wfx_tx_queues_has_cab(struct wfx_vif *wvif);
3262306a36Sopenharmony_civoid wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb);
3362306a36Sopenharmony_cistruct wfx_hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cibool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue);
3662306a36Sopenharmony_civoid wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue,
3762306a36Sopenharmony_ci		       struct sk_buff_head *dropped);
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cistruct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id);
4062306a36Sopenharmony_civoid wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped);
4162306a36Sopenharmony_ciunsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb);
4262306a36Sopenharmony_civoid wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms);
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#endif
45