From: Konstantin Shkolnyy <kshk@linux.ibm.com>
To: jasowang@redhat.com, mst@redhat.com
Cc: eperezma@redhat.com, sgarzare@redhat.com, mjrosato@linux.ibm.com,
qemu-devel@nongnu.org, Konstantin Shkolnyy <kshk@linux.ibm.com>
Subject: [PATCH v2] vdpa: Allow vDPA to work on big-endian machine
Date: Fri, 21 Feb 2025 13:07:33 -0600 [thread overview]
Message-ID: <20250221190733.490308-1-kshk@linux.ibm.com> (raw)
Add .set_vnet_le() function that always returns success, assuming that
vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and
outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"
Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
---
Changes in V2: Add code comment.
net/vhost-vdpa.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 231b45246c..6e7cec4d45 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -270,6 +270,18 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
}
+/*
+ * FIXME: vhost_vdpa doesn't have an API to "set h/w endianness". But it's
+ * reasonable to assume that h/w is LE by default, because LE is what
+ * virtio 1.0 and later ask for. So, this function just says "yes, the h/w is
+ * LE". Otherwise, on a BE machine, higher-level code would mistakely think
+ * the h/w is BE and can't support VDPA for a virtio 1.0 client.
+ */
+static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool enable)
+{
+ return 0;
+}
+
static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
Error **errp)
{
@@ -437,6 +449,7 @@ static NetClientInfo net_vhost_vdpa_info = {
.cleanup = vhost_vdpa_cleanup,
.has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
.has_ufo = vhost_vdpa_has_ufo,
+ .set_vnet_le = vhost_vdpa_set_vnet_le,
.check_peer_type = vhost_vdpa_check_peer_type,
.set_steering_ebpf = vhost_vdpa_set_steering_ebpf,
};
--
2.34.1
next reply other threads:[~2025-02-21 19:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 19:07 Konstantin Shkolnyy [this message]
2025-02-24 1:57 ` [PATCH v2] vdpa: Allow vDPA to work on big-endian machine 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
-- strict thread matches above, loose matches on Subject: below --
2025-06-16 13:36 [PATCH v2] vdpa: Allow VDPA " Konstantin Shkolnyy
2025-06-21 5:52 ` Akihiko Odaki
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=20250221190733.490308-1-kshk@linux.ibm.com \
--to=kshk@linux.ibm.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.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).