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

Lorenzo Bianconi lorenzo at kernel.org
Mon Nov 3 02:27:56 PST 2025


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 at 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




More information about the linux-arm-kernel mailing list