Skip to content

Commit 9542ef4

Browse files
rstorozhanguy11
authored andcommitted
ice: Sync VLAN filtering features for DVM
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. Fixes: 1babaf7 ("ice: Advertise 802.1ad VLAN filtering and offloads for PF netdev") 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> Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 71a579f commit 9542ef4

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5763,25 +5763,38 @@ static netdev_features_t
57635763
ice_fix_features(struct net_device *netdev, netdev_features_t features)
57645764
{
57655765
struct ice_netdev_priv *np = netdev_priv(netdev);
5766-
netdev_features_t supported_vlan_filtering;
5767-
netdev_features_t requested_vlan_filtering;
5768-
struct ice_vsi *vsi = np->vsi;
5769-
5770-
requested_vlan_filtering = features & NETIF_VLAN_FILTERING_FEATURES;
5771-
5772-
/* make sure supported_vlan_filtering works for both SVM and DVM */
5773-
supported_vlan_filtering = NETIF_F_HW_VLAN_CTAG_FILTER;
5774-
if (ice_is_dvm_ena(&vsi->back->hw))
5775-
supported_vlan_filtering |= NETIF_F_HW_VLAN_STAG_FILTER;
5776-
5777-
if (requested_vlan_filtering &&
5778-
requested_vlan_filtering != supported_vlan_filtering) {
5779-
if (requested_vlan_filtering & NETIF_F_HW_VLAN_CTAG_FILTER) {
5780-
netdev_warn(netdev, "cannot support requested VLAN filtering settings, enabling all supported VLAN filtering settings\n");
5781-
features |= supported_vlan_filtering;
5766+
netdev_features_t req_vlan_fltr, cur_vlan_fltr;
5767+
bool cur_ctag, cur_stag, req_ctag, req_stag;
5768+
5769+
cur_vlan_fltr = netdev->features & NETIF_VLAN_FILTERING_FEATURES;
5770+
cur_ctag = cur_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER;
5771+
cur_stag = cur_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER;
5772+
5773+
req_vlan_fltr = features & NETIF_VLAN_FILTERING_FEATURES;
5774+
req_ctag = req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER;
5775+
req_stag = req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER;
5776+
5777+
if (req_vlan_fltr != cur_vlan_fltr) {
5778+
if (ice_is_dvm_ena(&np->vsi->back->hw)) {
5779+
if (req_ctag && req_stag) {
5780+
features |= NETIF_VLAN_FILTERING_FEATURES;
5781+
} else if (!req_ctag && !req_stag) {
5782+
features &= ~NETIF_VLAN_FILTERING_FEATURES;
5783+
} else if ((!cur_ctag && req_ctag && !cur_stag) ||
5784+
(!cur_stag && req_stag && !cur_ctag)) {
5785+
features |= NETIF_VLAN_FILTERING_FEATURES;
5786+
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");
5787+
} else if ((cur_ctag && !req_ctag && cur_stag) ||
5788+
(cur_stag && !req_stag && cur_ctag)) {
5789+
features &= ~NETIF_VLAN_FILTERING_FEATURES;
5790+
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");
5791+
}
57825792
} else {
5783-
netdev_warn(netdev, "cannot support requested VLAN filtering settings, clearing all supported VLAN filtering settings\n");
5784-
features &= ~supported_vlan_filtering;
5793+
if (req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER)
5794+
netdev_warn(netdev, "cannot support requested 802.1ad filtering setting in SVM mode\n");
5795+
5796+
if (req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER)
5797+
features |= NETIF_F_HW_VLAN_CTAG_FILTER;
57855798
}
57865799
}
57875800

0 commit comments

Comments
 (0)