diff options
author | Brandon Streiff <brandon.streiff@ni.com> | 2018-02-13 19:07:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-14 14:33:37 -0500 |
commit | 0336369d3a4d65c9332476b618ff3bb9b41045e1 (patch) | |
tree | eae9faa3c3a54f4c24205f0891c62eb282426dd2 /net/dsa | |
parent | 4eb3be2937670aecf8bbd52a95b6e9238a9bd7aa (diff) |
net: dsa: forward hardware timestamping ioctls to switch driver
This patch adds support to the dsa slave network device so that
switch drivers can implement the SIOC[GS]HWTSTAMP ioctls and the
ethtool timestamp-info interface.
Signed-off-by: Brandon Streiff <brandon.streiff@ni.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index f52307296de4..935d93f0d36c 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -255,6 +255,22 @@ dsa_slave_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb, | |||
255 | 255 | ||
256 | static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 256 | static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
257 | { | 257 | { |
258 | struct dsa_slave_priv *p = netdev_priv(dev); | ||
259 | struct dsa_switch *ds = p->dp->ds; | ||
260 | int port = p->dp->index; | ||
261 | |||
262 | /* Pass through to switch driver if it supports timestamping */ | ||
263 | switch (cmd) { | ||
264 | case SIOCGHWTSTAMP: | ||
265 | if (ds->ops->port_hwtstamp_get) | ||
266 | return ds->ops->port_hwtstamp_get(ds, port, ifr); | ||
267 | break; | ||
268 | case SIOCSHWTSTAMP: | ||
269 | if (ds->ops->port_hwtstamp_set) | ||
270 | return ds->ops->port_hwtstamp_set(ds, port, ifr); | ||
271 | break; | ||
272 | } | ||
273 | |||
258 | if (!dev->phydev) | 274 | if (!dev->phydev) |
259 | return -ENODEV; | 275 | return -ENODEV; |
260 | 276 | ||
@@ -918,6 +934,18 @@ static int dsa_slave_set_rxnfc(struct net_device *dev, | |||
918 | return ds->ops->set_rxnfc(ds, dp->index, nfc); | 934 | return ds->ops->set_rxnfc(ds, dp->index, nfc); |
919 | } | 935 | } |
920 | 936 | ||
937 | static int dsa_slave_get_ts_info(struct net_device *dev, | ||
938 | struct ethtool_ts_info *ts) | ||
939 | { | ||
940 | struct dsa_slave_priv *p = netdev_priv(dev); | ||
941 | struct dsa_switch *ds = p->dp->ds; | ||
942 | |||
943 | if (!ds->ops->get_ts_info) | ||
944 | return -EOPNOTSUPP; | ||
945 | |||
946 | return ds->ops->get_ts_info(ds, p->dp->index, ts); | ||
947 | } | ||
948 | |||
921 | static const struct ethtool_ops dsa_slave_ethtool_ops = { | 949 | static const struct ethtool_ops dsa_slave_ethtool_ops = { |
922 | .get_drvinfo = dsa_slave_get_drvinfo, | 950 | .get_drvinfo = dsa_slave_get_drvinfo, |
923 | .get_regs_len = dsa_slave_get_regs_len, | 951 | .get_regs_len = dsa_slave_get_regs_len, |
@@ -938,6 +966,7 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = { | |||
938 | .set_link_ksettings = phy_ethtool_set_link_ksettings, | 966 | .set_link_ksettings = phy_ethtool_set_link_ksettings, |
939 | .get_rxnfc = dsa_slave_get_rxnfc, | 967 | .get_rxnfc = dsa_slave_get_rxnfc, |
940 | .set_rxnfc = dsa_slave_set_rxnfc, | 968 | .set_rxnfc = dsa_slave_set_rxnfc, |
969 | .get_ts_info = dsa_slave_get_ts_info, | ||
941 | }; | 970 | }; |
942 | 971 | ||
943 | /* legacy way, bypassing the bridge *****************************************/ | 972 | /* legacy way, bypassing the bridge *****************************************/ |