summaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/vector_kern.h
diff options
context:
space:
mode:
authorAnton Ivanov <anton.ivanov@cambridgegreys.com>2019-10-02 11:26:45 +0100
committerRichard Weinberger <richard@nod.at>2019-11-25 22:43:31 +0100
commit9807019a62dc670c73ce8e59e09b41ae458c34b3 (patch)
tree0ba729a1c5591cec5b6ad09117c0dac8f6abe1a6 /arch/um/drivers/vector_kern.h
parent7d8093a56063e5d7c4459d9d025a57e0c5186ce9 (diff)
downloadlinux-stable-9807019a62dc670c73ce8e59e09b41ae458c34b3.tar.gz
linux-stable-9807019a62dc670c73ce8e59e09b41ae458c34b3.tar.bz2
linux-stable-9807019a62dc670c73ce8e59e09b41ae458c34b3.zip
um: Loadable BPF "Firmware" for vector drivers
All vector drivers now allow a BPF program to be loaded and associated with the RX socket in the host kernel. 1. The program can be loaded as an extra kernel command line option to any of the vector drivers. 2. The program can also be loaded as "firmware", using the ethtool flash option. It is possible to turn this facility on or off using a command line option. A simplistic wrapper for generating the BPF firmware for the raw socket driver out of a tcpdump/libpcap filter expression can be found at: https://github.com/kot-begemot-uk/uml_vector_utilities/ Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/drivers/vector_kern.h')
-rw-r--r--arch/um/drivers/vector_kern.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/um/drivers/vector_kern.h b/arch/um/drivers/vector_kern.h
index 4d292e6c07af..d0159082faf0 100644
--- a/arch/um/drivers/vector_kern.h
+++ b/arch/um/drivers/vector_kern.h
@@ -29,10 +29,13 @@
#define VECTOR_TX (1 << 1)
#define VECTOR_BPF (1 << 2)
#define VECTOR_QDISC_BYPASS (1 << 3)
+#define VECTOR_BPF_FLASH (1 << 4)
#define ETH_MAX_PACKET 1500
#define ETH_HEADER_OTHER 32 /* just in case someone decides to go mad on QnQ */
+#define MAX_FILTER_PROG (2 << 16)
+
struct vector_queue {
struct mmsghdr *mmsg_vector;
void **skbuff_vector;
@@ -118,10 +121,13 @@ struct vector_private {
bool in_write_poll;
bool in_error;
+ /* guest allowed to use ethtool flash to load bpf */
+ bool bpf_via_flash;
+
/* ethtool stats */
struct vector_estats estats;
- void *bpf;
+ struct sock_fprog *bpf;
char user[0];
};