diff mbox series

[1/4,D/E] net: hns3: fix port setting handle for fibre port

Message ID 20200101160916.14854-1-ike.pan@canonical.com
State New
Headers show
Series Several Hisilicon ethernet fixes | expand

Commit Message

Ike Panhc Jan. 1, 2020, 4:09 p.m. UTC
From: Guangbin Huang <huangguangbin2@huawei.com>

BugLink: https://launchpad.net/bugs/1853984

For hardware doesn't support use specified speed and duplex
to negotiate, it's unnecessary to check and modify the port
speed and duplex for fibre port when autoneg is on.

Fixes: 22f48e24a23d ("net: hns3: add autoneg and change speed support for fibre port")
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 24283ece5a0f1040842367966c8e0245b871e309)
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
 .../net/ethernet/hisilicon/hns3/hns3_ethtool.c    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Kleber Sacilotto de Souza Jan. 7, 2020, 11:32 a.m. UTC | #1
On 2020-01-01 17:09, Ike Panhc wrote:
> From: Guangbin Huang <huangguangbin2@huawei.com>
> 
> BugLink: https://launchpad.net/bugs/1853984
> 
> For hardware doesn't support use specified speed and duplex
> to negotiate, it's unnecessary to check and modify the port
> speed and duplex for fibre port when autoneg is on.
> 
> Fixes: 22f48e24a23d ("net: hns3: add autoneg and change speed support for fibre port")
> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 24283ece5a0f1040842367966c8e0245b871e309)
> Signed-off-by: Ike Panhc <ike.pan@canonical.com>
> ---
>  .../net/ethernet/hisilicon/hns3/hns3_ethtool.c    | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
> index 0998647da15d..dddb0ccc2ee8 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
> @@ -684,6 +684,12 @@ static int hns3_check_ksettings_param(struct net_device *netdev,
>  	u8 duplex;
>  	int ret;
>  
> +	/* hw doesn't support use specified speed and duplex to negotiate,
> +	 * unnecessary to check them when autoneg on.
> +	 */
> +	if (cmd->base.autoneg)
> +		return 0;
> +
>  	if (ops->get_ksettings_an_result) {
>  		ops->get_ksettings_an_result(handle, &autoneg, &speed, &duplex);
>  		if (cmd->base.autoneg == autoneg && cmd->base.speed == speed &&
> @@ -740,6 +746,15 @@ static int hns3_set_link_ksettings(struct net_device *netdev,
>  			return ret;
>  	}
>  
> +	/* hw doesn't support use specified speed and duplex to negotiate,
> +	 * ignore them when autoneg on.
> +	 */
> +	if (cmd->base.autoneg) {
> +		netdev_info(netdev,
> +			    "autoneg is on, ignore the speed and duplex\n");
> +		return 0;
> +	}
> +
>  	if (ops->cfg_mac_speed_dup_h)
>  		ret = ops->cfg_mac_speed_dup_h(handle, cmd->base.speed,
>  					       cmd->base.duplex);
> 

Applied to disco/linux and eoan/linux.

Thanks,
Kleber
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 0998647da15d..dddb0ccc2ee8 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -684,6 +684,12 @@  static int hns3_check_ksettings_param(struct net_device *netdev,
 	u8 duplex;
 	int ret;
 
+	/* hw doesn't support use specified speed and duplex to negotiate,
+	 * unnecessary to check them when autoneg on.
+	 */
+	if (cmd->base.autoneg)
+		return 0;
+
 	if (ops->get_ksettings_an_result) {
 		ops->get_ksettings_an_result(handle, &autoneg, &speed, &duplex);
 		if (cmd->base.autoneg == autoneg && cmd->base.speed == speed &&
@@ -740,6 +746,15 @@  static int hns3_set_link_ksettings(struct net_device *netdev,
 			return ret;
 	}
 
+	/* hw doesn't support use specified speed and duplex to negotiate,
+	 * ignore them when autoneg on.
+	 */
+	if (cmd->base.autoneg) {
+		netdev_info(netdev,
+			    "autoneg is on, ignore the speed and duplex\n");
+		return 0;
+	}
+
 	if (ops->cfg_mac_speed_dup_h)
 		ret = ops->cfg_mac_speed_dup_h(handle, cmd->base.speed,
 					       cmd->base.duplex);