ice: check if VF exists before mode check
Setting trust on VF should return EINVAL when there is no VF. Move
checking for switchdev mode after checking if VF exists.
Fixes: c54d209c78
("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>
This commit is contained in:
parent
387d42ae6d
commit
83b49e7f63
|
@ -1341,15 +1341,15 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted)
|
||||||
struct ice_vf *vf;
|
struct ice_vf *vf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
vf = ice_get_vf_by_id(pf, vf_id);
|
||||||
|
if (!vf)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (ice_is_eswitch_mode_switchdev(pf)) {
|
if (ice_is_eswitch_mode_switchdev(pf)) {
|
||||||
dev_info(ice_pf_to_dev(pf), "Trusted VF is forbidden in switchdev mode\n");
|
dev_info(ice_pf_to_dev(pf), "Trusted VF is forbidden in switchdev mode\n");
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
vf = ice_get_vf_by_id(pf, vf_id);
|
|
||||||
if (!vf)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
ret = ice_check_vf_ready_for_cfg(vf);
|
ret = ice_check_vf_ready_for_cfg(vf);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_put_vf;
|
goto out_put_vf;
|
||||||
|
|
Loading…
Reference in New Issue