Re: [PATCH RFC net-next v8 06/13] net: Add struct kernel_ethtool_ts_info

From: Köry Maincent
Date: Mon Feb 19 2024 - 05:57:54 EST


On Fri, 16 Feb 2024 10:27:32 -0800
Rahul Rameshbabu <rrameshbabu@xxxxxxxxxx> wrote:

> > +/**
> > + * struct kernel_ethtool_ts_info - kernel copy of struct ethtool_ts_info
> > + * @cmd: command number = %ETHTOOL_GET_TS_INFO
> > + * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING
> > flags
> > + * @phc_index: device index of the associated PHC, or -1 if there is none
> > + * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration
> > values
> > + * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration
> > values
> > + */
> > +struct kernel_ethtool_ts_info {
> > + u32 cmd;
> > + u32 so_timestamping;
> > + int phc_index;
> > + enum hwtstamp_tx_types tx_types;
>
> I might just be terrible at reading code, but isn't this what
> tx_reserved in ethtool_ts_info is for? I feel like using one of the
> reserved memspaces for this enum removes the need to make
> kernel_ethtool_ts_info? I might be missing something obvious however.

I did it to prepare the introduction phc_qualifier in patch 12. I am not sure it
would be wise to put it under tx/rx_reserved field. IMHO create a new kernel
structure is cleaner for that than the hack of using one of the tx/rx_reserved
field.

Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com