2019-09-19 14:25:45 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
/*
|
2021-09-13 15:01:56 +02:00
|
|
|
* Queue between the tx operation and the bh workqueue.
|
2019-09-19 14:25:45 +00:00
|
|
|
*
|
2020-10-07 12:19:41 +02:00
|
|
|
* Copyright (c) 2017-2020, Silicon Laboratories, Inc.
|
2019-09-19 14:25:45 +00:00
|
|
|
* Copyright (c) 2010, ST-Ericsson
|
|
|
|
*/
|
2021-03-09 15:51:56 +01:00
|
|
|
#include <linux/sched.h>
|
2019-09-19 14:25:45 +00:00
|
|
|
#include <net/mac80211.h>
|
|
|
|
|
2021-03-09 15:51:56 +01:00
|
|
|
#include "queue.h"
|
2019-09-19 14:25:45 +00:00
|
|
|
#include "wfx.h"
|
2021-03-09 15:51:56 +01:00
|
|
|
#include "sta.h"
|
|
|
|
#include "data_tx.h"
|
2020-07-01 17:06:58 +02:00
|
|
|
#include "traces.h"
|
2019-09-19 14:25:45 +00:00
|
|
|
|
|
|
|
void wfx_tx_lock(struct wfx_dev *wdev)
|
|
|
|
{
|
|
|
|
atomic_inc(&wdev->tx_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wfx_tx_unlock(struct wfx_dev *wdev)
|
|
|
|
{
|
|
|
|
int tx_lock = atomic_dec_return(&wdev->tx_lock);
|
|
|
|
|
|
|
|
WARN(tx_lock < 0, "inconsistent tx_lock value");
|
|
|
|
if (!tx_lock)
|
|
|
|
wfx_bh_request_tx(wdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wfx_tx_flush(struct wfx_dev *wdev)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2021-09-13 15:01:58 +02:00
|
|
|
/* Do not wait for any reply if chip is frozen */
|
2019-09-19 14:25:45 +00:00
|
|
|
if (wdev->chip_frozen)
|
|
|
|
return;
|
|
|
|
|
2020-04-01 13:04:03 +02:00
|
|
|
wfx_tx_lock(wdev);
|
2019-09-19 14:25:45 +00:00
|
|
|
mutex_lock(&wdev->hif_cmd.lock);
|
2022-01-13 09:55:13 +01:00
|
|
|
ret = wait_event_timeout(wdev->hif.tx_buffers_empty, !wdev->hif.tx_buffers_used,
|
2019-09-19 14:25:45 +00:00
|
|
|
msecs_to_jiffies(3000));
|
|
|
|
if (!ret) {
|
2019-11-13 11:00:52 +00:00
|
|
|
dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n",
|
|
|
|
wdev->hif.tx_buffers_used);
|
2019-09-19 14:25:45 +00:00
|
|
|
wfx_pending_dump_old_frames(wdev, 3000);
|
2021-09-13 15:01:58 +02:00
|
|
|
/* FIXME: drop pending frames here */
|
2020-04-27 15:40:16 +02:00
|
|
|
wdev->chip_frozen = true;
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
mutex_unlock(&wdev->hif_cmd.lock);
|
2020-04-01 13:04:03 +02:00
|
|
|
wfx_tx_unlock(wdev);
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void wfx_tx_lock_flush(struct wfx_dev *wdev)
|
|
|
|
{
|
|
|
|
wfx_tx_lock(wdev);
|
|
|
|
wfx_tx_flush(wdev);
|
|
|
|
}
|
|
|
|
|
2020-07-01 17:06:55 +02:00
|
|
|
void wfx_tx_queues_init(struct wfx_vif *wvif)
|
2019-09-19 14:25:45 +00:00
|
|
|
{
|
2022-01-13 09:55:14 +01:00
|
|
|
/* The device is in charge to respect the details of the QoS parameters. The driver just
|
|
|
|
* ensure that it roughtly respect the priorities to avoid any shortage.
|
2021-09-13 15:01:58 +02:00
|
|
|
*/
|
staging: wfx: fix QoS priority for slow buses
The device is in charge of respecting the QoS constraints. The driver
have to ensure that all the queues contain data and the device choose
the right queue to send.
The things starts to be more difficult when the bandwidth of the bus is
lower than the bandwidth of the WiFi. The device quickly sends the
frames of the highest priority queue. Then, it starts to send frames
from a lower priority queue. Though, there are still some high priority
frames waiting in the driver.
To work around this problem, this patch add some priorities to each
queue. The weigh of the queue was (roughly) calculated experimentally by
checking the speed ratio of each queue when the bus does not limit the
traffic:
- Be/Bk -> 20Mbps/10Mbps
- Vi/Be -> 36Mbps/180Kbps
- Vo/Be -> 35Mbps/600Kbps
- Vi/Vo -> 24Mbps/12Mbps
So, if we fix the weigh of the Background to 1, the weight of Best
Effort should be 2. The weight of Video should be 116. However, since
there is only 32 queues, it make no sense to use a value greater than
64[1]. And finally, the weight of the Voice is set to 128.
[1] Because of this approximation, with very slow bus, we can still
observe frame starvation when we measure the speed ratio of Vi/Be. It is
around 35Mbps/1Mbps (instead of 36Mbps/180Kbps). However, it is still in
accepted error range.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20201007101943.749898-5-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-07 12:19:40 +02:00
|
|
|
const int priorities[IEEE80211_NUM_ACS] = { 1, 2, 64, 128 };
|
2019-09-19 14:25:45 +00:00
|
|
|
int i;
|
|
|
|
|
2020-04-01 13:04:01 +02:00
|
|
|
for (i = 0; i < IEEE80211_NUM_ACS; ++i) {
|
2020-07-01 17:06:55 +02:00
|
|
|
skb_queue_head_init(&wvif->tx_queue[i].normal);
|
|
|
|
skb_queue_head_init(&wvif->tx_queue[i].cab);
|
2023-10-04 19:28:42 +02:00
|
|
|
skb_queue_head_init(&wvif->tx_queue[i].offchan);
|
staging: wfx: fix QoS priority for slow buses
The device is in charge of respecting the QoS constraints. The driver
have to ensure that all the queues contain data and the device choose
the right queue to send.
The things starts to be more difficult when the bandwidth of the bus is
lower than the bandwidth of the WiFi. The device quickly sends the
frames of the highest priority queue. Then, it starts to send frames
from a lower priority queue. Though, there are still some high priority
frames waiting in the driver.
To work around this problem, this patch add some priorities to each
queue. The weigh of the queue was (roughly) calculated experimentally by
checking the speed ratio of each queue when the bus does not limit the
traffic:
- Be/Bk -> 20Mbps/10Mbps
- Vi/Be -> 36Mbps/180Kbps
- Vo/Be -> 35Mbps/600Kbps
- Vi/Vo -> 24Mbps/12Mbps
So, if we fix the weigh of the Background to 1, the weight of Best
Effort should be 2. The weight of Video should be 116. However, since
there is only 32 queues, it make no sense to use a value greater than
64[1]. And finally, the weight of the Voice is set to 128.
[1] Because of this approximation, with very slow bus, we can still
observe frame starvation when we measure the speed ratio of Vi/Be. It is
around 35Mbps/1Mbps (instead of 36Mbps/180Kbps). However, it is still in
accepted error range.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20201007101943.749898-5-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-07 12:19:40 +02:00
|
|
|
wvif->tx_queue[i].priority = priorities[i];
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-13 15:01:39 +02:00
|
|
|
bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue)
|
|
|
|
{
|
2023-10-04 19:28:42 +02:00
|
|
|
return skb_queue_empty_lockless(&queue->normal) &&
|
|
|
|
skb_queue_empty_lockless(&queue->cab) &&
|
|
|
|
skb_queue_empty_lockless(&queue->offchan);
|
2021-09-13 15:01:39 +02:00
|
|
|
}
|
|
|
|
|
2020-07-01 17:06:55 +02:00
|
|
|
void wfx_tx_queues_check_empty(struct wfx_vif *wvif)
|
2019-09-19 14:25:45 +00:00
|
|
|
{
|
2020-04-01 13:04:01 +02:00
|
|
|
int i;
|
2019-09-19 14:25:45 +00:00
|
|
|
|
2020-04-01 13:04:01 +02:00
|
|
|
for (i = 0; i < IEEE80211_NUM_ACS; ++i) {
|
2020-07-01 17:06:55 +02:00
|
|
|
WARN_ON(atomic_read(&wvif->tx_queue[i].pending_frames));
|
2021-09-13 15:01:39 +02:00
|
|
|
WARN_ON(!wfx_tx_queue_empty(wvif, &wvif->tx_queue[i]));
|
2020-04-01 13:04:01 +02:00
|
|
|
}
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-01 17:06:55 +02:00
|
|
|
static void __wfx_tx_queue_drop(struct wfx_vif *wvif,
|
2022-01-13 09:55:13 +01:00
|
|
|
struct sk_buff_head *skb_queue, struct sk_buff_head *dropped)
|
2020-04-01 13:04:01 +02:00
|
|
|
{
|
|
|
|
struct sk_buff *skb, *tmp;
|
|
|
|
|
|
|
|
spin_lock_bh(&skb_queue->lock);
|
|
|
|
skb_queue_walk_safe(skb_queue, skb, tmp) {
|
2020-07-01 17:06:55 +02:00
|
|
|
__skb_unlink(skb, skb_queue);
|
|
|
|
skb_queue_head(dropped, skb);
|
2020-04-01 13:03:55 +02:00
|
|
|
}
|
2020-04-01 13:04:01 +02:00
|
|
|
spin_unlock_bh(&skb_queue->lock);
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-01 17:06:55 +02:00
|
|
|
void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue,
|
|
|
|
struct sk_buff_head *dropped)
|
2019-09-19 14:25:45 +00:00
|
|
|
{
|
2020-07-01 17:06:55 +02:00
|
|
|
__wfx_tx_queue_drop(wvif, &queue->normal, dropped);
|
2023-10-04 19:28:42 +02:00
|
|
|
__wfx_tx_queue_drop(wvif, &queue->cab, dropped);
|
|
|
|
__wfx_tx_queue_drop(wvif, &queue->offchan, dropped);
|
2020-07-01 17:06:55 +02:00
|
|
|
wake_up(&wvif->wdev->tx_dequeue);
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-01 17:06:55 +02:00
|
|
|
void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb)
|
2019-09-19 14:25:45 +00:00
|
|
|
{
|
2020-07-01 17:06:55 +02:00
|
|
|
struct wfx_queue *queue = &wvif->tx_queue[skb_get_queue_mapping(skb)];
|
2020-04-01 13:03:55 +02:00
|
|
|
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
2019-09-19 14:25:45 +00:00
|
|
|
|
2023-10-04 19:28:42 +02:00
|
|
|
if (tx_info->flags & IEEE80211_TX_CTL_TX_OFFCHAN)
|
|
|
|
skb_queue_tail(&queue->offchan, skb);
|
|
|
|
else if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM)
|
2020-04-01 13:03:55 +02:00
|
|
|
skb_queue_tail(&queue->cab, skb);
|
|
|
|
else
|
|
|
|
skb_queue_tail(&queue->normal, skb);
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
|
2020-04-01 13:04:01 +02:00
|
|
|
void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped)
|
|
|
|
{
|
|
|
|
struct wfx_queue *queue;
|
2020-07-01 17:06:55 +02:00
|
|
|
struct wfx_vif *wvif;
|
2020-04-01 13:04:01 +02:00
|
|
|
struct sk_buff *skb;
|
|
|
|
|
2022-01-13 09:55:13 +01:00
|
|
|
WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", __func__);
|
2020-04-01 13:04:01 +02:00
|
|
|
while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) {
|
2023-10-04 19:28:42 +02:00
|
|
|
wvif = wfx_skb_wvif(wdev, skb);
|
2020-07-01 17:06:55 +02:00
|
|
|
if (wvif) {
|
|
|
|
queue = &wvif->tx_queue[skb_get_queue_mapping(skb)];
|
|
|
|
WARN_ON(skb_get_queue_mapping(skb) > 3);
|
|
|
|
WARN_ON(!atomic_read(&queue->pending_frames));
|
|
|
|
atomic_dec(&queue->pending_frames);
|
|
|
|
}
|
2020-04-01 13:04:01 +02:00
|
|
|
skb_queue_head(dropped, skb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-01 17:06:57 +02:00
|
|
|
struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id)
|
2019-09-19 14:25:45 +00:00
|
|
|
{
|
2020-04-01 13:03:59 +02:00
|
|
|
struct wfx_queue *queue;
|
2022-01-13 09:55:11 +01:00
|
|
|
struct wfx_hif_req_tx *req;
|
2020-07-01 17:06:57 +02:00
|
|
|
struct wfx_vif *wvif;
|
2022-01-13 09:55:11 +01:00
|
|
|
struct wfx_hif_msg *hif;
|
2020-04-01 13:03:59 +02:00
|
|
|
struct sk_buff *skb;
|
2019-09-19 14:25:45 +00:00
|
|
|
|
2020-07-01 17:06:57 +02:00
|
|
|
spin_lock_bh(&wdev->tx_pending.lock);
|
|
|
|
skb_queue_walk(&wdev->tx_pending, skb) {
|
2022-01-13 09:55:11 +01:00
|
|
|
hif = (struct wfx_hif_msg *)skb->data;
|
|
|
|
req = (struct wfx_hif_req_tx *)hif->body;
|
2020-07-01 17:06:57 +02:00
|
|
|
if (req->packet_id != packet_id)
|
|
|
|
continue;
|
|
|
|
spin_unlock_bh(&wdev->tx_pending.lock);
|
2023-10-04 19:28:42 +02:00
|
|
|
wvif = wfx_skb_wvif(wdev, skb);
|
2020-07-01 17:06:57 +02:00
|
|
|
if (wvif) {
|
2020-07-01 17:06:55 +02:00
|
|
|
queue = &wvif->tx_queue[skb_get_queue_mapping(skb)];
|
2020-04-01 13:03:59 +02:00
|
|
|
WARN_ON(skb_get_queue_mapping(skb) > 3);
|
|
|
|
WARN_ON(!atomic_read(&queue->pending_frames));
|
|
|
|
atomic_dec(&queue->pending_frames);
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
2020-07-01 17:06:57 +02:00
|
|
|
skb_unlink(skb, &wdev->tx_pending);
|
|
|
|
return skb;
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
2020-07-01 17:06:57 +02:00
|
|
|
spin_unlock_bh(&wdev->tx_pending.lock);
|
2019-10-08 09:43:01 +00:00
|
|
|
WARN(1, "cannot find packet in pending queue");
|
2019-09-19 14:25:45 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms)
|
|
|
|
{
|
|
|
|
ktime_t now = ktime_get();
|
|
|
|
struct wfx_tx_priv *tx_priv;
|
2022-01-13 09:55:11 +01:00
|
|
|
struct wfx_hif_req_tx *req;
|
2019-09-19 14:25:45 +00:00
|
|
|
struct sk_buff *skb;
|
|
|
|
bool first = true;
|
|
|
|
|
2020-04-01 13:03:57 +02:00
|
|
|
spin_lock_bh(&wdev->tx_pending.lock);
|
|
|
|
skb_queue_walk(&wdev->tx_pending, skb) {
|
2019-09-19 14:25:45 +00:00
|
|
|
tx_priv = wfx_skb_tx_priv(skb);
|
|
|
|
req = wfx_skb_txreq(skb);
|
2022-01-13 09:55:13 +01:00
|
|
|
if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, limit_ms))) {
|
2019-09-19 14:25:45 +00:00
|
|
|
if (first) {
|
|
|
|
dev_info(wdev->dev, "frames stuck in firmware since %dms or more:\n",
|
|
|
|
limit_ms);
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
dev_info(wdev->dev, " id %08x sent %lldms ago\n",
|
2022-01-13 09:55:13 +01:00
|
|
|
req->packet_id, ktime_ms_delta(now, tx_priv->xmit_timestamp));
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-01 13:03:57 +02:00
|
|
|
spin_unlock_bh(&wdev->tx_pending.lock);
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
|
2022-01-13 09:55:13 +01:00
|
|
|
unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb)
|
2019-09-19 14:25:45 +00:00
|
|
|
{
|
|
|
|
ktime_t now = ktime_get();
|
|
|
|
struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb);
|
|
|
|
|
|
|
|
return ktime_us_delta(now, tx_priv->xmit_timestamp);
|
|
|
|
}
|
|
|
|
|
2020-04-01 13:03:53 +02:00
|
|
|
bool wfx_tx_queues_has_cab(struct wfx_vif *wvif)
|
|
|
|
{
|
2022-05-06 13:00:46 -04:00
|
|
|
struct ieee80211_vif *vif = wvif_to_vif(wvif);
|
2020-04-01 13:03:53 +02:00
|
|
|
int i;
|
|
|
|
|
2022-05-06 13:00:46 -04:00
|
|
|
if (vif->type != NL80211_IFTYPE_AP)
|
2020-04-01 13:03:55 +02:00
|
|
|
return false;
|
|
|
|
for (i = 0; i < IEEE80211_NUM_ACS; ++i)
|
2022-02-25 12:23:58 +01:00
|
|
|
/* Note: since only AP can have mcast frames in queue and only one vif can be AP,
|
|
|
|
* all queued frames has same interface id
|
2021-09-13 15:01:58 +02:00
|
|
|
*/
|
2020-07-01 17:06:55 +02:00
|
|
|
if (!skb_queue_empty_lockless(&wvif->tx_queue[i].cab))
|
2020-04-01 13:03:55 +02:00
|
|
|
return true;
|
2020-04-01 13:03:53 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
staging: wfx: fix QoS priority for slow buses
The device is in charge of respecting the QoS constraints. The driver
have to ensure that all the queues contain data and the device choose
the right queue to send.
The things starts to be more difficult when the bandwidth of the bus is
lower than the bandwidth of the WiFi. The device quickly sends the
frames of the highest priority queue. Then, it starts to send frames
from a lower priority queue. Though, there are still some high priority
frames waiting in the driver.
To work around this problem, this patch add some priorities to each
queue. The weigh of the queue was (roughly) calculated experimentally by
checking the speed ratio of each queue when the bus does not limit the
traffic:
- Be/Bk -> 20Mbps/10Mbps
- Vi/Be -> 36Mbps/180Kbps
- Vo/Be -> 35Mbps/600Kbps
- Vi/Vo -> 24Mbps/12Mbps
So, if we fix the weigh of the Background to 1, the weight of Best
Effort should be 2. The weight of Video should be 116. However, since
there is only 32 queues, it make no sense to use a value greater than
64[1]. And finally, the weight of the Voice is set to 128.
[1] Because of this approximation, with very slow bus, we can still
observe frame starvation when we measure the speed ratio of Vi/Be. It is
around 35Mbps/1Mbps (instead of 36Mbps/180Kbps). However, it is still in
accepted error range.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20201007101943.749898-5-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-07 12:19:40 +02:00
|
|
|
static int wfx_tx_queue_get_weight(struct wfx_queue *queue)
|
|
|
|
{
|
|
|
|
return atomic_read(&queue->pending_frames) * queue->priority;
|
|
|
|
}
|
|
|
|
|
2020-04-01 13:03:55 +02:00
|
|
|
static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
|
2019-09-19 14:25:45 +00:00
|
|
|
{
|
2020-07-01 17:06:55 +02:00
|
|
|
struct wfx_queue *queues[IEEE80211_NUM_ACS * ARRAY_SIZE(wdev->vif)];
|
|
|
|
int i, j, num_queues = 0;
|
2020-04-01 13:03:55 +02:00
|
|
|
struct wfx_vif *wvif;
|
2022-01-13 09:55:11 +01:00
|
|
|
struct wfx_hif_msg *hif;
|
2020-04-01 13:03:55 +02:00
|
|
|
struct sk_buff *skb;
|
2020-07-01 17:06:55 +02:00
|
|
|
|
2021-09-13 15:01:58 +02:00
|
|
|
/* sort the queues */
|
2020-07-01 17:06:55 +02:00
|
|
|
wvif = NULL;
|
|
|
|
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
|
|
|
|
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
|
|
|
|
WARN_ON(num_queues >= ARRAY_SIZE(queues));
|
|
|
|
queues[num_queues] = &wvif->tx_queue[i];
|
|
|
|
for (j = num_queues; j > 0; j--)
|
staging: wfx: fix QoS priority for slow buses
The device is in charge of respecting the QoS constraints. The driver
have to ensure that all the queues contain data and the device choose
the right queue to send.
The things starts to be more difficult when the bandwidth of the bus is
lower than the bandwidth of the WiFi. The device quickly sends the
frames of the highest priority queue. Then, it starts to send frames
from a lower priority queue. Though, there are still some high priority
frames waiting in the driver.
To work around this problem, this patch add some priorities to each
queue. The weigh of the queue was (roughly) calculated experimentally by
checking the speed ratio of each queue when the bus does not limit the
traffic:
- Be/Bk -> 20Mbps/10Mbps
- Vi/Be -> 36Mbps/180Kbps
- Vo/Be -> 35Mbps/600Kbps
- Vi/Vo -> 24Mbps/12Mbps
So, if we fix the weigh of the Background to 1, the weight of Best
Effort should be 2. The weight of Video should be 116. However, since
there is only 32 queues, it make no sense to use a value greater than
64[1]. And finally, the weight of the Voice is set to 128.
[1] Because of this approximation, with very slow bus, we can still
observe frame starvation when we measure the speed ratio of Vi/Be. It is
around 35Mbps/1Mbps (instead of 36Mbps/180Kbps). However, it is still in
accepted error range.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20201007101943.749898-5-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-07 12:19:40 +02:00
|
|
|
if (wfx_tx_queue_get_weight(queues[j]) <
|
|
|
|
wfx_tx_queue_get_weight(queues[j - 1]))
|
2020-07-01 17:06:55 +02:00
|
|
|
swap(queues[j - 1], queues[j]);
|
|
|
|
num_queues++;
|
|
|
|
}
|
2020-04-01 13:03:55 +02:00
|
|
|
}
|
2020-07-01 17:06:55 +02:00
|
|
|
|
2023-10-04 19:28:42 +02:00
|
|
|
wvif = NULL;
|
|
|
|
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
|
|
|
|
for (i = 0; i < num_queues; i++) {
|
|
|
|
skb = skb_dequeue(&queues[i]->offchan);
|
|
|
|
if (!skb)
|
|
|
|
continue;
|
|
|
|
hif = (struct wfx_hif_msg *)skb->data;
|
|
|
|
/* Offchan frames are assigned to a special interface.
|
|
|
|
* The only interface allowed to send data during scan.
|
|
|
|
*/
|
|
|
|
WARN_ON(hif->interface != 2);
|
|
|
|
atomic_inc(&queues[i]->pending_frames);
|
|
|
|
trace_queues_stats(wdev, queues[i]);
|
|
|
|
return skb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mutex_is_locked(&wdev->scan_lock))
|
|
|
|
return NULL;
|
|
|
|
|
2020-04-01 13:03:55 +02:00
|
|
|
wvif = NULL;
|
|
|
|
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
|
|
|
|
if (!wvif->after_dtim_tx_allowed)
|
2019-09-19 14:25:45 +00:00
|
|
|
continue;
|
2020-07-01 17:06:55 +02:00
|
|
|
for (i = 0; i < num_queues; i++) {
|
|
|
|
skb = skb_dequeue(&queues[i]->cab);
|
2020-04-01 13:03:55 +02:00
|
|
|
if (!skb)
|
|
|
|
continue;
|
2022-02-25 12:23:58 +01:00
|
|
|
/* Note: since only AP can have mcast frames in queue and only one vif can
|
|
|
|
* be AP, all queued frames has same interface id
|
2021-09-13 15:01:58 +02:00
|
|
|
*/
|
2022-01-13 09:55:11 +01:00
|
|
|
hif = (struct wfx_hif_msg *)skb->data;
|
2020-04-01 13:03:55 +02:00
|
|
|
WARN_ON(hif->interface != wvif->id);
|
2022-01-13 09:55:13 +01:00
|
|
|
WARN_ON(queues[i] != &wvif->tx_queue[skb_get_queue_mapping(skb)]);
|
2020-07-01 17:06:55 +02:00
|
|
|
atomic_inc(&queues[i]->pending_frames);
|
2020-07-01 17:06:58 +02:00
|
|
|
trace_queues_stats(wdev, queues[i]);
|
2020-04-01 13:03:55 +02:00
|
|
|
return skb;
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
2021-09-13 15:01:58 +02:00
|
|
|
/* No more multicast to sent */
|
2020-04-01 13:03:55 +02:00
|
|
|
wvif->after_dtim_tx_allowed = false;
|
|
|
|
schedule_work(&wvif->update_tim_work);
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
2020-07-01 17:06:55 +02:00
|
|
|
|
|
|
|
for (i = 0; i < num_queues; i++) {
|
|
|
|
skb = skb_dequeue(&queues[i]->normal);
|
2020-04-01 13:03:55 +02:00
|
|
|
if (skb) {
|
2020-07-01 17:06:55 +02:00
|
|
|
atomic_inc(&queues[i]->pending_frames);
|
2020-07-01 17:06:58 +02:00
|
|
|
trace_queues_stats(wdev, queues[i]);
|
2020-04-01 13:03:55 +02:00
|
|
|
return skb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|
|
|
|
|
2022-01-13 09:55:11 +01:00
|
|
|
struct wfx_hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
|
2019-09-19 14:25:45 +00:00
|
|
|
{
|
2020-04-01 13:03:55 +02:00
|
|
|
struct wfx_tx_priv *tx_priv;
|
2019-09-19 14:25:45 +00:00
|
|
|
struct sk_buff *skb;
|
2020-01-15 13:55:25 +00:00
|
|
|
|
|
|
|
if (atomic_read(&wdev->tx_lock))
|
|
|
|
return NULL;
|
2020-05-29 14:16:03 +02:00
|
|
|
skb = wfx_tx_queues_get_skb(wdev);
|
|
|
|
if (!skb)
|
|
|
|
return NULL;
|
|
|
|
skb_queue_tail(&wdev->tx_pending, skb);
|
|
|
|
wake_up(&wdev->tx_dequeue);
|
|
|
|
tx_priv = wfx_skb_tx_priv(skb);
|
|
|
|
tx_priv->xmit_timestamp = ktime_get();
|
2022-01-13 09:55:11 +01:00
|
|
|
return (struct wfx_hif_msg *)skb->data;
|
2019-09-19 14:25:45 +00:00
|
|
|
}
|