Re: [RFC net-next 07/18] tun: set offloaded xdp program

2019-12-08 Thread Prashant Bhole
On 12/2/19 11:47 AM, Jason Wang wrote: On 2019/12/2 上午12:45, David Ahern wrote: On 11/26/19 4:07 AM, Prashant Bhole wrote: From: Jason Wang This patch introduces an ioctl way to set an offloaded XDP program to tun driver. This ioctl will be used by qemu to offload XDP program from

Re: [RFC net-next 15/18] virtio_net: implement XDP prog offload functionality

2019-11-27 Thread Prashant Bhole
On 11/28/19 5:42 AM, Michael S. Tsirkin wrote: On Tue, Nov 26, 2019 at 07:07:41PM +0900, Prashant Bhole wrote: From: Jason Wang This patch implements bpf_prog_offload_ops callbacks and adds handling for XDP_SETUP_PROG_HW. Handling of XDP_SETUP_PROG_HW involves setting up struct

Re: [RFC 0/3] Qemu: virtio-net XDP offload

2019-11-26 Thread Prashant Bhole
On 11/26/19 7:33 PM, no-re...@patchew.org wrote: Patchew URL: https://patchew.org/QEMU/20191126100914.5150-1-prashantbhole.li...@gmail.com/ Hi, This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed,

[RFC net-next 01/18] bpf: introduce bpf_prog_offload_verifier_setup()

2019-11-26 Thread Prashant Bhole
, it will get a chance to perform the fd replacement in its own copy of the program. Solution: Let's introduce a setup() callback in bpf_prog_offload_ops. It will be non mandetory. The verifier will call it just before replacing the map fds. Signed-off-by: Jason Wang Signed-off-by: Prashant Bhole

[RFC net-next 00/18] virtio_net XDP offload

2019-11-26 Thread Prashant Bhole
am virtio-net: store xdp_prog in device virtio_net: add XDP prog offload infrastructure virtio_net: implement XDP prog offload functionality bpf: export function __bpf_map_get virtio_net: implment XDP map offload functionality Prashant Bhole (9): tuntap: check tun_msg_ctl type at n

[RFC net-next 07/18] tun: set offloaded xdp program

2019-11-26 Thread Prashant Bhole
From: Jason Wang This patch introduces an ioctl way to set an offloaded XDP program to tun driver. This ioctl will be used by qemu to offload XDP program from virtio_net in the guest. Signed-off-by: Jason Wang Signed-off-by: Prashant Bhole --- drivers/net/tun.c | 19

[RFC net-next 05/18] vhost_net: user tap recvmsg api to access ptr ring

2019-11-26 Thread Prashant Bhole
they are passed to vhost_net. Signed-off-by: Prashant Bhole --- drivers/net/tap.c | 22 ++- drivers/net/tun.c | 24 - drivers/vhost/net.c| 48 +++--- include/linux/if_tun.h | 18 4 files changed, 98

[RFC net-next 09/18] tun: add a way to inject Tx path packet into Rx path

2019-11-26 Thread Prashant Bhole
, it is considered as XDP_TX'ed packet from offloaded program. Signed-off-by: Prashant Bhole --- drivers/net/tun.c | 35 --- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 466ea69f00ee..8d6cdd3e5139 100644

[RFC net-next 08/18] tun: run offloaded XDP program in Tx path

2019-11-26 Thread Prashant Bhole
the action handling to us. Signed-off-by: Prashant Bhole --- drivers/net/tun.c | 149 +- 1 file changed, 146 insertions(+), 3 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index ecb49101b0b5..466ea69f00ee 100644 --- a/drivers/net/tun.c

[RFC net-next 12/18] virtio-net: store xdp_prog in device

2019-11-26 Thread Prashant Bhole
From: Jason Wang This is a preparation for adding XDP offload support in virtio_net driver. By storing XDP program in virtionet_info will make it consistent with the offloaded program which will introduce in next patches. Signed-off-by: Jason Wang Co-developed-by: Prashant Bhole Signed-off

[RFC net-next 14/18] virtio_net: add XDP prog offload infrastructure

2019-11-26 Thread Prashant Bhole
-by: Prashant Bhole Signed-off-by: Prashant Bhole --- drivers/net/virtio_net.c | 103 +++ 1 file changed, 103 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index cee5c2b15c62..a1088d0114f2 100644 --- a/drivers/net/virtio_net.c +++ b

[RFC net-next 15/18] virtio_net: implement XDP prog offload functionality

2019-11-26 Thread Prashant Bhole
. Signed-off-by: Jason Wang Co-developed-by: Prashant Bhole Signed-off-by: Prashant Bhole --- drivers/net/virtio_net.c| 114 +++- include/uapi/linux/virtio_net.h | 27 2 files changed, 139 insertions(+), 2 deletions(-) diff --git a/drivers/net

[RFC net-next 02/18] net: core: rename netif_receive_generic_xdp() to do_generic_xdp_core()

2019-11-26 Thread Prashant Bhole
by renaming it. Signed-off-by: Jason Wang Signed-off-by: Prashant Bhole --- net/core/dev.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index c7fc902ccbdc..5ae647b9914f 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4461,9

[RFC 0/3] Qemu: virtio-net XDP offload

2019-11-26 Thread Prashant Bhole
changes to virtio_net.h are for RFC purpose only. Jason Wang (2): virtio-net: add support for offloading XDP program virtio-net: add support for offloading an ebpf map Prashant Bhole (1): configure: add libbpf support configure | 23 +++ hw/net

[RFC net-next 06/18] tuntap: remove usage of ptr ring in vhost_net

2019-11-26 Thread Prashant Bhole
Remove usage of ptr ring of tuntap in vhost_net and remove the functions exported from tuntap drivers to get ptr ring. Signed-off-by: Prashant Bhole --- drivers/net/tap.c | 13 - drivers/net/tun.c | 13 - drivers/vhost/net.c| 31

[RFC net-next 13/18] virtio_net: use XDP attachment helpers

2019-11-26 Thread Prashant Bhole
Next patches will introduce virtio_net XDP offloading. In that case we need to manage offloaded and non-offload program. In order to make it consistent this patch introduces use of XDP attachment helpers. Signed-off-by: Prashant Bhole --- drivers/net/virtio_net.c | 30

[RFC net-next 03/18] net: core: export do_xdp_generic_core()

2019-11-26 Thread Prashant Bhole
From: Jason Wang Let's export do_xdp_generic as a general purpose function. It will just run XDP program on skb but will not handle XDP actions. Signed-off-by: Jason Wang Signed-off-by: Prashant Bhole --- include/linux/netdevice.h | 2 ++ net/core/dev.c| 6 +++--- 2 files changed

[RFC net-next 18/18] virtio_net: restrict bpf helper calls from offloaded program

2019-11-26 Thread Prashant Bhole
Since we are offloading this program to the host, some of the helper calls will not make sense. For example get_numa_node_id. Some helpers can not be used because we don't handle them yet. So let's allow a small set of helper calls for now. Signed-off-by: Prashant Bhole --- drivers/net

[RFC net-next 16/18] bpf: export function __bpf_map_get

2019-11-26 Thread Prashant Bhole
From: Jason Wang __bpf_map_get is necessary to get verify whether an fd corresponds to a bpf map, without adding a refcount on that map. After exporting it can be used by a kernel module. Signed-off-by: Jason Wang Signed-off-by: Prashant Bhole --- kernel/bpf/syscall.c | 1 + 1 file changed

[RFC net-next 10/18] tun: handle XDP_TX action of offloaded program

2019-11-26 Thread Prashant Bhole
When offloaded program returns XDP_TX, we need to inject the packet in Rx path of tun. This patch injects such packets in Rx path using tun_xdp_one. Signed-off-by: Prashant Bhole --- drivers/net/tun.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/tun.c b

[RFC net-next 17/18] virtio_net: implment XDP map offload functionality

2019-11-26 Thread Prashant Bhole
have map fds from the host side for each offloaded map when program verification begins. map fds in the copy of the program are replaced with map fds from host side. This copy of program is used for offloading. Signed-off-by: Jason Wang Co-developed-by: Prashant Bhole Signed-off-by: Prashant

[RFC 2/3] virtio-net: add support for offloading XDP program

2019-11-26 Thread Prashant Bhole
by an ebpf program instructions. An array of bpf_insn is prepared and passed to libbpf API bpf_load_program. The program fd is retuned by the API is then attached to tap fd using TUNSETOFFLOADEDXDP ioctl command. Signed-off-by: Jason Wang Co-developed-by: Prashant Bhole Signed-off-by: Prashant

[RFC net-next 11/18] tun: run xdp prog when tun is read from file interface

2019-11-26 Thread Prashant Bhole
It handles the case when qemu performs read on tun using file operations. Signed-off-by: Prashant Bhole --- drivers/net/tun.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 084ca95358fe..639921c10e32 100644 --- a/drivers/net/tun.c

[RFC 3/3] virtio-net: add support for offloading an ebpf map

2019-11-26 Thread Prashant Bhole
/value or key/key pair. Map manipulation is done using libbpf APIs. Signed-off-by: Jason Wang Co-developed-by: Prashant Bhole Signed-off-by: Prashant Bhole --- hw/net/Makefile.objs| 2 + hw/net/virtio-net.c | 88 + include

[RFC 1/3] configure: add libbpf support

2019-11-26 Thread Prashant Bhole
. Signed-off-by: Prashant Bhole --- configure | 23 +++ 1 file changed, 23 insertions(+) diff --git a/configure b/configure index 6099be1d84..a7e8a8450d 100755 --- a/configure +++ b/configure @@ -504,6 +504,7 @@ debug_mutex="no" libpmem="" default_de

[RFC net-next 04/18] tuntap: check tun_msg_ctl type at necessary places

2019-11-26 Thread Prashant Bhole
tun_msg_ctl is used by vhost_net to communicate with tuntap. We will introduce another type in soon. As a preparation this patch adds conditions to check tun_msg_ctl type at necessary places. Signed-off-by: Prashant Bhole --- drivers/net/tap.c | 7 +-- drivers/net/tun.c | 6 +- 2 files