On Wed, Feb 12, 2025 at 4:37 PM Konstantin Shkolnyy <k...@linux.ibm.com> wrote: > > On 2/12/2025 09:06, Eugenio Perez Martin wrote: > >> - i = cpu_to_le16(svq->desc_next[i]); > >> + i = le16_to_cpu(svq->desc_next[i]); > > > > Both svq->desc_next and "i" are in QEMU. We can skip the conversion > > and assign directly. > > Are you saying that desc_next[] should be in "CPU" and not LE format? > > The original code contained statements (below) that led me to think that > desc_next[] was designed to be LE... > > vhost_svq_last_desc_of_chain() > i = le16_to_cpu(svq->desc_next[i]); > > vhost_svq_start() > svq->desc_next[i] = cpu_to_le16(i + 1); >
Yes, I did a mess with the endianness back then :(. But we can remove both conversions, and add the conversion at vhost_svq_vring_write_descs instead.