[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <26d7d26e-dd45-47bb-885b-45c6d44900bb@lunn.ch>
Date: Thu, 9 Oct 2025 14:31:04 +0200
From: Andrew Lunn <andrew@...n.ch>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Paolo Abeni <pabeni@...hat.com>, Jason Wang <jasowang@...hat.com>,
Eugenio Pérez <eperezma@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Jonathan Corbet <corbet@....net>, kvm@...r.kernel.org,
virtualization@...ts.linux.dev, linux-doc@...r.kernel.org
Subject: Re: [PATCH 1/3] virtio: dwords->qwords
On Thu, Oct 09, 2025 at 07:24:08AM -0400, Michael S. Tsirkin wrote:
> A "word" is 16 bit. 64 bit integers like virtio uses are not dwords,
> they are actually qwords.
I'm having trouble with this....
This bit makes sense. 4x 16bits = 64 bits.
> -static const u64 vhost_net_features[VIRTIO_FEATURES_DWORDS] = {
> +static const u64 vhost_net_features[VIRTIO_FEATURES_QWORDS] = {
If this was u16, and VIRTIO_FEATURES_QWORDS was 4, which the Q would
imply, than i would agree with what you are saying. But this is a u64
type. It is already a QWORD, and this is an array of two of them.
I think the real issue here is not D vs Q, but WORD. We have a default
meaning of a u16 for a word, especially in C. But that is not the
actual definition of a word a computer scientist would use. Wikipedia
has:
In computing, a word is any processor design's natural unit of
data. A word is a fixed-sized datum handled as a unit by the
instruction set or the hardware of the processor.
A word can be any size. In this context, virtio is not referring to
the instruction set, but a protocol. Are all fields in this protocol
u64? Hence word is u64? And this is an array of two words? That would
make DWORD correct, it is two words.
If you want to change anything here, i would actually change WORD to
something else, maybe FIELD?
And i could be wrong here, i've not looked at the actual protocol, so
i've no idea if all fields in the protocol are u64. There are
protocols like this, IPv6 uses u32, not octets, and the length field
in the headers refer to the number of u32s in the header.
Andrew
Powered by blists - more mailing lists