Re: [PATCH net-next 0/4] netlink: add 'bitmap' attribute type and API

From
Jakub Kicinski <kuba@kernel.org>
Date
2022-07-23 16:04:04
Also in
lkml
Reply to
Jakub Kicinski, 2022-07-22
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.
Thread (13 messages) 13 messages, 2 authors, last reply 2022-07-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help