net/mlx5e: Toggle link only after modifying port parameters
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_ethtool.c
index c4be3941957ec23eb5f05a721bf2165ad12eaf81..d0d3dcfb4de9a7edd38af0a019c2f687edadbc0a 100644 (file)
@@ -795,7 +795,6 @@ static int mlx5e_set_settings(struct net_device *netdev,
        u32 link_modes;
        u32 speed;
        u32 eth_proto_cap, eth_proto_admin;
-       enum mlx5_port_status ps;
        int err;
 
        speed = ethtool_cmd_speed(cmd);
@@ -829,12 +828,8 @@ static int mlx5e_set_settings(struct net_device *netdev,
        if (link_modes == eth_proto_admin)
                goto out;
 
-       mlx5_query_port_admin_status(mdev, &ps);
-       if (ps == MLX5_PORT_UP)
-               mlx5_set_port_admin_status(mdev, MLX5_PORT_DOWN);
        mlx5_set_port_proto(mdev, link_modes, MLX5_PTYS_EN);
-       if (ps == MLX5_PORT_UP)
-               mlx5_set_port_admin_status(mdev, MLX5_PORT_UP);
+       mlx5_toggle_port_link(mdev);
 
 out:
        return err;