From: Konstantin Shkolnyy <kshk@linux.ibm.com>
To: jasowang@redhat.com, akihiko.odaki@daynix.com, yin31149@gmail.com
Cc: qemu-devel@nongnu.org, mjrosato@linux.ibm.com,
"Konstantin Shkolnyy" <kshk@linux.ibm.com>,
"Eugenio Pérez" <eperezma@redhat.com>
Subject: [PATCH v2] vdpa: Allow VDPA to work on big-endian machine
Date: Mon, 16 Jun 2025 08:36:47 -0500 [thread overview]
Message-ID: <20250616133647.1662767-1-kshk@linux.ibm.com> (raw)
After commit 0caed25cd171 vhost_vdpa_net_load_vlan() started seeing
VIRTIO_NET_F_CTRL_VLAN flag and making 4096 calls to the kernel with
VIRTIO_NET_CTRL_VLAN_ADD command. However, it forgot to convert the
16-bit VLAN IDs to LE format. On BE machine, the kernel calls failed
when they saw "VLAN IDs" greater than 4095, and QEMU then said:
"unable to start vhost net: 5: falling back on userspace virtio", and
VDPA became disabled.
Convert the VLAN ID to LE before putting it into virtio queue.
Fixes: 8f7e9967484d ("vdpa: Restore vlan filtering state")
Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Eugenio Pérez <eperezma@redhat.com>
---
Changes in v2:
- Replace __le16 with uint16_t.
- Add "Fixes:" tag.
net/vhost-vdpa.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 58d738945d..bd5c37305d 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -1173,9 +1173,10 @@ static int vhost_vdpa_net_load_single_vlan(VhostVDPAState *s,
struct iovec *in_cursor,
uint16_t vid)
{
+ uint16_t vid_le = cpu_to_le16(vid);
const struct iovec data = {
- .iov_base = &vid,
- .iov_len = sizeof(vid),
+ .iov_base = &vid_le,
+ .iov_len = sizeof(vid_le),
};
ssize_t r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor,
VIRTIO_NET_CTRL_VLAN,
--
2.34.1
next reply other threads:[~2025-06-16 13:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 13:36 Konstantin Shkolnyy [this message]
2025-06-21 5:52 ` [PATCH v2] vdpa: Allow VDPA to work on big-endian machine Akihiko Odaki
-- strict thread matches above, loose matches on Subject: below --
2025-02-21 19:07 [PATCH v2] vdpa: Allow vDPA " Konstantin Shkolnyy
2025-02-24 1:57 ` Jason Wang
2025-03-13 15:13 ` Konstantin Shkolnyy
2025-03-17 0:26 ` Jason Wang
2025-03-17 0:36 ` Michael S. Tsirkin
2025-03-14 11:36 ` Eugenio Perez Martin
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=20250616133647.1662767-1-kshk@linux.ibm.com \
--to=kshk@linux.ibm.com \
--cc=akihiko.odaki@daynix.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=mjrosato@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=yin31149@gmail.com \
/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).