All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan promiscuous mode
@ 2022-08-10 14:21 Grzegorz Siwik
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 1/4] ice: Fix double VLAN error when entering promisc mode Grzegorz Siwik
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Grzegorz Siwik @ 2022-08-10 14:21 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Grzegorz Siwik

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.
---
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    |  8 +++++++-
 drivers/net/ethernet/intel/ice/ice_main.c   | 13 ++++++++++++-
 drivers/net/ethernet/intel/ice/ice_switch.c |  9 ++++++++-
 4 files changed, 31 insertions(+), 7 deletions(-)

-- 
1.8.3.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Intel-wired-lan] [PATCH net v3 1/4] ice: Fix double VLAN error when entering promisc mode
  2022-08-10 14:21 [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan promiscuous mode Grzegorz Siwik
@ 2022-08-10 14:21 ` Grzegorz Siwik
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 2/4] ice: Ignore ERR_ALREADY_EXISTS when setting " Grzegorz Siwik
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Siwik @ 2022-08-10 14:21 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Grzegorz Siwik

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")
Signed-off-by: Grzegorz Siwik <grzegorz.siwik@intel.com>
Link: https://lore.kernel.org/all/CAK8fFZ7m-KR57M_rYX6xZN39K89O=LGooYkKsu6HKt0Bs+x6xQ@mail.gmail.com/
---
 v2: Fixed error message when setting same promiscuous mode
---
 v3: Fixed style issues, changed to return directly.
---
 drivers/net/ethernet/intel/ice/ice_switch.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 8d8f3ee..8a60052 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -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,
-- 
1.8.3.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Intel-wired-lan] [PATCH net v3 2/4] ice: Ignore ERR_ALREADY_EXISTS when setting promisc mode
  2022-08-10 14:21 [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan promiscuous mode Grzegorz Siwik
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 1/4] ice: Fix double VLAN error when entering promisc mode Grzegorz Siwik
@ 2022-08-10 14:21 ` Grzegorz Siwik
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 3/4] ice: Fix clearing of promisc mode with bridge over bond Grzegorz Siwik
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Siwik @ 2022-08-10 14:21 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: 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.

Fixes: 5eda8afd6bcc ("ice: Add support for PF/VF promiscuous mode")
Signed-off-by: Grzegorz Siwik <grzegorz.siwik@intel.com>
Link: https://lore.kernel.org/all/CAK8fFZ7m-KR57M_rYX6xZN39K89O=LGooYkKsu6HKt0Bs+x6xQ@mail.gmail.com/
---
 v2: Fixed error message when setting same promiscuous mode
---
 v3: Fixed style issues, changed to return directly.
---
 drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 8a60052..0aa4871 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -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;
 	}
 
-- 
1.8.3.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Intel-wired-lan] [PATCH net v3 3/4] ice: Fix clearing of promisc mode with bridge over bond
  2022-08-10 14:21 [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan promiscuous mode Grzegorz Siwik
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 1/4] ice: Fix double VLAN error when entering promisc mode Grzegorz Siwik
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 2/4] ice: Ignore ERR_ALREADY_EXISTS when setting " Grzegorz Siwik
@ 2022-08-10 14:21 ` Grzegorz Siwik
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 4/4] ice: Ignore error message when setting same promiscuous mode Grzegorz Siwik
  2022-08-10 16:33 ` [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan " Tony Nguyen
  4 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Siwik @ 2022-08-10 14:21 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Jesse Brandeburg, 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!

Fixes: c31af68a1b94 ("ice: Add outer_vlan_ops and VSI specific VLAN ops implementations")
Signed-off-by: Grzegorz Siwik <grzegorz.siwik@intel.com>
Co-developed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Link: https://lore.kernel.org/all/CAK8fFZ7m-KR57M_rYX6xZN39K89O=LGooYkKsu6HKt0Bs+x6xQ@mail.gmail.com/
---
 v2: Fixed error message when setting same promiscuous mode
---
 v3: Fixed style issues, changed to return directly.
---
 drivers/net/ethernet/intel/ice/ice_lib.c  |  8 +++++++-
 drivers/net/ethernet/intel/ice/ice_main.c | 13 ++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index f7f9c97..251012d 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -4078,7 +4078,13 @@ 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);
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index c1ac2f7..c4f89c1 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -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
-- 
1.8.3.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Intel-wired-lan] [PATCH net v3 4/4] ice: Ignore error message when setting same promiscuous mode
  2022-08-10 14:21 [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan promiscuous mode Grzegorz Siwik
                   ` (2 preceding siblings ...)
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 3/4] ice: Fix clearing of promisc mode with bridge over bond Grzegorz Siwik
@ 2022-08-10 14:21 ` Grzegorz Siwik
  2022-08-10 16:33 ` [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan " Tony Nguyen
  4 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Siwik @ 2022-08-10 14:21 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Benjamin Mikailenko, Grzegorz Siwik

From: Benjamin Mikailenko <benjamin.mikailenko@intel.com>

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")
Signed-off-by: Benjamin Mikailenko <benjamin.mikailenko@intel.com>
Signed-off-by: Grzegorz Siwik <grzegorz.siwik@intel.com>
Link: https://lore.kernel.org/all/CAK8fFZ7m-KR57M_rYX6xZN39K89O=LGooYkKsu6HKt0Bs+x6xQ@mail.gmail.com/
---
 v2: Fixed error message when setting same promiscuous mode
---
 v3: Fixed style issues, changed to return directly.
---
 drivers/net/ethernet/intel/ice/ice_fltr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.c b/drivers/net/ethernet/intel/ice/ice_fltr.c
index 85a9448..40e678c 100644
--- a/drivers/net/ethernet/intel/ice/ice_fltr.c
+++ b/drivers/net/ethernet/intel/ice/ice_fltr.c
@@ -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);
-- 
1.8.3.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan promiscuous mode
  2022-08-10 14:21 [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan promiscuous mode Grzegorz Siwik
                   ` (3 preceding siblings ...)
  2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 4/4] ice: Ignore error message when setting same promiscuous mode Grzegorz Siwik
@ 2022-08-10 16:33 ` Tony Nguyen
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-08-10 16:33 UTC (permalink / raw)
  To: Grzegorz Siwik, intel-wired-lan



On 8/10/2022 7:21 AM, Grzegorz Siwik wrote:
> 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.

This doesn't apply. Did you rebase?

> ---
>   v2: Fixed error message when setting same promiscuous mode
> ---

nit/suggestion:
There doesn't need to be a '---' between every entry. Save some space :)

>   v3: Fixed style issues, changed to return directly.
> ---
> 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

The title needs to be updated too. s/ERR_ALREADY_EXISTS/EEXIST

>    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    |  8 +++++++-
>   drivers/net/ethernet/intel/ice/ice_main.c   | 13 ++++++++++++-
>   drivers/net/ethernet/intel/ice/ice_switch.c |  9 ++++++++-
>   4 files changed, 31 insertions(+), 7 deletions(-)
> 
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-10 16:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 14:21 [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan promiscuous mode Grzegorz Siwik
2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 1/4] ice: Fix double VLAN error when entering promisc mode Grzegorz Siwik
2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 2/4] ice: Ignore ERR_ALREADY_EXISTS when setting " Grzegorz Siwik
2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 3/4] ice: Fix clearing of promisc mode with bridge over bond Grzegorz Siwik
2022-08-10 14:21 ` [Intel-wired-lan] [PATCH net v3 4/4] ice: Ignore error message when setting same promiscuous mode Grzegorz Siwik
2022-08-10 16:33 ` [Intel-wired-lan] [PATCH net v3 0/4] ice: Fixes for double vlan " Tony Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.