On Tue, Jan 13, 2026 at 11:37:52AM +0000, Shameer Kolothum wrote:
> The virtio_net_hdr_v1_hash layout changed in the Linux UAPI, replacing
> the 32-bit hash_value field with two 16-bit fields, hash_value_lo and
> hash_value_hi.
> 
> Update hash handling to populate the new fields correctly and adjust
> offset and size calculations accordingly.
> 
> Cc: Michael S. Tsirkin <[email protected]>
> Cc: Jason Wang <[email protected]>
> Signed-off-by: Shameer Kolothum <[email protected]>


Has to be squashed in patch 1 or bisect will be broken.

> ---
>  hw/net/virtio-net.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 317f1ad23b..512a7c02c9 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -1879,7 +1879,8 @@ static int virtio_net_process_rss(NetClientState *nc, 
> const uint8_t *buf,
>                                               n->rss_data.runtime_hash_types);
>      if (net_hash_type > NetPktRssIpV6UdpEx) {
>          if (n->rss_data.populate_hash) {
> -            hdr->hash_value = VIRTIO_NET_HASH_REPORT_NONE;
> +            hdr->hash_value_lo = VIRTIO_NET_HASH_REPORT_NONE;
> +            hdr->hash_value_hi = VIRTIO_NET_HASH_REPORT_NONE;
>              hdr->hash_report = 0;
>          }
>          return n->rss_data.redirect ? n->rss_data.default_queue : -1;
> @@ -1888,7 +1889,8 @@ static int virtio_net_process_rss(NetClientState *nc, 
> const uint8_t *buf,
>      hash = net_rx_pkt_calc_rss_hash(pkt, net_hash_type, n->rss_data.key);
>  
>      if (n->rss_data.populate_hash) {
> -        hdr->hash_value = hash;
> +        hdr->hash_value_lo = cpu_to_le16(hash & 0xffff);
> +        hdr->hash_value_hi = cpu_to_le16((hash >> 16) & 0xffff);
>          hdr->hash_report = reports[net_hash_type];
>      }
>  
> @@ -1990,10 +1992,11 @@ static ssize_t virtio_net_receive_rcu(NetClientState 
> *nc, const uint8_t *buf,
>  
>              receive_header(n, sg, elem->in_num, buf, size);
>              if (n->rss_data.populate_hash) {
> -                offset = offsetof(typeof(extra_hdr), hash_value);
> +                offset = offsetof(typeof(extra_hdr), hash_value_lo);
>                  iov_from_buf(sg, elem->in_num, offset,
>                               (char *)&extra_hdr + offset,
> -                             sizeof(extra_hdr.hash_value) +
> +                             sizeof(extra_hdr.hash_value_lo) +
> +                             sizeof(extra_hdr.hash_value_hi) +
>                               sizeof(extra_hdr.hash_report));
>              }
>              offset = n->host_hdr_len;
> -- 
> 2.43.0


Reply via email to