net/mlx5e: Toggle link only after modifying port parameters
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / port.c
index 3e35611b19c30d05bc5530f06cab49743f9aa102..1562e7310f5b7a20a19dffb261f4ab970c0b8bfc 100644 (file)
@@ -222,6 +222,18 @@ int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 proto_admin,
 }
 EXPORT_SYMBOL_GPL(mlx5_set_port_proto);
 
+/* This function should be used after setting a port register only */
+void mlx5_toggle_port_link(struct mlx5_core_dev *dev)
+{
+       enum mlx5_port_status ps;
+
+       mlx5_query_port_admin_status(dev, &ps);
+       mlx5_set_port_admin_status(dev, MLX5_PORT_DOWN);
+       if (ps == MLX5_PORT_UP)
+               mlx5_set_port_admin_status(dev, MLX5_PORT_UP);
+}
+EXPORT_SYMBOL_GPL(mlx5_toggle_port_link);
+
 int mlx5_set_port_admin_status(struct mlx5_core_dev *dev,
                               enum mlx5_port_status status)
 {