From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Jiri Pirko <jiri@resnulli.us>,
Jacob Keller <jacob.e.keller@intel.com>,
Stanislav Fomichev <sdf@google.com>,
donald.hunter@redhat.com
Subject: Re: [PATCH net-next v1] tools/net/ynl: Add extack policy attribute decoding
Date: Thu, 28 Mar 2024 15:32:04 +0000 [thread overview]
Message-ID: <m2sf0ajrt7.fsf@gmail.com> (raw)
In-Reply-To: <20240327174731.6933ed21@kernel.org> (Jakub Kicinski's message of "Wed, 27 Mar 2024 17:47:31 -0700")
Jakub Kicinski <kuba@kernel.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
>>
prev parent reply other threads:[~2024-03-28 15:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 16:03 [PATCH net-next v1] tools/net/ynl: Add extack policy attribute decoding Donald Hunter
2024-03-28 0:47 ` Jakub Kicinski
2024-03-28 15:32 ` Donald Hunter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2sf0ajrt7.fsf@gmail.com \
--to=donald.hunter@gmail.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@redhat.com \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).