From: Paolo Abeni <pabeni@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Dmitry Fleytman <dmitry.fleytman@gmail.com>,
Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>,
Jason Wang <jasowang@redhat.com>,
Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Luigi Rizzo <lrizzo@google.com>,
Giuseppe Lettieri <g.lettieri@iet.unipi.it>,
Vincenzo Maffione <v.maffione@gmail.com>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH RFC v3 10/13] vhost-net: implement extended features support
Date: Fri, 18 Jul 2025 16:33:39 +0200 [thread overview]
Message-ID: <12b37ffa-19d4-4f8c-8ff5-30d323260cdd@redhat.com> (raw)
In-Reply-To: <zdfxqwsj7bmx6dfoxticifa2max3rkqhhoor5mjxfy7xcj7tys@6hwveszzsbua>
On 7/18/25 3:01 PM, Stefano Garzarella wrote:
> On Fri, Jul 18, 2025 at 10:52:36AM +0200, Paolo Abeni wrote:
>> @@ -234,7 +234,8 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
>> int r;
>> bool backend_kernel = options->backend_type == VHOST_BACKEND_TYPE_KERNEL;
>> struct vhost_net *net = g_new0(struct vhost_net, 1);
>> - uint64_t features = 0;
>> + uint64_t missing_features[VIRTIO_FEATURES_DWORDS];
>> + uint64_t features[VIRTIO_FEATURES_DWORDS];
>
> Should we initialize `features` (IIUC calling virtio_features_clear)
> since it was set to 0 before this patch?
>
>> Error *local_err = NULL;
>>
>> if (!options->net_backend) {
>> @@ -261,7 +262,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
>> net->backend = r;
>> net->dev.protocol_features = 0;
>> } else {
>> - net->dev.backend_features = 0;
>> + virtio_features_clear(net->dev.backend_features_ex);
>> net->dev.protocol_features = 0;
>> net->backend = -1;
>>
>> @@ -279,28 +280,31 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
>> if (backend_kernel) {
>> if (!qemu_has_vnet_hdr_len(options->net_backend,
>> sizeof(struct virtio_net_hdr_mrg_rxbuf))) {
>> - net->dev.features &= ~(1ULL << VIRTIO_NET_F_MRG_RXBUF);
>> + net->dev.features &= ~VIRTIO_BIT(VIRTIO_NET_F_MRG_RXBUF);
>> }
>> - if (~net->dev.features & net->dev.backend_features) {
>> - fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64
>> - " for backend\n",
>> - (uint64_t)(~net->dev.features & net->dev.backend_features));
>> +
>> + if (virtio_features_andnot(missing_features,
>> + net->dev.backend_features_ex,
>> + net->dev.features_ex)) {
>> + fprintf(stderr, "vhost lacks feature mask 0x" VIRTIO_FEATURES_FMT
>> + " for backend\n", VIRTIO_FEATURES_PR(missing_features));
>> goto fail;
>> }
>> }
>>
>> /* Set sane init value. Override when guest acks. */
>> if (options->get_acked_features) {
>> - features = options->get_acked_features(net->nc);
>> - if (~net->dev.features & features) {
>> - fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64
>> - " for backend\n",
>> - (uint64_t)(~net->dev.features & features));
>> + virtio_features_from_u64(features,
>> + options->get_acked_features(net->nc));
>> + if (virtio_features_andnot(missing_features, features,
>> + net->dev.features_ex)) {
>> + fprintf(stderr, "vhost lacks feature mask 0x" VIRTIO_FEATURES_FMT
>> + " for backend\n", VIRTIO_FEATURES_PR(missing_features));
>> goto fail;
>> }
>> }
>>
>> - vhost_net_ack_features(net, features);
>> + vhost_net_ack_features_ex(net, features);
>
> If `options->get_acked_features` is false, `features` here is not
> initialized (it was set to 0 before this patch).
Indeed the initialization is needed. I will fix the next revision.
Thanks,
Paolo
next prev parent reply other threads:[~2025-07-18 14:34 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 8:52 [PATCH RFC v3 00/13] virtio: introduce support for GSO over UDP tunnel Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 01/13] net: bundle all offloads in a single struct Paolo Abeni
2025-07-20 10:31 ` Akihiko Odaki
2025-07-18 8:52 ` [PATCH RFC v3 02/13] linux-headers: Update to Linux ~v6.16-rc5 net-next Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 03/13] virtio: introduce extended features type Paolo Abeni
2025-07-20 10:41 ` Akihiko Odaki
2025-07-21 7:33 ` Paolo Abeni
2025-07-21 7:49 ` Akihiko Odaki
2025-07-21 8:45 ` Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 04/13] virtio: serialize extended features state Paolo Abeni
2025-07-18 15:06 ` Stefano Garzarella
2025-07-20 10:44 ` Akihiko Odaki
2025-07-21 7:51 ` Paolo Abeni
2025-07-21 7:55 ` Akihiko Odaki
2025-07-18 8:52 ` [PATCH RFC v3 05/13] virtio: add support for negotiating extended features Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 06/13] virtio-pci: implement support for " Paolo Abeni
2025-07-22 3:28 ` Jason Wang
2025-07-22 7:37 ` Paolo Abeni
2025-07-23 5:47 ` Jason Wang
2025-07-23 11:21 ` Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 07/13] vhost: add support for negotiating " Paolo Abeni
2025-07-18 14:36 ` Stefano Garzarella
2025-07-21 2:53 ` Lei Yang
2025-07-21 8:21 ` Paolo Abeni
2025-07-21 7:00 ` Paolo Abeni
2025-07-22 3:32 ` Jason Wang
2025-07-22 16:55 ` Paolo Abeni
2025-07-23 5:56 ` Jason Wang
2025-07-18 8:52 ` [PATCH RFC v3 08/13] qmp: update virtio features map to support " Paolo Abeni
2025-07-18 10:18 ` Stefano Garzarella
2025-07-18 10:23 ` Paolo Abeni
2025-07-18 10:28 ` Stefano Garzarella
2025-07-19 6:57 ` Markus Armbruster
2025-07-21 7:07 ` Paolo Abeni
2025-07-21 7:23 ` Akihiko Odaki
2025-07-21 7:45 ` Stefano Garzarella
2025-07-21 8:04 ` Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 09/13] vhost-backend: implement extended features support Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 10/13] vhost-net: " Paolo Abeni
2025-07-18 13:01 ` Stefano Garzarella
2025-07-18 14:33 ` Paolo Abeni [this message]
2025-07-18 8:52 ` [PATCH RFC v3 11/13] virtio-net: " Paolo Abeni
2025-07-18 8:52 ` [PATCH RFC v3 12/13] net: implement tunnel probing Paolo Abeni
2025-07-18 11:17 ` Stefano Garzarella
2025-07-21 8:48 ` Paolo Abeni
2025-07-22 3:50 ` Jason Wang
2025-07-22 7:33 ` Paolo Abeni
2025-07-23 5:47 ` Jason Wang
2025-07-22 4:15 ` Akihiko Odaki
2025-07-18 8:52 ` [PATCH RFC v3 13/13] net: implement UDP tunnel features offloading Paolo Abeni
2025-07-18 13:22 ` Stefano Garzarella
2025-07-18 13:44 ` Paolo Abeni
2025-07-18 13:48 ` Stefano Garzarella
2025-07-18 15:21 ` Stefano Garzarella
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=12b37ffa-19d4-4f8c-8ff5-30d323260cdd@redhat.com \
--to=pabeni@redhat.com \
--cc=armbru@redhat.com \
--cc=cohuck@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=eblake@redhat.com \
--cc=g.lettieri@iet.unipi.it \
--cc=jasowang@redhat.com \
--cc=lrizzo@google.com \
--cc=mst@redhat.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=sriram.yagnaraman@ericsson.com \
--cc=v.maffione@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).