Subject: Re: [PATCH net-next v2 8/8] net: mscc: PTP Hardware Clock (PHC) support

From: Antoine Tenart <[email-masked]>
Date: Tue, 9 Jul 2019 17:23:56 +0200

Hello Jakub,

On Mon, Jul 08, 2019 at 12:06:26PM -0700, Jakub Kicinski wrote:
> On Mon, 8 Jul 2019 10:48:09 +0200, Antoine Tenart wrote:
> > > > +	/* Commit back the result & save it */
> > > > +	memcpy(&ocelot->hwtstamp_config, &cfg, sizeof(cfg));
> > > > +	mutex_unlock(&ocelot->ptp_lock);
> > > > +
> > > > +	return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0;
> > > > +}
> > > >  
> > > > +static int ocelot_get_ts_info(struct net_device *dev,
> > > > +			      struct ethtool_ts_info *info)
> > > > +{
> > > > +	struct ocelot_port *ocelot_port = netdev_priv(dev);
> > > > +	struct ocelot *ocelot = ocelot_port->ocelot;
> > > > +	int ret;
> > > > +
> > > > +	if (!ocelot->ptp)
> > > > +		return -EOPNOTSUPP;  
> > > 
> > > Hmm.. why does software timestamping depend on PTP?  
> > 
> > Because it depends on the "PTP" register bank (and the "PTP" interrupt)
> > being described and available. This is why I named the flag 'ptp', but
> > it could be named 'timestamp' or 'ts' as well.
> 
> Right, but software timestamps are done by calling skb_tx_timestamp(skb)
> in the driver, no need for HW support there (software RX timestamp is
> handled by the stack).

I see, I should instead filter the flags based on this so that the s/w
ones still get set.

Thanks!
Antoine

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com