Re: [PATCH v8 bpf-next 00/14] mvneta: introduce XDP multi-buffer support

2021-04-20 Thread Magnus Karlsson
On Mon, Apr 19, 2021 at 8:56 AM Lorenzo Bianconi wrote: > > > On Sun, Apr 18, 2021 at 6:18 PM Jesper Dangaard Brouer > > wrote: > > > > > > On Fri, 16 Apr 2021 16:27:18 +0200 > > > Magnus Karlsson wrote: > > > > > > >

Re: [PATCH v8 bpf-next 00/14] mvneta: introduce XDP multi-buffer support

2021-04-18 Thread Magnus Karlsson
On Sun, Apr 18, 2021 at 6:18 PM Jesper Dangaard Brouer wrote: > > On Fri, 16 Apr 2021 16:27:18 +0200 > Magnus Karlsson wrote: > > > On Thu, Apr 8, 2021 at 2:51 PM Lorenzo Bianconi wrote: > > > > > > This series introduce XDP multi-buffer support. The mvneta

Re: [PATCH v8 bpf-next 00/14] mvneta: introduce XDP multi-buffer support

2021-04-16 Thread Magnus Karlsson
On Thu, Apr 8, 2021 at 2:51 PM Lorenzo Bianconi wrote: > > This series introduce XDP multi-buffer support. The mvneta driver is > the first to support these new "non-linear" xdp_{buff,frame}. Reviewers > please focus on how these new types of xdp_{buff,frame} packets > traverse the different layer

Re: [PATCH net-next v4 08/10] virtio-net: xsk zero copy xmit setup

2021-04-14 Thread Magnus Karlsson
On Tue, Apr 13, 2021 at 9:58 AM Xuan Zhuo wrote: > > xsk is a high-performance packet receiving and sending technology. > > This patch implements the binding and unbinding operations of xsk and > the virtio-net queue for xsk zero copy xmit. > > The xsk zero copy xmit depends on tx napi. So if tx n

Re: [PATCH net-next v4 05/10] xsk: XDP_SETUP_XSK_POOL support option IFF_NOT_USE_DMA_ADDR

2021-04-14 Thread Magnus Karlsson
On Tue, Apr 13, 2021 at 9:58 AM Xuan Zhuo wrote: > > Some devices, such as virtio-net, do not directly use dma addr. These > devices do not initialize dma after completing the xsk setup, so the dma > check is skipped here. > > Signed-off-by: Xuan Zhuo > Reviewed-by: Dust

Re: [PATCH net-next v4 04/10] xsk: support get page by addr

2021-04-14 Thread Magnus Karlsson
On Tue, Apr 13, 2021 at 9:58 AM Xuan Zhuo wrote: > > xsk adds an interface and returns the page corresponding to > data. virtio-net does not initialize dma, so it needs page to construct > scatterlist to pass to vring. > > Signed-off-by: Xuan Zhuo > Reviewed-by: Dust

Re: [PATCH v2 bpf-next 0/2] xsk: introduce generic almost-zerocopy xmit

2021-04-13 Thread Magnus Karlsson
On Tue, Apr 13, 2021 at 3:49 AM Xuan Zhuo wrote: > > On Mon, 12 Apr 2021 16:13:12 +0200, Magnus Karlsson > wrote: > > On Wed, Mar 31, 2021 at 2:27 PM Alexander Lobakin wrote: > > > > > > This series is based on the exceptional generic zerocopy xmit logics &

Re: [PATCH v2 bpf-next 0/2] xsk: introduce generic almost-zerocopy xmit

2021-04-12 Thread Magnus Karlsson
On Wed, Mar 31, 2021 at 2:27 PM Alexander Lobakin wrote: > > This series is based on the exceptional generic zerocopy xmit logics > initially introduced by Xuan Zhuo. It extends it the way that it > could cover all the sane drivers, not only the ones that are capable > of xmitting skbs with no lin

Re: [PATCH net-next v3 3/8] virtio-net: xsk zero copy xmit setup

2021-04-07 Thread Magnus Karlsson
On Tue, Apr 6, 2021 at 3:13 PM Jason Wang wrote: > > > 在 2021/3/31 下午3:11, Xuan Zhuo 写道: > > xsk is a high-performance packet receiving and sending technology. > > > > This patch implements the binding and unbinding operations of xsk and > > the virtio-net queue for xsk zero copy xmit. > > > > The

Re: [PATCH net-next v3 4/8] virtio-net: xsk zero copy xmit implement wakeup and xmit

2021-04-07 Thread Magnus Karlsson
On Tue, Apr 6, 2021 at 3:33 PM Jason Wang wrote: > > > 在 2021/3/31 下午3:11, Xuan Zhuo 写道: > > When the user calls sendto to consume the data in the xsk tx queue, > > virtnet_xsk_wakeup will be called. > > > > In wakeup, it will try to send a part of the data directly, the quantity > > is operated b

Re: [PATCH bpf-next 0/2] xsk: introduce generic almost-zerocopy xmit

2021-03-31 Thread Magnus Karlsson
On Wed, Mar 31, 2021 at 1:17 AM Alexander Lobakin wrote: > > This series is based on the exceptional generic zerocopy xmit logics > initially introduced by Xuan Zhuo. It extends it the way that it > could cover all the sane drivers, not only the ones that are capable > of xmitting skbs with no lin

Re: [PATCH bpf 2/3] libbpf: restore umem state after socket create failure

2021-03-26 Thread Magnus Karlsson
On Fri, Mar 26, 2021 at 3:56 PM Loftus, Ciara wrote: > > > > > On Wed, Mar 24, 2021 at 3:46 PM Ciara Loftus > > wrote: > > > > > > If the call to socket_create fails, the user may want to retry the > > > socket creation using the same umem. Ensure that the umem is in the > > > same state on exit

Re: [PATCH bpf 1/3] libbpf: ensure umem pointer is non-NULL before dereferencing

2021-03-26 Thread Magnus Karlsson
n queues and > devices") > > Signed-off-by: Ciara Loftus > --- > tools/lib/bpf/xsk.c | 3 +++ > 1 file changed, 3 insertions(+) Thank you for the fix! Acked-by: Magnus Karlsson > diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c > index 526fc35c0b23..443b0cfb45e8

Re: [PATCH bpf 3/3] libbpf: ignore return values of setsockopt for XDP rings.

2021-03-26 Thread Magnus Karlsson
->config.tx_size)); Thanks Ciara! This is a pragmatic solution, but I do not see any better way around it since these operations are irreversible. And it works without any fix to the kernel which is good and you have a comment explaining things clearly. With that said, it would be nice as a follo

Re: [PATCH bpf 2/3] libbpf: restore umem state after socket create failure

2021-03-26 Thread Magnus Karlsson
On Wed, Mar 24, 2021 at 3:46 PM Ciara Loftus wrote: > > If the call to socket_create fails, the user may want to retry the > socket creation using the same umem. Ensure that the umem is in the > same state on exit if the call failed by restoring the _save pointers > and not unmapping the set of um

Re: [PATCH intel-net] i40e: fix receiving of single packets in xsk zero-copy mode

2021-03-19 Thread Magnus Karlsson
On Fri, Mar 19, 2021 at 12:10 PM Maciej Fijalkowski wrote: > > On Fri, Mar 19, 2021 at 10:44:10AM +0100, Magnus Karlsson wrote: > > From: Magnus Karlsson > > > > Fix so that single packets are received immediately instead of in > > batches of 8. If you sent 1 p

[PATCH intel-net] i40e: fix receiving of single packets in xsk zero-copy mode

2021-03-19 Thread Magnus Karlsson
From: Magnus Karlsson Fix so that single packets are received immediately instead of in batches of 8. If you sent 1 pss to a system, you received 8 packets every 8 seconds instead of 1 packet every second. The problem behind this was that the work_done reporting from the Tx part of the driver

Re: [PATCH v2 bpf-next 13/17] veth: implement ethtool's get_channels() callback

2021-03-16 Thread Magnus Karlsson
On Thu, Mar 11, 2021 at 4:43 PM Maciej Fijalkowski wrote: > > Libbpf's xsk part calls get_channels() API to retrieve the queue count > of the underlying driver so that XSKMAP is sized accordingly. > > Implement that in veth so multi queue scenarios can work properly. > > Signed-off-by: Maciej Fija

Re: [PATCH] net: xdp: fix error return code of xsk_generic_xmit()

2021-03-05 Thread Magnus Karlsson
On Fri, Mar 5, 2021 at 10:28 AM Jia-Ju Bai wrote: > > When err is zero but xskq_prod_reserve() fails, no error return code of > xsk_generic_xmit() is assigned. > To fix this bug, err is assigned with the return value of > xskq_prod_reserve(), and then err is checked. This error is ignored by desi

Re: [PATCH bpf-next 2/4] selftests/bpf: expose debug arg to shell script for xsk tests

2021-02-19 Thread Magnus Karlsson
On Wed, Feb 17, 2021 at 5:36 PM Ciara Loftus wrote: > > Launching xdpxceiver with -D enables debug mode. Make it possible Would be clearer if the option was the same both in the shell and in the xdpreceiver app, so please pick -d or -D and stick with it. And how about calling the mode "dump packe

Re: [PATCH bpf-next 1/3] libbpf: xsk: use bpf_link

2021-02-16 Thread Magnus Karlsson
On Wed, Feb 17, 2021 at 8:16 AM Magnus Karlsson wrote: > > On Wed, Feb 17, 2021 at 3:26 AM Dan Siemon wrote: > > > > On Mon, 2021-02-15 at 22:38 +0100, Toke Høiland-Jørgensen wrote: > > > The idea is to keep libbpf focused on bpf, and move the AF_XDP stuff > >

Re: [PATCH bpf-next 1/3] libbpf: xsk: use bpf_link

2021-02-16 Thread Magnus Karlsson
On Wed, Feb 17, 2021 at 3:26 AM Dan Siemon wrote: > > On Mon, 2021-02-15 at 22:38 +0100, Toke Høiland-Jørgensen wrote: > > The idea is to keep libbpf focused on bpf, and move the AF_XDP stuff > > to > > libxdp (so the socket stuff in xsk.h). We're adding the existing code > > wholesale, and keepin

Re: [PATCH v4 bpf-next 5/6] xsk: respect device's headroom and tailroom on generic xmit path

2021-02-16 Thread Magnus Karlsson
ess than driver requests > for headroom. NET_SKB_PAD here is to double-insure there will be > no reallocations even when the driver advertises no needed_headroom, > but in fact need it (not so rare case). > > Fixes: 35fcde7f8deb ("xsk: support for Tx") > Signed-off-by:

Re: [PATCH v4 bpf-next 6/6] xsk: build skb by page (aka generic zerocopy xmit)

2021-02-16 Thread Magnus Karlsson
-by: Dust Li > [ alobakin: > - expand subject to make it clearer; > - improve skb->truesize calculation; > - reserve some headroom in skb for drivers; > - tailroom is not needed as skb is non-linear ] > Signed-off-by: Alexander Lobakin Thank you Alexander! Acked-by: Magnus Kar

Re: [PATCH bpf-next v5 0/6] AF_XDP Packet Drop Tracing

2021-02-11 Thread Magnus Karlsson
On Mon, Feb 8, 2021 at 10:39 AM Ciara Loftus wrote: > > This series introduces tracing infrastructure for AF_XDP sockets (xsk). > A trace event 'xsk_packet_drop' is created which can be enabled by toggling > > /sys/kernel/debug/tracing/events/xsk/xsk_packet_drop/enable > > When enabled and packets

[PATCH intel-net] ice: fix napi work done reporting in xsk path

2021-02-05 Thread Magnus Karlsson
From: Magnus Karlsson Fix the wrong napi work done reporting in the xsk path of the ice driver. The code in the main Rx processing loop was written to assume that the buffer allocation code returns true if all allocations where successful and false if not. In contrast with all other Intel NIC

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-26 Thread Magnus Karlsson
On Mon, Jan 25, 2021 at 1:43 PM Xuan Zhuo wrote: > > On Mon, 25 Jan 2021 08:44:38 +0100, Magnus Karlsson > wrote: > > On Mon, Jan 25, 2021 at 3:27 AM Xuan Zhuo > > wrote: > > > > > > On Fri, 22 Jan 2021 19:37:06 +0100, Magnus Karlsson > > >

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-26 Thread Magnus Karlsson
On Mon, Jan 25, 2021 at 4:22 PM Xuan Zhuo wrote: > > On Mon, 25 Jan 2021 14:16:16 +0100, Magnus Karlsson > wrote: > > On Mon, Jan 25, 2021 at 1:43 PM Xuan Zhuo > > wrote: > > > > > > On Mon, 25 Jan 2021 08:44:38 +0100, Magnus Karlsson > > >

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-25 Thread Magnus Karlsson
On Mon, Jan 25, 2021 at 3:27 AM Xuan Zhuo wrote: > > On Fri, 22 Jan 2021 19:37:06 +0100, Magnus Karlsson > wrote: > > On Fri, Jan 22, 2021 at 6:26 PM Alexander Lobakin wrote: > > > > > > From: Xuan Zhuo > > > Date: Fri, 22 Jan 2021 23:39:15 +0800

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-22 Thread Magnus Karlsson
On Fri, Jan 22, 2021 at 6:26 PM Alexander Lobakin wrote: > > From: Xuan Zhuo > Date: Fri, 22 Jan 2021 23:39:15 +0800 > > > On Fri, 22 Jan 2021 13:55:14 +0100, Magnus Karlsson > > wrote: > > > On Fri, Jan 22, 2021 at 1:39 PM Alexander Lobakin wrote: >

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-22 Thread Magnus Karlsson
On Fri, Jan 22, 2021 at 1:39 PM Alexander Lobakin wrote: > > From: Magnus Karlsson > Date: Fri, 22 Jan 2021 13:18:47 +0100 > > > On Fri, Jan 22, 2021 at 12:57 PM Alexander Lobakin wrote: > > > > > > From: Alexander Lobakin > > > Date: Fri, 22 Jan

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-22 Thread Magnus Karlsson
On Fri, Jan 22, 2021 at 12:57 PM Alexander Lobakin wrote: > > From: Alexander Lobakin > Date: Fri, 22 Jan 2021 11:47:45 + > > > From: Eric Dumazet > > Date: Thu, 21 Jan 2021 16:41:33 +0100 > > > > > On 1/21/21 2:47 PM, Xuan Zhuo wrote: > > > > This patch is used to construct skb based on pag

Re: [PATCH bpf-next v2 0/8] Introduce bpf_redirect_xsk() helper

2021-01-22 Thread Magnus Karlsson
On Thu, Jan 21, 2021 at 6:07 PM Jesper Dangaard Brouer wrote: > > On Wed, 20 Jan 2021 17:19:31 +0100 > Maciej Fijalkowski wrote: > > > On Wed, Jan 20, 2021 at 04:57:08PM +0100, Jesper Dangaard Brouer wrote: > > > On Wed, 20 Jan 2021 15:15:22 +0200 > > > Maxim Mikityanskiy wrote: > > > > > > > On

Re: [PATCH bpf-next v3 3/3] xsk: build skb by page

2021-01-21 Thread Magnus Karlsson
would be nice if we could get some physical NIC drivers to support this too. Some probably already do and can just set the bit, while others need some modifications to support this. Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index 4a83117..38af7f1 100644 > -

Re: [PATCH net-next v2 3/3] xsk: build skb by page

2021-01-20 Thread Magnus Karlsson
On Wed, Jan 20, 2021 at 9:29 PM Alexander Lobakin wrote: > > From: Xuan Zhuo > Date: Wed, 20 Jan 2021 16:30:56 +0800 > > > This patch is used to construct skb based on page to save memory copy > > overhead. > > > > This function is implemented based on IFF_TX_SKB_NO_LINEAR. Only the > > network c

Re: [PATCH bpf-next] xsk: build skb by page

2021-01-18 Thread Magnus Karlsson
On Mon, Jan 18, 2021 at 5:38 PM Alexander Lobakin wrote: > > > From: Magnus Karlsson > > Date: Mon, 18 Jan 2021 16:10:40 +0100 > > > > On Mon, Jan 18, 2021 at 3:47 PM Alexander Lobakin wrote: > > > > > > From: Alexander Lobakin > > > Da

Re: [PATCH bpf-next] xsk: build skb by page

2021-01-18 Thread Magnus Karlsson
On Mon, Jan 18, 2021 at 3:47 PM Alexander Lobakin wrote: > > From: Alexander Lobakin > Date: Mon, 18 Jan 2021 13:00:17 + > > > From: Yunsheng Lin > > Date: Mon, 18 Jan 2021 20:40:52 +0800 > > > >> On 2021/1/16 10:44, Xuan Zhuo wrote: > >>> This patch is used to construct skb based on page to

Re: [PATCH bpf-next] xsk: build skb by page

2021-01-18 Thread Magnus Karlsson
On Mon, Jan 18, 2021 at 3:47 PM Alexander Lobakin wrote: > > From: Alexander Lobakin > Date: Mon, 18 Jan 2021 13:00:17 + > > > From: Yunsheng Lin > > Date: Mon, 18 Jan 2021 20:40:52 +0800 > > > >> On 2021/1/16 10:44, Xuan Zhuo wrote: > >>> This patch is used to construct skb based on page to

Re: [PATCH bpf-next] xsk: build skb by page

2021-01-18 Thread Magnus Karlsson
On Sat, Jan 16, 2021 at 3:47 AM Xuan Zhuo wrote: > > This patch is used to construct skb based on page to save memory copy > overhead. > > This has one problem: > > We construct the skb by fill the data page as a frag into the skb. In > this way, the linear space is empty, and the header informati

Re: [PATCH net-next 0/4] i40e: small improvements on XDP path

2021-01-17 Thread Magnus Karlsson
--- > 1 file changed, 79 insertions(+), 70 deletions(-) > > -- > 2.25.1 > Thank you for these clean ups Cristian! For the series: Acked-by: Magnus Karlsson

Re: mlx5 error when the skb linear space is empty

2021-01-12 Thread Magnus Karlsson
On Tue, Jan 12, 2021 at 9:35 PM Saeed Mahameed wrote: > > On Mon, 2021-01-11 at 09:02 +0100, Magnus Karlsson wrote: > > On Tue, Jan 5, 2021 at 9:51 PM Saeed Mahameed > > wrote: > > > On Mon, 2021-01-04 at 18:59 +0800, Xuan Zhuo wrote: > > > > hi > >

Re: mlx5 error when the skb linear space is empty

2021-01-11 Thread Magnus Karlsson
On Tue, Jan 5, 2021 at 9:51 PM Saeed Mahameed wrote: > > On Mon, 2021-01-04 at 18:59 +0800, Xuan Zhuo wrote: > > hi > > > > In the process of developing xdp socket, we tried to directly use > > page to > > construct skb directly, to avoid data copy. And the MAC information > > is also in > > the p

Re: [PATCH bpf-next] xsk: build skb by page

2020-12-23 Thread Magnus Karlsson
On Wed, Dec 23, 2020 at 9:57 AM Xuan Zhuo wrote: > > This patch is used to construct skb based on page to save memory copy > overhead. > > Taking into account the problem of addr unaligned, and the > possibility of frame size greater than page in the future. Thanks Xuan for the patch set. Could y

[PATCH bpf v2 2/2] xsk: rollback reservation at NETDEV_TX_BUSY

2020-12-18 Thread Magnus Karlsson
From: Magnus Karlsson Rollback the reservation in the completion ring when we get a NETDEV_TX_BUSY. When this error is received from the driver, we are supposed to let the user application retry the transmit again. And in order to do this, we need to roll back the failed send so it can be

[PATCH bpf v2 1/2] xsk: fix race in SKB mode transmit with shared cq

2020-12-18 Thread Magnus Karlsson
From: Magnus Karlsson Fix a race when multiple sockets are simultaneously calling sendto() when the completion ring is shared in the SKB case. This is the case when you share the same netdev and queue id through the XDP_SHARED_UMEM bind flag. The problem is that multiple processes can be in

[PATCH bpf v2 0/2] xsk: fix two bugs in the SKB Tx path

2020-12-18 Thread Magnus Karlsson
This patch set contains two bug fixes to the Tx SKB path. Details can be found in the individual commit messages. Special thanks to Xuan Zhuo for spotting both of them. v1 -> v2: * Rebase Thanks: Magnus Magnus Karlsson (2): xsk: fix race in SKB mode transmit with shared cq xsk: rollb

[PATCH bpf 0/2] xsk: fix two bugs in the SKB Tx path

2020-12-14 Thread Magnus Karlsson
This patch set contains two bug fixes to the Tx SKB path. Details can be found in the individual commit messages. Special thanks to Xuan Zhuo for spotting both of them. Thanks: Magnus Magnus Karlsson (2): xsk: fix race in SKB mode transmit with shared cq xsk: rollback reservation at

[PATCH bpf 1/2] xsk: fix race in SKB mode transmit with shared cq

2020-12-14 Thread Magnus Karlsson
From: Magnus Karlsson Fix a race when multiple sockets are simultaneously calling sendto() when the completion ring is shared in the SKB case. This is the case when you share the same netdev and queue id through the XDP_SHARED_UMEM bind flag. The problem is that multiple processes can be in

[PATCH bpf 2/2] xsk: rollback reservation at NETDEV_TX_BUSY

2020-12-14 Thread Magnus Karlsson
From: Magnus Karlsson Rollback the reservation in the completion ring when we get a NETDEV_TX_BUSY. When this error is received from the driver, we are supposed to let the user application retry the transmit again. And in order to do this, we need to roll back the failed send so it can be

Re: [PATCH bpf] xsk: fix memory leak for failed bind

2020-12-14 Thread Magnus Karlsson
On Mon, Dec 14, 2020 at 12:19 PM Maciej Fijalkowski wrote: > > On Mon, Dec 14, 2020 at 09:51:27AM +0100, Magnus Karlsson wrote: > > From: Magnus Karlsson > > > > Fix a possible memory leak when a bind of an AF_XDP socket fails. When > > the fill and completion rings

Re: [PATCH bpf] xsk: fix race in SKB mode transmit with shared cq

2020-12-14 Thread Magnus Karlsson
On Fri, Dec 11, 2020 at 8:47 AM Magnus Karlsson wrote: > > On Thu, Dec 10, 2020 at 10:53 PM Alexei Starovoitov > wrote: > > > > On Thu, Dec 10, 2020 at 7:36 AM Magnus Karlsson > > wrote: > > > > > > From: Magnus Karlsson > > > > > &

[PATCH bpf] xsk: fix memory leak for failed bind

2020-12-14 Thread Magnus Karlsson
From: Magnus Karlsson Fix a possible memory leak when a bind of an AF_XDP socket fails. When the fill and completion rings are created, they are tied to the socket. But when the buffer pool is later created at bind time, the ownership of these two rings are transferred to the buffer pool as they

Re: [PATCH bpf-next] xsk: save the undone skb

2020-12-11 Thread Magnus Karlsson
On Fri, Dec 11, 2020 at 2:12 PM Xuan Zhuo wrote: > > We can reserve the skb. When sending fails, NETDEV_TX_BUSY or > xskq_prod_reserve fails. As long as skb is successfully generated and > successfully configured, we can reserve skb if we encounter exceptions > later. > > Especially when NETDEV_TX

Re: [PATCH bpf] xsk: fix race in SKB mode transmit with shared cq

2020-12-10 Thread Magnus Karlsson
On Thu, Dec 10, 2020 at 10:53 PM Alexei Starovoitov wrote: > > On Thu, Dec 10, 2020 at 7:36 AM Magnus Karlsson > wrote: > > > > From: Magnus Karlsson > > > > Fix a race when multiple sockets are simultaneously calling sendto() > > when the completion ring

[PATCH bpf-next v2] samples/bpf: fix possible hang in xdpsock with multiple threads

2020-12-10 Thread Magnus Karlsson
From: Magnus Karlsson Fix a possible hang in xdpsock that can occur when using multiple threads. In this case, one or more of the threads might get stuck in the while-loop in tx_only after the user has signaled the main thread to stop execution. In this case, no more Tx packets will be sent, so

Re: [PATCH bpf-next] samples/bpf: fix possible hang in xdpsock with multiple threads

2020-12-10 Thread Magnus Karlsson
On Thu, Dec 10, 2020 at 5:03 PM Daniel Borkmann wrote: > > On 12/10/20 4:36 PM, Magnus Karlsson wrote: > > From: Magnus Karlsson > > > > Fix a possible hang in xdpsock that can occur when using multiple > > threads. In this case, one or more of the threads might g

[PATCH bpf-next] samples/bpf: fix possible hang in xdpsock with multiple threads

2020-12-10 Thread Magnus Karlsson
From: Magnus Karlsson Fix a possible hang in xdpsock that can occur when using multiple threads. In this case, one or more of the threads might get stuck in the while-loop in tx_only after the user has signaled the main thread to stop execution. In this case, no more Tx packets will be sent, so

[PATCH bpf] xsk: fix race in SKB mode transmit with shared cq

2020-12-10 Thread Magnus Karlsson
From: Magnus Karlsson Fix a race when multiple sockets are simultaneously calling sendto() when the completion ring is shared in the SKB case. This is the case when you share the same netdev and queue id through the XDP_SHARED_UMEM bind flag. The problem is that multiple processes can be in

Re: [Intel-wired-lan] Explaining XDP redirect bulk size design (Was: [PATCH v2 bpf 1/5] net: ethtool: add xdp properties flag set)

2020-12-10 Thread Magnus Karlsson
On Thu, Dec 10, 2020 at 2:32 PM Jesper Dangaard Brouer wrote: > > On Wed, 9 Dec 2020 08:44:33 -0700 > David Ahern wrote: > > > On 12/9/20 4:52 AM, Jesper Dangaard Brouer wrote: > > > But I have redesigned the ndo_xdp_xmit call to take a bulk of packets > > > (up-to 16) so it should not be a probl

Re: [PATCH bpf-next] xsk: Validate socket state in xsk_recvmsg, prior touching socket members

2020-12-07 Thread Magnus Karlsson
Reported-by: kernel test robot > Fixes: 45a86681844e ("xsk: Add support for recvmsg()") > Signed-off-by: Björn Töpel > --- > net/xdp/xsk.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk.c b/net

Re: [PATCH net v2] xsk: Return error code if force_zc is set

2020-12-04 Thread Magnus Karlsson
ng Changzhong > --- > net/xdp/xsk_buff_pool.c | 1 + > 1 file changed, 1 insertion(+) Thank you Changzhong! Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c > index 9287edd..d5adeee 100644 > --- a/net/xdp/xsk_buff_pool.c > +++ b/net/

Re: [PATCH net] xsk: Fix error return code in __xp_assign_dev()

2020-12-04 Thread Magnus Karlsson
On Fri, Dec 4, 2020 at 9:49 AM Zhang Changzhong wrote: > > Fix to return a negative error code from the error handling > case instead of 0, as done elsewhere in this function. > > Fixes: 921b68692abb ("xsk: Enable sharing of dma mappings") > Reported-by: Hulk Robot > Signed-off-by: Zhang Changzho

Re: [PATCH net-next 0/3] i40e, ice, ixgbe: optimize for XDP_REDIRECT in xsk path

2020-12-02 Thread Magnus Karlsson
On Wed, Dec 2, 2020 at 9:49 PM Maciej Fijalkowski wrote: > > On Wed, Dec 02, 2020 at 04:07:21PM +0100, Magnus Karlsson wrote: > > Optimize run_xdp_zc() for the XDP program verdict being XDP_REDIRECT > > in the zsk zero-copy path. This path is only used when having AF_XDP >

Re: [PATCH bpf V3 2/2] xsk: change the tx writeable condition

2020-12-02 Thread Magnus Karlsson
large number of EPOLLOUT events, and cause a large number of > process wake up. And the Fixes label here should be: Fixes: 35fcde7f8deb ("xsk: support for Tx") > Signed-off-by: Xuan Zhuo > Acked-by: Magnus Karlsson > --- > net/xdp/xsk.c | 16 +--- >

Re: [PATCH bpf V3 1/2] xsk: replace datagram_poll by sock_poll_wait

2020-12-02 Thread Magnus Karlsson
nks: Magnus > Signed-off-by: Xuan Zhuo > Acked-by: Magnus Karlsson > --- > net/xdp/xsk.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index b7b039b..9bbfd8a 100644 > --- a/net/xdp/xsk.c > +++ b/net/xdp/x

[PATCH net-next 2/3] ixgbe: optimize for XDP_REDIRECT in xsk path

2020-12-02 Thread Magnus Karlsson
From: Magnus Karlsson Optimize ixgbe_run_xdp_zc() for the XDP program verdict being XDP_REDIRECT in the zsk zero-copy path. This path is only used when having AF_XDP zero-copy on and in that case most packets will be directed to user space. This provides a little under 100k extra packets in

[PATCH net-next 3/3] ice: optimize for XDP_REDIRECT in xsk path

2020-12-02 Thread Magnus Karlsson
From: Magnus Karlsson Optimize ice_run_xdp_zc() for the XDP program verdict being XDP_REDIRECT in the zsk zero-copy path. This path is only used when having AF_XDP zero-copy on and in that case most packets will be directed to user space. This provides a little over 100k extra packets in

[PATCH net-next 0/3] i40e, ice, ixgbe: optimize for XDP_REDIRECT in xsk path

2020-12-02 Thread Magnus Karlsson
in xdpsock. Thanks: Magnus Magnus Karlsson (3): i40: optimize for XDP_REDIRECT in xsk path ixgbe: optimize for XDP_REDIRECT in xsk path ice: optimize for XDP_REDIRECT in xsk path drivers/net/ethernet/intel/i40e/i40e_xsk.c | 11 +++ drivers/net/ethernet/intel/ice/ice_xsk.c

[PATCH net-next 1/3] i40: optimize for XDP_REDIRECT in xsk path

2020-12-02 Thread Magnus Karlsson
From: Magnus Karlsson Optimize i40e_run_xdp_zc() for the XDP program verdict being XDP_REDIRECT in the zsk zero-copy path. This path is only used when having AF_XDP zero-copy on and in that case most packets will be directed to user space. This provides a little over 100k extra packets in

Re: [PATCH v5 bpf-next 1/2] libbpf: separate XDP program load with xsk socket creation

2020-11-27 Thread Magnus Karlsson
++ > tools/lib/bpf/xsk.h | 5 +++ > 3 files changed, 90 insertions(+), 9 deletions(-) Acked-by: Magnus Karlsson > diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map > index 29ff4807b909..d939d5ac092e 100644 > --- a/tools/lib/bpf/lib

Re: [PATCH v5 bpf-next 2/2] samples/bpf: sample application for eBPF load and socket creation split

2020-11-27 Thread Magnus Karlsson
f/xdpsock_ctrl_proc.c | 187 > samples/bpf/xdpsock_user.c | 146 +++-- > 4 files changed, 335 insertions(+), 10 deletions(-) > create mode 100644 samples/bpf/xdpsock_ctrl_proc.c Acked-by: Magnus Karlsson > diff --git a/samples/bpf/Makefi

Re: [PATCH bpf v2 2/2] xsk: change the tx writeable condition

2020-11-27 Thread Magnus Karlsson
large number of EPOLLOUT events, and cause a large number of > process wake up. > > Signed-off-by: Xuan Zhuo Thank you Xuan! Acked-by: Magnus Karlsson > --- > net/xdp/xsk.c | 16 +--- > net/xdp/xsk_queue.h | 6 ++ > 2 files changed, 19 insertions(+), 3 d

Re: [PATCH bpf v2 1/2] xsk: replace datagram_poll by sock_poll_wait

2020-11-27 Thread Magnus Karlsson
m_poll, and the mask is calculated by xsk_poll. > > Signed-off-by: Xuan Zhuo > --- > net/xdp/xsk.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index b014197..0df8651 100644 > --

Re: [PATCH v4 bpf-next 2/2] samples/bpf: sample application for eBPF load and socket creation split

2020-11-26 Thread Magnus Karlsson
On Thu, Nov 26, 2020 at 12:10 PM wrote: > > From: Mariusz Dudek > > Introduce a sample program to demonstrate the control and data > plane split. For the control plane part a new program called > xdpsock_ctrl_proc is introduced. For the data plane part, some code > was added to xdpsock_user.c to

Re: [PATCH v5 1/1] xdp: remove the functions xsk_map_inc and xsk_map_put

2020-11-26 Thread Magnus Karlsson
d20a1676df7e ("xsk: Move xskmap.c to net/xdp/") > Signed-off-by: Zhu Yanjun > --- > net/xdp/xsk.c| 4 ++-- > net/xdp/xsk.h| 2 -- > net/xdp/xskmap.c | 20 ++-- > 3 files changed, 4 insertions(+), 22 deletions(-) Thank you Yanjun for this cleanup!

[PATCH bpf-next] libbpf: replace size_t with __u32 in xsk interfaces

2020-11-26 Thread Magnus Karlsson
From: Magnus Karlsson Replace size_t with __u32 in the xsk interfaces that contain this. There is no reason to have size_t since the internal variable that is manipulated is a __u32. The following APIs are affected: __u32 xsk_ring_prod__reserve(struct xsk_ring_prod *prod, __u32 nb

Re: [PATCH bpf-next v3 06/10] xsk: propagate napi_id to XDP socket Rx path

2020-11-25 Thread Magnus Karlsson
| 3 ++- > net/xdp/xsk.c | 1 + > 29 files changed, 54 insertions(+), 36 deletions(-) For Intel drivers: Acked-by: Magnus Karlsson > diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c > b/drivers/net/ethernet/amazon/ena/ena_net

Re: [PATCH v3 bpf-next 2/2] samples/bpf: sample application for eBPF load and socket creation split

2020-11-25 Thread Magnus Karlsson
On Wed, Nov 18, 2020 at 9:34 AM wrote: > > From: Mariusz Dudek > > Introduce a sample program to demonstrate the control and data > plane split. For the control plane part a new program called > xdpsock_ctrl_proc is introduced. For the data plane part, some code > was added to xdpsock_user.c to a

Re: [PATCH v3 bpf-next 1/2] libbpf: separate XDP program load with xsk socket creation

2020-11-25 Thread Magnus Karlsson
On Wed, Nov 18, 2020 at 9:34 AM wrote: > > From: Mariusz Dudek > > Add support for separation of eBPF program load and xsk socket > creation. > > This is needed for use-case when you want to privide as little > privileges as possible to the data plane application that will > handle xsk socket cre

Re: [PATCH][V2] libbpf: add support for canceling cached_cons advance

2020-11-25 Thread Magnus Karlsson
On Wed, Nov 25, 2020 at 11:07 AM Daniel Borkmann wrote: > > On 11/25/20 10:13 AM, Magnus Karlsson wrote: > > On Wed, Nov 25, 2020 at 10:02 AM Daniel Borkmann > > wrote: > >> On 11/25/20 9:30 AM, Magnus Karlsson wrote: > >>> On Tue, Nov 24, 2020 at

Re: [PATCH][V2] libbpf: add support for canceling cached_cons advance

2020-11-25 Thread Magnus Karlsson
On Wed, Nov 25, 2020 at 10:02 AM Daniel Borkmann wrote: > > On 11/25/20 9:30 AM, Magnus Karlsson wrote: > > On Tue, Nov 24, 2020 at 10:58 PM Daniel Borkmann > > wrote: > >> On 11/24/20 9:12 AM, Magnus Karlsson wrote: > >>> On Tue, Nov 24, 2020 at 8:33 AM

Re: [PATCH v3 1/1] xdp: remove the function xsk_map_inc

2020-11-25 Thread Magnus Karlsson
On Wed, Nov 25, 2020 at 1:02 AM Daniel Borkmann wrote: > > On 11/23/20 4:05 PM, Zhu Yanjun wrote: > > From: Zhu Yanjun > > > > The function xsk_map_inc is a simple wrapper of bpf_map_inc and > > always returns zero. As such, replacing this function with bpf_map_inc > > and removing the test code.

Re: [PATCH][V2] libbpf: add support for canceling cached_cons advance

2020-11-25 Thread Magnus Karlsson
On Tue, Nov 24, 2020 at 10:58 PM Daniel Borkmann wrote: > > On 11/24/20 9:12 AM, Magnus Karlsson wrote: > > On Tue, Nov 24, 2020 at 8:33 AM Li RongQing wrote: > >> > >> Add a new function for returning descriptors the user received > >> after an xsk_ring

Re: [PATCH bpf-next v3 10/10] samples/bpf: add option to set the busy-poll budget

2020-11-25 Thread Magnus Karlsson
On Thu, Nov 19, 2020 at 9:33 AM Björn Töpel wrote: > > From: Björn Töpel > > Support for the SO_BUSY_POLL_BUDGET setsockopt, via the batching > option ('b'). > > Signed-off-by: Björn Töpel > --- > samples/bpf/xdpsock_user.c | 5 + > 1 file ch

Re: [PATCH bpf-next v3 09/10] samples/bpf: add busy-poll support to xdpsock

2020-11-25 Thread Magnus Karlsson
> --- > samples/bpf/xdpsock_user.c | 40 +++--- > 1 file changed, 33 insertions(+), 7 deletions(-) Acked-by: Magnus Karlsson > diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c > index 24aa7511c4c8..cb1eaee8a32b 100644 > --- a/sa

Re: [PATCH bpf-next v3 08/10] samples/bpf: use recvfrom() in xdpsock/l2fwd

2020-11-25 Thread Magnus Karlsson
les/bpf/xdpsock_user.c | 25 +++-- > 1 file changed, 11 insertions(+), 14 deletions(-) Acked-by: Magnus Karlsson > diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c > index f90111b95b2e..24aa7511c4c8 100644 > --- a/samples/bpf/xdpsock_user.c > +++ b/sampl

Re: [PATCH bpf-next v3 05/10] xsk: add busy-poll support for {recv,send}msg()

2020-11-25 Thread Magnus Karlsson
; --- > net/xdp/xsk.c | 24 > 1 file changed, 24 insertions(+) Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index bf0f5c34af6c..ecc4579e41ee 100644 > --- a/net/xdp/xsk.c > +++ b/net/xdp/xsk.c > @@ -23,6 +23,7 @@ > #include

Re: [PATCH bpf-next v3 07/10] samples/bpf: use recvfrom() in xdpsock/rxdrop

2020-11-25 Thread Magnus Karlsson
On Thu, Nov 19, 2020 at 9:34 AM Björn Töpel wrote: > > From: Björn Töpel > > Start using recvfrom() the rxdrop scenario. > > Signed-off-by: Björn Töpel > --- > samples/bpf/xdpsock_user.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) Acked-by: Magnu

Re: [PATCH bpf-next v3 04/10] xsk: check need wakeup flag in sendmsg()

2020-11-24 Thread Magnus Karlsson
et/xdp/xsk.c | 6 +- > net/xdp/xsk_buff_pool.c | 13 ++--- > 2 files changed, 11 insertions(+), 8 deletions(-) Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index 56a52ec75696..bf0f5c34af6c 100644 > --- a/net/xdp/xsk.c > +++ b/net/

Re: [PATCH bpf-next v3 03/10] xsk: add support for recvmsg()

2020-11-24 Thread Magnus Karlsson
gt; Signed-off-by: Björn Töpel > --- > net/xdp/xsk.c | 22 +- > 1 file changed, 21 insertions(+), 1 deletion(-) Acked-by: Magnus Karlsson > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index b0141973f23e..56a52ec75696 100644 > --- a/net/xdp/xsk.c > +++ b/ne

Re: [PATCH 1/3] xsk: replace datagram_poll by sock_poll_wait

2020-11-24 Thread Magnus Karlsson
On Mon, Nov 23, 2020 at 3:11 PM Magnus Karlsson wrote: > > On Wed, Nov 18, 2020 at 9:26 AM Xuan Zhuo wrote: > > > > datagram_poll will judge the current socket status (EPOLLIN, EPOLLOUT) > > based on the traditional socket information (eg: sk_wmem_alloc), but > >

Re: [PATCH 0/3] xsk: fix for xsk_poll writeable

2020-11-24 Thread Magnus Karlsson
On Tue, Nov 24, 2020 at 10:01 AM Magnus Karlsson wrote: > > On Mon, Nov 23, 2020 at 4:21 PM Xuan Zhuo wrote: > > > > On Mon, 23 Nov 2020 15:00:48 +0100, Magnus Karlsson > > wrote: > > > On Wed, Nov 18, 2020 at 9:25 AM Xuan Zhuo > > > wrote: > >

Re: [PATCH 2/3] xsk: change the tx writeable condition

2020-11-24 Thread Magnus Karlsson
On Wed, Nov 18, 2020 at 9:25 AM Xuan Zhuo wrote: > > Modify the tx writeable condition from the queue is not full to the > number of remaining tx queues is less than the half of the total number > of queues. Because the tx queue not full is a very short time, this will > cause a large number of EP

Re: [PATCH 0/3] xsk: fix for xsk_poll writeable

2020-11-24 Thread Magnus Karlsson
On Mon, Nov 23, 2020 at 4:21 PM Xuan Zhuo wrote: > > On Mon, 23 Nov 2020 15:00:48 +0100, Magnus Karlsson > wrote: > > On Wed, Nov 18, 2020 at 9:25 AM Xuan Zhuo > > wrote: > > > > > > I tried to combine cq available and tx writeable, but I found it very

Re: [PATCH v3 1/1] xdp: remove the function xsk_map_inc

2020-11-24 Thread Magnus Karlsson
and tested it and it passed. Thank you Yanjun! Acked-by: Magnus Karlsson > Signed-off-by: Zhu Yanjun > --- > net/xdp/xsk.c| 2 +- > net/xdp/xsk.h| 1 - > net/xdp/xskmap.c | 13 + > 3 files changed, 2 insertions(+), 14 deletions(-) > > diff --g

Re: [PATCH][V2] libbpf: add support for canceling cached_cons advance

2020-11-24 Thread Magnus Karlsson
from the end of > the batch of descriptors that was received through the peek call. > > Signed-off-by: Li RongQing > [ Magnus Karlsson: rewrote changelog ] > Cc: Magnus Karlsson > --- > diff with v1: fix the building, and rewrote changelog > > tools/lib/bpf/xsk.h | 6 ++

Re: [PATCH v3 1/1] xdp: remove the function xsk_map_inc

2020-11-23 Thread Magnus Karlsson
On Mon, Nov 23, 2020 at 3:30 PM Zhu Yanjun wrote: > > On Mon, Nov 23, 2020 at 10:27 PM wrote: > > > > From: Zhu Yanjun > > > > The function xsk_map_inc is a simple wrapper of bpf_map_inc and > > always returns zero. As such, replacing this function with bpf_map_inc > > and removing the test code

Re: [PATCH 1/3] xsk: replace datagram_poll by sock_poll_wait

2020-11-23 Thread Magnus Karlsson
On Wed, Nov 18, 2020 at 9:26 AM Xuan Zhuo wrote: > > datagram_poll will judge the current socket status (EPOLLIN, EPOLLOUT) > based on the traditional socket information (eg: sk_wmem_alloc), but > this does not apply to xsk. So this patch uses sock_poll_wait instead of > datagram_poll, and the mas

Re: [PATCH 0/3] xsk: fix for xsk_poll writeable

2020-11-23 Thread Magnus Karlsson
On Wed, Nov 18, 2020 at 9:25 AM Xuan Zhuo wrote: > > I tried to combine cq available and tx writeable, but I found it very > difficult. > Sometimes we pay attention to the status of "available" for both, but > sometimes, > we may only pay attention to one, such as tx writeable, because we can us

Re: [PATCHv2 1/1] xdp: remove the function xsk_map_inc

2020-11-23 Thread Magnus Karlsson
On Mon, Nov 23, 2020 at 2:37 PM Zhu Yanjun wrote: > > On Mon, Nov 23, 2020 at 8:19 PM Magnus Karlsson > wrote: > > > > On Mon, Nov 23, 2020 at 1:11 PM Zhu Yanjun wrote: > > > > > > On Mon, Nov 23, 2020 at 8:05 PM wrote: > > > > > > >

  1   2   3   4   5   >