[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1f584fff-1b35-4073-9270-67fc0cc3b864@intel.com>
Date: Mon, 3 Nov 2025 15:36:11 -0800
From: Jacob Keller <jacob.e.keller@...el.com>
To: Lorenzo Bianconi <lorenzo@...nel.org>, Andrew Lunn
<andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, "Eric
Dumazet" <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>
CC: <linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 2/2] net: airoha: Reorganize airoha_queue struct
On 11/3/2025 2:27 AM, Lorenzo Bianconi wrote:
> Do not allocate memory for rx-only fields for hw tx queues and for tx-only
> fields for hw rx queues.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> ---
> drivers/net/ethernet/airoha/airoha_eth.h | 22 +++++++++++++++-------
> 1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.h b/drivers/net/ethernet/airoha/airoha_eth.h
> index fbbc58133364baefafed30299ca0626c686b668e..750dd3e5dfecb5d3d0ff754f6a92ffa000db3343 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.h
> +++ b/drivers/net/ethernet/airoha/airoha_eth.h
> @@ -185,19 +185,27 @@ struct airoha_queue {
> spinlock_t lock;
> struct airoha_queue_entry *entry;
> struct airoha_qdma_desc *desc;
> - u16 head;
> - u16 tail;
>
> int queued;
> int ndesc;
> - int free_thr;
> - int buf_size;
>
> struct napi_struct napi;
> - struct page_pool *page_pool;
> - struct sk_buff *skb;
>
> - struct list_head tx_list;
> + union {
> + struct { /* rx */
> + u16 head;
> + u16 tail;
> + int buf_size;
> +
> + struct page_pool *page_pool;
> + struct sk_buff *skb;
> + };
> +
> + struct { /* tx */
> + struct list_head tx_list;
> + int free_thr;
> + };
> + };
This does save some memory since a given queue now is limited by the
size of the larger of the Tx or Rx portion.
You could completely separate the Tx and Rx queue structures, but that
ends up with a bunch of typing issues to deal with since all the
functions take a airoha_queue structure currently.
I think some recent work has been making use of struct_group() for
situations like this, but its not that valuable if you don't need to
quickly check the size of the group.
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
> };
>
> struct airoha_tx_irq_queue {
>
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)
Powered by blists - more mailing lists