Skip to content

Commit ab118da

Browse files
Leon RomanovskySaeed Mahameed
authored andcommitted
net/mlx5: Don't write read-only fields in MODIFY_HCA_VPORT_CONTEXT command
The MODIFY_HCA_VPORT_CONTEXT uses field_selector to mask fields needed to be written, other fields are required to be zero according to the HW specification. The supported fields are controlled by bitfield and limited to vport state, node and port GUIDs. Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 3243e04 commit ab118da

File tree

1 file changed

+7
-20
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+7
-20
lines changed

drivers/net/ethernet/mellanox/mlx5/core/vport.c

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,26 +1064,13 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev,
10641064

10651065
ctx = MLX5_ADDR_OF(modify_hca_vport_context_in, in, hca_vport_context);
10661066
MLX5_SET(hca_vport_context, ctx, field_select, req->field_select);
1067-
MLX5_SET(hca_vport_context, ctx, sm_virt_aware, req->sm_virt_aware);
1068-
MLX5_SET(hca_vport_context, ctx, has_smi, req->has_smi);
1069-
MLX5_SET(hca_vport_context, ctx, has_raw, req->has_raw);
1070-
MLX5_SET(hca_vport_context, ctx, vport_state_policy, req->policy);
1071-
MLX5_SET(hca_vport_context, ctx, port_physical_state, req->phys_state);
1072-
MLX5_SET(hca_vport_context, ctx, vport_state, req->vport_state);
1073-
MLX5_SET64(hca_vport_context, ctx, port_guid, req->port_guid);
1074-
MLX5_SET64(hca_vport_context, ctx, node_guid, req->node_guid);
1075-
MLX5_SET(hca_vport_context, ctx, cap_mask1, req->cap_mask1);
1076-
MLX5_SET(hca_vport_context, ctx, cap_mask1_field_select, req->cap_mask1_perm);
1077-
MLX5_SET(hca_vport_context, ctx, cap_mask2, req->cap_mask2);
1078-
MLX5_SET(hca_vport_context, ctx, cap_mask2_field_select, req->cap_mask2_perm);
1079-
MLX5_SET(hca_vport_context, ctx, lid, req->lid);
1080-
MLX5_SET(hca_vport_context, ctx, init_type_reply, req->init_type_reply);
1081-
MLX5_SET(hca_vport_context, ctx, lmc, req->lmc);
1082-
MLX5_SET(hca_vport_context, ctx, subnet_timeout, req->subnet_timeout);
1083-
MLX5_SET(hca_vport_context, ctx, sm_lid, req->sm_lid);
1084-
MLX5_SET(hca_vport_context, ctx, sm_sl, req->sm_sl);
1085-
MLX5_SET(hca_vport_context, ctx, qkey_violation_counter, req->qkey_violation_counter);
1086-
MLX5_SET(hca_vport_context, ctx, pkey_violation_counter, req->pkey_violation_counter);
1067+
if (req->field_select & MLX5_HCA_VPORT_SEL_STATE_POLICY)
1068+
MLX5_SET(hca_vport_context, ctx, vport_state_policy,
1069+
req->policy);
1070+
if (req->field_select & MLX5_HCA_VPORT_SEL_PORT_GUID)
1071+
MLX5_SET64(hca_vport_context, ctx, port_guid, req->port_guid);
1072+
if (req->field_select & MLX5_HCA_VPORT_SEL_NODE_GUID)
1073+
MLX5_SET64(hca_vport_context, ctx, node_guid, req->node_guid);
10871074
err = mlx5_cmd_exec(dev, in, in_sz, out, sizeof(out));
10881075
ex:
10891076
kfree(in);

0 commit comments

Comments
 (0)