From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <sdf@google.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com
Subject: Re: [PATCH net-next v2 1/4] tools: ynl: support byte-order in cli
Date: Fri, 24 Mar 2023 20:33:40 -0700 [thread overview]
Message-ID: <20230324203340.712824b8@kernel.org> (raw)
In-Reply-To: <20230324225656.3999785-2-sdf@google.com>
On Fri, 24 Mar 2023 15:56:53 -0700 Stanislav Fomichev wrote:
> @@ -250,7 +258,7 @@ genl_family_name_to_id = None
> if entry_attr.type == Netlink.CTRL_ATTR_MCAST_GRP_NAME:
> mcast_name = entry_attr.as_strz()
> elif entry_attr.type == Netlink.CTRL_ATTR_MCAST_GRP_ID:
> - mcast_id = entry_attr.as_u32()
> + mcast_id = entry_attr.as_u32(None)
I wonder if it's worth using a default value for the argument:
def as_u32(self, byte_order=None):
the number of Nones is very similar to number of meaningful args.
And only spec-based decoding needs the arg so new cases beyond
the 4 x2 are unlikely.
> - decoded = attr.as_u64()
> + decoded = attr.as_u64(attr_spec.get('byte-order'))
Could you add a field in class SpecAttr, like is_multi and read
a field instead of the get? I'm trying to avoid raw YAML access
outside of nlspec.py classes as much as possible.
next prev parent reply other threads:[~2023-03-25 3:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 22:56 [PATCH net-next v2 0/4] tools: ynl: fill in some gaps of ethtool spec Stanislav Fomichev
2023-03-24 22:56 ` [PATCH net-next v2 1/4] tools: ynl: support byte-order in cli Stanislav Fomichev
2023-03-25 3:33 ` Jakub Kicinski [this message]
2023-03-29 0:07 ` Stanislav Fomichev
2023-03-24 22:56 ` [PATCH net-next v2 2/4] tools: ynl: populate most of the ethtool spec Stanislav Fomichev
2023-03-24 22:56 ` [PATCH net-next v2 3/4] tools: ynl: replace print with NlError Stanislav Fomichev
2023-03-24 22:56 ` [PATCH net-next v2 4/4] tools: ynl: ethtool testing tool Stanislav Fomichev
2023-03-25 3:35 ` Jakub Kicinski
2023-03-29 0:06 ` Stanislav Fomichev
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=20230324203340.712824b8@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.