Subject: Re: [PATCH net-next v2 7/7] net: nexthop: Expose nexthop group HW stats to user space

From: Petr Machata <[email-masked]>
Date: Fri, 1 Mar 2024 18:22:55 +0100

David Ahern <[email-masked]> writes:

> On 2/29/24 11:16 AM, Petr Machata wrote:
>> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
>> index 15f108c440ae..169a003cc855 100644
>> --- a/net/ipv4/nexthop.c
>> +++ b/net/ipv4/nexthop.c
>> @@ -43,7 +43,8 @@ static const struct nla_policy rtm_nh_policy_new[] = {
>>  static const struct nla_policy rtm_nh_policy_get[] = {
>>  	[NHA_ID]		= { .type = NLA_U32 },
>>  	[NHA_OP_FLAGS]		= NLA_POLICY_MASK(NLA_U32,
>> -						  NHA_OP_FLAG_DUMP_STATS),
>> +						  NHA_OP_FLAG_DUMP_STATS |
>> +						  NHA_OP_FLAG_DUMP_HW_STATS),
>>  };
>>  
>>  static const struct nla_policy rtm_nh_policy_del[] = {
>> @@ -56,7 +57,8 @@ static const struct nla_policy rtm_nh_policy_dump[] = {
>>  	[NHA_MASTER]		= { .type = NLA_U32 },
>>  	[NHA_FDB]		= { .type = NLA_FLAG },
>>  	[NHA_OP_FLAGS]		= NLA_POLICY_MASK(NLA_U32,
>> -						  NHA_OP_FLAG_DUMP_STATS),
>> +						  NHA_OP_FLAG_DUMP_STATS |
>> +						  NHA_OP_FLAG_DUMP_HW_STATS),
>
> 2 instances of the same mask; worth giving it a name.

OK. I'll stick this somewhere above the policies:

#define NHA_OP_FLAGS_DUMP_STATS_ALL (NHA_OP_FLAG_DUMP_STATS | \
				     NHA_OP_FLAG_DUMP_HW_STATS)