[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240915172307.354caffd@kernel.org>
Date: Sun, 15 Sep 2024 17:23:07 +0200
From: Jakub Kicinski <kuba@...nel.org>
To: Asbjørn Sloth Tønnesen
<ast@...erby.net>
Cc: Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
David Ahern <dsahern@...nel.org>, Matthieu Baerts <matttbe@...nel.org>, Mat
Martineau <martineau@...nel.org>, Geliang Tang <geliang@...nel.org>, "David
S. Miller" <davem@...emloft.net>, Donald Hunter <donald.hunter@...il.com>,
netdev@...r.kernel.org, mptcp@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] tools: ynl-gen: use big-endian netlink
attribute types
On Sat, 14 Sep 2024 19:03:38 +0000 Asbjørn Sloth Tønnesen wrote:
> > We could just swap the type directly here?
>
> That could work too, WDYT?
>
> diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
> index 717530bc9c52e..e8706f36e5e7b 100755
> --- a/tools/net/ynl/ynl-gen-c.py
> +++ b/tools/net/ynl/ynl-gen-c.py
> @@ -157,7 +157,10 @@ class Type(SpecAttr):
> return '{ .type = ' + policy + ', }'
>
> def attr_policy(self, cw):
> - policy = c_upper('nla-' + self.attr['type'])
> + policy = f'NLA_{c_upper(self.type)}'
> + if self.attr.get('byte-order', '') == 'big-endian':
> + if self.type in {'u16', 'u32'}:
> + policy = f'NLA_BE{self.type[1:]}'
LGTM!
Powered by blists - more mailing lists