[PATCH v2 bpf 0/5] New netdev feature flags for XDP

2020-12-04 Thread alardam
From: Marek Majtyka Implement support for checking if a netdev has native XDP and AF_XDP zero copy support. Previously, there was no way to do this other than to try to create an AF_XDP socket on the interface or load an XDP program and see if it worked. This commit changes this by extending exis

[PATCH v2 bpf 2/5] drivers/net: turn XDP properties on

2020-12-04 Thread alardam
From: Marek Majtyka Turn 'hw-offload' property flag on for: - netronome. Turn 'native' and 'zerocopy' properties flags on for: - i40e - ice - ixgbe - mlx5. Turn 'native' properties flags on for: - igb - tun - veth - dpaa2 - mvneta - mvpp2 - qede - sfc - netsec - cpsw - xen - vi

[PATCH v2 bpf 1/5] net: ethtool: add xdp properties flag set

2020-12-04 Thread alardam
From: Marek Majtyka Implement support for checking what kind of xdp functionality a netdev supports. Previously, there was no way to do this other than to try to create an AF_XDP socket on the interface or load an XDP program and see if it worked. This commit changes this by adding a new variable

[PATCH v2 bpf 3/5] xsk: add usage of xdp properties flags

2020-12-04 Thread alardam
From: Marek Majtyka Change necessary condition check for XSK from ndo functions to xdp properties flags. Signed-off-by: Marek Majtyka --- net/xdp/xsk_buff_pool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c index 96bb60

[PATCH v2 bpf 4/5] xsk: add check for full support of XDP in bind

2020-12-04 Thread alardam
From: Marek Majtyka Add check for full support of XDP in AF_XDP socket bind. To be able to use an AF_XDP socket with zero-copy, there needs to be support for both XDP_REDIRECT in the driver (XDP native mode) and the driver needs to support zero-copy. The problem is that there are drivers out the

[PATCH v2 bpf 5/5] ethtool: provide xdp info with XDP_PROPERTIES_GET

2020-12-04 Thread alardam
From: Marek Majtyka Implement XDP_PROPERTIES_GET request to get network device information about supported xdp functionalities. Signed-off-by: Marek Majtyka --- include/uapi/linux/ethtool_netlink.h | 14 + net/ethtool/Makefile | 2 +- net/ethtool/netlink.c|

[PATCH bpf] xsk: fix incorrect netdev reference count

2020-11-20 Thread alardam
From: Marek Majtyka Fix incorrect netdev reference count in xsk_bind operation. Incorrect reference count of the device appears when a user calls bind with the XDP_ZEROCOPY flag on an interface which does not support zero-copy. In such a case, an error is returned but the reference count is not d

[PATCH 2/8] drivers/net: turn XDP flags on

2020-11-16 Thread alardam
From: Marek Majtyka Turn 'xdp' and 'af-xdp-zc' feature flags on for: - i40e - ice - ixgbe - mlx5. Turn 'xdp' feature flag on for: - igb - tun - veth - dpaa2 - mvneta - mvpp2 - qede - sfc - netsec - cpsw - xen - virtio_net. The first group of NICs is currently visible with ethtoo

[PATCH 0/8] New netdev feature flags for XDP

2020-11-16 Thread alardam
From: Marek Majtyka Implement support for checking if a netdev has native XDP and AF_XDP zero copy support. Previously, there was no way to do this other than to try to create an AF_XDP socket on the interface or load an XDP program and see if it worked. This commit changes this by extending exis

[PATCH 3/8] xsk: add usage of xdp netdev_features flags

2020-11-16 Thread alardam
From: Marek Majtyka Change necessary condition check for XSK from ndo functions to netdev_features flags. Signed-off-by: Marek Majtyka --- net/xdp/xsk_buff_pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c index 8a3

[PATCH 5/8] libbpf: extend netlink attribute API

2020-11-16 Thread alardam
From: Marek Majtyka Extend netlink attribute API to put a different attribute into the netlink message (nest{start, end}, string, u32, flag, etc). Add new API to parse attribute array. Signed-off-by: Marek Majtyka --- tools/lib/bpf/nlattr.c | 105 + tool

[PATCH 7/8] libbpf: add API to get XSK/XDP caps

2020-11-16 Thread alardam
From: Marek Majtyka Add public xsk API to read supported XDP functions of a netdev: - XDP driver mode (SKB, DRV), - XSK bind mode (COPY, ZEROCOPY). Signed-off-by: Marek Majtyka --- tools/lib/bpf/libbpf.map | 1 + tools/lib/bpf/xsk.c | 51 +++- tools/

[PATCH 8/8] samples/bpf/xdp: apply netdev XDP/XSK modes info

2020-11-16 Thread alardam
From: Marek Majtyka Update xdpsock sample so that it utilizes netlink ethtool interface to get available XDP/XSK modes. This allows to automatically choose the best available mode of operation, if these are not provided explicitly. Signed-off-by: Marek Majtyka --- samples/bpf/xdpsock_user.c |

[PATCH 6/8] libbpf: add functions to get XSK modes

2020-11-16 Thread alardam
From: Marek Majtyka Add functions to get XDP/XSK modes from netdev feature flags over netlink ethtool family interface. These functions provide functionalities that are going to be used in upcoming changes together constituting new libbpf public API function which informs about key xsk capabiliti

[PATCH 4/8] xsk: add check for full support of XDP in bind

2020-11-16 Thread alardam
From: Marek Majtyka Add check for full support of XDP in AF_XDP socket bind. To be able to use an AF_XDP socket with zero-copy, there needs to be support for both XDP_REDIRECT in the driver (XDP native mode) and the driver needs to support zero-copy. The problem is that there are drivers out the

[PATCH 1/8] net: ethtool: extend netdev_features flag set

2020-11-16 Thread alardam
From: Marek Majtyka Implement support for checking if a netdev has XDP and AF_XDP zero copy support. Previously, there was no way to do this other than to try to create an AF_XDP socket on the interface or load an XDP program and see if it worked. This commit changes this by extending existing ne