From: Konstantin Shkolnyy <kshk@linux.ibm.com>
To: jasowang@redhat.com, akihiko.odaki@daynix.com
Cc: qemu-devel@nongnu.org, mjrosato@linux.ibm.com,
Konstantin Shkolnyy <kshk@linux.ibm.com>
Subject: [PATCH] vdpa: Allow VDPA to work on big-endian machine
Date: Sat, 14 Jun 2025 17:44:22 -0500 [thread overview]
Message-ID: <20250614224422.1595301-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.
Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
---
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..99c9eb42b9 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)
{
+ __le16 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-14 22:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-14 22:44 Konstantin Shkolnyy [this message]
2025-06-16 2:49 ` [PATCH] vdpa: Allow VDPA to work on big-endian machine Jason Wang
2025-06-16 6:19 ` Eugenio Perez Martin
2025-06-16 8:56 ` Akihiko Odaki
-- strict thread matches above, loose matches on Subject: below --
2025-02-11 16:19 [PATCH] vdpa: Allow vDPA " Konstantin Shkolnyy
2025-02-12 13:38 ` Eugenio Perez Martin
2025-02-12 14:47 ` Konstantin Shkolnyy
2025-02-12 14:52 ` Philippe Mathieu-Daudé
2025-02-12 17:24 ` Konstantin Shkolnyy
2025-02-12 18:07 ` Philippe Mathieu-Daudé
2025-02-12 20:01 ` Konstantin Shkolnyy
2025-02-18 13:27 ` Konstantin Shkolnyy
2025-02-18 14:02 ` Philippe Mathieu-Daudé
2025-02-19 0:29 ` Jason Wang
2025-02-20 15:57 ` Michael S. Tsirkin
2025-02-21 3:40 ` Konstantin Shkolnyy
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=20250614224422.1595301-1-kshk@linux.ibm.com \
--to=kshk@linux.ibm.com \
--cc=akihiko.odaki@daynix.com \
--cc=jasowang@redhat.com \
--cc=mjrosato@linux.ibm.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).