Skip to contentSkip to conversation

Revert "hw/net: Fix the transmission return size"

PATCH In review Ilya Repko 2 participants 3 messages Nov 6, 2025 – Nov 7, 2025 Arm/Zynq architecture

lore
Share & tools
lore

Ilya Repko

author
#0 lore raw

PATCH 1/1 Revert "hw/net: Fix the transmission return size"

This reverts commit 3a6d374b754b4b345195ff6846eeaffedc96a7c5.

During axienet_eth_rx_notify(), s->rxpos is modified to indicate how much data was pushed to AXI DMA. eth_rx() would then return this value. If at 0, network subsystem would consider packet reception as failed and put the packet in a queue for later.

Before we attempt to push packet data to AXI DMA, the packet is stored in s->rxmem buffer. If an attempt to push data fails, we will reattempt to deliver it from s->rxmem buffer once s2mm stream gets a new descriptor. s->rxmem would not be overwritten by a subsequent eth_rx() call, because eth_can_rx() protects it in case it has any data at all. Leaving the packet in a NetQueue though effectively duplicates it.

Therefore, eth_rx() must indicate successful packet reception in case data push to AXI DMA fails.

---
 hw/net/xilinx_axienet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/xilinx_axienet.c +1 -1
index 31e7708082..101b3f260a 100644
@@ -867,7 +867,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
     axienet_eth_rx_notify(s);
 
     enet_update_irq(s);
-    return s->rxpos;
+    return size;
 }
 
 static size_t
Signature · 1 line
2.51.1
#1 lore raw
Quoted 14 lines · Ilya Repko

This reverts commit 3a6d374b754b4b345195ff6846eeaffedc96a7c5.

During axienet_eth_rx_notify(), s->rxpos is modified to indicate how much data was pushed to AXI DMA. eth_rx() would then return this value. If at 0, network subsystem would consider packet reception as failed and put the packet in a queue for later.

Before we attempt to push packet data to AXI DMA, the packet is stored in s->rxmem buffer. If an attempt to push data fails, we will reattempt to deliver it from s->rxmem buffer once s2mm stream gets a new descriptor. s->rxmem would not be overwritten by a subsequent eth_rx() call, because eth_can_rx() protects it in case it has any data at all. Leaving the packet in a NetQueue though effectively duplicates it.

Quoted 2 lines

Therefore, eth_rx() must indicate successful packet reception in case data push to AXI DMA fails.

Hi,

Adding Fea since we're reverting his patch, he may have some insights.

What you describe sounds reasonable but I think we've seen issues with both your version (the original one) and Fea's version.

What machine are you running? Are you running Linux guests?

Cheers,
Edgar

Quoted 22 lines
---
 hw/net/xilinx_axienet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/xilinx_axienet.c +1 -1
index 31e7708082..101b3f260a 100644
@@ -867,7 +867,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
     axienet_eth_rx_notify(s);
 
     enet_update_irq(s);
-    return s->rxpos;
+    return size;
 }
 
 static size_t
Signature · 1 line
2.51.1
author
#2 lore raw

Hi,

We encountered this issue with U-Boot driver. It implements a single RX buffer, which gets resubmitted to s2mm once the network stack is done handling a packet, so for a while the DMA engine has no buffers to store incoming packets into, and that's why we're seeing AXI DMA data push failures, which lead to packets duplicating and NetQueue growing indefinitely.

Haven't really tested with Linux. What was the problem with the kernel driver?

Ilya

Quoted 66 lines · Edgar E. Iglesias
Quoted 21 lines · Ilya Repko

This reverts commit 3a6d374b754b4b345195ff6846eeaffedc96a7c5.

During axienet_eth_rx_notify(), s->rxpos is modified to indicate how much
data was pushed to AXI DMA. eth_rx() would then return this value. If at 0, network subsystem would consider packet reception as failed
and put the packet in a queue for later.

Before we attempt to push packet data to AXI DMA, the packet is stored
in s->rxmem buffer. If an attempt to push data fails, we will reattempt
to deliver it from s->rxmem buffer once s2mm stream gets a new descriptor.
s->rxmem would not be overwritten by a subsequent eth_rx() call, because
eth_can_rx() protects it in case it has any data at all. Leaving the packet
in a NetQueue though effectively duplicates it.

Quoted 3 lines

Therefore, eth_rx() must indicate successful packet reception in case
data push to AXI DMA fails.

Hi,

Adding Fea since we're reverting his patch, he may have some insights.

What you describe sounds reasonable but I think we've seen issues with
both your version (the original one) and Fea's version.

What machine are you running? Are you running Linux guests?

Cheers,
Edgar

Quoted 23 lines

---
 hw/net/xilinx_axienet.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/xilinx_axienet.c +0 -0
index 31e7708082..101b3f260a 100644
@@ -867,7 +867,7 @@ static ssize_t eth_rx(NetClientState *nc, const
 uint8_t *buf, size_t size)
      axienet_eth_rx_notify(s);


     enet_update_irq(s);
-    return s->rxpos;
+    return size;
 }

 static size_t

Signature · 1 line
2.51.1