Message ID | 20170830065055.419-1-stefan.sorensen@spectralink.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
From: Stefan Sørensen <stefan.sorensen@spectralink.com> Date: Wed, 30 Aug 2017 08:50:55 +0200 > There is no reason to handle SIOC[GS]HWTSTAMP and return -EOPNOTSUPP when > CPTS is disabled, so just pass them on to the phy. This will allow PTP > timestamping on a capable phy by disabling CPTS. > > Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com> It should not be required to disable a Kconfig option just to get PHY timestamping to work properly. Rather, if the CPTS code returns -EOPNOTSUPP we should try to fallthrough to the PHY library based methods. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 30, 2017 at 02:47:45PM -0700, David Miller wrote: > It should not be required to disable a Kconfig option just to get PHY > timestamping to work properly. Well, if the MAC driver handles the ioctl and enables time stamping, then the PHY driver's time stamping remains disabled. We don't have a way to choose PHY time stamping at run time. > Rather, if the CPTS code returns -EOPNOTSUPP we should try to > fallthrough to the PHY library based methods. I agree that it would be better for the core (rather than the individual drivers) to handle this case. There are a few callers of .ndo_do_ioctl to consider. Besides dev_ifsioc() there is at least vlan_dev_ioctl() that needs to handle the EOPNOTSUPP. Thanks, Richard -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index db8a4bcfc6c7..4413a669fd79 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1791,16 +1791,6 @@ static int cpsw_hwtstamp_get(struct net_device *dev, struct ifreq *ifr) return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; } -#else -static int cpsw_hwtstamp_get(struct net_device *dev, struct ifreq *ifr) -{ - return -EOPNOTSUPP; -} - -static int cpsw_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) -{ - return -EOPNOTSUPP; -} #endif /*CONFIG_TI_CPTS*/ static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd) @@ -1813,10 +1803,12 @@ static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd) return -EINVAL; switch (cmd) { +#if IS_ENABLED(CONFIG_TI_CPTS) case SIOCSHWTSTAMP: return cpsw_hwtstamp_set(dev, req); case SIOCGHWTSTAMP: return cpsw_hwtstamp_get(dev, req); +#endif } if (!cpsw->slaves[slave_no].phy)
There is no reason to handle SIOC[GS]HWTSTAMP and return -EOPNOTSUPP when CPTS is disabled, so just pass them on to the phy. This will allow PTP timestamping on a capable phy by disabling CPTS. Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com> --- drivers/net/ethernet/ti/cpsw.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)