From: Paolo Abeni <pabeni@redhat.com>
To: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Dmitry Fleytman <dmitry.fleytman@gmail.com>,
Jason Wang <jasowang@redhat.com>,
Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Stefano Garzarella <sgarzare@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 03/13] virtio: introduce extended features type
Date: Mon, 21 Jul 2025 10:45:55 +0200 [thread overview]
Message-ID: <28bcda3f-52a9-43b9-86be-69e66b1f4ec2@redhat.com> (raw)
In-Reply-To: <e89fade5-1912-45d5-8c4e-259b45a8a3bd@rsg.ci.i.u-tokyo.ac.jp>
On 7/21/25 9:49 AM, Akihiko Odaki wrote:
> On 2025/07/21 16:33, Paolo Abeni wrote:
>> On 7/20/25 12:41 PM, Akihiko Odaki wrote:
>>> On 2025/07/18 17:52, Paolo Abeni wrote:
>>>> diff --git a/include/hw/virtio/virtio-features.h b/include/hw/virtio/virtio-features.h
>>>> new file mode 100644
>>>> index 0000000000..68e326e3e8
>>>> --- /dev/null
>>>> +++ b/include/hw/virtio/virtio-features.h
>>>> @@ -0,0 +1,123 @@
>>>> +/*
>>>> + * Virtio features helpers
>>>> + *
>>>> + * Copyright 2025 Red Hat, Inc.
>>>> + *
>>>> + * SPDX-License-Identifier: GPL-2.0-or-later
>>>> + */
>>>> +
>>>> +#ifndef QEMU_VIRTIO_FEATURES_H
>>>> +#define QEMU_VIRTIO_FEATURES_H
>>>> +
>>>> +#include "qemu/bitops.h"
>>>> +
>>>> +#define VIRTIO_FEATURES_FMT "%016"PRIx64"%016"PRIx64
>>>> +#define VIRTIO_FEATURES_PR(f) (f)[1], (f)[0]
>>>> +
>>>> +#define VIRTIO_FEATURES_MAX 128
>>>> +#define VIRTIO_BIT(b) BIT_ULL((b) % 64)
>>>> +#define VIRTIO_DWORD(b) ((b) >> 6)
>>>> +#define VIRTIO_FEATURES_WORDS (VIRTIO_FEATURES_MAX >> 5)
>>>> +#define VIRTIO_FEATURES_DWORDS (VIRTIO_FEATURES_WORDS >> 1)
>>>
>>> These shifts are better to be replaced with division for clarity;
>>> BIT_WORD() is a good example.
>>>
>>> "WORD" and "DWORD" should be avoided due to contradicting definitions
>>> common in QEMU as described at:
>>> https://lore.kernel.org/qemu-devel/aab8c434-364e-4305-9d8b-943eb0c98406@rsg.ci.i.u-tokyo.ac.jp/
>>>
>>> BITS_TO_U32S() is a good example this regard.
>>
>> Ok, I'll rename:
>> VIRTIO_FEATURES_DWORDS -> VIRTIO_U64_PER_FEATURES
>> VIRTIO_FEATURES_WORDS -> VIRTIO_U32_PER_FEATURES
>
> U64 and U32 should be plural (i.e., rename them into
> VIRTIO_U64S_PER_FEATURES and VIRTIO_U32S_PER_FEATURES)
>
> "PER_FEATURES" also sounds a bit awkward; BITS_PER_BYTE and
> BITS_PER_LONG had singular after "per" so the unit was clear, but it is
> not in this case.
>
> I could think of several options:
> - VIRTIO_U64S_PER_FEATURES (what you proposed + plural U64S)
> - VIRTIO_FEATURES_U64S (closer to the previous version)
> - VIRTIO_FEATURES_NU64S (like CPU_TEMP_BUF_NLONGS)
> - VIRTIO_U64S_PER_FEATURE_BITMASK
>
> They have downsides and upsides, and I don't have an idea what's the best.
Indeed an optimal name here could be impossible to fit. IMHO
VIRTIO_FEATURES_NU64S is the best option among the above and I like it.
I'll use that one.
Thanks,
Paolo
next prev parent reply other threads:[~2025-07-21 8:47 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 [this message]
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
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=28bcda3f-52a9-43b9-86be-69e66b1f4ec2@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).