diff mbox series

[net-next] tsnep: Fix TX queue stop/wake for multiple queues

Message ID 20230122190425.10041-1-gerhard@engleder-embedded.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tsnep: Fix TX queue stop/wake for multiple queues | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 26 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Gerhard Engleder Jan. 22, 2023, 7:04 p.m. UTC
netif_stop_queue() and netif_wake_queue() act on TX queue 0. This is ok
as long as only a single TX queue is supported. But support for multiple
TX queues was introduced with 762031375d5c and I missed to adapt stop
and wake of TX queues.

Use netif_stop_subqueue() and netif_tx_wake_queue() to act on specific
TX queue.

Fixes: 762031375d5c ("tsnep: Support multiple TX/RX queue pairs")
Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
---
 drivers/net/ethernet/engleder/tsnep_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Paolo Abeni Jan. 24, 2023, 12:07 p.m. UTC | #1
Hello,

On Sun, 2023-01-22 at 20:04 +0100, Gerhard Engleder wrote:
> netif_stop_queue() and netif_wake_queue() act on TX queue 0. This is ok
> as long as only a single TX queue is supported. But support for multiple
> TX queues was introduced with 762031375d5c and I missed to adapt stop
> and wake of TX queues.
> 
> Use netif_stop_subqueue() and netif_tx_wake_queue() to act on specific
> TX queue.
> 
> Fixes: 762031375d5c ("tsnep: Support multiple TX/RX queue pairs")
> Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>

Any special reason to have this on net-next instead of on the net tree?
The fix is reasonably small and safe and the culprit commit is on net
already.

Thanks,

Paolo
Gerhard Engleder Jan. 24, 2023, 6:59 p.m. UTC | #2
On 24.01.23 13:07, Paolo Abeni wrote:
> Hello,
> 
> On Sun, 2023-01-22 at 20:04 +0100, Gerhard Engleder wrote:
>> netif_stop_queue() and netif_wake_queue() act on TX queue 0. This is ok
>> as long as only a single TX queue is supported. But support for multiple
>> TX queues was introduced with 762031375d5c and I missed to adapt stop
>> and wake of TX queues.
>>
>> Use netif_stop_subqueue() and netif_tx_wake_queue() to act on specific
>> TX queue.
>>
>> Fixes: 762031375d5c ("tsnep: Support multiple TX/RX queue pairs")
>> Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
> 
> Any special reason to have this on net-next instead of on the net tree?
> The fix is reasonably small and safe and the culprit commit is on net
> already.

Not really. May I'm too shy to send to net. I will repost to net. Commit
will grow a little, but those additional lines should make a future
merge more straightforward.

Gerhard
diff mbox series

Patch

diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index e9dfefba5973..c3cf427a9409 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -458,7 +458,7 @@  static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,
 		/* ring full, shall not happen because queue is stopped if full
 		 * below
 		 */
-		netif_stop_queue(tx->adapter->netdev);
+		netif_stop_subqueue(tx->adapter->netdev, tx->queue_index);
 
 		return NETDEV_TX_BUSY;
 	}
@@ -495,7 +495,7 @@  static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,
 
 	if (tsnep_tx_desc_available(tx) < (MAX_SKB_FRAGS + 1)) {
 		/* ring can get full with next frame */
-		netif_stop_queue(tx->adapter->netdev);
+		netif_stop_subqueue(tx->adapter->netdev, tx->queue_index);
 	}
 
 	return NETDEV_TX_OK;
@@ -701,8 +701,8 @@  static bool tsnep_tx_poll(struct tsnep_tx *tx, int napi_budget)
 	} while (likely(budget));
 
 	if ((tsnep_tx_desc_available(tx) >= ((MAX_SKB_FRAGS + 1) * 2)) &&
-	    netif_queue_stopped(tx->adapter->netdev)) {
-		netif_wake_queue(tx->adapter->netdev);
+	    netif_tx_queue_stopped(nq)) {
+		netif_tx_wake_queue(nq);
 	}
 
 	__netif_tx_unlock(nq);