Skip to content

Commit

Permalink
virtio-net: Ensure queue index fits with RSS
Browse files Browse the repository at this point in the history
Ensure the queue index points to a valid queue when software RSS
enabled. The new calculation matches with the behavior of Linux's TAP
device with the RSS eBPF program.

Fixes: 4474e37 ("virtio-net: implement RX RSS processing")
Reported-by: Zhibin Hu <[email protected]>
Cc: [email protected]
Signed-off-by: Akihiko Odaki <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
  • Loading branch information
akihikodaki authored and jasowang committed Aug 2, 2024
1 parent 9e3b9f2 commit f1595ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hw/net/virtio-net.c
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
if (!no_rss && n->rss_data.enabled && n->rss_data.enabled_software_rss) {
int index = virtio_net_process_rss(nc, buf, size, &extra_hdr);
if (index >= 0) {
NetClientState *nc2 = qemu_get_subqueue(n->nic, index);
NetClientState *nc2 =
qemu_get_subqueue(n->nic, index % n->curr_queue_pairs);
return virtio_net_receive_rcu(nc2, buf, size, true);
}
}
Expand Down

0 comments on commit f1595ce

Please sign in to comment.