Skip to content

Commit 1261691

Browse files
jacob-kelleranguy11
authored andcommitted
ice: use ice_is_vf_trusted helper function
The ice_vc_cfg_promiscuous_mode_msg function directly checks ICE_VIRTCHNL_VF_CAP_PRIVILEGE, instead of using the existing helper function ice_is_vf_trusted. Switch this to use the helper function so that all trusted checks are consistent. This aids in any potential future refactor by ensuring consistent code. Signed-off-by: Jacob Keller <[email protected]> Tested-by: Konrad Jankowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 2b36944 commit 1261691

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,6 +3148,15 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)
31483148
return ret;
31493149
}
31503150

3151+
/**
3152+
* ice_is_vf_trusted
3153+
* @vf: pointer to the VF info
3154+
*/
3155+
static bool ice_is_vf_trusted(struct ice_vf *vf)
3156+
{
3157+
return test_bit(ICE_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);
3158+
}
3159+
31513160
/**
31523161
* ice_is_any_vf_in_promisc - check if any VF(s) are in promiscuous mode
31533162
* @pf: PF structure for accessing VF(s)
@@ -3212,7 +3221,7 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)
32123221
}
32133222

32143223
dev = ice_pf_to_dev(pf);
3215-
if (!test_bit(ICE_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) {
3224+
if (!ice_is_vf_trusted(vf)) {
32163225
dev_err(dev, "Unprivileged VF %d is attempting to configure promiscuous mode\n",
32173226
vf->vf_id);
32183227
/* Leave v_ret alone, lie to the VF on purpose. */
@@ -3862,15 +3871,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
38623871
NULL, 0);
38633872
}
38643873

3865-
/**
3866-
* ice_is_vf_trusted
3867-
* @vf: pointer to the VF info
3868-
*/
3869-
static bool ice_is_vf_trusted(struct ice_vf *vf)
3870-
{
3871-
return test_bit(ICE_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);
3872-
}
3873-
38743874
/**
38753875
* ice_can_vf_change_mac
38763876
* @vf: pointer to the VF info

0 commit comments

Comments
 (0)