Skip to content

Commit

Permalink
ice: check if VF exists before mode check
Browse files Browse the repository at this point in the history
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 <michal.swiatkowski@intel.com>
Signed-off-by: Kalyan Kodamagula <kalyan.kodamagula@intel.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
mswiatko authored and anguy11 committed Mar 21, 2023
1 parent 387d42a commit 83b49e7
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 @@ -1341,15 +1341,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 83b49e7

Please sign in to comment.