From: Konstantin Shkolnyy <kshk@linux.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, eperezma@redhat.com
Cc: mst@redhat.com, sgarzare@redhat.com, mjrosato@linux.ibm.com,
qemu-devel@nongnu.org
Subject: Re: [PATCH] vdpa: Allow vDPA to work on big-endian machine
Date: Wed, 12 Feb 2025 14:01:20 -0600 [thread overview]
Message-ID: <90adacff-9409-44f2-9ae6-9e01c8dc6e5c@linux.ibm.com> (raw)
In-Reply-To: <07a8be9a-d99e-4d02-b475-671435c11396@linaro.org>
On 2/12/2025 12:07, Philippe Mathieu-Daudé wrote:
> On 12/2/25 18:24, Konstantin Shkolnyy wrote:
>> On 2/12/2025 08:52, Philippe Mathieu-Daudé wrote:
>>> On 11/2/25 17:19, Konstantin Shkolnyy wrote:
>>>> 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>
>>>> ---
>>>> net/vhost-vdpa.c | 6 ++++++
>>>> 1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
>>>> index 231b45246c..7219aa2eee 100644
>>>> --- a/net/vhost-vdpa.c
>>>> +++ b/net/vhost-vdpa.c
>>>> @@ -270,6 +270,11 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
>>>> }
>>>> +static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool is_le)
>>>> +{
>>>> + return 0;
>>>> +}
>>>> +
>>>> static bool vhost_vdpa_check_peer_type(NetClientState *nc,
>>>> ObjectClass *oc,
>>>> Error **errp)
>>>> {
>>>> @@ -437,6 +442,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,
>>>
>>> Dubious mismatch with set_vnet_be handler.
>>
>> I'm not sure what you are suggesting...
>
> Implement set_vnet_le for parity?
To my (very limited) knowledge, kernel's vhost_vdpa that QEMU talks to
doesn't have an API to "change h/w endianness". If so, vDPA's
.set_vnet_le/be(), as well as qemu_set_vnet_le/be() have very limited
choices. qemu_set_vnet_le/be() behavior with vDPA was to simply assume
that h/w endianness by default matches host's. This assumption is valid
for other types of "NetClients" which are implemented in s/w. However, I
suspect, vDPA h/w might all be going to be LE, to match virtio 1.0. Such
is the NIC I'm dealing with.
My patch is only fixing a specific use case. Perhaps, for a complete
fix, qemu_set_vnet_be() also shouldn't unconditionally return success on
big endian machines, but always call .set_vnet_be() so that vDPA could
fail it? But then it would start calling .set_vnet_be() on other
"NetClients" where it didn't before.
That's why I don't want to just add a .set_vnet_be(), before someone
here even confirms that vDPA h/w is indeed assumed LE, and, hence, what
the right path is to a complete solution...
int qemu_set_vnet_be(NetClientState *nc, bool is_be)
{
#if HOST_BIG_ENDIAN
return 0;
#else
if (!nc || !nc->info->set_vnet_be)
return -ENOSYS;
return nc->info->set_vnet_be(nc, is_be);
#endif
}
next prev parent reply other threads:[~2025-02-12 20:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 16:19 [PATCH] vdpa: Allow vDPA to work on big-endian machine 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 [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2025-06-14 22:44 [PATCH] vdpa: Allow VDPA " Konstantin Shkolnyy
2025-06-16 2:49 ` Jason Wang
2025-06-16 6:19 ` Eugenio Perez Martin
2025-06-16 8:56 ` 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=90adacff-9409-44f2-9ae6-9e01c8dc6e5c@linux.ibm.com \
--to=kshk@linux.ibm.com \
--cc=eperezma@redhat.com \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--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).