From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFF55384CC8 for ; Fri, 12 Jun 2026 12:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781267849; cv=none; b=V5civJEo/eyWQcY7puVTZP0p2I68rmAHxFEp1JB0bYh1zvoUdP53wae916IObyvfGM4sZ/+66FAFMYXxbDiRvUKTvxqG5SDdEB/vIHAIthbetsuspE4RrYJJrrf7dB61PYGCWntRQW3LPuZVj6VWgqHdnk0vJjp/Ac5Y5uwnzxA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781267849; c=relaxed/simple; bh=9BiD/pNZG1w1cpdsMn9s0h2RHLqN9zijEXESHAV0+I4=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uqza2vWK5iTjZtW91IafrYCT18g+e+ehAAY+Uhn3CCLsEYPL7g66GeRjcruDjrxLHr9M5vbug56KnnmgwQqkGr2kp0cWpNsSiyakAIOY3klrzKvvO+g0B37tAy6RTESoMJapvvVPsCYf+7cYUB2XaYWXWh/hnnY6WLj4Jc4FJAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=S7J2Cpmx; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="S7J2Cpmx" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-490b211ee6aso6396225e9.3 for ; Fri, 12 Jun 2026 05:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1781267846; x=1781872646; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=MrjsT2w1j1qo9MwDPHviku0Dqn2a94LfN9cpJdJZDKs=; b=S7J2CpmxTelu6/D2S8mmF8NeGQzA/C9UYx9OVPvAbNwwlcjcKhNjpSxn8DMJI8cuMG 0sZ2cTdzxEGQDClGFUUIJBdP/2o/cyNeDl+kBIE7AS8LGq5nz61PRB7eVGrG1FYsSqjV jTh77xSN+Fdukmf17oLQE0vCgh/8QFRqH21N8i2XPRd5N5uonwR+RX3QMQU1FQ7qWw52 Zty/Ql7HfswoSxDFrQgAZt9Vtyiu/IqIvaaF9ocAg1dqw4+egIK8M8jxFClzEOQ/pafE nxuHqx5zT9mBMy/WJOTH2manPEi0QR1FEibC/RSUxOxuz9oakePYx+yjsGhm818Zg/Dl Jpbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781267846; x=1781872646; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MrjsT2w1j1qo9MwDPHviku0Dqn2a94LfN9cpJdJZDKs=; b=FTR5WjwSJzIJ2xY5DkH8pNAO/U0z9w+AlSG2I1MOCwn6g7+nZ9zz+ivSFQZF4bELuC wsli3ZtZjfQLrX9SngL5GApVI8i/gcmyVplrmyCW6tubQbMiEenqlsZGpYzKJfaqj0PF lgTN/Yf/xfq2WAvj/7WPH3V7dNAqwow7LJoaWSNZl5AAwB9p0CuioabejWGJMzE8EcLS DJpsx8/VrxbJPy4+VuXmsMraryaBXJq4Ra/R9S78gZMCM7JeNtebTiA3vnFgTIoJcP1p 9EKib8vg/kfCpUhgjgQRSzitihM15QwPREsaxoEi256e5LcVl161MvzCgDGLbyrdJ3FH 9ZMA== X-Forwarded-Encrypted: i=1; AFNElJ/AVwcSiK1N4jF8zUoqSAYZxhLVrfgUBXNU2m208mjtSz7NNbfE7Kyl/yhyXcC0OyQdY/yQWts=@vger.kernel.org X-Gm-Message-State: AOJu0YyIlRteKLZa3izw3KPAq6BDivYEmm8PGqqOJvVgmmjiAt8r6sWv bY6ScJTT6eB8D1Fgab0a3WMJjcknkkxf4roTZdnIi6dm3rhBBli1jpK7zWe8CuhLt7s= X-Gm-Gg: Acq92OHWrd7DVr548zwco40Liy80pj79dkjBRfIjdZAoyVdXBP8TMSIOUHeV4pohQSy GQz9ez2jc8qZ4bKSDCoaM3oWKgPHVJC9qYi/EtBvXnruB/yvyY+VgmTrgNZeCGSqt6v4j9b1de/ so72U98ZdMH5VjAOabpcm7RQrBqSLE1eS3KH94fZaynZdQP9de/g5vrPGtJPiOZ8GNLVY4pifZ9 CmS0Niw3ZR08S2Z0YNk3YIn7CFAEr4DezR63rzVvgQARMeg+azN4GoIDPHqD/1dWBoH0i0U1gc8 7Zpox9473HiMJQF8i6oahe36SqHhhihNriKEvD8IaDJHikyR4hBl8omGqvnLy1rTuVtT+AqbX3S TCaZl4kAXi4q/RD/uenwaLWJI7aFcArmfmv9htz2V9dKEIbeVotm+ovipYR3QyGKE7JpvWeMWCw J1j8OthmIx78AqigVBoXCc X-Received: by 2002:a05:600c:5296:b0:492:1e7f:d426 with SMTP id 5b1f17b1804b1-4921e7fd54bmr110925e9.2.1781267846081; Fri, 12 Jun 2026 05:37:26 -0700 (PDT) Received: from localhost ([195.94.146.6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ea843d63sm64794375e9.12.2026.06.12.05.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2026 05:37:25 -0700 (PDT) From: Andrea della Porta X-Google-Original-From: Andrea della Porta Date: Fri, 12 Jun 2026 14:40:47 +0200 To: =?iso-8859-1?Q?Th=E9o?= Lebrun Cc: Andrea della Porta , netdev@vger.kernel.org, Nicolas Ferre , Claudiu Beznea , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, Lukasz Raczylo , Steffen Jaeckel Subject: Re: [PATCH] net: macb: add TX stall timeout callback to recover from lost TSTART write Message-ID: References: <771b8faeaee1fce4a84a5ba2661d60b35a65a6d5.1781253818.git.andrea.porta@suse.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hi Theo, On 11:45 Fri 12 Jun , Théo Lebrun wrote: > Hello Andrea, > > On Fri Jun 12, 2026 at 11:01 AM CEST, Andrea della Porta wrote: > > From: Lukasz Raczylo > > > > The MACB found in the Raspberry Pi RP1 suffers from sporadic stalls on > > the TX queue. > > While the exact root cause is not yet fully understood, it is likely > > related to a hardware issue where a TSTART write to the NCR register > > is missed, preventing the transmission from being kicked off. > > > > Implement a timeout callback to handle TX queue stalls, triggering the > > existing restart mechanism to recover. > > > > Link: https://lore.kernel.org/all/20260514215459.36109-1-lukasz@raczylo.com/ > > Fixes: dc110d1b23564 ("net: cadence: macb: Add support for Raspberry Pi RP1 ethernet controller") > > Signed-off-by: Lukasz Raczylo > > Co-developed-by: Steffen Jaeckel > > Signed-off-by: Steffen Jaeckel > > Co-developed-by: Andrea della Porta > > Signed-off-by: Andrea della Porta > > --- > > drivers/net/ethernet/cadence/macb_main.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c > > index a12aa21244e83..615da65d5d68d 100644 > > --- a/drivers/net/ethernet/cadence/macb_main.c > > +++ b/drivers/net/ethernet/cadence/macb_main.c > > @@ -4522,6 +4522,16 @@ static int macb_setup_tc(struct net_device *dev, enum tc_setup_type type, > > } > > } > > > > +static void macb_tx_timeout(struct net_device *dev, unsigned int q) > > +{ > > + struct macb *bp = netdev_priv(dev); > > + > > + if (net_ratelimit()) > > + netdev_err(dev, "TX stall detected, re-kicking TSTART\n"); > > Is this standard? It looks odd. I've found it used in other drivers, it's the closest I had found that limit the rate for net related output. As Nicolai suggested, on timeout a message is already printed by the core, so I will drop those two lines. > > > + dev->stats.tx_errors++; > > I am surprised by this. `tx_errors` would ideally be one per packet that > didn't get sent. Here we increment it once per queue that stalled. > > I have a series to address stats issue (and use netdev_stat_ops API). > It is a follow-up to this: > https://lore.kernel.org/netdev/20260428-macb-drop-tx-v2-0-647f5199d8df@bootlin.com/ > > Also this is per-device shared data and we access it without > synchronisation. > > Let's drop this increment. Agreed. Thanks, Andrea > > > + macb_tx_restart(&bp->queues[q]); > > +} > > Regards, > > -- > Théo Lebrun, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com >