]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ice: Separate if conditions for ice_set_features()
authorTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 16 Apr 2019 17:21:23 +0000 (10:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:44:52 +0000 (06:44 -0700)
[ Upstream commit 8f529ff912073f778e3cd74e87fb69a36499fc2f ]

Set features can have multiple features turned on|off in a single
call.  Grouping these all in an if/else means after one condition
is met, other conditions/features will not be evaluated.  Break
the if/else statements by feature to ensure all features will be
handled properly.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ice/ice_main.c

index 8725569d11f0a898183b994266dbee41b3a8b01d..d083979acc22cc188aa539f068b6c9f8f1f1e870 100644 (file)
@@ -2490,6 +2490,9 @@ static int ice_set_features(struct net_device *netdev,
        struct ice_vsi *vsi = np->vsi;
        int ret = 0;
 
+       /* Multiple features can be changed in one call so keep features in
+        * separate if/else statements to guarantee each feature is checked
+        */
        if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH))
                ret = ice_vsi_manage_rss_lut(vsi, true);
        else if (!(features & NETIF_F_RXHASH) &&
@@ -2502,8 +2505,9 @@ static int ice_set_features(struct net_device *netdev,
        else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) &&
                 (netdev->features & NETIF_F_HW_VLAN_CTAG_RX))
                ret = ice_vsi_manage_vlan_stripping(vsi, false);
-       else if ((features & NETIF_F_HW_VLAN_CTAG_TX) &&
-                !(netdev->features & NETIF_F_HW_VLAN_CTAG_TX))
+
+       if ((features & NETIF_F_HW_VLAN_CTAG_TX) &&
+           !(netdev->features & NETIF_F_HW_VLAN_CTAG_TX))
                ret = ice_vsi_manage_vlan_insertion(vsi);
        else if (!(features & NETIF_F_HW_VLAN_CTAG_TX) &&
                 (netdev->features & NETIF_F_HW_VLAN_CTAG_TX))