All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Rameshbabu <sergeantsagara@protonmail.com>
To: "Kalle Valo" <kvalo@kernel.org>,
	"Larry Finger" <Larry.Finger@lwfinger.net>,
	"Michael Büsch" <m@bues.ch>,
	"Julian Calaby" <julian.calaby@gmail.com>
Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Rahul Rameshbabu <sergeantsagara@protonmail.com>
Subject: [PATCH wireless v2 3/4] wifi: b43: Stop correct queue in DMA worker when QoS is disabled
Date: Sun, 31 Dec 2023 05:03:51 +0000	[thread overview]
Message-ID: <20231231050300.122806-4-sergeantsagara@protonmail.com> (raw)
In-Reply-To: <20231231050300.122806-1-sergeantsagara@protonmail.com>

When QoS is disabled, the queue priority value will not map to the correct
ieee80211 queue since there is only one queue. Stop queue 0 when QoS is
disabled to prevent trying to stop a non-existent queue and failing to stop
the actual queue instantiated.

Fixes: bad691946966 ("b43: avoid packet losses in the dma worker code.")
Signed-off-by: Rahul Rameshbabu <sergeantsagara@protonmail.com>
---

Notes:
    Changes:
    
        v1->v2:
            - Refactored logic with helpers (suggested by Larry Finger
              <Larry.Finger@lwfinger.net>)
    
    Issue Details:
    
        When QoS was first introduced to the b43 driver in commit
        e6f5b934fba8 ("b43: Add QOS support"), four rings were allocated for
        different QoS priorities for video, voice, best effort, and background.
        The core networking stack maps these priorities in the skb, and these
        mappings are noted in the ring's queue_prio member. When disabling QoS
        in the driver, the skb will still contain the mapping for the core
        stack while only one queue is actually considered active (the best
        effort queue). In the situation that QoS is disabled, b43 needs to pass
        0 to ieee80211 queue functions since the number of queues is set to 1
        in the struct ieee80211_hw queues member. This issue was then extended
        to the changes in commit bad691946966 ("b43: avoid packet losses in the
        dma worker code.").

 drivers/net/wireless/broadcom/b43/main.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c
index 92ca0b2ca286..97d8bdeaa06c 100644
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
@@ -3603,7 +3603,7 @@ static void b43_tx_work(struct work_struct *work)
 				err = b43_dma_tx(dev, skb);
 			if (err == -ENOSPC) {
 				wl->tx_queue_stopped[queue_num] = true;
-				ieee80211_stop_queue(wl->hw, queue_num);
+				b43_stop_queue(dev, queue_num);
 				skb_queue_head(&wl->tx_queue[queue_num], skb);
 				break;
 			}
@@ -3627,6 +3627,7 @@ static void b43_op_tx(struct ieee80211_hw *hw,
 		      struct sk_buff *skb)
 {
 	struct b43_wl *wl = hw_to_b43_wl(hw);
+	u16 skb_queue_mapping;
 
 	if (unlikely(skb->len < 2 + 2 + 6)) {
 		/* Too short, this can't be a valid frame. */
@@ -3635,12 +3636,12 @@ static void b43_op_tx(struct ieee80211_hw *hw,
 	}
 	B43_WARN_ON(skb_shinfo(skb)->nr_frags);
 
-	skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb);
-	if (!wl->tx_queue_stopped[skb->queue_mapping]) {
+	skb_queue_mapping = skb_get_queue_mapping(skb);
+	skb_queue_tail(&wl->tx_queue[skb_queue_mapping], skb);
+	if (!wl->tx_queue_stopped[skb_queue_mapping])
 		ieee80211_queue_work(wl->hw, &wl->tx_work);
-	} else {
-		ieee80211_stop_queue(wl->hw, skb->queue_mapping);
-	}
+	else
+		b43_stop_queue(wl->current_dev, skb_queue_mapping);
 }
 
 static void b43_qos_params_upload(struct b43_wldev *dev,
-- 
2.42.0



WARNING: multiple messages have this Message-ID (diff)
From: Rahul Rameshbabu <sergeantsagara@protonmail.com>
To: "Kalle Valo" <kvalo@kernel.org>,
	"Larry Finger" <Larry.Finger@lwfinger.net>,
	"Michael Büsch" <m@bues.ch>,
	"Julian Calaby" <julian.calaby@gmail.com>
Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Rahul Rameshbabu <sergeantsagara@protonmail.com>
Subject: [PATCH wireless v2 3/4] wifi: b43: Stop correct queue in DMA worker when QoS is disabled
Date: Sun, 31 Dec 2023 05:03:51 +0000	[thread overview]
Message-ID: <20231231050300.122806-4-sergeantsagara@protonmail.com> (raw)
In-Reply-To: <20231231050300.122806-1-sergeantsagara@protonmail.com>

When QoS is disabled, the queue priority value will not map to the correct
ieee80211 queue since there is only one queue. Stop queue 0 when QoS is
disabled to prevent trying to stop a non-existent queue and failing to stop
the actual queue instantiated.

Fixes: bad691946966 ("b43: avoid packet losses in the dma worker code.")
Signed-off-by: Rahul Rameshbabu <sergeantsagara@protonmail.com>
---

Notes:
    Changes:
    
        v1->v2:
            - Refactored logic with helpers (suggested by Larry Finger
              <Larry.Finger@lwfinger.net>)
    
    Issue Details:
    
        When QoS was first introduced to the b43 driver in commit
        e6f5b934fba8 ("b43: Add QOS support"), four rings were allocated for
        different QoS priorities for video, voice, best effort, and background.
        The core networking stack maps these priorities in the skb, and these
        mappings are noted in the ring's queue_prio member. When disabling QoS
        in the driver, the skb will still contain the mapping for the core
        stack while only one queue is actually considered active (the best
        effort queue). In the situation that QoS is disabled, b43 needs to pass
        0 to ieee80211 queue functions since the number of queues is set to 1
        in the struct ieee80211_hw queues member. This issue was then extended
        to the changes in commit bad691946966 ("b43: avoid packet losses in the
        dma worker code.").

 drivers/net/wireless/broadcom/b43/main.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c
index 92ca0b2ca286..97d8bdeaa06c 100644
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
@@ -3603,7 +3603,7 @@ static void b43_tx_work(struct work_struct *work)
 				err = b43_dma_tx(dev, skb);
 			if (err == -ENOSPC) {
 				wl->tx_queue_stopped[queue_num] = true;
-				ieee80211_stop_queue(wl->hw, queue_num);
+				b43_stop_queue(dev, queue_num);
 				skb_queue_head(&wl->tx_queue[queue_num], skb);
 				break;
 			}
@@ -3627,6 +3627,7 @@ static void b43_op_tx(struct ieee80211_hw *hw,
 		      struct sk_buff *skb)
 {
 	struct b43_wl *wl = hw_to_b43_wl(hw);
+	u16 skb_queue_mapping;
 
 	if (unlikely(skb->len < 2 + 2 + 6)) {
 		/* Too short, this can't be a valid frame. */
@@ -3635,12 +3636,12 @@ static void b43_op_tx(struct ieee80211_hw *hw,
 	}
 	B43_WARN_ON(skb_shinfo(skb)->nr_frags);
 
-	skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb);
-	if (!wl->tx_queue_stopped[skb->queue_mapping]) {
+	skb_queue_mapping = skb_get_queue_mapping(skb);
+	skb_queue_tail(&wl->tx_queue[skb_queue_mapping], skb);
+	if (!wl->tx_queue_stopped[skb_queue_mapping])
 		ieee80211_queue_work(wl->hw, &wl->tx_work);
-	} else {
-		ieee80211_stop_queue(wl->hw, skb->queue_mapping);
-	}
+	else
+		b43_stop_queue(wl->current_dev, skb_queue_mapping);
 }
 
 static void b43_qos_params_upload(struct b43_wldev *dev,
-- 
2.42.0



_______________________________________________
b43-dev mailing list
b43-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/b43-dev

  parent reply	other threads:[~2023-12-31  5:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-31  5:03 [PATCH wireless v2 0/4] wifi: b43: Various QoS-related fixes Rahul Rameshbabu
2023-12-31  5:03 ` Rahul Rameshbabu
2023-12-31  5:03 ` [PATCH wireless v2 1/4] wifi: b43: Stop/wake correct queue in DMA Tx path when QoS is disabled Rahul Rameshbabu
2023-12-31  5:03   ` Rahul Rameshbabu
2024-01-01  8:01   ` Julian Calaby
2024-01-01  8:01     ` Julian Calaby
2024-01-10 14:56   ` Kalle Valo
2024-01-10 14:56     ` Kalle Valo
2023-12-31  5:03 ` [PATCH wireless v2 2/4] wifi: b43: Stop/wake correct queue in PIO " Rahul Rameshbabu
2023-12-31  5:03   ` Rahul Rameshbabu
2024-01-01  8:02   ` Julian Calaby
2024-01-01  8:02     ` Julian Calaby
2023-12-31  5:03 ` Rahul Rameshbabu [this message]
2023-12-31  5:03   ` [PATCH wireless v2 3/4] wifi: b43: Stop correct queue in DMA worker " Rahul Rameshbabu
2024-01-01  8:03   ` Julian Calaby
2024-01-01  8:03     ` Julian Calaby
2023-12-31  5:03 ` [PATCH wireless v2 4/4] wifi: b43: Disable QoS for bcm4331 Rahul Rameshbabu
2023-12-31  5:03   ` Rahul Rameshbabu
2024-01-01  8:05   ` Julian Calaby
2024-01-01  8:05     ` Julian Calaby
2023-12-31  9:26 ` [PATCH wireless v2 0/4] wifi: b43: Various QoS-related fixes Michael Büsch
2023-12-31  9:26   ` Michael Büsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231231050300.122806-4-sergeantsagara@protonmail.com \
    --to=sergeantsagara@protonmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=b43-dev@lists.infradead.org \
    --cc=julian.calaby@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=m@bues.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.