virtio-net: Added eBPF RSS to virtio-net.

When RSS is enabled the device tries to load the eBPF program
to select RX virtqueue in the TUN. If eBPF can be loaded
the RSS will function also with vhost (works with kernel 5.8 and later).
Software RSS is used as a fallback with vhost=off when eBPF can't be loaded
or when hash population requested by the guest.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
Andrew Melnychenko 2021-05-14 14:48:33 +03:00 committed by Jason Wang
parent 46627f41b6
commit 0145c39348
4 changed files with 122 additions and 3 deletions

View file

@ -21,6 +21,8 @@
#include "qemu/option_int.h"
#include "qom/object.h"
#include "ebpf/ebpf_rss.h"
#define TYPE_VIRTIO_NET "virtio-net-device"
OBJECT_DECLARE_SIMPLE_TYPE(VirtIONet, VIRTIO_NET)
@ -130,6 +132,7 @@ typedef struct VirtioNetRscChain {
typedef struct VirtioNetRssData {
bool enabled;
bool enabled_software_rss;
bool redirect;
bool populate_hash;
uint32_t hash_types;
@ -209,6 +212,7 @@ struct VirtIONet {
Notifier migration_state;
VirtioNetRssData rss_data;
struct NetRxPkt *rx_pkt;
struct EBPFRSSContext ebpf_rss;
};
void virtio_net_set_netclient_name(VirtIONet *n, const char *name,