Skip to contentSkip to conversation

ice: check if VF exists before mode check

PATCH In review Kalyan Kodamagula 2 participants 2 messages Mar 10, 2023 – Mar 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ice: check if VF exists before mode check

From: Michal Swiatkowski <[email protected]>

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

Fixes c54d209c78b8a ("ice: Wait for VF to be reset/ready before configuration")

---
V1->V2: Added Fixes tag

---
 drivers/net/ethernet/intel/ice/ice_sriov.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_sriov.c +4 -4
index 96a64c25e2ef..0cc05e54a781 100644
@@ -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;
Signature · 6 lines
2.39.2

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v2 1/1
#1 lore raw
Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Kalyan Kodamagula
Sent: Friday, March 10, 2023 5:04 PM
To: [email protected]
Cc: Swiatkowski, Michal <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2] ice: check if VF exists before mode check

From: Michal Swiatkowski <[email protected]>

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

Fixes c54d209c78b8a ("ice: Wait for VF to be reset/ready before

configuration")

Quoted 9 lines

---
V1->V2: Added Fixes tag

---
 drivers/net/ethernet/intel/ice/ice_sriov.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan