lkml.org 
[lkml]   [2022]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2022-07-23 17:53    [W:0.068 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site