Re: [PATCH net-next v2 18/21] virtio_net: xsk: rx: introduce receive_xsk() to recv xsk buffer

2023-11-13 Thread Maciej Fijalkowski
On Tue, Nov 07, 2023 at 11:12:24AM +0800, Xuan Zhuo wrote: > The virtnet_xdp_handler() is re-used. But > > 1. We need to copy data to create skb for XDP_PASS. > 2. We need to call xsk_buff_free() to release the buffer. > 3. The handle for xdp_buff is difference. > > If we pushed this logic into e

Re: [PATCH net-next v2 16/21] virtio_net: xsk: rx: introduce add_recvbuf_xsk()

2023-11-13 Thread Maciej Fijalkowski
On Fri, Nov 10, 2023 at 10:38:04AM +0800, Xuan Zhuo wrote: > On Thu, 9 Nov 2023 17:26:33 +0100, Maciej Fijalkowski > wrote: > > On Thu, Nov 09, 2023 at 07:11:46PM +0800, Xuan Zhuo wrote: > > > On Thu, 9 Nov 2023 03:12:27 -0500, "Michael S. Tsirkin" > > >

Re: [PATCH net-next v2 16/21] virtio_net: xsk: rx: introduce add_recvbuf_xsk()

2023-11-09 Thread Maciej Fijalkowski
On Thu, Nov 09, 2023 at 07:11:46PM +0800, Xuan Zhuo wrote: > On Thu, 9 Nov 2023 03:12:27 -0500, "Michael S. Tsirkin" > wrote: > > On Tue, Nov 07, 2023 at 11:12:22AM +0800, Xuan Zhuo wrote: > > > Implement the logic of filling rq with XSK buffers. > > > > > > Signed-off-by: Xuan Zhuo > > > --- >

[PATCH v5 bpf-next 17/17] selftests: xsk: Remove unused defines

2021-03-29 Thread Maciej Fijalkowski
From: Björn Töpel Remove two unused defines. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 7 +++ tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/te

[PATCH v5 bpf-next 16/17] selftests: xsk: Remove mutex and condition variable

2021-03-29 Thread Maciej Fijalkowski
From: Björn Töpel The usage of the condition variable is broken, and overkill. Replace it with a pthread barrier. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 33 tools/testing/selftests/bpf/xdpxceiver.h | 3 +-- 2 files changed, 6 inserti

[PATCH v5 bpf-next 15/17] selftests: xsk: remove thread attribute

2021-03-29 Thread Maciej Fijalkowski
From: Björn Töpel There is really no reason to have a non-default thread stack size. Remove that. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 9 ++--- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git

[PATCH v5 bpf-next 14/17] selftests: xsk: implement bpf_link test

2021-03-29 Thread Maciej Fijalkowski
it doesn't have anything in common with bi-directional testing. Drop opt_queue command line argument as it wasn't working before anyway. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/test_xsk.sh | 3 +- tools/testing/selftests/bpf/xdpxceiver.c | 179 +

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

2021-03-29 Thread Maciej Fijalkowski
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. Cc: Toshiaki Makita Signed-off-by: Maciej Fijalkowski --- drivers/net/veth.c

[PATCH v5 bpf-next 10/17] selftests: xsk: remove Tx synchronization resources

2021-03-29 Thread Maciej Fijalkowski
spinning_rx. This means that spinning_tx can be removed altogheter. signal_tx_condition is never utilized, so simply remove it. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 15 +++ tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 7

[PATCH v5 bpf-next 11/17] selftests: xsk: refactor teardown/bidi test cases and testapp_validate

2021-03-29 Thread Maciej Fijalkowski
ional test. Thread creation now is easey to follow. switching_notify variable is useless, info about vector switch can be printed based on bidi_pass state. Last but not least, init/destroy synchronization variables only once, not per each test. Signed-off-by: Maciej Fijalkowski --- tools/testing

[PATCH v5 bpf-next 09/17] selftests: xsk: split worker thread

2021-03-29 Thread Maciej Fijalkowski
final result will be a code base that is much easier to follow. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 156 +++ 1 file changed, 77 insertions(+), 79 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/self

[PATCH v5 bpf-next 12/17] selftests: xsk: remove sync_mutex_tx and atomic var

2021-03-29 Thread Maciej Fijalkowski
spin on atomic variable. Note that this simplification wouldn't be possible if there would still be a common worker thread. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 31 ++-- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2

[PATCH v5 bpf-next 08/17] selftests: xsk: remove thread for netns switch

2021-03-29 Thread Maciej Fijalkowski
t rid of logic around making sure that it's possible to switch ns in validate_interfaces(). Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 123 +++ tools/testing/selftests/bpf/xdpxceiver.h | 10 +- 2 files changed, 14 insertions(+), 119

[PATCH v5 bpf-next 07/17] samples: bpf: do not unload prog within xdpsock

2021-03-29 Thread Maciej Fijalkowski
no more active users. While at it, don't dump stats on error path. Signed-off-by: Maciej Fijalkowski --- samples/bpf/xdpsock_user.c | 55 ++ 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_

[PATCH v5 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-29 Thread Maciej Fijalkowski
Signed-off-by: Maciej Fijalkowski --- tools/lib/bpf/xsk.c | 258 1 file changed, 213 insertions(+), 45 deletions(-) diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index 526fc35c0b23..95da0e19f4a5 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/l

[PATCH v5 bpf-next 05/17] selftests: xsk: simplify frame traversal in dumping thread

2021-03-29 Thread Maciej Fijalkowski
Store offsets to each layer in a separate variables rather than compute them every single time. Signed-off-by: Björn Töpel Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 47 +++- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git

[PATCH v5 bpf-next 03/17] selftests: xsk: remove unused function

2021-03-29 Thread Maciej Fijalkowski
Probably it was ported from xdpsock but is not used anywhere. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 13 - 1 file changed, 13 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c

[PATCH v5 bpf-next 04/17] selftests: xsk: remove inline keyword from source file

2021-03-29 Thread Maciej Fijalkowski
Follow the kernel coding style guidelines and let compiler do the decision about inlining. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/bpf

[PATCH v5 bpf-next 01/17] selftests: xsk: don't call worker_pkt_dump() for stats test

2021-03-29 Thread Maciej Fijalkowski
For TEST_TYPE_STATS, worker_pkt_validate() that places frames onto pkt_buf is not called. Therefore, when dump mode is set, don't call worker_pkt_dump() for mentioned test type, so that it won't crash on pkt_buf() access. Signed-off-by: Maciej Fijalkowski --- tools/testing/sel

[PATCH v5 bpf-next 02/17] selftests: xsk: remove struct ifaceconfigobj

2021-03-29 Thread Maciej Fijalkowski
ifaceconfigobj is not really useful, it is possible to keep the functionality and simplify the code. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 65 +++- tools/testing/selftests/bpf/xdpxceiver.h | 9 2 files changed, 30 insertions

[PATCH v5 bpf-next 00/17] AF_XDP selftests improvements & bpf_link

2021-03-29 Thread Maciej Fijalkowski
com/ is needed. Thanks, Maciej Björn Töpel (3): selftests: xsk: remove thread attribute selftests: xsk: Remove mutex and condition variable selftests: xsk: Remove unused defines Maciej Fijalkowski (14): selftests: xsk: don't call worker_pkt_dump() for stats test selftests: xsk:

Re: [PATCH v4 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-29 Thread Maciej Fijalkowski
On Mon, Mar 29, 2021 at 04:09:33PM +0200, Toke Høiland-Jørgensen wrote: > Maciej Fijalkowski writes: > > > On Mon, Mar 29, 2021 at 01:05:44PM +0200, Toke Høiland-Jørgensen wrote: > >> Maciej Fijalkowski writes: > >> > >> > Currently, if there are mult

Re: [PATCH v4 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-29 Thread Maciej Fijalkowski
On Mon, Mar 29, 2021 at 01:05:44PM +0200, Toke Høiland-Jørgensen wrote: > Maciej Fijalkowski writes: > > > Currently, if there are multiple xdpsock instances running on a single > > interface and in case one of the instances is terminated, the rest of > > them are left in

[PATCH v4 bpf-next 16/17] selftests: xsk: Remove mutex and condition variable

2021-03-26 Thread Maciej Fijalkowski
From: Björn Töpel The usage of the condition variable is broken, and overkill. Replace it with a pthread barrier. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 33 tools/testing/selftests/bpf/xdpxceiver.h | 3 +-- 2 files changed, 6 inserti

[PATCH v4 bpf-next 15/17] selftests: xsk: remove thread attribute

2021-03-26 Thread Maciej Fijalkowski
From: Björn Töpel There is really no reason to have a non-default thread stack size. Remove that. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 9 ++--- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git

[PATCH v4 bpf-next 09/17] selftests: xsk: split worker thread

2021-03-26 Thread Maciej Fijalkowski
final result will be a code base that is much easier to follow. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 156 +++ 1 file changed, 77 insertions(+), 79 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/self

[PATCH v4 bpf-next 10/17] selftests: xsk: remove Tx synchronization resources

2021-03-26 Thread Maciej Fijalkowski
spinning_rx. This means that spinning_tx can be removed altogheter. signal_tx_condition is never utilized, so simply remove it. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 15 +++ tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 7

[PATCH v4 bpf-next 11/17] selftests: xsk: refactor teardown/bidi test cases and testapp_validate

2021-03-26 Thread Maciej Fijalkowski
ional test. Thread creation now is easey to follow. switching_notify variable is useless, info about vector switch can be printed based on bidi_pass state. Last but not least, init/destroy synchronization variables only once, not per each test. Signed-off-by: Maciej Fijalkowski --- tools/testing

[PATCH v4 bpf-next 17/17] selftests: xsk: Remove unused defines

2021-03-26 Thread Maciej Fijalkowski
From: Björn Töpel Remove two unused defines. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 7 +++ tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/te

[PATCH v4 bpf-next 14/17] selftests: xsk: implement bpf_link test

2021-03-26 Thread Maciej Fijalkowski
it doesn't have anything in common with bi-directional testing. Drop opt_queue command line argument as it wasn't working before anyway. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/test_xsk.sh | 3 +- tools/testing/selftests/bpf/xdpxceiver.c | 179 +

[PATCH v4 bpf-next 08/17] selftests: xsk: remove thread for netns switch

2021-03-26 Thread Maciej Fijalkowski
t rid of logic around making sure that it's possible to switch ns in validate_interfaces(). Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 123 +++ tools/testing/selftests/bpf/xdpxceiver.h | 10 +- 2 files changed, 14 insertions(+), 119

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

2021-03-26 Thread Maciej Fijalkowski
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 Fijalkowski --- drivers/net/veth.c | 12 1 file change

[PATCH v4 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-26 Thread Maciej Fijalkowski
Signed-off-by: Maciej Fijalkowski --- tools/lib/bpf/xsk.c | 259 1 file changed, 214 insertions(+), 45 deletions(-) diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index 526fc35c0b23..c75067f0035f 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/l

[PATCH v4 bpf-next 12/17] selftests: xsk: remove sync_mutex_tx and atomic var

2021-03-26 Thread Maciej Fijalkowski
spin on atomic variable. Note that this simplification wouldn't be possible if there would still be a common worker thread. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 31 ++-- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2

[PATCH v4 bpf-next 05/17] selftests: xsk: simplify frame traversal in dumping thread

2021-03-26 Thread Maciej Fijalkowski
Store offsets to each layer in a separate variables rather than compute them every single time. Signed-off-by: Björn Töpel Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 47 +++- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git

[PATCH v4 bpf-next 04/17] selftests: xsk: remove inline keyword from source file

2021-03-26 Thread Maciej Fijalkowski
Follow the kernel coding style guidelines and let compiler do the decision about inlining. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/bpf

[PATCH v4 bpf-next 07/17] samples: bpf: do not unload prog within xdpsock

2021-03-26 Thread Maciej Fijalkowski
no more active users. While at it, don't dump stats on error path. Signed-off-by: Maciej Fijalkowski --- samples/bpf/xdpsock_user.c | 55 ++ 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_

[PATCH v4 bpf-next 03/17] selftests: xsk: remove unused function

2021-03-26 Thread Maciej Fijalkowski
Probably it was ported from xdpsock but is not used anywhere. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 13 - 1 file changed, 13 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c

[PATCH v4 bpf-next 02/17] selftests: xsk: remove struct ifaceconfigobj

2021-03-26 Thread Maciej Fijalkowski
ifaceconfigobj is not really useful, it is possible to keep the functionality and simplify the code. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 65 +++- tools/testing/selftests/bpf/xdpxceiver.h | 9 2 files changed, 30 insertions

[PATCH v4 bpf-next 01/17] selftests: xsk: don't call worker_pkt_dump() for stats test

2021-03-26 Thread Maciej Fijalkowski
For TEST_TYPE_STATS, worker_pkt_validate() that places frames onto pkt_buf is not called. Therefore, when dump mode is set, don't call worker_pkt_dump() for mentioned test type, so that it won't crash on pkt_buf() access. Signed-off-by: Maciej Fijalkowski --- tools/testing/sel

[PATCH v4 bpf-next 00/17] AF_XDP selftests improvements & bpf_link

2021-03-26 Thread Maciej Fijalkowski
needed. Thanks, Maciej Björn Töpel (3): selftests: xsk: remove thread attribute selftests: xsk: Remove mutex and condition variable selftests: xsk: Remove unused defines Maciej Fijalkowski (14): selftests: xsk: don't call worker_pkt_dump() for stats test selftests: xsk: remove struct if

Re: [PATCH v3 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-26 Thread Maciej Fijalkowski
On Thu, Mar 25, 2021 at 12:38:07AM +0100, Toke Høiland-Jørgensen wrote: > Maciej Fijalkowski writes: > > > On Mon, Mar 22, 2021 at 10:47:09PM +0100, Toke Høiland-Jørgensen wrote: > >> Maciej Fijalkowski writes: > >> > >> > Currently, if there are mult

Re: [PATCH v3 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-24 Thread Maciej Fijalkowski
On Mon, Mar 22, 2021 at 10:47:09PM +0100, Toke Høiland-Jørgensen wrote: > Maciej Fijalkowski writes: > > > Currently, if there are multiple xdpsock instances running on a single > > interface and in case one of the instances is terminated, the rest of > > them are left in

[PATCH v3 bpf-next 11/17] selftests: xsk: refactor teardown/bidi test cases and testapp_validate

2021-03-22 Thread Maciej Fijalkowski
ional test. Thread creation now is easey to follow. switching_notify variable is useless, info about vector switch can be printed based on bidi_pass state. Last but not least, init/destroy synchronization variables only once, not per each test. Signed-off-by: Maciej Fijalkowski --- tools/testing

[PATCH v3 bpf-next 12/17] selftests: xsk: remove sync_mutex_tx and atomic var

2021-03-22 Thread Maciej Fijalkowski
spin on atomic variable. Note that this simplification wouldn't be possible if there would still be a common worker thread. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 31 ++-- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2

[PATCH v3 bpf-next 10/17] selftests: xsk: remove Tx synchronization resources

2021-03-22 Thread Maciej Fijalkowski
spinning_rx. This means that spinning_tx can be removed altogheter. signal_tx_condition is never utilized, so simply remove it. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 15 +++ tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 7

[PATCH v3 bpf-next 16/17] selftest: xsk: Remove mutex and condition variable

2021-03-22 Thread Maciej Fijalkowski
From: Björn Töpel The usage of the condition variable is broken, and overkill. Replace with a pthread barrier. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 33 tools/testing/selftests/bpf/xdpxceiver.h | 3 +-- 2 files changed, 6 insertions

[PATCH v3 bpf-next 15/17] selftests: xsk: remove thread attribute

2021-03-22 Thread Maciej Fijalkowski
From: Björn Töpel There is really no reason to have a non-default thread stack size. Remove that. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 9 ++--- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git

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

2021-03-22 Thread Maciej Fijalkowski
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 Fijalkowski --- drivers/net/veth.c | 12 1 file change

[PATCH v3 bpf-next 17/17] selftests: xsk: Remove unused defines

2021-03-22 Thread Maciej Fijalkowski
From: Björn Töpel Remove two unused defines. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 7 +++ tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/te

[PATCH v3 bpf-next 14/17] selftests: xsk: implement bpf_link test

2021-03-22 Thread Maciej Fijalkowski
it doesn't have anything in common with bi-directional testing. Drop opt_queue command line argument as it wasn't working before anyway. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/test_xsk.sh | 3 +- tools/testing/selftests/bpf/xdpxceiver.c | 179 +

[PATCH v3 bpf-next 09/17] selftests: xsk: split worker thread

2021-03-22 Thread Maciej Fijalkowski
final result will be a code base that is much easier to follow. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 156 +++ 1 file changed, 77 insertions(+), 79 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/self

[PATCH v3 bpf-next 08/17] selftests: xsk: remove thread for netns switch

2021-03-22 Thread Maciej Fijalkowski
t rid of logic around making sure that it's possible to switch ns in validate_interfaces(). Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 123 +++ tools/testing/selftests/bpf/xdpxceiver.h | 10 +- 2 files changed, 14 insertions(+), 119

[PATCH v3 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-22 Thread Maciej Fijalkowski
ng the ifindexes from bpf_link and xsk socket. For case where resources exist but they are not AF_XDP related, bail out and ask user to remove existing prog and then retry. Signed-off-by: Maciej Fijalkowski --- tools/lib/bpf/xsk.c | 175 +++- 1 file change

[PATCH v3 bpf-next 07/17] samples: bpf: do not unload prog within xdpsock

2021-03-22 Thread Maciej Fijalkowski
no more active users. While at it, don't dump stats on error path. Signed-off-by: Maciej Fijalkowski --- samples/bpf/xdpsock_user.c | 55 ++ 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_

[PATCH v3 bpf-next 05/17] selftests: xsk: simplify frame traversal in dumping thread

2021-03-22 Thread Maciej Fijalkowski
Store offsets to each layer in a separate variables rather than compute them every single time. Signed-off-by: Björn Töpel Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 47 +++- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git

[PATCH v3 bpf-next 03/17] selftests: xsk: remove unused function

2021-03-22 Thread Maciej Fijalkowski
Probably it was ported from xdpsock but is not used anywhere. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 13 - 1 file changed, 13 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c

[PATCH v3 bpf-next 04/17] selftests: xsk: remove inline keyword from source file

2021-03-22 Thread Maciej Fijalkowski
Follow the kernel coding style guidelines and let compiler do the decision about inlining. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/bpf

[PATCH v3 bpf-next 02/17] selftests: xsk: remove struct ifaceconfigobj

2021-03-22 Thread Maciej Fijalkowski
ifaceconfigobj is not really useful, it is possible to keep the functionality and simplify the code. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 65 +++- tools/testing/selftests/bpf/xdpxceiver.h | 9 2 files changed, 30 insertions

[PATCH v3 bpf-next 01/17] selftests: xsk: don't call worker_pkt_dump() for stats test

2021-03-22 Thread Maciej Fijalkowski
For TEST_TYPE_STATS, worker_pkt_validate() that places frames onto pkt_buf is not called. Therefore, when dump mode is set, don't call worker_pkt_dump() for mentioned test type, so that it won't crash on pkt_buf() access. Signed-off-by: Maciej Fijalkowski --- tools/testing/sel

[PATCH v3 bpf-next 00/17] AF_XDP selftests improvements & bpf_link

2021-03-22 Thread Maciej Fijalkowski
independently of XDP prog presence https://lore.kernel.org/bpf/20210303152903.11172-1-maciej.fijalkow...@intel.com/ is needed. Thanks, Maciej Björn Töpel (3): selftests: xsk: remove thread attribute selftest: xsk: Remove mutex and condition variable selftests: xsk: Remove unused defines Ma

Re: [PATCH v2 bpf-next 14/17] selftests: xsk: implement bpf_link test

2021-03-22 Thread Maciej Fijalkowski
On Mon, Mar 15, 2021 at 10:39:38PM -0700, Andrii Nakryiko wrote: > On Thu, Mar 11, 2021 at 7:43 AM Maciej Fijalkowski > wrote: > > > > Introduce a test that is supposed to verify the persistence of BPF > > resources based on underlying bpf_link usage. > > > > T

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

2021-03-22 Thread Maciej Fijalkowski
On Tue, Mar 16, 2021 at 09:44:38AM +0100, Magnus Karlsson wrote: > 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 according

Re: [PATCH v2 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-22 Thread Maciej Fijalkowski
On Mon, Mar 15, 2021 at 10:34:11PM -0700, Andrii Nakryiko wrote: > On Thu, Mar 11, 2021 at 7:42 AM Maciej Fijalkowski > wrote: > > > > Currently, if there are multiple xdpsock instances running on a single > > interface and in case one of the instances is terminated, the r

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

2021-03-19 Thread Maciej Fijalkowski
ackets as the budget since there might be more packets we can > process. > > Fixes: 3106c580fb7c ("i40e: Use batched xsk Tx interfaces to increase > performance") > Reported-by: Sreedevi Joshi > Signed-off-by: Magnus Karlsson Acked-by: Maciej Fijalkowski > --

[PATCH v2 bpf-next 17/17] selftests: xsk: Remove unused defines

2021-03-11 Thread Maciej Fijalkowski
From: Björn Töpel Remove two unused defines. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 5 ++--- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/test

[PATCH v2 bpf-next 15/17] selftests: xsk: remove thread attribute

2021-03-11 Thread Maciej Fijalkowski
From: Björn Töpel There is really no reason to have a non-default thread stack size. Remove that. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 9 ++--- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git

[PATCH v2 bpf-next 14/17] selftests: xsk: implement bpf_link test

2021-03-11 Thread Maciej Fijalkowski
it doesn't have anything in common with bi-directional testing. Drop opt_queue command line argument as it wasn't working before anyway. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/test_xsk.sh | 2 +- tools/testing/selftests/bpf/xdpxceiver.c | 179 +

[PATCH v2 bpf-next 10/17] selftests: xsk: remove Tx synchronization resources

2021-03-11 Thread Maciej Fijalkowski
spinning_rx. This means that spinning_tx can be removed altogheter. signal_tx_condition is never utilized, so simply remove it. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 15 +++ tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2 files changed, 7

[PATCH v2 bpf-next 12/17] selftests: xsk: remove sync_mutex_tx and atomic var

2021-03-11 Thread Maciej Fijalkowski
spin on atomic variable. Note that this simplification wouldn't be possible if there would still be a common worker thread. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 31 ++-- tools/testing/selftests/bpf/xdpxceiver.h | 2 -- 2

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

2021-03-11 Thread Maciej Fijalkowski
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 Fijalkowski --- drivers/net/veth.c | 12 1 file change

[PATCH v2 bpf-next 16/17] selftest: xsk: Remove mutex and condition variable

2021-03-11 Thread Maciej Fijalkowski
From: Björn Töpel The usage of the condition variable is broken, and overkill. Replace with a pthread barrier. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/xdpxceiver.c | 33 tools/testing/selftests/bpf/xdpxceiver.h | 3 +-- 2 files changed, 6 insertions

[PATCH v2 bpf-next 11/17] selftests: xsk: refactor teardown/bidi test cases and testapp_validate

2021-03-11 Thread Maciej Fijalkowski
ional test. Thread creation now is easey to follow. switching_notify variable is useless, info about vector switch can be printed based on bidi_pass state. Last but not least, init/destroy synchronization variables only once, not per each test. Signed-off-by: Maciej Fijalkowski --- tools/testing

[PATCH v2 bpf-next 08/17] selftests: xsk: remove thread for netns switch

2021-03-11 Thread Maciej Fijalkowski
t rid of logic around making sure that it's possible to switch ns in validate_interfaces(). Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 123 +++ tools/testing/selftests/bpf/xdpxceiver.h | 10 +- 2 files changed, 14 insertions(+), 119

[PATCH v2 bpf-next 06/17] libbpf: xsk: use bpf_link

2021-03-11 Thread Maciej Fijalkowski
ven the presence of XDP_FLAGS_UPDATE_IF_NOEXIST. If there's netlink-based XDP prog running on a interface, bail out and ask user to do removal by himself. Signed-off-by: Maciej Fijalkowski --- tools/lib/bpf/xsk.c | 139 ++-- 1 file changed, 120 insert

[PATCH v2 bpf-next 07/17] samples: bpf: do not unload prog within xdpsock

2021-03-11 Thread Maciej Fijalkowski
no more active users. While at it, don't dump stats on error path. Signed-off-by: Maciej Fijalkowski --- samples/bpf/xdpsock_user.c | 55 ++ 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_

[PATCH v2 bpf-next 09/17] selftests: xsk: split worker thread

2021-03-11 Thread Maciej Fijalkowski
final result will be a code base that is much easier to follow. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 156 +++ 1 file changed, 77 insertions(+), 79 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/self

[PATCH v2 bpf-next 05/17] selftests: xsk: simplify frame traversal in dumping thread

2021-03-11 Thread Maciej Fijalkowski
Store offsets to each layer in a separate variables rather than compute them every single time. Signed-off-by: Björn Töpel Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 48 +++- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git

[PATCH v2 bpf-next 00/17] AF_XDP selftests improvements & bpf_link

2021-03-11 Thread Maciej Fijalkowski
ded. Thanks, Maciej Björn Töpel (3): selftests: xsk: remove thread attribute selftest: xsk: Remove mutex and condition variable selftests: xsk: Remove unused defines Maciej Fijalkowski (14): selftests: xsk: don't call worker_pkt_dump() for stats test selftests: xsk: remove struct i

[PATCH v2 bpf-next 04/17] selftests: xsk: remove inline keyword from source file

2021-03-11 Thread Maciej Fijalkowski
Follow the kernel coding style guidelines and let compiler do the decision about inlining. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/bpf

[PATCH v2 bpf-next 01/17] selftests: xsk: don't call worker_pkt_dump() for stats test

2021-03-11 Thread Maciej Fijalkowski
For TEST_TYPE_STATS, worker_pkt_validate() that places frames onto pkt_buf is not called. Therefore, when dump mode is set, don't call worker_pkt_dump() for mentioned test type, so that it won't crash on pkt_buf() access. Signed-off-by: Maciej Fijalkowski --- tools/testing/sel

[PATCH v2 bpf-next 03/17] selftests: xsk: remove unused function

2021-03-11 Thread Maciej Fijalkowski
Probably it was ported from xdpsock but is not used anywhere. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 13 - 1 file changed, 13 deletions(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c

[PATCH v2 bpf-next 02/17] selftests: xsk: remove struct ifaceconfigobj

2021-03-11 Thread Maciej Fijalkowski
ifaceconfigobj is not really useful, it is possible to keep the functionality and simplify the code. Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/xdpxceiver.c | 65 +++- tools/testing/selftests/bpf/xdpxceiver.h | 9 2 files changed, 30 insertions

[PATCH bpf] veth: store queue_mapping independently of XDP prog presence

2021-03-03 Thread Maciej Fijalkowski
a correct rxq. To fix that, store queue_mapping independently of XDP prog presence on peer interface. Fixes: 638264dc9022 ("veth: Support per queue XDP ring") Signed-off-by: Maciej Fijalkowski --- drivers/net/veth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

[PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring

2021-03-03 Thread Maciej Fijalkowski
) Reported-by: Jesper Dangaard Brouer Co-developed-by: Jesper Dangaard Brouer Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Maciej Fijalkowski --- drivers/net/ethernet/intel/i40e/i40e_main.c | 13 + drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 2 files changed,

[PATCH intel-net 3/3] ixgbe: move headroom initialization to ixgbe_configure_rx_ring

2021-03-03 Thread Maciej Fijalkowski
result of ixgbe_rx_offset() onto ixgbe_ring") Signed-off-by: Maciej Fijalkowski --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixg

[PATCH intel-net 2/3] ice: move headroom initialization to ice_setup_rx_ctx

2021-03-03 Thread Maciej Fijalkowski
) Signed-off-by: Maciej Fijalkowski --- drivers/net/ethernet/intel/ice/ice_base.c | 18 ++ drivers/net/ethernet/intel/ice/ice_txrx.c | 17 - 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/eth

[PATCH intel-net 0/3] intel: Rx headroom fixes

2021-03-03 Thread Maciej Fijalkowski
://lore.kernel.org/bpf/20210118151318.12324-10-maciej.fijalkow...@intel.com/ Maciej Fijalkowski (3): i40e: move headroom initialization to i40e_configure_rx_ring ice: move headroom initialization to ice_setup_rx_ctx ixgbe: move headroom initialization to ixgbe_configure_rx_ring drivers/net/ethernet/intel

Re: [PATCH bpf-next v2 4/4] selftests/bpf: introduce xsk statistics tests

2021-02-23 Thread Maciej Fijalkowski
> Do not populate the fill queue and then try to receive pkts. Thanks for adding descriptions! Reviewed-by: Maciej Fijalkowski > > Signed-off-by: Ciara Loftus > --- > tools/testing/selftests/bpf/xdpxceiver.c | 137 --- > tools/testing/selftests/bpf/xdpxceiver.h | 13 +++ > 2 files changed, 136 insertions(+), 14 deletions(-) >

Re: [PATCH bpf-next v2 2/4] selftests/bpf: expose and rename debug argument

2021-02-23 Thread Maciej Fijalkowski
On Tue, Feb 23, 2021 at 10:35:05AM +, Ciara Loftus wrote: > Launching xdpxceiver with -D enables what was formerly know as 'debug' > mode. Rename this mode to 'dump-pkts' as it better describes the > behavior enabled by the option. New usage: > > ./xdpxceiver .. -D > or > ./xdpxceiver .. --dum

Re: [PATCH bpf-next 1/4] selftest/bpf: make xsk tests less verbose

2021-02-22 Thread Maciej Fijalkowski
se > option, if further debugging is needed when a problem arises. > > To run the xsk tests with verbose output: > ./test_xsk.sh -v > > Signed-off-by: Magnus Karlsson > Signed-off-by: Ciara Loftus Acked-by: Maciej Fijalkowski

Re: [PATCH bpf-next 4/4] selftests/bpf: introduce xsk statistics tests

2021-02-22 Thread Maciej Fijalkowski
On Wed, Feb 17, 2021 at 04:02:14PM +, Ciara Loftus wrote: > This commit introduces a range of tests to the xsk testsuite > for validating xsk statistics. > > A new test type called 'stats' is added. Within it there are > four sub-tests which test the following statistics: > 1. rx dropped > 2.

Re: [PATCH bpf-next 3/4] selftests/bpf: restructure xsk selftests

2021-02-22 Thread Maciej Fijalkowski
sh | 24 +-- > 4 files changed, 139 insertions(+), 223 deletions(-) > Good cleanup! I have a series of fixes/cleanups as well and I need to introduce a new test over here, so your work makes it easier for me. One nit below and once you address Bjorn's request, then feel fr

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

2021-02-16 Thread Maciej Fijalkowski
On Tue, Feb 16, 2021 at 11:15:41AM -0800, John Fastabend wrote: > Toke Høiland-Jørgensen wrote: > > Björn Töpel writes: > > > > > On 2021-02-15 21:49, John Fastabend wrote: > > >> Maciej Fijalkowski wrote: > > >>> Currently, if there

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

2021-02-16 Thread Maciej Fijalkowski
On Tue, Feb 16, 2021 at 11:27:55AM +0100, Toke Høiland-Jørgensen wrote: > Maciej Fijalkowski writes: > > > > Am I reading this right or you're trying to reject the fix of the long > > standing issue due to a PR that is not ready yet on a standalone > > project/li

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

2021-02-16 Thread Maciej Fijalkowski
On Tue, Feb 16, 2021 at 10:19:17AM -0800, John Fastabend wrote: > Maciej Fijalkowski wrote: > > On Mon, Feb 15, 2021 at 12:49:27PM -0800, John Fastabend wrote: > > > Maciej Fijalkowski wrote: > > > > Currently, if there are multiple xdpsock instances running on a s

Re: [PATCH bpf-next 3/3] samples: bpf: do not unload prog within xdpsock

2021-02-16 Thread Maciej Fijalkowski
On Tue, Feb 16, 2021 at 10:22:15AM +0100, Björn Töpel wrote: > On 2021-02-15 21:24, John Fastabend wrote: > > Maciej Fijalkowski wrote: > > > With the introduction of bpf_link in xsk's libbpf part, there's no > > > further need for explicit unload o

Re: [PATCH bpf-next 2/3] libbpf: clear map_info before each bpf_obj_get_info_by_fd

2021-02-15 Thread Maciej Fijalkowski
On Mon, Feb 15, 2021 at 12:33:37PM -0800, John Fastabend wrote: > Maciej Fijalkowski wrote: > > xsk_lookup_bpf_maps, based on prog_fd, looks whether current prog has a > > reference to XSKMAP. BPF prog can include insns that work on various BPF > > maps and this is covered

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

2021-02-15 Thread Maciej Fijalkowski
On Mon, Feb 15, 2021 at 12:49:27PM -0800, John Fastabend wrote: > Maciej Fijalkowski wrote: > > Currently, if there are multiple xdpsock instances running on a single > > interface and in case one of the instances is terminated, the rest of > > them are left in an inoperable

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

2021-02-15 Thread Maciej Fijalkowski
On Mon, Feb 15, 2021 at 04:18:28PM -0800, John Fastabend wrote: > Toke Høiland-Jørgensen wrote: > > John Fastabend writes: > > > > >> > However, in libxdp we can solve the original problem in a different > > >> > way, > > >> > and in fact I already suggested to Magnus that we should do this (see

  1   2   3   4   >