vlan: also check phy_driver ts_info for vlan's real device
Subsystems (2)
PATCH 1/1 vlan: also check phy_driver ts_info for vlan's real device
Just like function ethtool_get_ts_info(), we should also consider the phy_driver ts_info call back. For example, driver dp83640.
--- net/8021q/vlan_dev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/8021q/vlan_dev.c +5 -1
@@ -29,6 +29,7 @@#include <linux/net_tstamp.h> #include <linux/etherdevice.h> #include <linux/ethtool.h> +#include <linux/phy.h> #include <net/arp.h> #include <net/switchdev.h>
@@ -665,8 +666,11 @@ static int vlan_ethtool_get_ts_info(struct net_device *dev, {const struct vlan_dev_priv *vlan =vlan_dev_priv (dev);const struct ethtool_ops *ops = vlan->real_dev->ethtool_ops; +struct phy_device *phydev = vlan->real_dev->phydev; -if (ops->get_ts_info) { +if (phydev && phydev->drv && phydev->drv->ts_info) { +return phydev->drv->ts_info (phydev, info); + }else if (ops->get_ts_info) {return ops->get_ts_info (vlan->real_dev, info); }else { info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
Signature · 1 line
2.5.5
Quoted 3 lines · Andrew Lunn
Would it not be better to just call
ethtool_get_ts_info()on the real device? That would then also deal with the case that the 'real' device is another virtual device stacked on top of a real device.
That won't work.
The returned 'ethtool_ts_info' is on the stack of ethtool_get_ts_info(). Both the top level and the inner call to will call copy_to_user(), but the top level will clobber the correct result with zeros.
Thanks,
Richard
Quoted 2 lines · Hangbin Liu
Just like function
ethtool_get_ts_info(), we should also consider thephy_driverts_infocall back. For example, driver dp83640.
Hi Hangbin
Would it not be better to just call ethtool_get_ts_info() on the real device? That would then also deal with the case that the 'real' device is another virtual device stacked on top of a real device.
Andrew
Quoted 11 lines · Richard Cochran
Quoted 3 lines · Andrew Lunn
Would it not be better to just call
ethtool_get_ts_info()on the real device? That would then also deal with the case that the 'real' device is another virtual device stacked on top of a real device.That won't work.
The returned '
ethtool_ts_info' is on the stack ofethtool_get_ts_info(). Both the top level and the inner call to will callcopy_to_user(), but the top level will clobber the correct result with zeros.
Ah, O.K.
But it still seems like there should be one central place to handle a device. Maybe factor out the part which deals with getting the information from the device, from the part that copies it to userspace?
Andrew
David Miller
maintainerFrom: Hangbin Liu <[email protected]>
Date: Fri, 30 Mar 2018 09:44:00 +0800
Quoted 6 lines
Just like function
ethtool_get_ts_info(), we should also consider thephy_driverts_infocall back. For example, driver dp83640.Fixes 37dd9255b2f6 ("vlan: Pass ethtool get_ts_info queries to real device.")Acked-by Richard Cochran <[email protected]>Signed-off-by Hangbin Liu <[email protected]>
Applied and queued up for -stable.