From: Joe Damato <jdamato@fastly.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com
Subject: Re: [PATCH net-next] tools: ynl-gen: use names of constants in generated limits
Date: Thu, 10 Oct 2024 22:07:30 +0000 [thread overview]
Message-ID: <20241010220730.GA260524@cache-sql13432> (raw)
In-Reply-To: <20241010151248.2049755-1-kuba@kernel.org>
On Thu, Oct 10, 2024 at 08:12:48AM -0700, Jakub Kicinski wrote:
> YNL specs can use string expressions for limits, like s32-min
> or u16-max. We convert all of those into their numeric values
> when generating the code, which isn't always helpful. Try to
> retain the string representations in the output. Any sort of
> calculations still need the integers.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> net/core/netdev-genl-gen.c | 4 ++--
> tools/net/ynl/ynl-gen-c.py | 36 +++++++++++++++++++++++-------------
> 2 files changed, 25 insertions(+), 15 deletions(-)
I rebased my per-NAPI changes on top of this commit and gave it a test
run and it generated this diff:
diff --git a/net/core/netdev-genl-gen.c b/net/core/netdev-genl-gen.c
index 3692c8270c6b..21de7e10be16 100644
--- a/net/core/netdev-genl-gen.c
+++ b/net/core/netdev-genl-gen.c
@@ -23,7 +23,7 @@ static const struct netlink_range_validation netdev_a_page_pool_ifindex_range =
};
static const struct netlink_range_validation netdev_a_napi_defer_hard_irqs_range = {
- .max = 2147483647ULL,
+ .max = S32_MAX,
};
/* Common nested types */
---
which is much nicer! I am not a python expert, but the code seems
reasonable to me and the generated output is a huge improvement (IMO).
Thanks for doing this.
Reviewed-by: Joe Damato <jdamato@fastly.com>
next prev parent reply other threads:[~2024-10-10 22:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 15:12 [PATCH net-next] tools: ynl-gen: use names of constants in generated limits Jakub Kicinski
2024-10-10 22:07 ` Joe Damato [this message]
2024-10-11 15:51 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241010220730.GA260524@cache-sql13432 \
--to=jdamato@fastly.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.