diff mbox series

[bpf-next,v4,03/11] tools: ynl: Print xsk-features from the sample

Message ID 20231019174944.3376335-4-sdf@google.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series xsk: TX metadata | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for bpf-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers warning 4 maintainers not CCed: davem@davemloft.net pabeni@redhat.com edumazet@google.com martin.lau@kernel.org
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-0 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-1 success Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-2 success Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-10 success Logs for test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-11 fail Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-12 success Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-14 success Logs for test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-15 fail Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-4 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-7 success Logs for test_maps on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-6 success Logs for test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-17 success Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-5 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-18 success Logs for test_progs_no_alu32_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-19 success Logs for test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-21 success Logs for test_progs_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-22 success Logs for test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for test_progs_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-24 success Logs for test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-26 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-28 success Logs for veristat

Commit Message

Stanislav Fomichev Oct. 19, 2023, 5:49 p.m. UTC
Regenerate the userspace specs and print xsk-features bitmask.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 tools/net/ynl/samples/netdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jakub Kicinski Oct. 21, 2023, 1:06 a.m. UTC | #1
On Thu, 19 Oct 2023 10:49:36 -0700 Stanislav Fomichev wrote:
> Regenerate the userspace specs and print xsk-features bitmask.

I'm afraid you regenerated in previous patch already :]
Perhaps we should add an easy-to-use flag to ynl-regen to skip tools/ ?

> diff --git a/tools/net/ynl/samples/netdev.c b/tools/net/ynl/samples/netdev.c
> index b828225daad0..da7c2848f773 100644
> --- a/tools/net/ynl/samples/netdev.c
> +++ b/tools/net/ynl/samples/netdev.c
> @@ -44,6 +44,12 @@ static void netdev_print_device(struct netdev_dev_get_rsp *d, unsigned int op)
>  			printf(" %s", netdev_xdp_rx_metadata_str(1 << i));
>  	}
>  
> +	printf(" xsk-features (%llx):", d->xsk_features);
> +	for (int i = 0; d->xsk_features > 1U << i; i++) {

Shouldn't this be >= ?

> +		if (d->xsk_features & (1U << i))
> +			printf(" %s", netdev_xsk_flags_str(1 << i));
> +	}
Stanislav Fomichev Oct. 23, 2023, 5:27 p.m. UTC | #2
On 10/20, Jakub Kicinski wrote:
> On Thu, 19 Oct 2023 10:49:36 -0700 Stanislav Fomichev wrote:
> > Regenerate the userspace specs and print xsk-features bitmask.
> 
> I'm afraid you regenerated in previous patch already :]
> Perhaps we should add an easy-to-use flag to ynl-regen to skip tools/ ?

Oops, leftover :-(

I do find it useful that we now regenerate everything, so not sure the
flag is needed (I'm probably missing the intent). I hope we eventually can
drop those generated files altogether from the tree and generate everything
during the build.

> > diff --git a/tools/net/ynl/samples/netdev.c b/tools/net/ynl/samples/netdev.c
> > index b828225daad0..da7c2848f773 100644
> > --- a/tools/net/ynl/samples/netdev.c
> > +++ b/tools/net/ynl/samples/netdev.c
> > @@ -44,6 +44,12 @@ static void netdev_print_device(struct netdev_dev_get_rsp *d, unsigned int op)
> >  			printf(" %s", netdev_xdp_rx_metadata_str(1 << i));
> >  	}
> >  
> > +	printf(" xsk-features (%llx):", d->xsk_features);
> > +	for (int i = 0; d->xsk_features > 1U << i; i++) {
> 
> Shouldn't this be >= ?

Oh, good catch, will fix the other ones as well. But this is subtle and
still mostly works during my tests.

For bits 1 and 2 we get 3 and 'd->xsk_features > 1U << i' is always
true for both 1 and 2.
diff mbox series

Patch

diff --git a/tools/net/ynl/samples/netdev.c b/tools/net/ynl/samples/netdev.c
index b828225daad0..da7c2848f773 100644
--- a/tools/net/ynl/samples/netdev.c
+++ b/tools/net/ynl/samples/netdev.c
@@ -44,6 +44,12 @@  static void netdev_print_device(struct netdev_dev_get_rsp *d, unsigned int op)
 			printf(" %s", netdev_xdp_rx_metadata_str(1 << i));
 	}
 
+	printf(" xsk-features (%llx):", d->xsk_features);
+	for (int i = 0; d->xsk_features > 1U << i; i++) {
+		if (d->xsk_features & (1U << i))
+			printf(" %s", netdev_xsk_flags_str(1 << i));
+	}
+
 	printf(" xdp-zc-max-segs=%u", d->xdp_zc_max_segs);
 
 	name = netdev_op_str(op);