Subject: Re: [PATCH net-next 2/7] net: nexthop: Add NHA_OP_FLAGS

From: Petr Machata <[email-masked]>
Date: Wed, 28 Feb 2024 11:50:33 +0100

Jakub Kicinski <[email-masked]> writes:

> On Tue, 27 Feb 2024 19:17:27 +0100 Petr Machata wrote:
>> +	/* bitfield32; operation-specific flags */
>> +	NHA_OP_FLAGS,
>
>>  static const struct nla_policy rtm_nh_policy_get[] = {
>>  	[NHA_ID]		= { .type = NLA_U32 },
>> +	[NHA_OP_FLAGS]		= NLA_POLICY_BITFIELD32(0),
>
> Why bitfiled? You never use the mask.
> bitfield gives you the ability to do RMW "atomically" on object fields.
> For op flags I don't think it makes much sense.

Mostly because we get flag validation for free, whereas it would need to
be hand-rolled for u32. But also I don't know what will be useful in the
future. It would be silly to have to add another flags attribute as
bitfield because this time we actually care about toggling single bits
of an object.