Skip to contentSkip to conversation

queue_api: reduce risk of name collision over txq

PATCH Applied Gur Stavi 3 participants 4 messages May 18, 2025 – May 20, 2025

Subsystems (2)
lore
Share & tools
lore

Gur Stavi

author
#0 lore raw

cover queue_api: reduce risk of name collision over txq

Rename local variable in macros from txq to _txq.
When macro parameter get_desc is expended it is likely to have a txq token that refers to a different txq variable at the caller's site.

Gur Stavi (1):
queue_api: reduce risk of name collision over txq

 include/net/netdev_queues.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

base-commit: 67fa756408a5359941bea2c021740da5e9ed490d

Signature · 1 line
2.45.2
author
#1 lore raw

PATCH 1/1 queue_api: reduce risk of name collision over txq

Rename local variable in macros from txq to _txq.
When macro parameter get_desc is expended it is likely to have a txq token that refers to a different txq variable at the caller's site.

---
 include/net/netdev_queues.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
include/net/netdev_queues.h +9 -9
index 069ff35a72de..ba2eaf39089b 100644
@@ -288,27 +288,27 @@ netdev_txq_completed_mb(struct netdev_queue *dev_queue,
 
 #define netif_subqueue_try_stop(dev, idx, get_desc, start_thrs)		\
 	({								\
-		struct netdev_queue *txq;				\
+		struct netdev_queue *_txq;				\
 									\
-		txq = netdev_get_tx_queue(dev, idx);			\
-		netif_txq_try_stop(txq, get_desc, start_thrs);		\
+		_txq = netdev_get_tx_queue(dev, idx);			\
+		netif_txq_try_stop(_txq, get_desc, start_thrs);		\
 	})
 
 #define netif_subqueue_maybe_stop(dev, idx, get_desc, stop_thrs, start_thrs) \
 	({								\
-		struct netdev_queue *txq;				\
+		struct netdev_queue *_txq;				\
 									\
-		txq = netdev_get_tx_queue(dev, idx);			\
-		netif_txq_maybe_stop(txq, get_desc, stop_thrs, start_thrs); \
+		_txq = netdev_get_tx_queue(dev, idx);			\
+		netif_txq_maybe_stop(_txq, get_desc, stop_thrs, start_thrs); \
 	})
 
 #define netif_subqueue_completed_wake(dev, idx, pkts, bytes,		\
 				      get_desc, start_thrs)		\
 	({								\
-		struct netdev_queue *txq;				\
+		struct netdev_queue *_txq;				\
 									\
-		txq = netdev_get_tx_queue(dev, idx);			\
-		netif_txq_completed_wake(txq, pkts, bytes,		\
+		_txq = netdev_get_tx_queue(dev, idx);			\
+		netif_txq_completed_wake(_txq, pkts, bytes,		\
 					 get_desc, start_thrs);		\
 	})
 
Signature · 1 line
2.45.2
#3 lore raw
In reply to Gur Stavi
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sun, 18 May 2025 13:00:53 +0300 you wrote:

Rename local variable in macros from txq to _txq.
When macro parameter get_desc is expended it is likely to have a txq token that refers to a different txq variable at the caller's site.

Gur Stavi (1):
queue_api: reduce risk of name collision over txq

[...]

Here is the summary with links:
- [net-next,v1,1/1] queue_api: reduce risk of name collision over txq

    https://git.kernel.org/netdev/net-next/c/84b21e61ebd6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html