aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
diff options
context:
space:
mode:
authorShalom Toledo <shalomt@mellanox.com>2019-07-04 10:07:39 +0300
committerDavid S. Miller <davem@davemloft.net>2019-07-05 15:28:57 -0700
commit5fc1733897bff10b2a9d1fb1eae775c96cefa333 (patch)
treee7dbe75d1da0531c8b00fa72bc04fbead100ffb1 /drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
parenteceed3b1453d4115b4256ea1d24fab7b6eb7ba1f (diff)
downloadkernel_replicant_linux-5fc1733897bff10b2a9d1fb1eae775c96cefa333.tar.gz
kernel_replicant_linux-5fc1733897bff10b2a9d1fb1eae775c96cefa333.tar.bz2
kernel_replicant_linux-5fc1733897bff10b2a9d1fb1eae775c96cefa333.zip
mlxsw: spectrum: Set up PTP shaper when port status has changed
When getting port up down event (PUDE), change the PTP shaper configuration based on hardware time stamping on/off and the port's speed. Signed-off-by: Shalom Toledo <shalomt@mellanox.com> Reviewed-by: Petr Machata <petrm@mellanox.com> Acked-by: Jiri Pirko <jiri@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_ptp.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
index 49aba0ce896b..0f7c4bd22a45 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
@@ -1000,6 +1000,23 @@ static int mlxsw_sp1_ptp_port_shaper_check(struct mlxsw_sp_port *mlxsw_sp_port)
return mlxsw_sp1_ptp_port_shaper_set(mlxsw_sp_port, ptps);
}
+void mlxsw_sp1_ptp_shaper_work(struct work_struct *work)
+{
+ struct delayed_work *dwork = to_delayed_work(work);
+ struct mlxsw_sp_port *mlxsw_sp_port;
+ int err;
+
+ mlxsw_sp_port = container_of(dwork, struct mlxsw_sp_port,
+ ptp.shaper_dw);
+
+ if (!mlxsw_sp1_ptp_hwtstamp_enabled(mlxsw_sp_port))
+ return;
+
+ err = mlxsw_sp1_ptp_port_shaper_check(mlxsw_sp_port);
+ if (err)
+ netdev_err(mlxsw_sp_port->dev, "Failed to set up PTP shaper\n");
+}
+
int mlxsw_sp1_ptp_hwtstamp_set(struct mlxsw_sp_port *mlxsw_sp_port,
struct hwtstamp_config *config)
{