summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2019-08-28 18:54:37 +0300
committerDavid S. Miller <davem@davemloft.net>2019-08-28 18:24:04 -0700
commitdc4f3eb08a123918e63843c6b10759598e7baf31 (patch)
treecb1429713cc1e92b871de63978e027ed5566470a /drivers/net/ethernet/mellanox/mlxsw/spectrum.h
parent45bd634131fd17d5761876e09f81b921534bc2c4 (diff)
mlxsw: spectrum_ptp: Add counters for GC events
On Spectrum-1, timestamped PTP packets and the corresponding timestamps need to be kept in caches until both are available, at which point they are matched up and packets forwarded as appropriate. However, not all packets will ever see their timestamp, and not all timestamps will ever see their packet. It is necessary to dispose of such abandoned entries, so a garbage collector was introduced in commit 5d23e4159772 ("mlxsw: spectrum: PTP: Garbage-collect unmatched entries"). If these GC events happen often, it is a sign of a problem. However because this whole mechanism is taking place behind the scenes, there is no direct way to determine whether garbage collection took place. Therefore to fix this, on Spectrum-1 only, expose four artificial ethtool counters for the GC events: GCd timestamps and packets, in TX and RX directions. Cc: Richard Cochran <richardcochran@gmail.com> Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum.h')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index 12f14a42b43a..b2a0028b1694 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -225,6 +225,16 @@ struct mlxsw_sp_port_xstats {
u64 tx_packets[IEEE_8021QAZ_MAX_TCS];
};
+struct mlxsw_sp_ptp_port_dir_stats {
+ u64 packets;
+ u64 timestamps;
+};
+
+struct mlxsw_sp_ptp_port_stats {
+ struct mlxsw_sp_ptp_port_dir_stats rx_gcd;
+ struct mlxsw_sp_ptp_port_dir_stats tx_gcd;
+};
+
struct mlxsw_sp_port {
struct net_device *dev;
struct mlxsw_sp_port_pcpu_stats __percpu *pcpu_stats;
@@ -271,6 +281,7 @@ struct mlxsw_sp_port {
struct hwtstamp_config hwtstamp_config;
u16 ing_types;
u16 egr_types;
+ struct mlxsw_sp_ptp_port_stats stats;
} ptp;
};