Re: [PATCH net-next v5 14/22] ethtool: provide timestamping information in GET_INFO request

Michal Kubecek
2019-03-28T10:03:54Z

On Wed, Mar 27, 2019 at 08:36:53PM -0700, Florian Fainelli wrote:
>
>
> On 3/25/2019 10:08 AM, Michal Kubecek wrote:
> > Add timestamping information as provided by ETHTOOL_GET_TS_INFO ioctl
> > command in GET_INFO reply if ETH_INFO_IM_TSINFO flag is set in the request.
> >
> > Add constants for counts of HWTSTAMP_TX_* and HWTSTAM_FILTER_* constants
> > and provide symbolic names for timestamping related values so that they can
> > be retrieved in GET_STRSET and GET_INFO requests.
> >
> > Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> > ---
>
> [snip]
>
> > +int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)
> > +{
> > + const struct ethtool_ops *ops = dev->ethtool_ops;
> > + struct phy_device *phydev = dev->phydev;
> > + int err = 0;
> > +
> > + memset(info, 0, sizeof(*info));
> > + info->cmd = ETHTOOL_GET_TS_INFO;
> > +
> > + if (phydev && phydev->drv && phydev->drv->ts_info) {
> > + err = phydev->drv->ts_info(phydev, info);
> > + } else if (ops->get_ts_info) {
> > + err = ops->get_ts_info(dev, info);
> > + } else {
> > + info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
> > + SOF_TIMESTAMPING_SOFTWARE;
> > + info->phc_index = -1;
> > + }
>
> We don't have to solve this just yet, but this is the type of logic that
> we want to be able to change in the future, there are a number of things
> in the current ethtool code where, say, we always prefer PHY time
> stamping over MAC time stamping when there should be a choice if both
> are supported.

For the record, this is just a code block carved out of existing
ethtool_ts_info() where the only difference is that info is a pointer
rather than a structure itself.

> I don't know if you maintain a TODO for after when this patch series get
> merged, but we may want to start one :)

I have some informal TODO locally; some ideas are in the cover letter,
I also mentioned some in my talk last week. Perhaps it is time to make
it a publicly visible document and start collecting ideas.

Michal