lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b79433ea-0be6-5cca-39b8-424d31603ea6@gmail.com>
Date:   Fri, 3 Nov 2017 12:53:06 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Lipeng <lipeng321@...wei.com>, davem@...emloft.net
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linuxarm@...wei.com, salil.mehta@...wei.com
Subject: Re: [PATCH net-next 5/6] net: hns3: add support for nway_reset

On 11/02/2017 09:18 PM, Lipeng wrote:
> From: Fuyun Liang <liangfuyun1@...wei.com>
> 
> This patch adds nway_reset support for ethtool cmd.
> 
> Signed-off-by: Fuyun Liang <liangfuyun1@...wei.com>
> Signed-off-by: Lipeng <lipeng321@...wei.com>
> ---
>  .../net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c  | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
> index 7fe193b..a21470c 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c
> @@ -832,6 +832,23 @@ static int hns3_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
>  	}
>  }
>  
> +static int hns3_nway_reset(struct net_device *netdev)
> +{
> +	struct phy_device *phy = netdev->phydev;
> +
> +	if (!netif_running(netdev))
> +		return 0;
> +
> +	/* Only support nway_reset for netdev with phy attached for now */
> +	if (!phy)
> +		return -EOPNOTSUPP;
> +
> +	if (phy->autoneg != AUTONEG_ENABLE)
> +		return -EINVAL;
> +
> +	return genphy_restart_aneg(phy);

Consider using phy_ethtool_nway_reset() which properly checks for
phydev->drv (you don't). phy_restart_aneg() already checks for
phydev->autoneg.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ