Re: [RFC PATCH net-next 1/7] net: ethtool: netlink: introduce ethnl_update_bool()

Vladimir Oltean
2022-08-17T12:00:44Z

On Wed, Aug 17, 2022 at 02:52:56PM +0300, Vladimir Oltean wrote:
> On Wed, Aug 17, 2022 at 01:27:29PM +0200, Michal Kubecek wrote:
> > On Wed, Aug 17, 2022 at 01:29:14AM +0300, Vladimir Oltean wrote:
> > > For a reason I can't really understand, ethnl_update_bool32() exists,
> > > but the plain function that operates on a boolean value kept in an
> > > actual u8 netlink attribute doesn't.
> >
> > I can explain that: at the moment these helpers were introduced, only
> > members of traditional structures shared with ioctl interface were
> > updated and all attributes which were booleans logically were
> > represented as u32 in them so that no other helper was needed back then.
>
> Thanks, but the internal data structures of the kernel did not
> necessitate boolean netlink attributes to be promoted to u32 just
> because the ioctl interface did it that way; or did they?
>
> Or otherwise said, is there a technical requirement that if a boolean is
> passed to the kernel as u32 via ioctl, it should be passed as u32 via
> netlink too?

Ah, don't mind me... By the time I wrote this email, I forgot that
ethnl_update_bool32() also calls nla_get_u8(). All clear now.