Re: [PATCH bpf-next v3 00/15] Introducing AF_XDP support

2018-05-07 Thread Magnus Karlsson
On Sat, May 5, 2018 at 2:34 AM, Alexei Starovoitov <alexei.starovoi...@gmail.com> wrote: > On Fri, May 04, 2018 at 01:22:17PM +0200, Magnus Karlsson wrote: >> On Fri, May 4, 2018 at 1:38 AM, Alexei Starovoitov >> <alexei.starovoi...@gmail.com> wrote: >> > On F

Re: [PATCH bpf-next v3 00/15] Introducing AF_XDP support

2018-05-04 Thread Magnus Karlsson
On Fri, May 4, 2018 at 1:38 AM, Alexei Starovoitov wrote: > On Fri, May 04, 2018 at 12:49:09AM +0200, Daniel Borkmann wrote: >> On 05/02/2018 01:01 PM, Björn Töpel wrote: >> > From: Björn Töpel >> > >> > This patch set introduces a new address

Re: [RFC PATCH bpf-next 12/12] i40e: implement Tx zero-copy

2018-05-16 Thread Magnus Karlsson
On Wed, May 16, 2018 at 4:28 PM, Jesper Dangaard Brouer <bro...@redhat.com> wrote: > On Tue, 15 May 2018 21:06:15 +0200 > Björn Töpel <bjorn.to...@gmail.com> wrote: > >> From: Magnus Karlsson <magnus.karls...@intel.com> >> >> Here, the zero-copy nd

Re: [RFC PATCH bpf-next 12/12] i40e: implement Tx zero-copy

2018-05-16 Thread Magnus Karlsson
On Wed, May 16, 2018 at 4:38 PM, Magnus Karlsson <magnus.karls...@gmail.com> wrote: > On Wed, May 16, 2018 at 4:28 PM, Jesper Dangaard Brouer > <bro...@redhat.com> wrote: >> On Tue, 15 May 2018 21:06:15 +0200 >> Björn Töpel <bjorn.to...@gmail.com> wrote: >&g

[PATCH bpf 1/4] xsk: fix potential lost completion message in SKB path

2018-06-27 Thread Magnus Karlsson
message to user space being lost. Fixes: 35fcde7f8deb ("xsk: support for Tx") Signed-off-by: Magnus Karlsson Reported-by: Pavel Odintsov --- net/xdp/xsk_queue.h | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h index ef

[PATCH bpf 2/4] xsk: frame could be completed more than once in SKB path

2018-06-27 Thread Magnus Karlsson
in this case has been changed from EAGAIN to EBUSY in order to tell user space that the sending of the packet failed and the buffer has been return to user space through the completion queue. Fixes: 35fcde7f8deb ("xsk: support for Tx") Signed-off-by: Magnus Karlsson Reported-by: Pave

[PATCH bpf 0/4] Bug fixes to the SKB TX path of AF_XDP

2018-06-27 Thread Magnus Karlsson
/Magnus Magnus Karlsson (4): xsk: fix potential lost completion message in SKB path xsk: frame could be completed more than once in SKB path samples/bpf: deal with EBUSY return code from sendmsg in xdpsock sample xsk: fix potential race in SKB TX completion code include/net/xdp_sock.h

[PATCH bpf 4/4] xsk: fix potential race in SKB TX completion code

2018-06-27 Thread Magnus Karlsson
Signed-off-by: Magnus Karlsson --- include/net/xdp_sock.h | 4 net/xdp/xsk.c | 4 2 files changed, 8 insertions(+) diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h index 9fe472f2ac95..7161856bcf9c 100644 --- a/include/net/xdp_sock.h +++ b/include/net/xdp_sock.h @@ -6

[PATCH bpf 3/4] samples/bpf: deal with EBUSY return code from sendmsg in xdpsock sample

2018-06-27 Thread Magnus Karlsson
Sendmsg in the SKB path of AF_XDP can now return EBUSY when a packet was discarded and completed by the driver. Just ignore this message in the sample application. Fixes: b4b8faa1ded7 ("samples/bpf: sample application and documentation for AF_XDP sockets") Signed-off-by: Magnu

[PATCH bpf-next v2 2/2] xsk: i40e: get rid of useless struct xdp_umem_props

2018-08-31 Thread Magnus Karlsson
and as a bonus gets rid of one internal header file. The i40e driver is also adapted to the new interface in this commit. Signed-off-by: Magnus Karlsson --- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 ++-- include/net/xdp_sock.h | 8 ++-- net/xdp/xdp_umem.c

[PATCH bpf-next v2 1/2] i40e: fix possible compiler warning in xsk TX path

2018-08-31 Thread Magnus Karlsson
With certain gcc versions, it was possible to get the warning "'tx_desc' may be used uninitialized in this function" for the i40e_xmit_zc. This was not possible, however this commit simplifies the code path so that this warning is no longer emitted. Signed-off-by: Magnus Karlsson --

[PATCH bpf-next v2 0/2] xsk: misc code cleanup

2018-08-31 Thread Magnus Karlsson
the i40e driver to this new interface. I based this patch set on bpf-next commit 9c4f39811db8 ("samples/bpf: xdpsock, minor fixes") Thanks: Magnus Magnus Karlsson (2): i40e: fix possible compiler warning in xsk TX path xsk: i40e: get rid of useless struct xdp_umem_props d

[PATCH bpf 4/4] xsk: do not return EMSGSIZE in copy mode for packets larger than MTU

2018-07-11 Thread Magnus Karlsson
t;xsk: support for Tx") Signed-off-by: Magnus Karlsson --- net/xdp/xsk.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 9c784307f7b0..72335c2e8108 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -233,15 +233,10 @@ static int xsk_ge

[PATCH bpf 3/4] xsk: always return ENOBUFS from sendmsg if there is no TX queue

2018-07-11 Thread Magnus Karlsson
t;) Signed-off-by: Magnus Karlsson --- net/xdp/xsk.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 87567232d0f8..9c784307f7b0 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -218,9 +218,6 @@ static int xsk_generic_xmit(struct sock *

[PATCH bpf 1/4] xsk: do not return ENXIO from TX copy mode

2018-07-11 Thread Magnus Karlsson
the two modes. Fixes: 35fcde7f8deb ("xsk: support for Tx") Signed-off-by: Magnus Karlsson --- net/xdp/xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 7d220cbd09b6..08d09115093e 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c

[PATCH bpf 0/4] Consistent sendmsg error reporting in AF_XDP

2018-07-11 Thread Magnus Karlsson
performance implications for zero-copy mode as we will touch one more cache line with dev->mtu. Thanks: Magnus Magnus Karlsson (4): xsk: do not return ENXIO from TX copy mode xsk: do not return EAGAIN from sendmsg when completion queue is full xsk: always return ENOBUFS from send

[PATCH bpf 2/4] xsk: do not return EAGAIN from sendmsg when completion queue is full

2018-07-11 Thread Magnus Karlsson
no amount of calling sendmsg will solve the problem. Only consuming one or more messages on the completion queue will fix this. With this patch, the error reporting becomes consistent between copy mode and zero-copy mode. Fixes: 35fcde7f8deb ("xsk: support for Tx") Signed-off-by: Magnu

Re: [PATCH bpf-next 13/15] xsk: support for Tx

2018-04-25 Thread Magnus Karlsson
On Tue, Apr 24, 2018 at 6:57 PM, Willem de Bruijn <willemdebruijn.ker...@gmail.com> wrote: > On Mon, Apr 23, 2018 at 9:56 AM, Björn Töpel <bjorn.to...@gmail.com> wrote: >> From: Magnus Karlsson <magnus.karls...@intel.com> >> >> Here, Tx support is added.

Re: [PATCH bpf-next 14/15] xsk: statistics support

2018-04-25 Thread Magnus Karlsson
On Tue, Apr 24, 2018 at 6:58 PM, Willem de Bruijn <willemdebruijn.ker...@gmail.com> wrote: > On Mon, Apr 23, 2018 at 9:56 AM, Björn Töpel <bjorn.to...@gmail.com> wrote: >> From: Magnus Karlsson <magnus.karls...@intel.com> >> >> In this commit, a

Re: [PATCH bpf-next 00/15] Introducing AF_XDP support

2018-04-24 Thread Magnus Karlsson
s > Thanks > > >> >> * Daniel Borkmann's suggestion for a "copy to XDP socket, and return >>XDP_PASS" for a tcpdump-like functionality. >> >> * And of course getting to zero-copy support in small increments. >> >> Thanks: Björn and

Re: [PATCH bpf-next 03/15] xsk: add umem fill queue support and mmap

2018-04-24 Thread Magnus Karlsson
On Tue, Apr 24, 2018 at 1:59 AM, Willem de Bruijn <willemdebruijn.ker...@gmail.com> wrote: > On Mon, Apr 23, 2018 at 7:21 PM, Michael S. Tsirkin <m...@redhat.com> wrote: >> On Mon, Apr 23, 2018 at 03:56:07PM +0200, Björn Töpel wrote: >>> From: Magnus Karls

Re: [PATCH bpf-next 00/15] Introducing AF_XDP support

2018-04-24 Thread Magnus Karlsson
On Tue, Apr 24, 2018 at 11:10 AM, Jason Wang <jasow...@redhat.com> wrote: > > > On 2018年04月24日 16:44, Magnus Karlsson wrote: >>>> >>>> We have run some benchmarks on a dual socket system with two Broadwell >>>> E5 2660 @ 2.0 GHz with hyperthread

Re: [PATCH bpf-next 15/15] samples/bpf: sample application for AF_XDP sockets

2018-04-24 Thread Magnus Karlsson
On Tue, Apr 24, 2018 at 1:31 AM, Michael S. Tsirkin <m...@redhat.com> wrote: > On Mon, Apr 23, 2018 at 03:56:19PM +0200, Björn Töpel wrote: >> From: Magnus Karlsson <magnus.karls...@intel.com> >> >> This is a sample application for AF_XDP sockets. The application

[PATCH bpf v2 0/4] Bug fixes to the SKB TX path of AF_XDP

2018-06-29 Thread Magnus Karlsson
Changes from v1: * Added explanation of race in commit message of patch 4. /Magnus Magnus Karlsson (4): xsk: fix potential lost completion message in SKB path xsk: frame could be completed more than once in SKB path samples/bpf: deal with EBUSY return code from sendmsg in xdpsock sample

[PATCH bpf v2 3/4] samples/bpf: deal with EBUSY return code from sendmsg in xdpsock sample

2018-06-29 Thread Magnus Karlsson
Sendmsg in the SKB path of AF_XDP can now return EBUSY when a packet was discarded and completed by the driver. Just ignore this message in the sample application. Fixes: b4b8faa1ded7 ("samples/bpf: sample application and documentation for AF_XDP sockets") Signed-off-by: Magnu

[PATCH bpf v2 4/4] xsk: fix potential race in SKB TX completion code

2018-06-29 Thread Magnus Karlsson
t;xsk: support for Tx") Signed-off-by: Magnus Karlsson --- include/net/xdp_sock.h | 4 net/xdp/xsk.c | 4 2 files changed, 8 insertions(+) diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h index 9fe472f2ac95..7161856bcf9c 100644 --- a/include/net/xdp_sock.h +++ b/i

[PATCH bpf v2 1/4] xsk: fix potential lost completion message in SKB path

2018-06-29 Thread Magnus Karlsson
message to user space being lost. Fixes: 35fcde7f8deb ("xsk: support for Tx") Signed-off-by: Magnus Karlsson Reported-by: Pavel Odintsov --- net/xdp/xsk_queue.h | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h index ef

[PATCH bpf v2 2/4] xsk: frame could be completed more than once in SKB path

2018-06-29 Thread Magnus Karlsson
in this case has been changed from EAGAIN to EBUSY in order to tell user space that the sending of the packet failed and the buffer has been return to user space through the completion queue. Fixes: 35fcde7f8deb ("xsk: support for Tx") Signed-off-by: Magnus Karlsson Reported-by: Pave

Re: [PATCH bpf 4/4] xsk: fix potential race in SKB TX completion code

2018-06-28 Thread Magnus Karlsson
On Wed, Jun 27, 2018 at 5:57 PM Eric Dumazet wrote: > > > > On 06/27/2018 07:02 AM, Magnus Karlsson wrote: > > There was a potential race in the TX completion code for > > the SKB case when the TX napi thread and the error path > > of the sendmsg code coul

Re: [PATCH bpf-next v2 0/5] xsk: fix bug when trying to use both copy and zero-copy mode

2018-10-02 Thread Magnus Karlsson
On Mon, Oct 1, 2018 at 10:34 PM Jakub Kicinski wrote: > > On Mon, 1 Oct 2018 14:51:32 +0200, Magnus Karlsson wrote: > > Jakub, please take a look at your patches. The last one I had to > > change slightly to make it fit with the new interface > > xdp_get_umem_fr

[PATCH bpf-next v2 2/5] xsk: fix bug when trying to use both copy and zero-copy on one queue id

2018-10-01 Thread Magnus Karlsson
been bound to a queue id and can act appropriately at bind time. Signed-off-by: Magnus Karlsson --- net/xdp/xdp_umem.c | 90 ++ net/xdp/xdp_umem.h | 2 +- net/xdp/xsk.c | 7 - 3 files changed, 64 insertions(+), 35 deletions(-) diff

[PATCH bpf-next v2 3/5] ethtool: rename local variable max -> curr

2018-10-01 Thread Magnus Karlsson
From: Jakub Kicinski ethtool_set_channels() validates the config against driver's max settings. It retrieves the current config and stores it in a variable called max. This was okay when only max settings were accessed but we will soon want to access current settings as well, so calling the

[PATCH bpf-next v2 5/5] xsk: simplify xdp_clear_umem_at_qid implementation

2018-10-01 Thread Magnus Karlsson
As we now do not allow ethtool to deactivate the queue id we are running an AF_XDP socket on, we can simplify the implementation of xdp_clear_umem_at_qid(). Signed-off-by: Magnus Karlsson --- net/xdp/xdp_umem.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/net/xdp

[PATCH bpf-next v2 4/5] ethtool: don't allow disabling queues with umem installed

2018-10-01 Thread Magnus Karlsson
From: Jakub Kicinski We already check the RSS indirection table does not use queues which would be disabled by channel reconfiguration. Make sure user does not try to disable queues which have a UMEM and zero-copy AF_XDP socket installed. Signed-off-by: Jakub Kicinski Reviewed-by: Quentin

[PATCH bpf-next v2 0/5] xsk: fix bug when trying to use both copy and zero-copy mode

2018-10-01 Thread Magnus Karlsson
nus Jakub Kicinski (2): ethtool: rename local variable max -> curr ethtool: don't allow disabling queues with umem installed Magnus Karlsson (3): net: add umem reference in netdev{_rx}_queue xsk: fix bug when trying to use both copy and zero-copy on one queue id

[PATCH bpf-next v2 1/5] net: add umem reference in netdev{_rx}_queue

2018-10-01 Thread Magnus Karlsson
These references to the umem will be used to store information on what kind of AF_XDP umem that is bound to a queue id, if any. Signed-off-by: Magnus Karlsson --- include/linux/netdevice.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux

[PATCH bpf-next 0/3] xsk: misc code cleanup

2018-08-30 Thread Magnus Karlsson
;) Thanks: Magnus Magnus Karlsson (3): i40e: fix possible compiler warning in xsk TX path xsk: get rid of useless struct xdp_umem_props i40e: adapt driver to new xdp_umem structure drivers/net/ethernet/intel/i40e/i40e_xsk.c | 10 -- include/net/xdp_sock.h | 8 ++-

[PATCH bpf-next 2/3] xsk: get rid of useless struct xdp_umem_props

2018-08-30 Thread Magnus Karlsson
and as a bonus gets rid of one internal header file. Signed-off-by: Magnus Karlsson --- include/net/xdp_sock.h | 8 ++-- net/xdp/xdp_umem.c | 4 ++-- net/xdp/xdp_umem_props.h | 14 -- net/xdp/xsk.c| 10 ++ net/xdp/xsk_queue.c | 5 +++-- net/xdp

[PATCH bpf-next 1/3] i40e: fix possible compiler warning in xsk TX path

2018-08-30 Thread Magnus Karlsson
With certain gcc versions, it was possible to get the warning "'tx_desc' may be used uninitialized in this function" for the i40e_xmit_zc. This was not possible, however this commit simplifies the code path so that this warning is no longer emitted. Signed-off-by: Magnus Karlsson --

[PATCH bpf-next 3/3] i40e: adapt driver to new xdp_umem structure

2018-08-30 Thread Magnus Karlsson
The struct xdp_umem_props was removed in the xsk code and this commit adapts the i40e af_xdp zero-copy driver code to the new xdp_umem structure. Signed-off-by: Magnus Karlsson --- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

Re: [PATCH bpf-next 2/2] xsk: fix bug when trying to use both copy and zero-copy on one queue id

2018-09-24 Thread Magnus Karlsson
On Thu, Sep 20, 2018 at 4:41 PM Jakub Kicinski wrote: > > On Thu, 20 Sep 2018 11:17:17 +0200, Magnus Karlsson wrote: > > On Wed, Sep 19, 2018 at 9:18 AM Magnus Karlsson wrote: > > > On Wed, Sep 19, 2018 at 3:58 AM Jakub Kicinski wrote: > > > > > > > &g

Re: [PATCH bpf-next 2/2] xsk: fix bug when trying to use both copy and zero-copy on one queue id

2018-09-20 Thread Magnus Karlsson
On Wed, Sep 19, 2018 at 9:18 AM Magnus Karlsson wrote: > > On Wed, Sep 19, 2018 at 3:58 AM Jakub Kicinski > wrote: > > > > On Tue, 18 Sep 2018 10:22:11 -0700, Y Song wrote: > > > > +/* The umem is stored both in the _rx struct and the _tx struct as we

[PATCH bpf-next 1/2] net: add umem reference in netdev{_rx}_queue

2018-09-18 Thread Magnus Karlsson
These references to the umem will be used to store information on what kind of AF_XDP umem that is bound to a queue id, if any. Signed-off-by: Magnus Karlsson --- include/linux/netdevice.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux

[PATCH bpf-next 0/2] xsk: fix bug when trying to use both copy and zero-copy mode

2018-09-18 Thread Magnus Karlsson
. I based this patch set on bpf-next commit 70e88c758a6b ("selftests/bpf: fix bpf_flow.c build") Thanks: Magnus Magnus Karlsson (2): net: add umem reference in netdev{_rx}_queue xsk: fix bug when trying to use both copy and zero-copy on one queue id include/linux/netdev

[PATCH bpf-next 2/2] xsk: fix bug when trying to use both copy and zero-copy on one queue id

2018-09-18 Thread Magnus Karlsson
been bound to a queue id and can act appropriately at bind time. Signed-off-by: Magnus Karlsson --- net/xdp/xdp_umem.c | 87 +++--- net/xdp/xdp_umem.h | 2 +- 2 files changed, 71 insertions(+), 18 deletions(-) diff --git a/net/xdp/xdp_umem.c b/net

Re: [PATCH bpf-next 2/2] xsk: fix bug when trying to use both copy and zero-copy on one queue id

2018-09-19 Thread Magnus Karlsson
On Wed, Sep 19, 2018 at 3:58 AM Jakub Kicinski wrote: > > On Tue, 18 Sep 2018 10:22:11 -0700, Y Song wrote: > > > +/* The umem is stored both in the _rx struct and the _tx struct as we do > > > + * not know if the device has more tx queues than rx, or the opposite. > > > + * This might also

Re: [PATCH bpf-next 2/2] xsk: fix bug when trying to use both copy and zero-copy on one queue id

2018-09-19 Thread Magnus Karlsson
On Tue, Sep 18, 2018 at 7:23 PM Y Song wrote: > > On Tue, Sep 18, 2018 at 3:13 AM Magnus Karlsson > wrote: > > > > Previously, the xsk code did not record which umem was bound to a > > specific queue id. This was not required if all drivers were zero-copy > > e