public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Vivian Wang <wangruikang@iscas.ac.cn>
Cc: Chukun Pan <amadeus@jmu.edu.cn>,
	Michael Opdenacker <michael.opdenacker@rootcommit.com>,
	netdev@vger.kernel.org, linux-riscv@lists.infradead.org,
	spacemit@lists.linux.dev, linux-kernel@vger.kernel.org,
	Mark Brown <broonie@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Yixun Lan <dlan@gentoo.org>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Troy Mitchell <troy.mitchell@linux.spacemit.com>
Subject: Re: [PATCH net v3] net: spacemit: Check for netif_carrier_ok() in emac_stats_update(): manual merge
Date: Tue, 27 Jan 2026 12:02:38 +0100	[thread overview]
Message-ID: <1c357d72-2a73-47d8-9ec7-56a2912a2e10@kernel.org> (raw)
In-Reply-To: <20260123-k1-ethernet-clarify-stat-timeout-v3-1-93b9df627e87@iscas.ac.cn>

[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]

Hi Vivian,

+cc Mark Brown

On 23/01/2026 04:52, Vivian Wang wrote:
> Some PHYs stop the refclk for power saving, usually while link down.
> This causes reading stats to time out.
> 
> Therefore, in emac_stats_update(), also don't update and reschedule if
> !netif_carrier_ok(). But that means we could be missing later updates if
> the link comes back up, so also reschedule when link up is detected in
> emac_adjust_link().
> 
> While we're at it, improve the comments and error message prints around
> this to reflect the better understanding of how this could happen.
> Hopefully if this happens again on new hardware, these comments will
> direct towards a solution.

(...)

> ---
> This has a conflict in context lines in emac_adjust_link() with current
> net-next, which will show up when pulling that for next rc1. Just remove
> "emac_set_fc_autoneg(priv);".

Thank you for this note, this was useful! Just in case it can be useful
for linux-next and Net maintainers, I confirm the conflict when merging
'net' in 'net-next' due to this patch applied in 'net':

  2c84959167d6 ("net: spacemit: Check for netif_carrier_ok() in
emac_stats_update()")

and this one from 'net-next':

  f66086798f91 ("net: spacemit: Remove broken flow control support")

The resolution is attached to this email, and rerere cache is available
there:

 https://github.com/multipath-tcp/mptcp-upstream-rr-cache/commit/526c74b

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.

[-- Attachment #2: 7daa0aa370b7e9326e11e06fdb247227773bba0a.patch --]
[-- Type: text/x-patch, Size: 546 bytes --]

diff --cc drivers/net/ethernet/spacemit/k1_emac.c
index c85dc742c404,88e9424d2d51..23b6f1531e0c
--- a/drivers/net/ethernet/spacemit/k1_emac.c
+++ b/drivers/net/ethernet/spacemit/k1_emac.c
@@@ -1531,6 -1648,14 +1545,12 @@@ static void emac_adjust_link(struct net
  		}
  
  		emac_wr(priv, MAC_GLOBAL_CONTROL, ctrl);
+ 
 -		emac_set_fc_autoneg(priv);
 -
+ 		/*
+ 		 * Reschedule stats updates now that link is up. See comments in
+ 		 * emac_stats_update().
+ 		 */
+ 		mod_timer(&priv->stats_timer, jiffies);
  	}
  
  	phy_print_status(phydev);

      parent reply	other threads:[~2026-01-27 11:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23  3:52 [PATCH net v3] net: spacemit: Check for netif_carrier_ok() in emac_stats_update() Vivian Wang
2026-01-27  4:00 ` patchwork-bot+netdevbpf
2026-01-27 11:02 ` Matthieu Baerts [this message]

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=1c357d72-2a73-47d8-9ec7-56a2912a2e10@kernel.org \
    --to=matttbe@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=amadeus@jmu.edu.cn \
    --cc=andrew+netdev@lunn.ch \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dlan@gentoo.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=michael.opdenacker@rootcommit.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=troy.mitchell@linux.spacemit.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=wangruikang@iscas.ac.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