From: Deepak Khungar Date: Mon, 19 Sep 2016 07:58:08 +0000 (-0400) Subject: bnxt_en: Support for "ethtool -r" command X-Git-Tag: v4.1.12-92~10^2~32 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ee3cc21cd27568fef4cab33c8f4c711f096e90cc;p=users%2Fjedix%2Flinux-maple.git bnxt_en: Support for "ethtool -r" command Orabug: 24567991 Restart autoneg if autoneg is enabled. Signed-off-by: Deepak Khungar Signed-off-by: Michael Chan Signed-off-by: David S. Miller (cherry picked from commit ae8e98a6fa7a73917196c507e43414ea96b6a0fc) Signed-off-by: Brian Maly Signed-off-by: Dhaval Giani --- diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 0260390798b5..30908d0fe66f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2070,6 +2070,25 @@ static int bnxt_get_module_eeprom(struct net_device *dev, return rc; } +static int bnxt_nway_reset(struct net_device *dev) +{ + int rc = 0; + + struct bnxt *bp = netdev_priv(dev); + struct bnxt_link_info *link_info = &bp->link_info; + + if (!BNXT_SINGLE_PF(bp)) + return -EOPNOTSUPP; + + if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) + return -EINVAL; + + if (netif_running(dev)) + rc = bnxt_hwrm_set_link_setting(bp, true, false); + + return rc; +} + const struct ethtool_ops bnxt_ethtool_ops = { #ifdef HAVE_ETHTOOL_GLINKSETTINGS_25G .get_link_ksettings = bnxt_get_link_ksettings, @@ -2107,4 +2126,5 @@ const struct ethtool_ops bnxt_ethtool_ops = { .set_eee = bnxt_set_eee, .get_module_info = bnxt_get_module_info, .get_module_eeprom = bnxt_get_module_eeprom, + .nway_reset = bnxt_nway_reset };