[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bbbdd1a0-2835-44c4-8b9f-942d2309e067@fiberby.net>
Date: Tue, 14 Oct 2025 17:29:30 +0000
From: Asbjørn Sloth Tønnesen <ast@...erby.net>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Alexei Starovoitov <ast@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>,
Daniel Borkmann <daniel@...earbox.net>, Daniel Zahka
<daniel.zahka@...il.com>, Donald Hunter <donald.hunter@...il.com>,
Jacob Keller <jacob.e.keller@...el.com>,
Jesper Dangaard Brouer <hawk@...nel.org>, Jiri Pirko <jiri@...nulli.us>,
Joe Damato <jdamato@...tly.com>, John Fastabend <john.fastabend@...il.com>,
Jonathan Corbet <corbet@....net>, Simon Horman <horms@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Willem de Bruijn <willemb@...gle.com>, bpf@...r.kernel.org,
netdev@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, "Jason A. Donenfeld" <Jason@...c4.com>
Subject: Re: [PATCH net-next 3/6] tools: ynl-gen: use uapi mask definition in
NLA_POLICY_MASK
On 10/14/25 12:59 AM, Jakub Kicinski wrote:
> On Mon, 13 Oct 2025 16:50:00 +0000 Asbjørn Sloth Tønnesen wrote:
>> Currently when generating policies using NLA_POLICY_MASK(), then
>> we emit a pre-computed decimal mask.
>>
>> When render-max is set, then we can re-use the mask definition,
>> that has been generated in the uapi header.
>
> This will encourage people to render masks in uAPI which just pollutes
> the uAPI files.
It might, but is that a problem, given that most flag-sets are rather small?
Example from include/uapi/linux/wireguard.h:
> enum wgpeer_flag {
> WGPEER_F_REMOVE_ME = 1U << 0,
> WGPEER_F_REPLACE_ALLOWEDIPS = 1U << 1,
> WGPEER_F_UPDATE_ONLY = 1U << 2,
> __WGPEER_F_ALL = WGPEER_F_REMOVE_ME | WGPEER_F_REPLACE_ALLOWEDIPS |
> WGPEER_F_UPDATE_ONLY
> };
I agree that a private "WGPEER_F_ALL" would be pollution, but "__WGPEER_F_ALL"
is less likely to accidentally be used by user-space.
I get why Jason likes having the __WGPEER_F_ALL in a place where it is easy
to review that it has contains all flags, and why he don't like a policy like
NLA_POLICY_MASK(.., 0x7).
We could do the mask definition in the kernel code, like many handwritten
netlink families does, but we still need to keep NETDEV_XDP_ACT_MASK in
netdev.h or remove it's YNL-GEN header for some time.
Powered by blists - more mailing lists