linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
To: <davem@davemloft.net>, <yisen.zhuang@huawei.com>,
	<salil.mehta@huawei.com>, <yankejian@huawei.com>
Cc: <liguozhu@huawei.com>, <huangdaode@hisilicon.com>,
	<arnd@arndb.de>, <andriy.shevchenko@linux.intel.com>,
	<andrew@lunn.ch>, <geliangtang@163.com>, <ivecera@redhat.com>,
	<fengguang.wu@intel.com>, <charles.chenxin@huawei.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <linuxarm@huawei.com>
Subject: [PATCH net-next 09/19] net: hns: fix the wrong speed for bond
Date: Tue, 21 Jun 2016 11:56:29 +0800	[thread overview]
Message-ID: <1466481399-70080-10-git-send-email-Yisen.Zhuang@huawei.com> (raw)
In-Reply-To: <1466481399-70080-1-git-send-email-Yisen.Zhuang@huawei.com>

From: Qianqian Xie <xieqianqian@huawei.com>

For debug-ports,there are two non-synchronized processes:
Speed-Auto-Negotiation and Link-Update-Status. The two
processes are towed by two different state machines.
Bond reads the speed when link up, but the speed maybe
not update the right value at that time.That make for bond's
wrong speed. Thus only one state machine should be used and
if phy_state_machine is used, it does not need to do
hns_nic_update_link_status().

Signed-off-by: Qianqian Xie <xieqianqian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_enet.c    | 43 +++++++++++++-----------
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |  2 +-
 2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 00e529f..cef9d12 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -991,8 +991,26 @@ static void hns_nic_adjust_link(struct net_device *ndev)
 {
 	struct hns_nic_priv *priv = netdev_priv(ndev);
 	struct hnae_handle *h = priv->ae_handle;
+	int state = 1;
+
+	if (priv->phy) {
+		h->dev->ops->adjust_link(h, ndev->phydev->speed,
+					 ndev->phydev->duplex);
+		state = priv->phy->link;
+	}
+	state = state && h->dev->ops->get_status(h);
 
-	h->dev->ops->adjust_link(h, ndev->phydev->speed, ndev->phydev->duplex);
+	if (state != priv->link) {
+		if (state) {
+			netif_carrier_on(ndev);
+			netif_tx_wake_all_queues(ndev);
+			netdev_info(ndev, "link up\n");
+		} else {
+			netif_carrier_off(ndev);
+			netdev_info(ndev, "link down\n");
+		}
+		priv->link = state;
+	}
 }
 
 /**
@@ -1577,27 +1595,14 @@ static void hns_nic_update_link_status(struct net_device *netdev)
 	struct hns_nic_priv *priv = netdev_priv(netdev);
 
 	struct hnae_handle *h = priv->ae_handle;
-	int state = 1;
 
-	if (priv->phy) {
-		if (!genphy_update_link(priv->phy))
-			state = priv->phy->link;
-		else
-			state = 0;
-	}
-	state = state && h->dev->ops->get_status(h);
+	if (h->phy_dev) {
+		if (h->phy_if != PHY_INTERFACE_MODE_XGMII)
+			return;
 
-	if (state != priv->link) {
-		if (state) {
-			netif_carrier_on(netdev);
-			netif_tx_wake_all_queues(netdev);
-			netdev_info(netdev, "link up\n");
-		} else {
-			netif_carrier_off(netdev);
-			netdev_info(netdev, "link down\n");
-		}
-		priv->link = state;
+		(void)genphy_read_status(h->phy_dev);
 	}
+	hns_nic_adjust_link(netdev);
 }
 
 /* for dumping key regs*/
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 5b3dccb..564ae1e 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -49,7 +49,7 @@ static u32 hns_nic_get_link(struct net_device *net_dev)
 	h = priv->ae_handle;
 
 	if (priv->phy) {
-		if (!genphy_update_link(priv->phy))
+		if (!genphy_read_status(priv->phy))
 			link_stat = priv->phy->link;
 		else
 			link_stat = 0;
-- 
1.9.1

  parent reply	other threads:[~2016-06-21  3:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21  3:56 [PATCH net-next 00/19] net: hns: fix some bugs in hns driver Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 01/19] net: hns: bug fix of ge reset sequence Yisen Zhuang
2016-06-21 10:35   ` Andy Shevchenko
2016-06-22  1:33     ` Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 02/19] net: hns: fix hns dsaf v1 dont support tx_pause close Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 03/19] net: hns: add skb_reset_mac_header() after skb being alloc Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 04/19] net: hns: typo fix of annotation info for hns_nic_reset_subtask() Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 05/19] net: hns: Remove unnecessary device resource free Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 06/19] net: hns: fix the error info when dma_set_mask_and_coherent fail Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 07/19] net: hns: select Hilink before serdes loopback for HNS V2 Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 08/19] net: hns: fix ethtool loopback fail bug Yisen Zhuang
2016-06-21  3:56 ` Yisen Zhuang [this message]
2016-06-21  3:56 ` [PATCH net-next 10/19] net: hns: bugfix about pfc pause frame statistics Yisen Zhuang
2016-06-21 10:32   ` Andy Shevchenko
2016-06-22  1:43     ` Yisen Zhuang
2016-06-22  9:41       ` Andy Shevchenko
2016-06-23  5:42         ` Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 11/19] net: hns: add spin lock for tcam table operation Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 12/19] net: hns: fix bug of getting the wrong tcam data Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 13/19] net: hns: add get_coalesce_range api for hns Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 14/19] net: hns: delete redundancy ring enable operations Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 15/19] net: hns: bug fix about led control logic when link down Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 16/19] net: hns: fix bug that alloc skb fail lead to port unavailable Yisen Zhuang
2016-06-21 13:25   ` Sergei Shtylyov
2016-06-22  1:41     ` Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 17/19] net: hns: fix sbm default parameters config error Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 18/19] net: hns: change the default coalesce usecs Yisen Zhuang
2016-06-21  3:56 ` [PATCH net-next 19/19] net: hns: bug fix about TSO on|off when there is traffic Yisen Zhuang
2016-06-21  8:54 ` [PATCH net-next 00/19] net: hns: fix some bugs in hns driver David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466481399-70080-10-git-send-email-Yisen.Zhuang@huawei.com \
    --to=yisen.zhuang@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=charles.chenxin@huawei.com \
    --cc=davem@davemloft.net \
    --cc=fengguang.wu@intel.com \
    --cc=geliangtang@163.com \
    --cc=huangdaode@hisilicon.com \
    --cc=ivecera@redhat.com \
    --cc=liguozhu@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yankejian@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).