From 5e42bd97cd2b4f8b1bb47a33989e7410ff46df71 Mon Sep 17 00:00:00 2001 From: Zhe Weng Date: Sun, 8 Jan 2023 17:39:22 +0800 Subject: [PATCH] virtio/net: Try fix virtnet logic Signed-off-by: Zhe Weng --- drivers/virtio/virtio-mmio-net.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio-mmio-net.c b/drivers/virtio/virtio-mmio-net.c index 4433a596ec..7e5ac7713c 100644 --- a/drivers/virtio/virtio-mmio-net.c +++ b/drivers/virtio/virtio-mmio-net.c @@ -435,11 +435,9 @@ static int virtnet_txpoll(FAR struct net_driver_s *dev) virtnet_reply(priv); - /* If zero is returned, the polling will continue until all connections - * have been examined. - */ + /* Stop the poll now because we only have one tx buffer (g_pktbuf) */ - return 0; + return -EBUSY; } /**************************************************************************** @@ -591,6 +589,7 @@ static void virtnet_rxdispatch(FAR struct virtnet_driver_s *priv) static void virtnet_receive(FAR struct virtnet_driver_s *priv) { + FAR uint8_t *buf = priv->vnet_dev.d_buf; uint16_t used = priv->rxq->used->idx; uint16_t idx; @@ -632,6 +631,8 @@ static void virtnet_receive(FAR struct virtnet_driver_s *priv) priv->rxq->last_used_idx = used; vrtinfo("+++ rxq->last_used_idx=%d\n", priv->rxq->last_used_idx); + + priv->vnet_dev.d_buf = buf; } /****************************************************************************