public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Thomas Voegtle <tv@lio96.de>
Cc: linux-kernel@vger.kernel.org,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: network problems with r8169
Date: Fri, 19 Jul 2019 22:05:38 +0200	[thread overview]
Message-ID: <2eeedff5-4911-db6e-6bfd-99b591daa7ef@gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.21.1907182032370.7080@er-systems.de>

On 18.07.2019 20:50, Thomas Voegtle wrote:
> 
> Hello,
> 
> I'm having network problems with the commits on r8169 since v5.2. There are ping packet loss, sometimes 100%, sometimes 50%. In the end network is unusable.
> 
> v5.2 is fine, I bisected it down to:
> 
> a2928d28643e3c064ff41397281d20c445525032 is the first bad commit
> commit a2928d28643e3c064ff41397281d20c445525032
> Author: Heiner Kallweit <hkallweit1@gmail.com>
> Date:   Sun Jun 2 10:53:49 2019 +0200
> 
>     r8169: use paged versions of phylib MDIO access functions
> 
>     Use paged versions of phylib MDIO access functions to simplify
>     the code.
> 
>     Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> 
> Reverting that commit on top of v5.2-11564-g22051d9c4a57 fixes the problem
> for me (had to adjust the renaming to r8169_main.c).
> 
> I have a:
> 04:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd.
> RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev
> 0c)
>         Subsystem: Biostar Microtech Int'l Corp Device [1565:2400]
>         Kernel driver in use: r8169
> 
> on a BIOSTAR H81MG motherboard.
> 
Interesting. I have the same chip version (RTL8168g) and can't reproduce
the issue. Can you provide a full dmesg output and test the patch below
on top of linux-next? I'd be interested in the WARN_ON stack traces
(if any) and would like to know whether the experimental change to
__phy_modify_changed helps.

> 
> greetings,
> 
>   Thomas
> 
> 
Heiner


diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 8d7dd4c5f..26be73000 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -1934,6 +1934,8 @@ static int rtl_get_eee_supp(struct rtl8169_private *tp)
 	struct phy_device *phydev = tp->phydev;
 	int ret;
 
+	WARN_ON(phy_read(phydev, 0x1f));
+
 	switch (tp->mac_version) {
 	case RTL_GIGA_MAC_VER_34:
 	case RTL_GIGA_MAC_VER_35:
@@ -1957,6 +1959,8 @@ static int rtl_get_eee_lpadv(struct rtl8169_private *tp)
 	struct phy_device *phydev = tp->phydev;
 	int ret;
 
+	WARN_ON(phy_read(phydev, 0x1f));
+
 	switch (tp->mac_version) {
 	case RTL_GIGA_MAC_VER_34:
 	case RTL_GIGA_MAC_VER_35:
@@ -1980,6 +1984,8 @@ static int rtl_get_eee_adv(struct rtl8169_private *tp)
 	struct phy_device *phydev = tp->phydev;
 	int ret;
 
+	WARN_ON(phy_read(phydev, 0x1f));
+
 	switch (tp->mac_version) {
 	case RTL_GIGA_MAC_VER_34:
 	case RTL_GIGA_MAC_VER_35:
@@ -2003,6 +2009,8 @@ static int rtl_set_eee_adv(struct rtl8169_private *tp, int val)
 	struct phy_device *phydev = tp->phydev;
 	int ret = 0;
 
+	WARN_ON(phy_read(phydev, 0x1f));
+
 	switch (tp->mac_version) {
 	case RTL_GIGA_MAC_VER_34:
 	case RTL_GIGA_MAC_VER_35:
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 16667fbac..1aa1142b8 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -463,12 +463,10 @@ int __phy_modify_changed(struct phy_device *phydev, u32 regnum, u16 mask,
 		return ret;
 
 	new = (ret & ~mask) | set;
-	if (new == ret)
-		return 0;
 
-	ret = __phy_write(phydev, regnum, new);
+	__phy_write(phydev, regnum, new);
 
-	return ret < 0 ? ret : 1;
+	return new != ret;
 }
 EXPORT_SYMBOL_GPL(__phy_modify_changed);
 
-- 
2.22.0


  reply	other threads:[~2019-07-19 20:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 18:50 network problems with r8169 Thomas Voegtle
2019-07-19 20:05 ` Heiner Kallweit [this message]
2019-07-19 21:12   ` Thomas Voegtle
2019-07-20  9:11     ` Heiner Kallweit
2019-07-20 14:22       ` Thomas Voegtle
2019-07-20 16:44         ` Heiner Kallweit
2019-07-20  9:13     ` Heiner Kallweit

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=2eeedff5-4911-db6e-6bfd-99b591daa7ef@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tv@lio96.de \
    /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