[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <m2sf0ajrt7.fsf@gmail.com>
Date: Thu, 28 Mar 2024 15:32:04 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Jiri
Pirko <jiri@...nulli.us>, Jacob Keller <jacob.e.keller@...el.com>,
Stanislav Fomichev <sdf@...gle.com>, donald.hunter@...hat.com
Subject: Re: [PATCH net-next v1] tools/net/ynl: Add extack policy attribute
decoding
Jakub Kicinski <kuba@...nel.org> writes:
> On Wed, 27 Mar 2024 16:03:02 +0000 Donald Hunter wrote:
>
> Nice!
>
> Some optional comments below...
>
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_MIN_VALUE_S:
>> + policy['min-value-s'] = attr.as_scalar('s64')
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_MAX_VALUE_S:
>> + policy['max-value-s'] = attr.as_scalar('s64')
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_MIN_VALUE_U:
>> + policy['min-value-u'] = attr.as_scalar('u64')
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_MAX_VALUE_U:
>> + policy['max-value-u'] = attr.as_scalar('u64')
>
> I think the signed / unsigned thing is primarily so that decode knows
> if its s64 or u64. Is it useful for the person seeing the decoded
> extack whether max was signed or unsigned?
>
> IOW are we losing any useful info if we stop the -u / -s suffixes?
>
> Otherwise I'd vote lose them.
Yep, makes sense, I'll collapse these into min-value and max-value.
>
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_MIN_LENGTH:
>> + policy['min-length'] = attr.as_scalar('u32')
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_MAX_LENGTH:
>> + policy['max-length'] = attr.as_scalar('u32')
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_POLICY_IDX:
>> + policy['policy-idx'] = attr.as_scalar('u32')
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE:
>> + policy['policy-maxtype'] = attr.as_scalar('u32')
>
> I don't think these two (policy-..) can actually pop up in extack.
> They are for cross-referencing nested policies in policy dumps.
> extack only carries constraints local to the attr.
>
> Up to you if you want to keep them.
Sure, I can drop these.
>
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_BITFIELD32_MASK:
>> + policy['bitfield32-mask'] = attr.as_scalar('u32')
>> + elif attr.type == Netlink.NL_POLICY_TYPE_ATTR_MASK:
>> + policy['mask'] = attr.as_scalar('u64')
>> + return policy
>> +
>> def cmd(self):
>> return self.nl_type
>>
Powered by blists - more mailing lists