net/mlx5: Use read-modify-write when changing PCMR register values
authorEli Britstein <elibr@mellanox.com>
Mon, 21 Jan 2019 07:00:42 +0000 (09:00 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 22 Feb 2019 21:38:23 +0000 (13:38 -0800)
Currently changing a PCMR field is done by setting the field in a
zeroed buffer, zeroing other unrelated fields.
Fix this behaviour by modifying only the required field after first
reading the current register values, as a pre-step towards using more
fields in PCMR register.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/port.c

index b81542820528ca89748c31b88d45cf7a415a0889..55b30d21a73a410700432ae3780c70f90de15463 100644 (file)
@@ -785,7 +785,11 @@ static int mlx5_set_ports_check(struct mlx5_core_dev *mdev, u32 *in, int inlen)
 int mlx5_set_port_fcs(struct mlx5_core_dev *mdev, u8 enable)
 {
        u32 in[MLX5_ST_SZ_DW(pcmr_reg)] = {0};
+       int err;
 
+       err = mlx5_query_ports_check(mdev, in, sizeof(in));
+       if (err)
+               return err;
        MLX5_SET(pcmr_reg, in, local_port, 1);
        MLX5_SET(pcmr_reg, in, fcs_chk, enable);
        return mlx5_set_ports_check(mdev, in, sizeof(in));