All of lore.kernel.org
 help / color / mirror / Atom feed
From: Balakumaran Kannan <kumaran.4353@gmail.com>
To: f.fainelli@gmail.com, netdev@vger.kernel.org
Subject: [PATCH] net phy: Check for aneg completion before setting state to PHY_RUNNING
Date: Thu, 24 Apr 2014 08:22:47 +0530	[thread overview]
Message-ID: <53587C7F.2000808@gmail.com> (raw)

phy_state_machine should check whether auto-negotiatin is completed
before changing phydev->state from PHY_NOLINK to PHY_RUNNING. If
auto-negotiation is not completed phydev->state should be set to
PHY_AN.

Signed-off-by: Balakumaran Kannan <kumaran.4353@gmail.com>
---
 drivers/net/phy/phy.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1b6d09a..a972056 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -765,6 +765,17 @@ void phy_state_machine(struct work_struct *work)
 			break;
 
 		if (phydev->link) {
+			if (AUTONEG_ENABLE == phydev->autoneg) {
+				err = phy_aneg_done(phydev);
+				if (err < 0)
+					break;
+
+				if (!err) {
+					phydev->state = PHY_AN;
+					phydev->link_timeout = PHY_AN_TIMEOUT;
+					break;
+				}
+			}
 			phydev->state = PHY_RUNNING;
 			netif_carrier_on(phydev->attached_dev);
 			phydev->adjust_link(phydev->attached_dev);
-- 
1.8.2.1

             reply	other threads:[~2014-04-24  2:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-24  2:52 Balakumaran Kannan [this message]
2014-04-24 18:53 ` [PATCH] net phy: Check for aneg completion before setting state to PHY_RUNNING Florian Fainelli
2014-04-25  5:53   ` Balakumaran Kannan
2014-04-25 17:08     ` David Miller
2014-05-01  2:11     ` Florian Fainelli
2014-04-28 20:17 ` David Miller
2014-05-01  2:11 ` Florian Fainelli
2014-05-02 19:51 ` 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=53587C7F.2000808@gmail.com \
    --to=kumaran.4353@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.