Skip to content

Commit d94dbdc

Browse files
bcreeley13anguy11
authored andcommitted
ice: Fix ice_cfg_rdma_fltr() to only update relevant fields
The current implementation causes ice_vsi_update() to update all VSI fields based on the cached VSI context. This also assumes that the ICE_AQ_VSI_PROP_Q_OPT_VALID bit is set. This can cause problems if the VSI context is not correctly synced by the driver. Fix this by only updating the fields that correspond to ICE_AQ_VSI_PROP_Q_OPT_VALID. Also, make sure to save the updated result in the cached VSI context on success. Fixes: 348048e ("ice: Implement iidc operations") Co-developed-by: Robert Malz <[email protected]> Signed-off-by: Robert Malz <[email protected]> Signed-off-by: Brett Creeley <[email protected]> Signed-off-by: Jesse Brandeburg <[email protected]> Reviewed-by: Piotr Raczynski <[email protected]> Tested-by: Jakub Andrysiak <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 66ceaa4 commit d94dbdc

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

drivers/net/ethernet/intel/ice/ice_switch.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,18 +1780,36 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
17801780
int
17811781
ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable)
17821782
{
1783-
struct ice_vsi_ctx *ctx;
1783+
struct ice_vsi_ctx *ctx, *cached_ctx;
1784+
int status;
1785+
1786+
cached_ctx = ice_get_vsi_ctx(hw, vsi_handle);
1787+
if (!cached_ctx)
1788+
return -ENOENT;
17841789

1785-
ctx = ice_get_vsi_ctx(hw, vsi_handle);
1790+
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
17861791
if (!ctx)
1787-
return -EIO;
1792+
return -ENOMEM;
1793+
1794+
ctx->info.q_opt_rss = cached_ctx->info.q_opt_rss;
1795+
ctx->info.q_opt_tc = cached_ctx->info.q_opt_tc;
1796+
ctx->info.q_opt_flags = cached_ctx->info.q_opt_flags;
1797+
1798+
ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_Q_OPT_VALID);
17881799

17891800
if (enable)
17901801
ctx->info.q_opt_flags |= ICE_AQ_VSI_Q_OPT_PE_FLTR_EN;
17911802
else
17921803
ctx->info.q_opt_flags &= ~ICE_AQ_VSI_Q_OPT_PE_FLTR_EN;
17931804

1794-
return ice_update_vsi(hw, vsi_handle, ctx, NULL);
1805+
status = ice_update_vsi(hw, vsi_handle, ctx, NULL);
1806+
if (!status) {
1807+
cached_ctx->info.q_opt_flags = ctx->info.q_opt_flags;
1808+
cached_ctx->info.valid_sections |= ctx->info.valid_sections;
1809+
}
1810+
1811+
kfree(ctx);
1812+
return status;
17951813
}
17961814

17971815
/**

0 commit comments

Comments
 (0)