Re: [RFC PATCH net-next v2 10/17] ethtool: implement GET_SETTINGS message

From: Michal Kubecek
Date: Mon Jul 30 2018 - 15:42:48 EST


On Mon, Jul 30, 2018 at 09:09:41PM +0200, Andrew Lunn wrote:
> > +Response contents:
> > +
> > + ETHA_SETTINGS_LINK (u32) link state
>
> > + [ETHA_SETTINGS_LINK] = { .type = NLA_FLAG },
>
> Is this correct?

NLA_FLAG is wrong, we need three states: on/off/unknown for "get"
replies and on/off/keep for "set" requests.

> The link is either up or down. So a u32 seems a bit big.

I tend to use u32 everywhere with some obvious exceptions. The reason is
that netlink attributes are padded to 32 bits so that no matter if you
use u8, u16 or u32, the attribute still ends up taking 8 bytes. But yes,
this looks like an obvious exception where u8 wouldn't mean any risk of
running out of values one day.

Michal Kubecek