qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: Jason Wang <jasowang@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: [PATCH 7/7] virtio-net: Fix num_buffers for version 1
Date: Sun, 15 Sep 2024 10:06:45 +0900	[thread overview]
Message-ID: <20240915-queue-v1-7-b49bd49b926d@daynix.com> (raw)
In-Reply-To: <20240915-queue-v1-0-b49bd49b926d@daynix.com>

The specification says the device MUST set num_buffers to 1 if
VIRTIO_NET_F_MRG_RXBUF has not been negotiated.

Fixes: df91055db5c9 ("virtio-net: enable virtio 1.0")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 hw/net/virtio-net.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index ca4e22344f78..b4a3fb575c7c 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1982,6 +1982,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                                     offsetof(typeof(hdr),
                                              virtio_net.hdr.num_buffers),
                                     sizeof(hdr.virtio_net.hdr.num_buffers));
+            } else {
+                hdr.virtio_net.hdr.num_buffers = cpu_to_le16(1);
             }
 
             guest_offset = n->has_vnet_hdr ?

-- 
2.46.0



  parent reply	other threads:[~2024-09-15  1:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-15  1:06 [PATCH 0/7] virtio-net fixes Akihiko Odaki
2024-09-15  1:06 ` [PATCH 1/7] net: checksum: Convert data to void * Akihiko Odaki
2024-09-15  1:06 ` [PATCH 2/7] virtio-net: Fix size check in dhclient workaround Akihiko Odaki
2024-09-15  1:06 ` [PATCH 3/7] virtio-net: Do not check for the queue before RSS Akihiko Odaki
2024-10-21  8:23   ` Jason Wang
2024-09-15  1:06 ` [PATCH 4/7] virtio-net: Fix hash reporting when the queue changes Akihiko Odaki
2024-09-15  1:06 ` [PATCH 5/7] virtio-net: Initialize hash reporting values Akihiko Odaki
2024-09-15  1:06 ` [PATCH 6/7] virtio-net: Copy received header to buffer Akihiko Odaki
2024-10-21  8:21   ` Jason Wang
2024-10-21  8:22     ` Jason Wang
2024-10-22  6:37       ` Akihiko Odaki
2024-09-15  1:06 ` Akihiko Odaki [this message]
2024-10-15 17:58 ` [PATCH 0/7] virtio-net fixes Michael Tokarev
2024-10-17  6:52   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240915-queue-v1-7-b49bd49b926d@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).