Skip to content

Commit

Permalink
ice: check if VF exists before mode check
Browse files Browse the repository at this point in the history
[ Upstream commit 83b49e7 ]

Setting trust on VF should return EINVAL when there is no VF. Move
checking for switchdev mode after checking if VF exists.

Fixes: c54d209 ("ice: Wait for VF to be reset/ready before configuration")
Signed-off-by: Michal Swiatkowski <[email protected]>
Signed-off-by: Kalyan Kodamagula <[email protected]>
Tested-by: Sujai Buvaneswaran <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
mswiatko authored and gregkh committed Mar 30, 2023
1 parent 90c229d commit ad62a28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/intel/ice/ice_sriov.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,15 +1384,15 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted)
struct ice_vf *vf;
int ret;

vf = ice_get_vf_by_id(pf, vf_id);
if (!vf)
return -EINVAL;

if (ice_is_eswitch_mode_switchdev(pf)) {
dev_info(ice_pf_to_dev(pf), "Trusted VF is forbidden in switchdev mode\n");
return -EOPNOTSUPP;
}

vf = ice_get_vf_by_id(pf, vf_id);
if (!vf)
return -EINVAL;

ret = ice_check_vf_ready_for_cfg(vf);
if (ret)
goto out_put_vf;
Expand Down

0 comments on commit ad62a28

Please sign in to comment.