mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hayes Wang <hayeswang@realtek.com>
To: Linmao Li <lilinmao@kylinos.cn>, Andrew Lunn <andrew@lunn.ch>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Chih Kai Hsu <hsu.chih.kai@realtek.com>,
	nic_swsd <nic_swsd@realtek.com>,
	Birger Koblitz <mail@birger-koblitz.de>,
	Xiangqian Zhang <zhangxiangqian@kylinos.cn>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH net v2] r8152: Use BMSR to detect the link state
Date: Mon, 19 Oct 2026 12:12:06 +0000	[thread overview]
Message-ID: <04de94998df1449b945b8847204980d2@realtek.com> (raw)
In-Reply-To: <cf64cf73-aa31-4a78-82c4-a9a6c866d7cf@kylinos.cn>

Linmao Li <lilinmao@kylinos.cn>
> Sent: Friday, October 16, 2026 3:16 PM
[...]
> Option a) addresses only the speed regression. It keeps the existing
> PLA_PHYSTATUS carrier detection and does not improve reporting of short link
> drops that recover before the link work runs.
> 
> I plan to post a) as v3 for net next week, keeping that scope explicit. Please let
> me know if you see a problem with this approach.

I tested the following patch, and it works for me. It might be useful as a reference.

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index f61686433031..398d35f6fb7b 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -6979,11 +6979,8 @@ static void set_carrier(struct r8152 *tp)
 {
 	struct net_device *netdev = tp->netdev;
 	struct napi_struct *napi = &tp->napi;
-	u16 speed;
-
-	speed = rtl8152_get_speed(tp);
 
-	if (speed & LINK_STATUS) {
+	if (r8152_mdio_read(tp, MII_BMSR) & BMSR_LSTATUS) {
 		if (!netif_carrier_ok(netdev)) {
 			tp->rtl_ops.enable(tp);
 			netif_stop_queue(netdev);
@@ -7009,6 +7006,11 @@ static void set_carrier(struct r8152 *tp)
 			tasklet_enable(&tp->tx_tl);
 			netif_info(tp, link, netdev, "carrier off\n");
 		}
+
+		if (rtl8152_get_speed(tp) & LINK_STATUS) {
+			set_bit(RTL8152_LINK_CHG, &tp->flags);
+			schedule_delayed_work(&tp->schedule, 0);
+		}
 	}
 }


Best Regards,
Hayes


  reply	other threads:[~2026-10-19 12:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 10:52 Linmao Li
2026-10-05 18:32 ` Birger Koblitz
2026-10-09  7:18   ` Linmao Li
2026-10-12 16:13     ` Birger Koblitz
2026-10-13  2:38       ` Linmao Li
2026-10-13  3:51         ` Birger Koblitz
2026-10-06  8:28 ` Hayes Wang
2026-10-06 16:10   ` Andrew Lunn
2026-10-09  7:16     ` Linmao Li
2026-10-09 12:22       ` Andrew Lunn
2026-10-13  2:36         ` Linmao Li
2026-10-13 10:30           ` Hayes Wang
2026-10-13  8:04         ` Hayes Wang
2026-10-14 16:10           ` Andrew Lunn
2026-10-16  7:15             ` Linmao Li
2026-10-19 12:12               ` Hayes Wang [this message]
2026-10-13  7:37       ` Hayes Wang
2026-10-06 22:55 ` netdev-bot+sashiko

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=04de94998df1449b945b8847204980d2@realtek.com \
    --to=hayeswang@realtek.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hsu.chih.kai@realtek.com \
    --cc=kuba@kernel.org \
    --cc=lilinmao@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mail@birger-koblitz.de \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=zhangxiangqian@kylinos.cn \
    /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

all inboxes | Powered by JetHome®