Thread (35 messages) 35 messages, 4 authors, 3d ago

Re: [PATCH net-next v3 04/15] net: macb: unify queue index variable naming convention and types

From: Théo Lebrun <theo.lebrun@bootlin.com>
Date: 2026-07-03 17:10:58
Also in: lkml

Hello Conor,

On Fri Jul 3, 2026 at 1:34 PM CEST, Conor Dooley wrote:
On Wed, Jul 01, 2026 at 05:59:07PM +0200, Théo Lebrun wrote:
quoted
Variables are named q or queue_index. Types are int, unsigned int, u32
and u16. Use `unsigned int q` everywhere.

Skip over taprio functions. They use `u8 queue_id` which fits with the
`struct macb_queue_enst_config` field. Using `queue_id` everywhere
would be too verbose.
I'm not sure that I agree about the verbosity, and "q" isn't a letter I
would naturally associate with indexing, in the way ijk etc are. Perhaps
in netdev it is a natural choice however?
The question wasn't much if q made sense in netdev land, more about what
the MACB code used and to unify the naming convention.

                           Before  After
struct macb_queue * q           1      0
int q                           1      0
u32 queue_index                 1      0
u16 queue_index                 2      0
unsigned int q                  4     12
struct macb_queue * queue      29     25

`q` that could be an index (5 times) or a `struct macb_queue *`
(29 times) was the most annoying to me. As `queue` was often the
pointer, I used that.

`queue_id` or `queue_index` for the stack felt too descriptive for no
valid reason. If it was green-field code I'd name it `qid` but that
name doesn't appear anywhere in MACB so I avoided introducing new
jargon.

If you have a name proposal I will probably agree with you and go that
route!

# command to extract counts
ctags -o - --kinds-c='{local}{member}{parameter}' \
      --fields='{typeref}' drivers/net/ethernet/cadence/* | \
awk -F"\t" '$1=="q" || $1 ~ /queue/ {print $NF, $1}' | \
sort | uniq -c | sort -n

Thanks,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help