[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220723085243.00e4bfa4@kernel.org>
Date: Sat, 23 Jul 2022 08:52:43 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Alexander Lobakin <alexandr.lobakin@...el.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Yury Norov <yury.norov@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Nikolay Aleksandrov <razor@...ckwall.org>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 0/4] netlink: add 'bitmap' attribute type and
API
On Fri, 22 Jul 2022 11:19:51 -0700 Jakub Kicinski wrote:
> So at the netlink level the field is bigint (LE, don't care about BE).
> Kernel side API is:
>
> nla_get_b8, nla_get_b16, nla_get_b32, nla_get_b64,
> nla_get_bitmap
> nla_put_b8, nla_put_b16 etc.
>
> u16 my_flags_are_so_toight;
>
> my_flags_are_so_toight = nla_get_b16(attr[BLAA_BLA_BLA_FLAGS]);
>
> The point is - the representation can be more compact than u64 and will
> therefore encourage anyone who doesn't have a strong reason to use
> fixed size fields to switch to the bigint.
IDK if I convinced you yet, but in case you're typing the code for this
- the types smaller than 4B don't really have to be represented at the
netlink level. Padding will round them up, anyway. But we do want the
32b values there, otherwise we need padding type to align which bloats
the API.
Powered by blists - more mailing lists