Skip to contentSkip to conversation

ice: Fixes for double vlan promiscuous mode

PATCH In review Grzegorz Siwik 3 participants 10 messages Aug 12, 2022 – Aug 16, 2022

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

v5 cover ice: Fixes for double vlan promiscuous mode

This series fixes known issues related to double vlan promiscuous mode. When at least two interfaces are bonded and a bridge is enabled on the bond, an error can occur when the bridge is removed and re-added. The reason for the error is because promiscuous mode was not fully cleared from the VLAN VSI in the hardware.
Ignore ERR_ALREADY_EXISTS error when setting promiscuous mode. This fix is needed because the driver could set promiscuous mode when it still has not cleared properly.
If the requested promiscuous mode setting already exists,
an -EEXIST error message would be printed.
This is incorrect because promiscuous mode is
either on/off and shouldn't print an error when the requested configuration is already set.
Avoid enabling or disabling vlan 0 when trying to set promiscuous vlan mode if double vlan mode is enabled. This fix is needed because the driver tries to add the vlan 0 filter twice (once for inner and once for outer) when double VLAN mode is enabled.

---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue
---
Benjamin Mikailenko (1):
ice: Ignore error message when setting same promiscuous mode

Grzegorz Siwik (3):
ice: Fix double VLAN error when entering promisc mode
ice: Ignore ERR_ALREADY_EXISTS when setting promisc mode
ice: Fix clearing of promisc mode with bridge over bond

 drivers/net/ethernet/intel/ice/ice_fltr.c   |  8 ++++----
 drivers/net/ethernet/intel/ice/ice_lib.c    |  6 +++++-
 drivers/net/ethernet/intel/ice/ice_main.c   | 13 ++++++++++++-
 drivers/net/ethernet/intel/ice/ice_switch.c |  9 ++++++++-
 4 files changed, 29 insertions(+), 7 deletions(-)
Signature · 6 lines
1.8.3.1

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

PATCH v5 1/4 ice: Fix double VLAN error when entering promisc mode

Avoid enabling or disabling vlan 0 when trying to set promiscuous vlan mode if double vlan mode is enabled. This fix is needed because the driver tries to add the vlan 0 filter twice (once for inner and once for outer) when double VLAN mode is enabled. The filter program is rejected by the firmware when double vlan is enabled, because the promiscuous filter only needs to be set once.

This issue was missed in the initial implementation of double vlan mode.

---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue

---
 drivers/net/ethernet/intel/ice/ice_switch.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/ethernet/intel/ice/ice_switch.c +7 -0
index 8d8f3ee..8a60052 100644
@@ -4414,6 +4414,13 @@ static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi)
 		goto free_fltr_list;
 
 	list_for_each_entry(list_itr, &vsi_list_head, list_entry) {
+		/* Avoid enabling or disabling vlan zero twice when in double
+		 * vlan mode
+		 */
+		if (ice_is_dvm_ena(hw) &&
+		    list_itr->fltr_info.l_data.vlan.tpid == 0)
+			continue;
+
 		vlan_id = list_itr->fltr_info.l_data.vlan.vlan_id;
 		if (rm_vlan_promisc)
 			status = ice_clear_vsi_promisc(hw, vsi_handle,
Signature · 6 lines
1.8.3.1

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

Re: [Intel-wired-lan] [PATCH net v5 1/4] ice: Fix double VLAN error when entering promisc mode

Quoted 32 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Siwik
Sent: Friday, August 12, 2022 6:56 PM
To: [email protected]
Cc: Siwik, Grzegorz <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v5 1/4] ice: Fix double VLAN error when entering promisc mode

Avoid enabling or disabling vlan 0 when trying to set promiscuous vlan mode if double vlan mode is enabled. This fix is needed because the driver tries to add the vlan 0 filter twice (once for inner and once for outer) when double VLAN mode is enabled. The filter program is rejected by the firmware when double vlan is enabled, because the promiscuous filter only needs to be set once.

This issue was missed in the initial implementation of double vlan mode.

Fixes 5eda8afd6bcc ("ice: Add support for PF/VF promiscuous mode")

[email protected]/
---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue

Quoted 4 lines
---
 drivers/net/ethernet/intel/ice/ice_switch.c | 7 +++++++
 1 file changed, 7 insertions(+)

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

#3 lore raw

PATCH v5 2/4 ice: Ignore EEXIST when setting promisc mode

In reply to Grzegorz Siwik

Ignore EEXIST error when setting promiscuous mode. This fix is needed because the driver could set promiscuous mode when it still has not cleared properly.
Promiscuous mode could be set only once, so setting it second time will be rejected.

---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue

---
 drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_switch.c +1 -1
index 8a60052..0aa4871 100644
@@ -4428,7 +4428,7 @@ static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi)
 		else
 			status = ice_set_vsi_promisc(hw, vsi_handle,
 						     promisc_mask, vlan_id);
-		if (status)
+		if (status && status != -EEXIST)
 			break;
 	}
 
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v5 2/4
#4 lore raw

Re: [Intel-wired-lan] [PATCH net v5 2/4] ice: Ignore EEXIST when setting promisc mode

Quoted 29 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Siwik
Sent: Friday, August 12, 2022 6:56 PM
To: [email protected]
Cc: Siwik, Grzegorz <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v5 2/4] ice: Ignore EEXIST when setting promisc mode

Ignore EEXIST error when setting promiscuous mode.
This fix is needed because the driver could set promiscuous mode when it still has not cleared properly.
Promiscuous mode could be set only once, so setting it second time will be rejected.

Fixes 5eda8afd6bcc ("ice: Add support for PF/VF promiscuous mode")

[email protected]/
---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue

Quoted 4 lines
---
 drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

#5 lore raw

PATCH v5 3/4 ice: Fix clearing of promisc mode with bridge over bond

In reply to Grzegorz Siwik

When at least two interfaces are bonded and a bridge is enabled on the bond, an error can occur when the bridge is removed and re-added. The reason for the error is because promiscuous mode was not fully cleared from the VLAN VSI in the hardware. With this change, promiscuous mode is properly removed when the bridge disconnects from bonding.

[ 1033.676359] bond1: link status definitely down for interface enp95s0f0, disabling it
[ 1033.676366] bond1: making interface enp175s0f0 the new active one
[ 1033.676369] device enp95s0f0 left promiscuous mode
[ 1033.676522] device enp175s0f0 entered promiscuous mode
[ 1033.676901] ice 0000:af:00.0 enp175s0f0: Error setting Multicast promiscuous mode on VSI 6
[ 1041.795662] ice 0000:af:00.0 enp175s0f0: Error setting Multicast promiscuous mode on VSI 6
[ 1041.944826] bond1: link status definitely down for interface enp175s0f0, disabling it
[ 1041.944874] device enp175s0f0 left promiscuous mode
[ 1041.944918] bond1: now running without any active interface!

---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue

---
 drivers/net/ethernet/intel/ice/ice_lib.c  |  6 +++++-
 drivers/net/ethernet/intel/ice/ice_main.c | 13 ++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +5 -1
index f7f9c97..4b1d070 100644
@@ -4078,7 +4078,11 @@ int ice_vsi_del_vlan_zero(struct ice_vsi *vsi)
 	if (err && err != -EEXIST)
 		return err;
 
-	return 0;
+	/* when deleting the last VLAN filter, make sure to disable the VLAN
+	 * promisc mode so the filter isn't left by accident
+	 */
+	return ice_clear_vsi_promisc(&vsi->back->hw, vsi->idx,
+				    ICE_MCAST_VLAN_PROMISC_BITS, 0);
 }
 
 /**
drivers/net/ethernet/intel/ice/ice_main.c +12 -1
index c1ac2f7..c4f89c1 100644
@@ -267,8 +267,10 @@ static int ice_set_promisc(struct ice_vsi *vsi, u8 promisc_m)
 		status = ice_fltr_set_vsi_promisc(&vsi->back->hw, vsi->idx,
 						  promisc_m, 0);
 	}
+	if (status && status != -EEXIST)
+		return status;
 
-	return status;
+	return 0;
 }
 
 /**
@@ -3572,6 +3574,15 @@ struct ice_vsi *
 	while (test_and_set_bit(ICE_CFG_BUSY, vsi->state))
 		usleep_range(1000, 2000);
 
+	ret = ice_clear_vsi_promisc(&vsi->back->hw, vsi->idx,
+				    ICE_MCAST_VLAN_PROMISC_BITS, vid);
+
+	if (ret) {
+		netdev_err(netdev, "Error clearing multicast promiscuous mode on VSI %i\n",
+			   vsi->vsi_num);
+		vsi->current_netdev_flags |= IFF_ALLMULTI;
+	}
+
 	vlan_ops = ice_get_compat_vsi_vlan_ops(vsi);
 
 	/* Make sure VLAN delete is successful before updating VLAN
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v5 3/4
#6 lore raw

Re: [Intel-wired-lan] [PATCH net v5 3/4] ice: Fix clearing of promisc mode with bridge over bond

Quoted 44 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Siwik
Sent: Friday, August 12, 2022 6:56 PM
To: [email protected]
Cc: Brandeburg, Jesse <[email protected]>; Siwik, Grzegorz <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v5 3/4] ice: Fix clearing of promisc mode with bridge over bond

When at least two interfaces are bonded and a bridge is enabled on the bond, an error can occur when the bridge is removed and re-added. The reason for the error is because promiscuous mode was not fully cleared from the VLAN VSI in the hardware. With this change, promiscuous mode is properly removed when the bridge disconnects from bonding.

[ 1033.676359] bond1: link status definitely down for interface enp95s0f0,

disabling it [ 1033.676366] bond1: making interface enp175s0f0 the new active one [ 1033.676369] device enp95s0f0 left promiscuous mode [ 1033.676522] device enp175s0f0 entered promiscuous mode [ 1033.676901] ice 0000:af:00.0 enp175s0f0: Error setting Multicast promiscuous mode on VSI 6 [ 1041.795662] ice 0000:af:00.0 enp175s0f0: Error setting Multicast promiscuous mode on VSI 6 [ 1041.944826] bond1: link status definitely down for interface enp175s0f0, disabling it [ 1041.944874] device enp175s0f0 left promiscuous mode [ 1041.944918] bond1: now running without any active interface!

Fixes c31af68a1b94 ("ice: Add outer_vlan_ops and VSI specific VLAN ops

implementations")

[email protected]/
---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue

Quoted 5 lines
---
 drivers/net/ethernet/intel/ice/ice_lib.c  |  6 +++++-
drivers/net/ethernet/intel/ice/ice_main.c | 13 ++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

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

#7 lore raw

PATCH v5 4/4 ice: Ignore error message when setting same promiscuous mode

In reply to Grzegorz Siwik

From: Benjamin Mikailenko <[email protected]>

Commit 1273f89578f2 ("ice: Fix broken IFF_ALLMULTI handling") introduced new checks when setting/clearing promiscuous mode. But if the requested promiscuous mode setting already exists, an -EEXIST error message would be printed. This is incorrect because promiscuous mode is either on/off and shouldn't print an error when the requested configuration is already set.

This can happen when removing a bridge with two bonded interfaces and promiscuous most isn't fully cleared from VLAN VSI in hardware.

Fix this by ignoring cases where requested promiscuous mode exists.

---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue

---
 drivers/net/ethernet/intel/ice/ice_fltr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_fltr.c +4 -4
index 85a9448..40e678c 100644
@@ -62,7 +62,7 @@ void ice_fltr_free_list(struct device *dev, struct list_head *h)
 	int result;
 
 	result = ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_mask, false);
-	if (result)
+	if (result && result != -EEXIST)
 		dev_err(ice_pf_to_dev(pf),
 			"Error setting promisc mode on VSI %i (rc=%d)\n",
 			vsi->vsi_num, result);
@@ -86,7 +86,7 @@ void ice_fltr_free_list(struct device *dev, struct list_head *h)
 	int result;
 
 	result = ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_mask, true);
-	if (result)
+	if (result && result != -EEXIST)
 		dev_err(ice_pf_to_dev(pf),
 			"Error clearing promisc mode on VSI %i (rc=%d)\n",
 			vsi->vsi_num, result);
@@ -109,7 +109,7 @@ void ice_fltr_free_list(struct device *dev, struct list_head *h)
 	int result;
 
 	result = ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask, vid);
-	if (result)
+	if (result && result != -EEXIST)
 		dev_err(ice_pf_to_dev(pf),
 			"Error clearing promisc mode on VSI %i for VID %u (rc=%d)\n",
 			ice_get_hw_vsi_num(hw, vsi_handle), vid, result);
@@ -132,7 +132,7 @@ void ice_fltr_free_list(struct device *dev, struct list_head *h)
 	int result;
 
 	result = ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid);
-	if (result)
+	if (result && result != -EEXIST)
 		dev_err(ice_pf_to_dev(pf),
 			"Error setting promisc mode on VSI %i for VID %u (rc=%d)\n",
 			ice_get_hw_vsi_num(hw, vsi_handle), vid, result);
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v5 4/4
#8 lore raw

Re: [Intel-wired-lan] [PATCH net v5 4/4] ice: Ignore error message when setting same promiscuous mode

Quoted 38 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Siwik
Sent: Friday, August 12, 2022 6:56 PM
To: [email protected]
Cc: Mikailenko, Benjamin <[email protected]>; Siwik, Grzegorz <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v5 4/4] ice: Ignore error message when setting same promiscuous mode

From: Benjamin Mikailenko <[email protected]>

Commit 1273f89578f2 ("ice: Fix broken IFF_ALLMULTI handling") introduced new checks when setting/clearing promiscuous mode. But if the requested promiscuous mode setting already exists, an -EEXIST error message would be printed. This is incorrect because promiscuous mode is either on/off and shouldn't print an error when the requested configuration is already set.

This can happen when removing a bridge with two bonded interfaces and promiscuous most isn't fully cleared from VLAN VSI in hardware.

Fix this by ignoring cases where requested promiscuous mode exists.

Fixes 1273f89578f2 ("ice: Fix broken IFF_ALLMULTI handling")

[email protected]/
---
v2: Fixed error message when setting same promiscuous mode
---
v3: Fixed style issues, changed to return directly.
---
v4: Fixed problem with patch applying
---
v5: Fixed incorrect title patch issue

Quoted 4 lines
---
 drivers/net/ethernet/intel/ice/ice_fltr.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

Tested-by on the v5 series
#9 lore raw
In reply to Grzegorz Siwik

Grzegorz Siwik píše v Pá 12. 08. 2022 v 15:25 +0200:

Quoted 38 lines

This series fixes known issues related to double vlan promiscuous mode.
When at least two interfaces are bonded and a bridge is enabled on the
bond, an error can occur when the bridge is removed and re-added. The reason for the error is because promiscuous mode was not fully cleared from
the VLAN VSI in the hardware.
Ignore ERR_ALREADY_EXISTS error when setting promiscuous mode. This fix is needed because the driver could set promiscuous mode when it still has not cleared properly.
If the requested promiscuous mode setting already exists, an -EEXIST error message would be printed.
This is incorrect because promiscuous mode is
either on/off and shouldn't print an error when the requested configuration is already set.
Avoid enabling or disabling vlan 0 when trying to set promiscuous vlan mode if double vlan mode is enabled. This fix is needed because the driver tries to add the vlan 0 filter twice (once for inner and once for outer) when double VLAN mode is enabled.

---
 v2: Fixed error message when setting same promiscuous mode
---
 v3: Fixed style issues, changed to return directly.
---
 v4: Fixed problem with patch applying
---
 v5: Fixed incorrect title patch issue
---
Benjamin Mikailenko (1):
  ice: Ignore error message when setting same promiscuous mode

Grzegorz Siwik (3):
  ice: Fix double VLAN error when entering promisc mode
  ice: Ignore ERR_ALREADY_EXISTS when setting promisc mode
  ice: Fix clearing of promisc mode with bridge over bond

Quoted 6 lines

 drivers/net/ethernet/intel/ice/ice_fltr.c   |  8 ++++---- drivers/net/ethernet/intel/ice/ice_lib.c    |  6 +++++- drivers/net/ethernet/intel/ice/ice_main.c   | 13 ++++++++++++- drivers/net/ethernet/intel/ice/ice_switch.c |  9 ++++++++-

 4 files changed, 29 insertions(+), 7 deletions(-)

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