Skip to content

Commit 4b0a3ff

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dsa: implement get_ts_stats ethtool operation for user ports
Integrate with the standard infrastructure for reporting hardware packet timestamping statistics. Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6a128cd commit 4b0a3ff

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/net/dsa.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,8 @@ struct dsa_switch_ops {
906906
void (*get_rmon_stats)(struct dsa_switch *ds, int port,
907907
struct ethtool_rmon_stats *rmon_stats,
908908
const struct ethtool_rmon_hist_range **ranges);
909+
void (*get_ts_stats)(struct dsa_switch *ds, int port,
910+
struct ethtool_ts_stats *ts_stats);
909911
void (*get_stats64)(struct dsa_switch *ds, int port,
910912
struct rtnl_link_stats64 *s);
911913
void (*get_pause_stats)(struct dsa_switch *ds, int port,

net/dsa/user.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,16 @@ dsa_user_get_rmon_stats(struct net_device *dev,
11501150
ds->ops->get_rmon_stats(ds, dp->index, rmon_stats, ranges);
11511151
}
11521152

1153+
static void dsa_user_get_ts_stats(struct net_device *dev,
1154+
struct ethtool_ts_stats *ts_stats)
1155+
{
1156+
struct dsa_port *dp = dsa_user_to_port(dev);
1157+
struct dsa_switch *ds = dp->ds;
1158+
1159+
if (ds->ops->get_ts_stats)
1160+
ds->ops->get_ts_stats(ds, dp->index, ts_stats);
1161+
}
1162+
11531163
static void dsa_user_net_selftest(struct net_device *ndev,
11541164
struct ethtool_test *etest, u64 *buf)
11551165
{
@@ -2501,6 +2511,7 @@ static const struct ethtool_ops dsa_user_ethtool_ops = {
25012511
.get_eth_mac_stats = dsa_user_get_eth_mac_stats,
25022512
.get_eth_ctrl_stats = dsa_user_get_eth_ctrl_stats,
25032513
.get_rmon_stats = dsa_user_get_rmon_stats,
2514+
.get_ts_stats = dsa_user_get_ts_stats,
25042515
.set_wol = dsa_user_set_wol,
25052516
.get_wol = dsa_user_get_wol,
25062517
.set_eee = dsa_user_set_eee,

0 commit comments

Comments
 (0)