This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 6b35a49f6e dirivers: virtio: Fix virtnet_transmit() in 
virtio-mmio-net.c
6b35a49f6e is described below

commit 6b35a49f6eea6f88242131ec9dd2730323315aba
Author: Masayuki Ishikawa <[email protected]>
AuthorDate: Thu Jun 1 11:50:54 2023 +0900

    dirivers: virtio: Fix virtnet_transmit() in virtio-mmio-net.c
    
    Summary:
    - I noticed that the driver sends incorrect packets sometimes.
    - This commit fixes this issue.
    
    Impact:
    - None
    
    Testing:
    - Tested with qemu-7.1
    
    Signed-off-by: Masayuki Ishikawa <[email protected]>
---
 drivers/virtio/virtio-mmio-net.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/virtio/virtio-mmio-net.c b/drivers/virtio/virtio-mmio-net.c
index cbf1127936..c8a4a6044a 100644
--- a/drivers/virtio/virtio-mmio-net.c
+++ b/drivers/virtio/virtio-mmio-net.c
@@ -394,6 +394,14 @@ static int virtnet_transmit(FAR struct virtnet_driver_s 
*priv)
 
   wd_start(&priv->vnet_txtimeout, VIRTNET_TXTIMEOUT,
            virtnet_txtimeout_expiry, (wdparm_t)priv);
+
+  /* Wait for completion */
+
+  while (priv->txq->avail->idx != priv->txq->used->idx)
+    {
+      virtio_mb();
+    }
+
   return OK;
 }
 

Reply via email to