Skip to contentSkip to conversation

ice: Fix VF not able to send tagged traffic with no VLAN filters

PATCH In review Mateusz Palczewski 2 participants 2 messages Aug 3, 2022 – Aug 16, 2022

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

PATCH v2 1/1 ice: Fix VF not able to send tagged traffic with no VLAN filters

From: Sylwester Dziedziuch <[email protected]>

VF was not able to send tagged traffic when it didn't have any VLAN interfaces and VLAN anti-spoofing was enabled. Fix this by allowing VFs with no VLAN filters to send tagged traffic. After VF adds a VLAN interface it will be able to send tagged traffic matching VLAN filters only.

Testing hints:
1. Spawn VF
2. Send tagged packet from a VF
3. The packet should be sent out and not dropped
4. Add a VLAN interface on VF
5. Send tagged packet on that VLAN interface
6. Packet should be sent out and not dropped
7. Send tagged packet with id different than VLAN interface
8. Packet should be dropped

Fixes daf4dd16438b ("ice: Refactor spoofcheck configuration functions")

---
v2: Removed Unnecessary parentheses around 'vsi->type != ICE_VSI_VF'
Unfortunetly some lines must be over 80 char to make the code more readable

---
 drivers/net/ethernet/intel/ice/ice_vf_lib.c   | 11 ++--
 drivers/net/ethernet/intel/ice/ice_virtchnl.c | 57 ++++++++++++++++---
 2 files changed, 57 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_vf_lib.c +7 -4
index 2d6130af1d40..7775aaa8cc43 100644
@@ -707,13 +707,16 @@ static int ice_cfg_mac_antispoof(struct ice_vsi *vsi, bool enable)
 static int ice_vsi_ena_spoofchk(struct ice_vsi *vsi)
 {
 	struct ice_vsi_vlan_ops *vlan_ops;
-	int err;
+	int err = 0;
 
 	vlan_ops = ice_get_compat_vsi_vlan_ops(vsi);
 
-	err = vlan_ops->ena_tx_filtering(vsi);
-	if (err)
-		return err;
+	/* Allow VF with VLAN 0 only to send all tagged traffic */
+	if (vsi->type != ICE_VSI_VF || ice_vsi_has_non_zero_vlans(vsi)) {
+		err = vlan_ops->ena_tx_filtering(vsi);
+		if (err)
+			return err;
+	}
 
 	return ice_cfg_mac_antispoof(vsi, true);
 }
drivers/net/ethernet/intel/ice/ice_virtchnl.c +50 -7

94 lines not on this page · raw message

Signature · 6 lines
2.27.0

_______________________________________________
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

drivers/net/ethernet/intel/ice/ice_vf_lib.c static int ice_cfg_mac_antispoof(struct ice_vsi *vsi,

Quoted 45 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: Wednesday, August 3, 2022 10:43 AM
To: [email protected]
Cc: Dziedziuch, SylwesterX <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2] ice: Fix VF not able to send tagged traffic with no VLAN filters

From: Sylwester Dziedziuch <[email protected]>

VF was not able to send tagged traffic when it didn't have any VLAN interfaces and VLAN anti-spoofing was enabled.
Fix this by allowing VFs with no VLAN filters to send tagged traffic. After VF adds a VLAN interface it will be able to send tagged traffic matching VLAN filters only.

Testing hints:
1. Spawn VF
2. Send tagged packet from a VF
3. The packet should be sent out and not dropped 4. Add a VLAN interface on VF 5. Send tagged packet on that VLAN interface 6. Packet should be sent out and not dropped 7. Send tagged packet with id different than VLAN interface
8. Packet should be dropped

Fixes daf4dd16438b ("ice: Refactor spoofcheck configuration functions")

---
v2: Removed Unnecessary parentheses around 'vsi->type != ICE_VSI_VF'
Unfortunetly some lines must be over 80 char to make the code more
readable

---
 drivers/net/ethernet/intel/ice/ice_vf_lib.c   | 11 ++--
 drivers/net/ethernet/intel/ice/ice_virtchnl.c | 57 ++++++++++++++++---
 2 files changed, 57 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_vf_lib.c +0 -0
index 2d6130af1d40..7775aaa8cc43 100644
@@ -707,13 +707,16 @@ static int ice_cfg_mac_antispoof(struct ice_vsi *vsi,

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