From 8f364e344c3e71d4cc4e683d21241f6c36d62a5e Mon Sep 17 00:00:00 2001 From: Andrew Melnychenko Date: Fri, 14 May 2021 14:48:30 +0300 Subject: net: Added SetSteeringEBPF method for NetClientState. For now, that method supported only by Linux TAP. Linux TAP uses TUNSETSTEERINGEBPF ioctl. Signed-off-by: Andrew Melnychenko Signed-off-by: Jason Wang --- include/net/net.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/net/net.h b/include/net/net.h index 1ef536d..5d15080 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -61,6 +61,7 @@ typedef int (SetVnetBE)(NetClientState *, bool); typedef struct SocketReadState SocketReadState; typedef void (SocketReadStateFinalize)(SocketReadState *rs); typedef void (NetAnnounce)(NetClientState *); +typedef bool (SetSteeringEBPF)(NetClientState *, int); typedef struct NetClientInfo { NetClientDriver type; @@ -82,6 +83,7 @@ typedef struct NetClientInfo { SetVnetLE *set_vnet_le; SetVnetBE *set_vnet_be; NetAnnounce *announce; + SetSteeringEBPF *set_steering_ebpf; } NetClientInfo; struct NetClientState { -- cgit v1.1 From 0145c3934895e2cb2b8bd679ca274bc5f7e76de7 Mon Sep 17 00:00:00 2001 From: Andrew Melnychenko Date: Fri, 14 May 2021 14:48:33 +0300 Subject: 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 Signed-off-by: Andrew Melnychenko Signed-off-by: Jason Wang --- include/hw/virtio/virtio-net.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 7e96d19..824a69c 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -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, -- cgit v1.1