diff mbox series

[bpf-next] selftests: xsk: fix rx_full stats test

Message ID 20220121123508.12759-1-magnus.karlsson@gmail.com (mailing list archive)
State Accepted
Commit b4ec6a19231224f6b08dc54ea07da4c4090e8ee3
Delegated to: BPF
Headers show
Series [bpf-next] selftests: xsk: fix rx_full stats test | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 11 maintainers not CCed: andrii@kernel.org linux-kselftest@vger.kernel.org hawk@kernel.org kuba@kernel.org kpsingh@kernel.org john.fastabend@gmail.com kafai@fb.com shuah@kernel.org songliubraving@fb.com yhs@fb.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: line length of 90 exceeds 80 columns WARNING: line length of 93 exceeds 80 columns WARNING: line length of 99 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next success VM_Test
bpf/vmtest-bpf-next-PR success PR summary

Commit Message

Magnus Karlsson Jan. 21, 2022, 12:35 p.m. UTC
From: Magnus Karlsson <magnus.karlsson@intel.com>

Fix the rx_full stats test so that it correctly reports pass even when
the fill ring is not full of buffers.

Fixes: 872a1184dbf2 ("selftests: xsk: Put the same buffer only once in the fill ring")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
---
 tools/testing/selftests/bpf/xdpxceiver.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


base-commit: 820e6e227c4053b6b631ae65ef1f65d560cb392b

Comments

Maciej Fijalkowski Jan. 21, 2022, 4 p.m. UTC | #1
On Fri, Jan 21, 2022 at 01:35:08PM +0100, Magnus Karlsson wrote:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
> 
> Fix the rx_full stats test so that it correctly reports pass even when
> the fill ring is not full of buffers.
> 
> Fixes: 872a1184dbf2 ("selftests: xsk: Put the same buffer only once in the fill ring")
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>

Fixes xdpxceiver hang on my side.

Tested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  tools/testing/selftests/bpf/xdpxceiver.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
> index 0a5d23da486d..ffa5502ad95e 100644
> --- a/tools/testing/selftests/bpf/xdpxceiver.c
> +++ b/tools/testing/selftests/bpf/xdpxceiver.c
> @@ -906,7 +906,10 @@ static bool rx_stats_are_valid(struct ifobject *ifobject)
>  			return true;
>  		case STAT_TEST_RX_FULL:
>  			xsk_stat = stats.rx_ring_full;
> -			expected_stat -= RX_FULL_RXQSIZE;
> +			if (ifobject->umem->num_frames < XSK_RING_PROD__DEFAULT_NUM_DESCS)
> +				expected_stat = ifobject->umem->num_frames - RX_FULL_RXQSIZE;
> +			else
> +				expected_stat = XSK_RING_PROD__DEFAULT_NUM_DESCS - RX_FULL_RXQSIZE;
>  			break;
>  		case STAT_TEST_RX_FILL_EMPTY:
>  			xsk_stat = stats.rx_fill_ring_empty_descs;
> 
> base-commit: 820e6e227c4053b6b631ae65ef1f65d560cb392b
> -- 
> 2.34.1
>
patchwork-bot+netdevbpf@kernel.org Jan. 24, 2022, 4:49 p.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Fri, 21 Jan 2022 13:35:08 +0100 you wrote:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
> 
> Fix the rx_full stats test so that it correctly reports pass even when
> the fill ring is not full of buffers.
> 
> Fixes: 872a1184dbf2 ("selftests: xsk: Put the same buffer only once in the fill ring")
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests: xsk: fix rx_full stats test
    https://git.kernel.org/bpf/bpf-next/c/b4ec6a192312

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 0a5d23da486d..ffa5502ad95e 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -906,7 +906,10 @@  static bool rx_stats_are_valid(struct ifobject *ifobject)
 			return true;
 		case STAT_TEST_RX_FULL:
 			xsk_stat = stats.rx_ring_full;
-			expected_stat -= RX_FULL_RXQSIZE;
+			if (ifobject->umem->num_frames < XSK_RING_PROD__DEFAULT_NUM_DESCS)
+				expected_stat = ifobject->umem->num_frames - RX_FULL_RXQSIZE;
+			else
+				expected_stat = XSK_RING_PROD__DEFAULT_NUM_DESCS - RX_FULL_RXQSIZE;
 			break;
 		case STAT_TEST_RX_FILL_EMPTY:
 			xsk_stat = stats.rx_fill_ring_empty_descs;