Re: [RFC net-next 1/2] ethtool: add support for controling the type of adaptive coalescing

Michal Kubecek
2020-11-19T21:43:29Z

On Thu, Nov 19, 2020 at 05:15:57AM +0100, Andrew Lunn wrote:
> > diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h
> > index e2bf36e..e3458d9 100644
> > --- a/include/uapi/linux/ethtool_netlink.h
> > +++ b/include/uapi/linux/ethtool_netlink.h
> > @@ -366,6 +366,7 @@ enum {
> > ETHTOOL_A_COALESCE_TX_USECS_HIGH, /* u32 */
> > ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH, /* u32 */
> > ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL, /* u32 */
> > + ETHTOOL_A_COALESCE_USE_DIM, /* u8 */
>
> This appears to be a boolean? So /* flag */ would be better. Or do you
> think there is scope for a few different algorithms, and an enum would
> be better. If so, you should add the enum with the two current
> options.

NLA_FLAG would suffice for a read only bool attribute but if the
attribute is expected to be set, we need to distinguish three cases:
set to true, set to false and keep current value. That's why we use
NLA_U8 for read write bool attributes (0 false, anything else true and
attribute not present means leave untouched).

Michal