ice: combine cases in ice_ksettings_find_adv_link_speed()
authorPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Wed, 23 Nov 2022 15:55:44 +0000 (16:55 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 19 Jan 2023 16:18:03 +0000 (08:18 -0800)
Combine if statements setting the same link speed together.

Suggested-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Acked-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_ethtool.c

index 42ff621f9c68acbf32c0d94a91fcf84d07ceb4d1..e0a83d55fef48f99698e92b8cdca2c2baa5b2a17 100644 (file)
@@ -2259,17 +2259,15 @@ ice_ksettings_find_adv_link_speed(const struct ethtool_link_ksettings *ks)
                                                  100baseT_Full))
                adv_link_speed |= ICE_AQ_LINK_SPEED_100MB;
        if (ethtool_link_ksettings_test_link_mode(ks, advertising,
-                                                 1000baseX_Full))
-               adv_link_speed |= ICE_AQ_LINK_SPEED_1000MB;
-       if (ethtool_link_ksettings_test_link_mode(ks, advertising,
+                                                 1000baseX_Full) ||
+           ethtool_link_ksettings_test_link_mode(ks, advertising,
                                                  1000baseT_Full) ||
            ethtool_link_ksettings_test_link_mode(ks, advertising,
                                                  1000baseKX_Full))
                adv_link_speed |= ICE_AQ_LINK_SPEED_1000MB;
        if (ethtool_link_ksettings_test_link_mode(ks, advertising,
-                                                 2500baseT_Full))
-               adv_link_speed |= ICE_AQ_LINK_SPEED_2500MB;
-       if (ethtool_link_ksettings_test_link_mode(ks, advertising,
+                                                 2500baseT_Full) ||
+           ethtool_link_ksettings_test_link_mode(ks, advertising,
                                                  2500baseX_Full))
                adv_link_speed |= ICE_AQ_LINK_SPEED_2500MB;
        if (ethtool_link_ksettings_test_link_mode(ks, advertising,
@@ -2278,9 +2276,8 @@ ice_ksettings_find_adv_link_speed(const struct ethtool_link_ksettings *ks)
        if (ethtool_link_ksettings_test_link_mode(ks, advertising,
                                                  10000baseT_Full) ||
            ethtool_link_ksettings_test_link_mode(ks, advertising,
-                                                 10000baseKR_Full))
-               adv_link_speed |= ICE_AQ_LINK_SPEED_10GB;
-       if (ethtool_link_ksettings_test_link_mode(ks, advertising,
+                                                 10000baseKR_Full) ||
+           ethtool_link_ksettings_test_link_mode(ks, advertising,
                                                  10000baseSR_Full) ||
            ethtool_link_ksettings_test_link_mode(ks, advertising,
                                                  10000baseLR_Full))
@@ -2304,9 +2301,8 @@ ice_ksettings_find_adv_link_speed(const struct ethtool_link_ksettings *ks)
        if (ethtool_link_ksettings_test_link_mode(ks, advertising,
                                                  50000baseCR2_Full) ||
            ethtool_link_ksettings_test_link_mode(ks, advertising,
-                                                 50000baseKR2_Full))
-               adv_link_speed |= ICE_AQ_LINK_SPEED_50GB;
-       if (ethtool_link_ksettings_test_link_mode(ks, advertising,
+                                                 50000baseKR2_Full) ||
+           ethtool_link_ksettings_test_link_mode(ks, advertising,
                                                  50000baseSR2_Full))
                adv_link_speed |= ICE_AQ_LINK_SPEED_50GB;
        if (ethtool_link_ksettings_test_link_mode(ks, advertising,