Re: [RFC bpf-next 7/7] samples/bpf: add busy-poll support to xdpsock sample

2019-05-26 Thread Magnus Karlsson
On Fri, May 24, 2019 at 4:59 AM Ye Xiaolong wrote: > > Hi, Magnus > > On 05/02, Magnus Karlsson wrote: > >This patch adds busy-poll support to the xdpsock sample > >application. It is enabled by the "-b" or the "--busy-poll" command > >l

Re: [PATCH bpf-next v3 00/16] AF_XDP infrastructure improvements and mlx5e support

2019-06-03 Thread Magnus Karlsson
On Fri, May 31, 2019 at 11:59 PM Saeed Mahameed wrote: > > On Fri, 2019-05-24 at 12:18 +0200, Björn Töpel wrote: > > On 2019-05-24 11:35, Maxim Mikityanskiy wrote: > > > This series contains improvements to the AF_XDP kernel > > > infrastructure > > > and AF_XDP support in mlx5e. The infrastructur

Re: [PATCH bpf] libbpf: fix another GCC8 warning for strncpy

2019-07-16 Thread Magnus Karlsson
On Tue, Jul 16, 2019 at 5:59 AM Andrii Nakryiko wrote: > > Similar issue was fixed in cdfc7f888c2a ("libbpf: fix GCC8 warning for > strncpy") already. This one was missed. Fixing now. Thanks Andrii. Acked-by: Magnus Karlsson > Cc: Magnus Karlsson > Signe

Re: [Intel-wired-lan] [PATCH v2 00/10] XDP unaligned chunk placement support

2019-07-24 Thread Magnus Karlsson
On Tue, Jul 23, 2019 at 11:08 PM Alexei Starovoitov wrote: > > Johnathan, Bjorn, Jakub, > Please review! > The patch set has been pending for a week. There is a v3 coming out shortly so I suggest we wait for that. It will have Mellanox support for this feature too and some clean ups. I refrained

Re: [PATCH bpf-next] libbpf: silence GCC8 warning about string truncation

2019-07-24 Thread Magnus Karlsson
the bytes anyway. Let us make GCC8 happy then :-). Thanks Andrii. Acked-by: Magnus Karlsson > Cc: Magnus Karlsson > Signed-off-by: Andrii Nakryiko > --- > tools/lib/bpf/xsk.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/bpf/xsk.c b/tools/li

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: [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: [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 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 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 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 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 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-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 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 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: [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

[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

[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

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 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] 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

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

[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] 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 > > > > > &

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

[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

[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 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 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 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

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 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

[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 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

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

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 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 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 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 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

[PATCH bpf] xsk: fix umem cleanup bug at socket destruct

2020-11-20 Thread Magnus Karlsson
From: Magnus Karlsson Fix a bug that is triggered when a partially setup socket is destroyed. For a fully setup socket, a socket that has been bound to a device, the cleanup of the umem is performed at the end of the buffer pool's cleanup work queue item. This has to be performed in a work

Re: [PATCH bpf] xsk: fix incorrect netdev reference count

2020-11-23 Thread Magnus Karlsson
l *pool, > err_unreg_pool: > if (!force_zc) > err = 0; /* fallback to copy mode */ > - if (err) > + if (err) { > xsk_clear_pool_at_qid(netdev, queue_id); > + dev_put(netdev); > + } > return err; > } Thank you Marek for spotting and fixing this! Acked-by: Magnus Karlsson > -- > 2.27.0 >

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

2020-11-23 Thread Magnus Karlsson
On Sun, Nov 22, 2020 at 2:21 PM Li RongQing wrote: > > It is possible to fail receiving packets after calling > xsk_ring_cons__peek, at this condition, cached_cons has > been advanced, should be cancelled. Thanks RongQing, I have needed this myself in various situations, so I think we should add

Re: [PATCH 1/1] xdp: compact the function xsk_map_inc

2020-11-23 Thread Magnus Karlsson
On Sun, Nov 22, 2020 at 10:07 AM Zhu Yanjun wrote: > > From: Zhu Yanjun > > The function xsk_map_inc always returns zero. As such, changing the > return type to void and removing the test code. > > Signed-off-by: Zhu Yanjun > Signed-off-by: Zhu Yanjun > --- > net/xdp/xsk.c|1 - > net/x

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

2020-11-23 Thread Magnus Karlsson
On Mon, Nov 23, 2020 at 1:11 PM Zhu Yanjun wrote: > > On Mon, Nov 23, 2020 at 8:05 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: [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: > > > > > > >

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: [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 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][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-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 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 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 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 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 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 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 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 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 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 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][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 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 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][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 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 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 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

[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 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!

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 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 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: [Intel-wired-lan] [PATCH bpf-next 2/6] samples/bpf: increment Tx stats at sending

2020-11-09 Thread Magnus Karlsson
On Mon, Nov 9, 2020 at 9:47 PM John Fastabend wrote: > > Magnus Karlsson wrote: > > From: Magnus Karlsson > > > > Increment the statistics over how many Tx packets have been sent at > > the time of sending instead of at the time of completion. This as a > > co

Re: [Intel-wired-lan] [PATCH bpf-next 5/6] xsk: introduce batched Tx descriptor interfaces

2020-11-10 Thread Magnus Karlsson
On Mon, Nov 9, 2020 at 10:06 PM John Fastabend wrote: > > Magnus Karlsson wrote: > > From: Magnus Karlsson > > > > Introduce batched descriptor interfaces in the xsk core code for the > > Tx path to be used in the driver to write a code path with higher > >

[PATCH bpf-next v2 0/5] xsk: i40e: Tx performance improvements

2020-11-10 Thread Magnus Karlsson
fields in the ring. Patch 4: Introduce batched Tx descriptor interfaces. Patch 5: Use the new batched interfaces in the i40e driver to get higher throughput. Thanks: Magnus Magnus Karlsson (5): samples/bpf: increment Tx stats at sending i40e: remove unnecessary sw_ring access from

[PATCH bpf-next v2 2/5] i40e: remove unnecessary sw_ring access from xsk Tx

2020-11-10 Thread Magnus Karlsson
From: Magnus Karlsson Remove the unnecessary access to the software ring for the AF_XDP zero-copy driver. This was used to record the length of the packet so that the driver Tx completion code could sum this up to produce the total bytes sent. This is now performed during the transmission of the

[PATCH bpf-next v2 1/5] samples/bpf: increment Tx stats at sending

2020-11-10 Thread Magnus Karlsson
From: Magnus Karlsson Increment the statistics over how many Tx packets have been sent at the time of sending instead of at the time of completion. This as a completion event means that the buffer has been sent AND returned to user space. The packet always gets sent shortly after sendto() is

[PATCH bpf-next v2 4/5] xsk: introduce batched Tx descriptor interfaces

2020-11-10 Thread Magnus Karlsson
From: Magnus Karlsson Introduce batched descriptor interfaces in the xsk core code for the Tx path to be used in the driver to write a code path with higher performance. This interface will be used by the i40e driver in the next patch. Though other drivers would likely benefit from this new

[PATCH bpf-next v2 3/5] xsk: introduce padding between more ring pointers

2020-11-10 Thread Magnus Karlsson
From: Magnus Karlsson Introduce one cache line worth of padding between the consumer pointer and the flags field as well as between the flags field and the start of the descriptors in all the lockless rings. This so that the x86 HW adjacency prefetcher will not prefetch the adjacent pointer

[PATCH bpf-next v2 5/5] i40e: use batched xsk Tx interfaces to increase performance

2020-11-10 Thread Magnus Karlsson
From: Magnus Karlsson Use the new batched xsk interfaces for the Tx path in the i40e driver to improve performance. On my machine, this yields a throughput increase of 4% for the l2fwd sample app in xdpsock. If we instead just look at the Tx part, this patch set increases throughput with above

Re: [PATCH bpf-next v2 5/5] i40e: use batched xsk Tx interfaces to increase performance

2020-11-11 Thread Magnus Karlsson
On Wed, Nov 11, 2020 at 2:38 AM kernel test robot wrote: > > Hi Magnus, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on bpf-next/master] > > url: > https://github.com/0day-ci/linux/commits/Magnus-Karlsson/xsk-i40e-Tx-perfor

Re: [PATCH bpf-next v2 5/5] i40e: use batched xsk Tx interfaces to increase performance

2020-11-11 Thread Magnus Karlsson
On Wed, Nov 11, 2020 at 8:16 PM Nick Desaulniers wrote: > > On Wed, Nov 11, 2020 at 3:57 AM Magnus Karlsson > wrote: > > > > On Wed, Nov 11, 2020 at 2:38 AM kernel test robot wrote: > > > > > > Hi Magnus, > > > > > > I love your patch! P

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

2020-11-13 Thread Magnus Karlsson
On Thu, Nov 12, 2020 at 8:12 PM Andrii Nakryiko wrote: > > On Thu, Nov 12, 2020 at 12:58 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 > > privilege

[PATCH bpf-next v3 3/5] xsk: introduce padding between more ring pointers

2020-11-16 Thread Magnus Karlsson
From: Magnus Karlsson Introduce one cache line worth of padding between the consumer pointer and the flags field as well as between the flags field and the start of the descriptors in all the lockless rings. This so that the x86 HW adjacency prefetcher will not prefetch the adjacent pointer

[PATCH bpf-next v3 4/5] xsk: introduce batched Tx descriptor interfaces

2020-11-16 Thread Magnus Karlsson
From: Magnus Karlsson Introduce batched descriptor interfaces in the xsk core code for the Tx path to be used in the driver to write a code path with higher performance. This interface will be used by the i40e driver in the next patch. Though other drivers would likely benefit from this new

[PATCH bpf-next v3 0/5] xsk: i40e: Tx performance improvements

2020-11-16 Thread Magnus Karlsson
higher throughput. Thanks: Magnus Magnus Karlsson (5): samples/bpf: increment Tx stats at sending i40e: remove unnecessary sw_ring access from xsk Tx xsk: introduce padding between more ring pointers xsk: introduce batched Tx descriptor interfaces i40e: use batched xsk Tx interfac

[PATCH bpf-next v3 5/5] i40e: use batched xsk Tx interfaces to increase performance

2020-11-16 Thread Magnus Karlsson
From: Magnus Karlsson Use the new batched xsk interfaces for the Tx path in the i40e driver to improve performance. On my machine, this yields a throughput increase of 4% for the l2fwd sample app in xdpsock. If we instead just look at the Tx part, this patch set increases throughput with above

[PATCH bpf-next v3 1/5] samples/bpf: increment Tx stats at sending

2020-11-16 Thread Magnus Karlsson
From: Magnus Karlsson Increment the statistics over how many Tx packets have been sent at the time of sending instead of at the time of completion. This as a completion event means that the buffer has been sent AND returned to user space. The packet always gets sent shortly after sendto() is

[PATCH bpf-next v3 2/5] i40e: remove unnecessary sw_ring access from xsk Tx

2020-11-16 Thread Magnus Karlsson
From: Magnus Karlsson Remove the unnecessary access to the software ring for the AF_XDP zero-copy driver. This was used to record the length of the packet so that the driver Tx completion code could sum this up to produce the total bytes sent. This is now performed during the transmission of the

Re: [Intel-wired-lan] [PATCH 0/8] New netdev feature flags for XDP

2020-11-16 Thread Magnus Karlsson
On Mon, Nov 16, 2020 at 2:25 PM Toke Høiland-Jørgensen wrote: > > alar...@gmail.com writes: > > > 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_X

Re: [PATCH bpf-next v3 4/5] xsk: introduce batched Tx descriptor interfaces

2020-11-17 Thread Magnus Karlsson
On Tue, Nov 17, 2020 at 8:07 PM John Fastabend wrote: > > Magnus Karlsson wrote: > > From: Magnus Karlsson > > > > Introduce batched descriptor interfaces in the xsk core code for the > > Tx path to be used in the driver to write a code path with higher > >

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

  1   2   3   4   5   >