netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] ynl: couple of unrelated fixes
@ 2023-07-25 23:35 Stanislav Fomichev
  2023-07-25 23:35 ` [PATCH net-next 1/4] ynl: expose xdp-zc-max-segs Stanislav Fomichev
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Stanislav Fomichev @ 2023-07-25 23:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, edumazet, kuba, pabeni, Stanislav Fomichev

- spelling of xdp-features
- s/xdp_zc_max_segs/xdp-zc-max-segs/
- expose xdp-zc-max-segs
- add /* private: */
- regenerate headers
- print xdp_zc_max_segs from sample

Stanislav Fomichev (4):
  ynl: expose xdp-zc-max-segs
  ynl: mark max/mask as private for kdoc
  ynl: regenerate all headers
  ynl: print xdp-zc-max-segs in the sample

 Documentation/netlink/specs/netdev.yaml |  5 +++--
 include/uapi/linux/netdev.h             |  4 +++-
 tools/net/ynl/Makefile                  | 10 ++++++++++
 tools/net/ynl/generated/netdev-user.c   |  6 ++++++
 tools/net/ynl/generated/netdev-user.h   |  2 ++
 tools/net/ynl/samples/netdev.c          |  2 ++
 tools/net/ynl/ynl-gen-c.py              |  2 ++
 7 files changed, 28 insertions(+), 3 deletions(-)

-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net-next 1/4] ynl: expose xdp-zc-max-segs
  2023-07-25 23:35 [PATCH net-next 0/4] ynl: couple of unrelated fixes Stanislav Fomichev
@ 2023-07-25 23:35 ` Stanislav Fomichev
  2023-07-25 23:35 ` [PATCH net-next 2/4] ynl: mark max/mask as private for kdoc Stanislav Fomichev
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Stanislav Fomichev @ 2023-07-25 23:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, edumazet, kuba, pabeni, Stanislav Fomichev

Also rename it to dashes, to match the rest. And fix unrelated
spelling error while we're at it.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 Documentation/netlink/specs/netdev.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
index e41015310a6e..1c7284fd535b 100644
--- a/Documentation/netlink/specs/netdev.yaml
+++ b/Documentation/netlink/specs/netdev.yaml
@@ -14,7 +14,7 @@ name: netdev
       -
         name: basic
         doc:
-          XDP feautues set supported by all drivers
+          XDP features set supported by all drivers
           (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX)
       -
         name: redirect
@@ -63,7 +63,7 @@ name: netdev
         enum: xdp-act
         enum-as-flags: true
       -
-        name: xdp_zc_max_segs
+        name: xdp-zc-max-segs
         doc: max fragment count supported by ZC driver
         type: u32
         checks:
@@ -83,6 +83,7 @@ name: netdev
           attributes:
             - ifindex
             - xdp-features
+            - xdp-zc-max-segs
       dump:
         reply: *dev-all
     -
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 2/4] ynl: mark max/mask as private for kdoc
  2023-07-25 23:35 [PATCH net-next 0/4] ynl: couple of unrelated fixes Stanislav Fomichev
  2023-07-25 23:35 ` [PATCH net-next 1/4] ynl: expose xdp-zc-max-segs Stanislav Fomichev
@ 2023-07-25 23:35 ` Stanislav Fomichev
  2023-07-26 23:33   ` Jakub Kicinski
  2023-07-25 23:35 ` [PATCH net-next 3/4] ynl: regenerate all headers Stanislav Fomichev
  2023-07-25 23:35 ` [PATCH net-next 4/4] ynl: print xdp-zc-max-segs in the sample Stanislav Fomichev
  3 siblings, 1 reply; 10+ messages in thread
From: Stanislav Fomichev @ 2023-07-25 23:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, edumazet, kuba, pabeni, Stanislav Fomichev

Simon mentioned in another thread that it makes kdoc happy
and Jakub confirms that commit e27cb89a22ad ("scripts: kernel-doc: support
private / public marking for enums") actually added the needed
support.

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

diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 71c5e79e877f..0112722fcc37 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -2124,6 +2124,8 @@ _C_KW = {
                 cw.p(entry.c_name + suffix)
 
             if const.get('render-max', False):
+                cw.nl()
+                cw.p('/* private: */')
                 cw.nl()
                 if const['type'] == 'flags':
                     max_name = c_upper(name_pfx + 'mask')
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 3/4] ynl: regenerate all headers
  2023-07-25 23:35 [PATCH net-next 0/4] ynl: couple of unrelated fixes Stanislav Fomichev
  2023-07-25 23:35 ` [PATCH net-next 1/4] ynl: expose xdp-zc-max-segs Stanislav Fomichev
  2023-07-25 23:35 ` [PATCH net-next 2/4] ynl: mark max/mask as private for kdoc Stanislav Fomichev
@ 2023-07-25 23:35 ` Stanislav Fomichev
  2023-07-26 23:37   ` Jakub Kicinski
  2023-07-25 23:35 ` [PATCH net-next 4/4] ynl: print xdp-zc-max-segs in the sample Stanislav Fomichev
  3 siblings, 1 reply; 10+ messages in thread
From: Stanislav Fomichev @ 2023-07-25 23:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, edumazet, kuba, pabeni, Stanislav Fomichev

Also add small (and simple - no dependencies) makefile rule do update
the UAPI ones.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 include/uapi/linux/netdev.h           |  4 +++-
 tools/net/ynl/Makefile                | 10 ++++++++++
 tools/net/ynl/generated/netdev-user.c |  6 ++++++
 tools/net/ynl/generated/netdev-user.h |  2 ++
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
index bf71698a1e82..1a2f6e320f1c 100644
--- a/include/uapi/linux/netdev.h
+++ b/include/uapi/linux/netdev.h
@@ -11,7 +11,7 @@
 
 /**
  * enum netdev_xdp_act
- * @NETDEV_XDP_ACT_BASIC: XDP feautues set supported by all drivers
+ * @NETDEV_XDP_ACT_BASIC: XDP features set supported by all drivers
  *   (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX)
  * @NETDEV_XDP_ACT_REDIRECT: The netdev supports XDP_REDIRECT
  * @NETDEV_XDP_ACT_NDO_XMIT: This feature informs if netdev implements
@@ -34,6 +34,8 @@ enum netdev_xdp_act {
 	NETDEV_XDP_ACT_RX_SG = 32,
 	NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
 
+	/* private: */
+
 	NETDEV_XDP_ACT_MASK = 127,
 };
 
diff --git a/tools/net/ynl/Makefile b/tools/net/ynl/Makefile
index d664b36deb5b..f4eacafa9665 100644
--- a/tools/net/ynl/Makefile
+++ b/tools/net/ynl/Makefile
@@ -1,5 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 
+DIR_SPEC:=../../../Documentation/netlink/specs
+DIR_UAPI:=../../../include/uapi/linux
+SPECS:=netdev fou handshake
+TOOL:=./ynl-gen-c.py
+
 SUBDIRS = lib generated samples
 
 all: $(SUBDIRS)
@@ -16,4 +21,9 @@ all: $(SUBDIRS)
 		fi \
 	done
 
+generate:
+	for spec in $(SPECS); do \
+		$(TOOL) --spec $(DIR_SPEC)/$$spec.yaml --header --mode uapi > $(DIR_UAPI)/$$spec.h; \
+	done
+
 .PHONY: clean all $(SUBDIRS)
diff --git a/tools/net/ynl/generated/netdev-user.c b/tools/net/ynl/generated/netdev-user.c
index 4eb8aefef0cd..68b408ca0f7f 100644
--- a/tools/net/ynl/generated/netdev-user.c
+++ b/tools/net/ynl/generated/netdev-user.c
@@ -50,6 +50,7 @@ struct ynl_policy_attr netdev_dev_policy[NETDEV_A_DEV_MAX + 1] = {
 	[NETDEV_A_DEV_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, },
 	[NETDEV_A_DEV_PAD] = { .name = "pad", .type = YNL_PT_IGNORE, },
 	[NETDEV_A_DEV_XDP_FEATURES] = { .name = "xdp-features", .type = YNL_PT_U64, },
+	[NETDEV_A_DEV_XDP_ZC_MAX_SEGS] = { .name = "xdp-zc-max-segs", .type = YNL_PT_U32, },
 };
 
 struct ynl_policy_nest netdev_dev_nest = {
@@ -91,6 +92,11 @@ int netdev_dev_get_rsp_parse(const struct nlmsghdr *nlh, void *data)
 				return MNL_CB_ERROR;
 			dst->_present.xdp_features = 1;
 			dst->xdp_features = mnl_attr_get_u64(attr);
+		} else if (type == NETDEV_A_DEV_XDP_ZC_MAX_SEGS) {
+			if (ynl_attr_validate(yarg, attr))
+				return MNL_CB_ERROR;
+			dst->_present.xdp_zc_max_segs = 1;
+			dst->xdp_zc_max_segs = mnl_attr_get_u32(attr);
 		}
 	}
 
diff --git a/tools/net/ynl/generated/netdev-user.h b/tools/net/ynl/generated/netdev-user.h
index 5554dc69bb9c..0952d3261f4d 100644
--- a/tools/net/ynl/generated/netdev-user.h
+++ b/tools/net/ynl/generated/netdev-user.h
@@ -47,10 +47,12 @@ struct netdev_dev_get_rsp {
 	struct {
 		__u32 ifindex:1;
 		__u32 xdp_features:1;
+		__u32 xdp_zc_max_segs:1;
 	} _present;
 
 	__u32 ifindex;
 	__u64 xdp_features;
+	__u32 xdp_zc_max_segs;
 };
 
 void netdev_dev_get_rsp_free(struct netdev_dev_get_rsp *rsp);
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 4/4] ynl: print xdp-zc-max-segs in the sample
  2023-07-25 23:35 [PATCH net-next 0/4] ynl: couple of unrelated fixes Stanislav Fomichev
                   ` (2 preceding siblings ...)
  2023-07-25 23:35 ` [PATCH net-next 3/4] ynl: regenerate all headers Stanislav Fomichev
@ 2023-07-25 23:35 ` Stanislav Fomichev
  3 siblings, 0 replies; 10+ messages in thread
From: Stanislav Fomichev @ 2023-07-25 23:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, edumazet, kuba, pabeni, Stanislav Fomichev

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>
---
 tools/net/ynl/samples/netdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/net/ynl/samples/netdev.c b/tools/net/ynl/samples/netdev.c
index d31268aa47c5..06433400dddd 100644
--- a/tools/net/ynl/samples/netdev.c
+++ b/tools/net/ynl/samples/netdev.c
@@ -38,6 +38,8 @@ static void netdev_print_device(struct netdev_dev_get_rsp *d, unsigned int op)
 			printf(" %s", netdev_xdp_act_str(1 << i));
 	}
 
+	printf(" xdp-zc-max-segs=%u", d->xdp_zc_max_segs);
+
 	name = netdev_op_str(op);
 	if (name)
 		printf(" (ntf: %s)", name);
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 2/4] ynl: mark max/mask as private for kdoc
  2023-07-25 23:35 ` [PATCH net-next 2/4] ynl: mark max/mask as private for kdoc Stanislav Fomichev
@ 2023-07-26 23:33   ` Jakub Kicinski
  2023-07-26 23:35     ` Stanislav Fomichev
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2023-07-26 23:33 UTC (permalink / raw)
  To: Stanislav Fomichev; +Cc: netdev, davem, edumazet, pabeni

On Tue, 25 Jul 2023 16:35:15 -0700 Stanislav Fomichev wrote:
> +                cw.p('/* private: */')
>                  cw.nl()

I was about to apply but I keep having doubts whether there should 
be a new line after the private marker. I know - a very important
question :D

Quick grep of

$ git grep -A1 '\* private:'

shows that all(?) current uses have something immediately following
the comment.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 2/4] ynl: mark max/mask as private for kdoc
  2023-07-26 23:33   ` Jakub Kicinski
@ 2023-07-26 23:35     ` Stanislav Fomichev
  0 siblings, 0 replies; 10+ messages in thread
From: Stanislav Fomichev @ 2023-07-26 23:35 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, davem, edumazet, pabeni

On Wed, Jul 26, 2023 at 4:33 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Tue, 25 Jul 2023 16:35:15 -0700 Stanislav Fomichev wrote:
> > +                cw.p('/* private: */')
> >                  cw.nl()
>
> I was about to apply but I keep having doubts whether there should
> be a new line after the private marker. I know - a very important
> question :D
>
> Quick grep of
>
> $ git grep -A1 '\* private:'
>
> shows that all(?) current uses have something immediately following
> the comment.

:-D I was too lazy to grep. Will drop \n and respin!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 3/4] ynl: regenerate all headers
  2023-07-25 23:35 ` [PATCH net-next 3/4] ynl: regenerate all headers Stanislav Fomichev
@ 2023-07-26 23:37   ` Jakub Kicinski
  2023-07-26 23:55     ` Stanislav Fomichev
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2023-07-26 23:37 UTC (permalink / raw)
  To: Stanislav Fomichev; +Cc: netdev, davem, edumazet, pabeni

On Tue, 25 Jul 2023 16:35:16 -0700 Stanislav Fomichev wrote:
> Also add small (and simple - no dependencies) makefile rule do update
> the UAPI ones.

I was thinking people would use:

./tools/net/ynl/ynl-regen.sh -f

for this. It is slightly more capable. Can we perhaps hook the new make
target to just run that script?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 3/4] ynl: regenerate all headers
  2023-07-26 23:37   ` Jakub Kicinski
@ 2023-07-26 23:55     ` Stanislav Fomichev
  2023-07-27  0:22       ` Jakub Kicinski
  0 siblings, 1 reply; 10+ messages in thread
From: Stanislav Fomichev @ 2023-07-26 23:55 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, davem, edumazet, pabeni

On Wed, Jul 26, 2023 at 4:37 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Tue, 25 Jul 2023 16:35:16 -0700 Stanislav Fomichev wrote:
> > Also add small (and simple - no dependencies) makefile rule do update
> > the UAPI ones.
>
> I was thinking people would use:
>
> ./tools/net/ynl/ynl-regen.sh -f
>
> for this. It is slightly more capable. Can we perhaps hook the new make
> target to just run that script?

Oh, didn't know about this. Something like this maybe? Ugly?

diff --git a/tools/net/ynl/Makefile b/tools/net/ynl/Makefile
index d664b36deb5b..c36380bf1536 100644
--- a/tools/net/ynl/Makefile
+++ b/tools/net/ynl/Makefile
@@ -3,6 +3,7 @@
 SUBDIRS = lib generated samples

 all: $(SUBDIRS)
+       (cd ../../../ && ./tools/net/ynl/ynl-regen.sh -f)

 $(SUBDIRS):
        @if [ -f "$@/Makefile" ] ; then \

Or, now that I know about the script I can actually run it manually.
But with a makefile imo a bit easier to discover..

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 3/4] ynl: regenerate all headers
  2023-07-26 23:55     ` Stanislav Fomichev
@ 2023-07-27  0:22       ` Jakub Kicinski
  0 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2023-07-27  0:22 UTC (permalink / raw)
  To: Stanislav Fomichev; +Cc: netdev, davem, edumazet, pabeni

On Wed, 26 Jul 2023 16:55:07 -0700 Stanislav Fomichev wrote:
> Oh, didn't know about this. Something like this maybe? Ugly?
> 
> diff --git a/tools/net/ynl/Makefile b/tools/net/ynl/Makefile
> index d664b36deb5b..c36380bf1536 100644
> --- a/tools/net/ynl/Makefile
> +++ b/tools/net/ynl/Makefile
> @@ -3,6 +3,7 @@
>  SUBDIRS = lib generated samples
> 
>  all: $(SUBDIRS)
> +       (cd ../../../ && ./tools/net/ynl/ynl-regen.sh -f)

Hm, I thought the script itself would handle this. I guess I did a
stupid. How about we extend the script to default to the full tree:

diff --git a/tools/net/ynl/ynl-regen.sh b/tools/net/ynl/ynl-regen.sh
index 8d4ca6a50582..bdba24066cf1 100755
--- a/tools/net/ynl/ynl-regen.sh
+++ b/tools/net/ynl/ynl-regen.sh
@@ -4,15 +4,18 @@
 TOOL=$(dirname $(realpath $0))/ynl-gen-c.py
 
 force=
+search=
 
 while [ ! -z "$1" ]; do
   case "$1" in
     -f ) force=yes; shift ;;
+    -p ) search=$2; shift 2 ;;
     * )  echo "Unrecognized option '$1'"; exit 1 ;;
   esac
 done
 
 KDIR=$(dirname $(dirname $(dirname $(dirname $(realpath $0)))))
+pushd ${search:-$KDIR} >>/dev/null
 
 files=$(git grep --files-with-matches '^/\* YNL-GEN \(kernel\|uapi\|user\)')
 for f in $files; do
@@ -30,3 +33,5 @@ for f in $files; do
     $TOOL --mode ${params[2]} --${params[3]} --spec $KDIR/${params[0]} \
 	  $args -o $f
 done
+
+popd >>/dev/null

>  $(SUBDIRS):
>         @if [ -f "$@/Makefile" ] ; then \
> 
> Or, now that I know about the script I can actually run it manually.
> But with a makefile imo a bit easier to discover..

Yea, agreed.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-07-27  0:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25 23:35 [PATCH net-next 0/4] ynl: couple of unrelated fixes Stanislav Fomichev
2023-07-25 23:35 ` [PATCH net-next 1/4] ynl: expose xdp-zc-max-segs Stanislav Fomichev
2023-07-25 23:35 ` [PATCH net-next 2/4] ynl: mark max/mask as private for kdoc Stanislav Fomichev
2023-07-26 23:33   ` Jakub Kicinski
2023-07-26 23:35     ` Stanislav Fomichev
2023-07-25 23:35 ` [PATCH net-next 3/4] ynl: regenerate all headers Stanislav Fomichev
2023-07-26 23:37   ` Jakub Kicinski
2023-07-26 23:55     ` Stanislav Fomichev
2023-07-27  0:22       ` Jakub Kicinski
2023-07-25 23:35 ` [PATCH net-next 4/4] ynl: print xdp-zc-max-segs in the sample Stanislav Fomichev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).