Commit Graph

6 Commits

Author SHA1 Message Date
Petr Oros e3624f1548 tools: ynl: error check scanf() in a sample
JIRA: https://issues.redhat.com/browse/RHEL-57756

Upstream commit(s):
commit 3d8806f37d318b10ddf9fa686821f58bc6301c7b
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Wed Aug 28 10:36:09 2024 -0700

    tools: ynl: error check scanf() in a sample

    Someone reported on GitHub that the YNL NIPA test is failing
    when run locally. The test builds the tools, and it hits:

      netdev.c:82:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      82 | scanf("%d", &ifindex);

    I can't repro this on my setups but error seems clear enough.

    Link: https://github.com/linux-netdev/nipa/discussions/37
    Reviewed-by: Simon Horman <horms@kernel.org>
    Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Link: https://patch.msgid.link/20240828173609.2951335-1-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-12-10 10:37:56 +01:00
Petr Oros f70a1b2047 tools: ynl: add ynl_dump_empty() helper
JIRA: https://issues.redhat.com/browse/RHEL-57756

Upstream commit(s):
commit d6d647d7ba6413148c3db2d48640986c8c1d7d08
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Mar 29 11:16:51 2024 -0700

    tools: ynl: add ynl_dump_empty() helper

    Checking if dump is empty requires a couple of casts.
    Add a convenient wrapper.

    Add an example use in the netdev sample, loopback is always
    present so an empty dump is an error.

    Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Link: https://lore.kernel.org/r/20240329181651.319326-1-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-12-10 10:37:53 +01:00
Petr Oros 809f38d93c tools: ynl: Print xsk-features from the sample
JIRA: https://issues.redhat.com/browse/RHEL-31944

Upstream commit(s):
commit 9276009d35d3f65e083b95d30a4f967baaae0fc6
Author: Stanislav Fomichev <sdf@google.com>
Date:   Mon Nov 27 11:03:09 2023 -0800

    tools: ynl: Print xsk-features from the sample

    In a similar fashion we do for the other bit masks.
    Fix mask parsing (>= vs >) while we are it.

    Signed-off-by: Stanislav Fomichev <sdf@google.com>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/r/20231127190319.1190813-4-sdf@google.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Signed-off-by: Petr Oros <poros@redhat.com>
2024-06-05 17:01:39 +02:00
Jose Ignacio Tornos Martinez ed575ca41b tools: ynl: extend netdev sample to dump xdp-rx-metadata-features
JIRA: https://issues.redhat.com/browse/RHEL-31945

commit 0c6c9b105ee90d7415dc796bcf632147b3d267ce
Author: Stanislav Fomichev <sdf@google.com>
Date:   Wed Sep 13 10:13:50 2023 -0700

    tools: ynl: extend netdev sample to dump xdp-rx-metadata-features
    
    The tool can be used to verify that everything works end to end.
    
    Unrelated updates:
    - include tools/include/uapi to pick the latest kernel uapi headers
    - print "xdp-features" and "xdp-rx-metadata-features" so it's clear
      which bitmask is being dumped
    
    Cc: netdev@vger.kernel.org
    Cc: Willem de Bruijn <willemb@google.com>
    Signed-off-by: Stanislav Fomichev <sdf@google.com>
    Link: https://lore.kernel.org/r/20230913171350.369987-4-sdf@google.com
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-04-22 13:45:53 +02:00
Ivan Vecera 34f0a19860 ynl: print xdp-zc-max-segs in the sample
JIRA: https://issues.redhat.com/browse/RHEL-30656

commit 26fdb67e8b4ae08eaab40a63c2e3a5e48f9c31f5
Author: Stanislav Fomichev <sdf@google.com>
Date:   Thu Jul 27 09:30:01 2023 -0700

    ynl: print xdp-zc-max-segs in the sample

    Technically we don't have to keep extending the sample, but it
    feels useful to run these tools locally to confirm everything
    is working.

    Signed-off-by: Stanislav Fomichev <sdf@google.com>
    Reviewed-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://lore.kernel.org/r/20230727163001.3952878-5-sdf@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:19:27 +02:00
Ivan Vecera 1d7861400e tools: ynl: add sample for netdev
JIRA: https://issues.redhat.com/browse/RHEL-30656

commit ee0202e2e731d074639461b3db2296bf44d847ce
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Mon Jun 5 12:01:08 2023 -0700

    tools: ynl: add sample for netdev

    Add a sample application using the C library.
    My main goal is to make writing selftests easier but until
    I have some of those ready I think it's useful to show off
    the functionality and let people poke and tinker.

    Sample outputs - dump:

    $ ./netdev
    Select ifc ($ifindex; or 0 = dump; or -2 ntf check): 0
          lo[1]     0:
      enp1s0[2]     23: basic redirect rx-sg

    Notifications (watching veth pair getting added and deleted):

    $ ./netdev
    Select ifc ($ifindex; or 0 = dump; or -2 ntf check): -2
    [53]    0: (ntf: dev-add-ntf)
    [54]    0: (ntf: dev-add-ntf)
    [54]    23: basic redirect rx-sg (ntf: dev-change-ntf)
    [53]    23: basic redirect rx-sg (ntf: dev-change-ntf)
    [53]    23: basic redirect rx-sg (ntf: dev-del-ntf)
    [54]    23: basic redirect rx-sg (ntf: dev-del-ntf)

    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:19:23 +02:00