All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net-next v1] ice: Sync VLAN filtering features for DVM
@ 2022-06-06  7:06 Anatolii Gerasymenko
  2022-06-06 18:26 ` Tony Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Anatolii Gerasymenko @ 2022-06-06  7:06 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Anatolii Gerasymenko

From: Roman Storozhenko <roman.storozhenko@intel.com>

VLAN filtering features, that is C-Tag and S-Tag, in DVM mode must be
both enabled or disabled.
In case of turning off/on only one of the features, another feature must
be turned off/on automatically with issuing an appropriate message to
the kernel log.

Signed-off-by: Roman Storozhenko <roman.storozhenko@intel.com>
Co-developed-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
Signed-off-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 49 ++++++++++++++---------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index e1cae253412c..aa4e55a29630 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -5763,25 +5763,38 @@ static netdev_features_t
 ice_fix_features(struct net_device *netdev, netdev_features_t features)
 {
 	struct ice_netdev_priv *np = netdev_priv(netdev);
-	netdev_features_t supported_vlan_filtering;
-	netdev_features_t requested_vlan_filtering;
-	struct ice_vsi *vsi = np->vsi;
-
-	requested_vlan_filtering = features & NETIF_VLAN_FILTERING_FEATURES;
-
-	/* make sure supported_vlan_filtering works for both SVM and DVM */
-	supported_vlan_filtering = NETIF_F_HW_VLAN_CTAG_FILTER;
-	if (ice_is_dvm_ena(&vsi->back->hw))
-		supported_vlan_filtering |= NETIF_F_HW_VLAN_STAG_FILTER;
-
-	if (requested_vlan_filtering &&
-	    requested_vlan_filtering != supported_vlan_filtering) {
-		if (requested_vlan_filtering & NETIF_F_HW_VLAN_CTAG_FILTER) {
-			netdev_warn(netdev, "cannot support requested VLAN filtering settings, enabling all supported VLAN filtering settings\n");
-			features |= supported_vlan_filtering;
+	netdev_features_t req_vlan_fltr, cur_vlan_fltr;
+	bool cur_ctag, cur_stag, req_ctag, req_stag;
+
+	cur_vlan_fltr = netdev->features & NETIF_VLAN_FILTERING_FEATURES;
+	cur_ctag = cur_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER;
+	cur_stag = cur_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER;
+
+	req_vlan_fltr = features & NETIF_VLAN_FILTERING_FEATURES;
+	req_ctag = req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER;
+	req_stag = req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER;
+
+	if (req_vlan_fltr != cur_vlan_fltr) {
+		if (ice_is_dvm_ena(&np->vsi->back->hw)) {
+			if (req_ctag && req_stag) {
+				features |= NETIF_VLAN_FILTERING_FEATURES;
+			} else if (!req_ctag && !req_stag) {
+				features &= ~NETIF_VLAN_FILTERING_FEATURES;
+			} else if ((!cur_ctag && req_ctag && !cur_stag) ||
+					(!cur_stag && req_stag && !cur_ctag)) {
+				features |= NETIF_VLAN_FILTERING_FEATURES;
+				netdev_warn(netdev,  "802.1Q and 802.1ad VLAN filtering must be either both on or both off. VLAN filtering has been enabled for both types.\n");
+			} else if ((cur_ctag && !req_ctag && cur_stag) ||
+					(cur_stag && !req_stag && cur_ctag)) {
+				features &= ~NETIF_VLAN_FILTERING_FEATURES;
+				netdev_warn(netdev,  "802.1Q and 802.1ad VLAN filtering must be either both on or both off. VLAN filtering has been disabled for both types.\n");
+			}
 		} else {
-			netdev_warn(netdev, "cannot support requested VLAN filtering settings, clearing all supported VLAN filtering settings\n");
-			features &= ~supported_vlan_filtering;
+			if (req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER)
+				netdev_warn(netdev, "cannot support requested 802.1ad filtering setting in SVM mode\n");
+
+			if (req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER)
+				features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 		}
 	}
 
-- 
2.25.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] 3+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next v1] ice: Sync VLAN filtering features for DVM
  2022-06-06  7:06 [Intel-wired-lan] [PATCH net-next v1] ice: Sync VLAN filtering features for DVM Anatolii Gerasymenko
@ 2022-06-06 18:26 ` Tony Nguyen
  2022-06-07  6:02   ` Anatolii Gerasymenko
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Nguyen @ 2022-06-06 18:26 UTC (permalink / raw)
  To: Anatolii Gerasymenko, intel-wired-lan



On 6/6/2022 12:06 AM, Anatolii Gerasymenko wrote:
> From: Roman Storozhenko <roman.storozhenko@intel.com>
> 
> VLAN filtering features, that is C-Tag and S-Tag, in DVM mode must be
> both enabled or disabled.
> In case of turning off/on only one of the features, another feature must
> be turned off/on automatically with issuing an appropriate message to
> the kernel log.

This sounds like a bug fix, why not to "net" (with a Fixes)?

> Signed-off-by: Roman Storozhenko <roman.storozhenko@intel.com>
> Co-developed-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
> Signed-off-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>

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

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

* Re: [Intel-wired-lan] [PATCH net-next v1] ice: Sync VLAN filtering features for DVM
  2022-06-06 18:26 ` Tony Nguyen
@ 2022-06-07  6:02   ` Anatolii Gerasymenko
  0 siblings, 0 replies; 3+ messages in thread
From: Anatolii Gerasymenko @ 2022-06-07  6:02 UTC (permalink / raw)
  To: Tony Nguyen, intel-wired-lan

On 06.06.2022 20:26, Tony Nguyen wrote:
> 
> 
> On 6/6/2022 12:06 AM, Anatolii Gerasymenko wrote:
>> From: Roman Storozhenko <roman.storozhenko@intel.com>
>>
>> VLAN filtering features, that is C-Tag and S-Tag, in DVM mode must be
>> both enabled or disabled.
>> In case of turning off/on only one of the features, another feature must
>> be turned off/on automatically with issuing an appropriate message to
>> the kernel log.
> 
> This sounds like a bug fix, why not to "net" (with a Fixes)?
> 

You are right. I'll prepare a new patch for "net" with Fixes tag.

>> Signed-off-by: Roman Storozhenko <roman.storozhenko@intel.com>
>> Co-developed-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
>> Signed-off-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
> 

Thank you,
Anatolii Gerasymenko
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

end of thread, other threads:[~2022-06-07  6:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06  7:06 [Intel-wired-lan] [PATCH net-next v1] ice: Sync VLAN filtering features for DVM Anatolii Gerasymenko
2022-06-06 18:26 ` Tony Nguyen
2022-06-07  6:02   ` Anatolii Gerasymenko

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.