[PATCH net-next 2/2] net: airoha: Reorganize airoha_queue struct

Lorenzo Bianconi
2025-11-03T10:28:27Z

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@kernel.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;
+ };
+ };
};

struct airoha_tx_irq_queue {

--
2.51.1