[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKH8qBvPKdRPZpTiihZKhLixcbSyp-UPAOM+0_TuFHOUruSFSQ@mail.gmail.com>
Date: Tue, 28 Mar 2023 17:07:01 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com
Subject: Re: [PATCH net-next v2 1/4] tools: ynl: support byte-order in cli
On Fri, Mar 24, 2023 at 8:33 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> 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.
Sure, will do this and the above suggestions!
Powered by blists - more mailing lists