netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Samu Nuutamo <samu.nuutamo@vincit.fi>
Cc: netdev@vger.kernel.org, Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: Regression: mv88e6xxx packet loss after 4.18's PHYLINK merge
Date: Wed, 23 Jan 2019 03:10:32 +0100	[thread overview]
Message-ID: <20190123021032.GG3634@lunn.ch> (raw)
In-Reply-To: <20190117113722.GA22476@samu-ThinkPad-T480s>

> Hi Andrew,
> 
> I tested the patch and it has an issue that prevents the carrier from turning
> on. I think it's caused by the change from using link_state to phy->phy_state,
> as later in the same function the link_state attributes are read when
> deciding if the carrier needs to be turned on.
 
Hi Samu

This version has had better testing. So i'm a bit more confident about
it.

	Andrew

From d093492f9aba75cb4844d15148e0efd014f193bb Mon Sep 17 00:00:00 2001
From: Andrew Lunn <andrew@lunn.ch>
Date: Wed, 16 Jan 2019 20:22:04 -0600
Subject: [PATCH] net: phy: phylink: Only change mac when fixed link changes
 state

phylink polls the fixed-link once per second to see if the GPIO has
changed state, or if the callback indicates if there has been a change
in state. It then calls the MAC to reconfigure itself to the current
state.

For some MACs, reconfiguration can result in packets being dropped.
Hence only reconfigure the MAC if the link state differs from the
netdev carrier state.

Reported-by: Samu Nuutamo <samu.nuutamo@vincit.fi>
Fixes: 9cd00a8aa42e ("net: phy: phylink: Poll link GPIOs")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/phylink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index e7becc7379d7..394b1eb5b55a 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -409,7 +409,8 @@ static void phylink_resolve(struct work_struct *w)
 
 		case MLO_AN_FIXED:
 			phylink_get_fixed_state(pl, &link_state);
-			phylink_mac_config(pl, &link_state);
+			if (link_state.link != netif_carrier_ok(ndev))
+				phylink_mac_config(pl, &link_state);
 			break;
 
 		case MLO_AN_INBAND:
-- 
2.20.1


  reply	other threads:[~2019-01-23  2:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14 11:34 Regression: mv88e6xxx packet loss after 4.18's PHYLINK merge Samu Nuutamo
2019-01-14 14:23 ` Andrew Lunn
2019-01-14 18:03   ` Florian Fainelli
2019-01-15  8:15     ` Samu Nuutamo
2019-01-17  2:29 ` Andrew Lunn
2019-01-17 11:37   ` Samu Nuutamo
2019-01-23  2:10     ` Andrew Lunn [this message]
2019-01-23  7:16       ` Samu Nuutamo
2019-01-25 19:00       ` Florian Fainelli
2019-01-25 19:15         ` Russell King - ARM Linux admin
2019-01-17 15:46   ` Samu Nuutamo
2019-01-21 17:52     ` Andrew Lunn

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=20190123021032.GG3634@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=samu.nuutamo@vincit.fi \
    --cc=vivien.didelot@gmail.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).