mirror of https://gitee.com/openkylin/linux.git
vlan: Pass ethtool get_ts_info queries to real device.
Commit a6111d3c
"vlan: Pass SIOC[SG]HWTSTAMP ioctls to real device"
intended to enable hardware time stamping on VLAN interfaces, but
passing SIOCSHWTSTAMP is only half of the story. This patch adds
the second half, by letting user space find out the time stamping
capabilities of the device backing a VLAN interface.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cd91a88b99
commit
37dd9255b2
|
@ -26,6 +26,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
|
#include <linux/net_tstamp.h>
|
||||||
#include <linux/etherdevice.h>
|
#include <linux/etherdevice.h>
|
||||||
#include <linux/ethtool.h>
|
#include <linux/ethtool.h>
|
||||||
#include <net/arp.h>
|
#include <net/arp.h>
|
||||||
|
@ -669,6 +670,23 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev,
|
||||||
strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
|
strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vlan_ethtool_get_ts_info(struct net_device *dev,
|
||||||
|
struct ethtool_ts_info *info)
|
||||||
|
{
|
||||||
|
const struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
|
||||||
|
const struct ethtool_ops *ops = vlan->real_dev->ethtool_ops;
|
||||||
|
|
||||||
|
if (ops->get_ts_info) {
|
||||||
|
return ops->get_ts_info(vlan->real_dev, info);
|
||||||
|
} else {
|
||||||
|
info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
|
||||||
|
SOF_TIMESTAMPING_SOFTWARE;
|
||||||
|
info->phc_index = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
||||||
{
|
{
|
||||||
struct vlan_pcpu_stats *p;
|
struct vlan_pcpu_stats *p;
|
||||||
|
@ -752,6 +770,7 @@ static const struct ethtool_ops vlan_ethtool_ops = {
|
||||||
.get_settings = vlan_ethtool_get_settings,
|
.get_settings = vlan_ethtool_get_settings,
|
||||||
.get_drvinfo = vlan_ethtool_get_drvinfo,
|
.get_drvinfo = vlan_ethtool_get_drvinfo,
|
||||||
.get_link = ethtool_op_get_link,
|
.get_link = ethtool_op_get_link,
|
||||||
|
.get_ts_info = vlan_ethtool_get_ts_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct net_device_ops vlan_netdev_ops = {
|
static const struct net_device_ops vlan_netdev_ops = {
|
||||||
|
|
Loading…
Reference in New Issue