aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatherine Sullivan <catherine.sullivan@intel.com>2015-09-28 14:16:58 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-10-19 18:35:52 -0400
commit3ce12ee9d8f9ae245f38e6acbd32625d8e002c5b (patch)
treeac43451833958438c6289596f722410a7388391a
parenta03dc368547a7a4e9fcedc6f64dd64a9ff5e0593 (diff)
i40e: Fix order of checks when enabling/disabling autoneg in ethtool
We were previously checking if autoneg was allowed to change before checking if autoneg was changing. We need to do this in the other order or else we will erroneously return EINVAL when autoneg is not changing. Change-ID: Iff9f7d1c9bddc1ad1e5d227d4f42754f90155410 Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 767b1db1005f..6e5f9314994b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -661,28 +661,31 @@ static int i40e_set_settings(struct net_device *netdev,
661 661
662 /* Check autoneg */ 662 /* Check autoneg */
663 if (autoneg == AUTONEG_ENABLE) { 663 if (autoneg == AUTONEG_ENABLE) {
664 /* If autoneg is not supported, return error */
665 if (!(safe_ecmd.supported & SUPPORTED_Autoneg)) {
666 netdev_info(netdev, "Autoneg not supported on this phy\n");
667 return -EINVAL;
668 }
669 /* If autoneg was not already enabled */ 664 /* If autoneg was not already enabled */
670 if (!(hw->phy.link_info.an_info & I40E_AQ_AN_COMPLETED)) { 665 if (!(hw->phy.link_info.an_info & I40E_AQ_AN_COMPLETED)) {
666 /* If autoneg is not supported, return error */
667 if (!(safe_ecmd.supported & SUPPORTED_Autoneg)) {
668 netdev_info(netdev, "Autoneg not supported on this phy\n");
669 return -EINVAL;
670 }
671 /* Autoneg is allowed to change */
671 config.abilities = abilities.abilities | 672 config.abilities = abilities.abilities |
672 I40E_AQ_PHY_ENABLE_AN; 673 I40E_AQ_PHY_ENABLE_AN;
673 change = true; 674 change = true;
674 } 675 }
675 } else { 676 } else {
676 /* If autoneg is supported 10GBASE_T is the only phy that
677 * can disable it, so otherwise return error
678 */
679 if (safe_ecmd.supported & SUPPORTED_Autoneg &&
680 hw->phy.link_info.phy_type != I40E_PHY_TYPE_10GBASE_T) {
681 netdev_info(netdev, "Autoneg cannot be disabled on this phy\n");
682 return -EINVAL;
683 }
684 /* If autoneg is currently enabled */ 677 /* If autoneg is currently enabled */
685 if (hw->phy.link_info.an_info & I40E_AQ_AN_COMPLETED) { 678 if (hw->phy.link_info.an_info & I40E_AQ_AN_COMPLETED) {
679 /* If autoneg is supported 10GBASE_T is the only PHY
680 * that can disable it, so otherwise return error
681 */
682 if (safe_ecmd.supported & SUPPORTED_Autoneg &&
683 hw->phy.link_info.phy_type !=
684 I40E_PHY_TYPE_10GBASE_T) {
685 netdev_info(netdev, "Autoneg cannot be disabled on this phy\n");
686 return -EINVAL;
687 }
688 /* Autoneg is allowed to change */
686 config.abilities = abilities.abilities & 689 config.abilities = abilities.abilities &
687 ~I40E_AQ_PHY_ENABLE_AN; 690 ~I40E_AQ_PHY_ENABLE_AN;
688 change = true; 691 change = true;