diff mbox series

[v2,1/3] hw/dma: xilinx_axidma: Correct the txlen value in the descriptor

Message ID 20240801140609.26922-2-jim.shu@sifive.com (mailing list archive)
State New, archived
Headers show
Series Several fixes of AXI-ethernet/DMA | expand

Commit Message

Jim Shu Aug. 1, 2024, 2:06 p.m. UTC
Currently, txlen is always decremented to 0 before filling to the
descriptor. Keep the origin txlen value to have the correct value of
descriptor status field.

It will fix the 'tx_bytes' statistic value in linux axi-ethernet driver.

Signed-off-by: Jim Shu <jim.shu@sifive.com>
---
 hw/dma/xilinx_axidma.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Peter Maydell Aug. 8, 2024, 1:21 p.m. UTC | #1
On Thu, 1 Aug 2024 at 15:07, Jim Shu <jim.shu@sifive.com> wrote:
>
> Currently, txlen is always decremented to 0 before filling to the
> descriptor. Keep the origin txlen value to have the correct value of
> descriptor status field.
>
> It will fix the 'tx_bytes' statistic value in linux axi-ethernet driver.
>
> Signed-off-by: Jim Shu <jim.shu@sifive.com>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox series

Patch

diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index c9cfc3169b..6aa8c9272c 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -291,7 +291,7 @@  static void stream_process_mem2s(struct Stream *s, StreamSink *tx_data_dev,
                                  StreamSink *tx_control_dev)
 {
     uint32_t prev_d;
-    uint32_t txlen;
+    uint32_t txlen, origin_txlen;
     uint64_t addr;
     bool eop;
 
@@ -314,6 +314,7 @@  static void stream_process_mem2s(struct Stream *s, StreamSink *tx_data_dev,
         }
 
         txlen = s->desc.control & SDESC_CTRL_LEN_MASK;
+        origin_txlen = txlen;
 
         eop = stream_desc_eof(&s->desc);
         addr = s->desc.buffer_address;
@@ -334,7 +335,7 @@  static void stream_process_mem2s(struct Stream *s, StreamSink *tx_data_dev,
         }
 
         /* Update the descriptor.  */
-        s->desc.status = txlen | SDESC_STATUS_COMPLETE;
+        s->desc.status = origin_txlen | SDESC_STATUS_COMPLETE;
         stream_desc_store(s, s->regs[R_CURDESC]);
 
         /* Advance.  */