Received: by 10.223.164.221 with SMTP id h29csp2897521wrb; Thu, 2 Nov 2017 20:52:31 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TnRtcVnLAqEGxsdIjfZxmBRmqhA8xvKTInPj1IJlx9U+hwZ/mpN+CcdoCeZj+lgGZyxMeu X-Received: by 10.98.214.143 with SMTP id a15mr6162684pfl.154.1509681151318; Thu, 02 Nov 2017 20:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509681151; cv=none; d=google.com; s=arc-20160816; b=KI5vT1VpjN4Np5Ay5BRySKvkSxOTRhMB1fPgEMARDLCeButBT6xktVGdTWCWvl/B+z Rob4Ds1WN7NI5Jlp5Y/+btEjqq6JDzgJ7SpxvYkW3+RwDoZnCwM6FgwrEqgupnNodlDW ue7UvwPa/t4OQXjuU4NiTVZk1U52VAUVEwVd0Tsdl+EVXiPXxdNmfhfFRpguvfifOy4H D+DTlL8CG712FhHpFltuFXuAdStJKAK/g0riwiJPvlfXnE6WZ90a2y6uP5pavDX3alJ4 Lqx7sdGCxpEtAHphqHY4zvHhRC9lzbtMZBk2RVfHFm5yFtOACLkHOJBkijYrHgv9gM90 AGcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=38ayBHr/xeqDIc43CLk08I13IUgzltHXVy3JnsbTW6c=; b=fxEpSQcYVSKWH4I/k4pM2+jurW9HzwZx0hCt5VRsO6Pvav81TGUM40RFmBp/N4lGLM huKfO1wfysnGTvMqycv0DDDqpL8YOUHFh2Gg4KmO2nK+38Uun2CGhmo7fUkakkwyK4tG lLRmRj4Y52McUbabo5K4L4ZeMM4G+OfNXUEpieYWlYFGOveflttxvyGFQW4QvU8rsmsB c538jP4HZw54gUxrLe28xmvA6/ZG97x24fnlUo6Su8UPLA+YSjA7MSdkXZ7WeqSXs3up JTO58y3sgH0HtdtYi06noG8H+NYHjtON6TpGbZUk/BClGtm3I9/wnJEN2WC32+LRXAEf 97Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si5336087pfd.106.2017.11.02.20.52.17; Thu, 02 Nov 2017 20:52:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754649AbdKCDvS (ORCPT + 97 others); Thu, 2 Nov 2017 23:51:18 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9942 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752471AbdKCDvI (ORCPT ); Thu, 2 Nov 2017 23:51:08 -0400 Received: from 172.30.72.58 (EHLO DGGEMS411-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKE90174; Fri, 03 Nov 2017 11:51:05 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.361.1; Fri, 3 Nov 2017 11:50:55 +0800 From: Lipeng To: CC: , , , , Subject: [PATCH net-next 1/6] net: hns3: fix for getting autoneg in hns3_get_link_ksettings Date: Fri, 3 Nov 2017 12:18:25 +0800 Message-ID: <1509682710-94908-2-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509682710-94908-1-git-send-email-lipeng321@huawei.com> References: <1509682710-94908-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.59FBE7A9.00D2,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e2a0076116a8e440c5ed14015c07e49d Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fuyun Liang This patch fixes a bug for ethtool's get_link_ksettings(). When phy exists, we should get autoneg from phy rather than from mac. Because the value of mac.autoneg is invalid when phy exists. Fixes: 496d03e (net: hns3: Add Ethtool support to HNS3 driver) Signed-off-by: Fuyun Liang Signed-off-by: Lipeng --- .../ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c index 5cd163b..367b20c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c @@ -9,6 +9,7 @@ #include #include +#include #include "hns3_enet.h" @@ -571,26 +572,25 @@ static int hns3_get_link_ksettings(struct net_device *netdev, u32 advertised_caps; u8 media_type = HNAE3_MEDIA_TYPE_UNKNOWN; u8 link_stat; - u8 auto_neg; - u8 duplex; - u32 speed; if (!h->ae_algo || !h->ae_algo->ops) return -EOPNOTSUPP; /* 1.auto_neg & speed & duplex from cmd */ - if (h->ae_algo->ops->get_ksettings_an_result) { - h->ae_algo->ops->get_ksettings_an_result(h, &auto_neg, - &speed, &duplex); - cmd->base.autoneg = auto_neg; - cmd->base.speed = speed; - cmd->base.duplex = duplex; - - link_stat = hns3_get_link(netdev); - if (!link_stat) { - cmd->base.speed = (u32)SPEED_UNKNOWN; - cmd->base.duplex = DUPLEX_UNKNOWN; - } + if (netdev->phydev) + phy_ethtool_ksettings_get(netdev->phydev, cmd); + else if (h->ae_algo->ops->get_ksettings_an_result) + h->ae_algo->ops->get_ksettings_an_result(h, + &cmd->base.autoneg, + &cmd->base.speed, + &cmd->base.duplex); + else + return -EOPNOTSUPP; + + link_stat = hns3_get_link(netdev); + if (!link_stat) { + cmd->base.speed = SPEED_UNKNOWN; + cmd->base.duplex = DUPLEX_UNKNOWN; } /* 2.media_type get from bios parameter block */ -- 1.9.1 From 1583467669698692916@xxx Wed Nov 08 03:40:47 +0000 2017 X-GM-THRID: 1583467669698692916 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread