net/mlx5: Use read-modify-write when changing PCMR register values
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>
This commit is contained in:
parent
2fce40a592
commit
bfedc645de
|
@ -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)
|
int mlx5_set_port_fcs(struct mlx5_core_dev *mdev, u8 enable)
|
||||||
{
|
{
|
||||||
u32 in[MLX5_ST_SZ_DW(pcmr_reg)] = {0};
|
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, local_port, 1);
|
||||||
MLX5_SET(pcmr_reg, in, fcs_chk, enable);
|
MLX5_SET(pcmr_reg, in, fcs_chk, enable);
|
||||||
return mlx5_set_ports_check(mdev, in, sizeof(in));
|
return mlx5_set_ports_check(mdev, in, sizeof(in));
|
||||||
|
|
Loading…
Reference in New Issue