Skip to contentSkip to conversation

staging: wfx: fix AC priority

PATCH New Jerome Pouiller 1 participant 2 messages May 29, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging: wfx: fix AC priority

From: Jérôme Pouiller <[email protected]>

In order to work properly all the queues of the device must be filled (the device chooses itself the queue to use depending of AC parameters and other things). It is the job of wfx_tx_queues_get_skb() to choose which queue must be filled. However, the sorting algorithm was inverted, so it prioritized the already filled queue! Consequently, the AC priorities was badly broken.

Fixes 6bf418c50f98a ("staging: wfx: change the way to choose frame to send")
---
 drivers/staging/wfx/queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/queue.c +1 -1
index 3248ecefda564..75df4aca29ac3 100644
@@ -246,7 +246,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
 	for (i = 0; i < IEEE80211_NUM_ACS; i++) {
 		sorted_queues[i] = &wdev->tx_queue[i];
 		for (j = i; j > 0; j--)
-			if (atomic_read(&sorted_queues[j]->pending_frames) >
+			if (atomic_read(&sorted_queues[j]->pending_frames) <
 			    atomic_read(&sorted_queues[j - 1]->pending_frames))
 				swap(sorted_queues[j - 1], sorted_queues[j]);
 	}
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/2 staging: wfx: drop useless loop

From: Jérôme Pouiller <[email protected]>

It is guarantee that the loop will stop at first iteration. So drop the loop.

Fixes 6bf418c50f98a ("staging: wfx: change the way to choose frame to send")
---
 drivers/staging/wfx/queue.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/staging/wfx/queue.c +8 -11
index 75df4aca29ac3..93ea2b72febd0 100644
@@ -291,15 +291,12 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
 
 	if (atomic_read(&wdev->tx_lock))
 		return NULL;
-
-	for (;;) {
-		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();
-		return (struct hif_msg *)skb->data;
-	}
+	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();
+	return (struct hif_msg *)skb->data;
 }
Signature · 1 line
2.26.2