From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 C62C63B9956 for ; Fri, 12 Jun 2026 12:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781267850; cv=none; b=V0ELnIq+LaI8Pla6Li3JWZ0SjcgoDYxa1DYm2f5r1HDkouTr4RmkQSwGujQvCVM4Gsv5PkiHothK1t6pu/UqwOZn0k04adsrH94YeNhnla6akIIiyVJDucJy1OlZFJ9ztyeiN+0oB5OurABaCRr8NKS80titRimZJ/osqMJ9pJM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781267850; 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=rXCpvCZl9nxUMZToDKnMMzMZOfHMUsrGc0oM099FD931G+dxS/Dn38Y+WamZQ623LZ113VmoeN/aIgpPtgy0HMuGSqYF8ihmLQzqciX7i+Rc+JI9ujQtJmsmeCfm4EGh1JBOo3aa2LFLtW1Ms673PP9aQTh68qi2NxKm9pV43lA= 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.49 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-f49.google.com with SMTP id 5b1f17b1804b1-490d1e54b3bso11471245e9.1 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=s96bpV34dSxdQvHggAjJPYeAL9qDzfAwDZ8gCAbSrbyiAKf23W7oF5/N0iXWfRUzXP L8cLfNc3YqpHZF4Wm6xCA/DncrJfxyLCjp1DnvQCyoz3XULixFnv60jDei7WH71xCkwH ajPfXTsADNI3etiD3aPy6GuzRobgEvHhZuP7P3k6G1HMs969S249PPoJY8ZiDO1DRwXw XUjaoj/2qBDO7dMTuNWy8WG1dNiOVXzNbnicLda/1dWwA2yI65wSkWx1wC021KFUBMrJ V2k+qdCjBX3XWaUUZ9uu6TtS3jIf/wpRsVb7ycTaOEUca5NXIDn8SU4tbvHcLOU2RsQF vidw== X-Forwarded-Encrypted: i=1; AFNElJ/D8I78WOnc35tynML7AgaZKNYSeh3aEQiozSxXFuB+8w/rbCjvkoUm/vJshb2QRG5Hhavds5h1p2RIFKY=@vger.kernel.org X-Gm-Message-State: AOJu0YxysCKkXKnVFiif9fONdid1mqH6GNf2i+3/RLshucHs9fBzjLc2 qjeHMPlhO4sakvLVcRWg01lJlWa+BWC7Q5PbnWEIYrM5nqwq/LISkFBzOWxAEJ1x1R8= X-Gm-Gg: Acq92OHLmFvPzmSPrk50jeQE+fCbl1hCpvMQdAk4JroH1IULLjSLrn9vNR18oJCN8hx c1ZYJ4EhOnkVfweHYK1CbCCb+0tW3AvMskHGraVNo6XcXCOe6Eu2c/5nDv6oQ2iPf7jBhKtwPUk +juvexAONQUQzLsJaqtWESrkKBfGF5Ldf/bWaO3MbMRnww6yUYY62Vyupj6Dx5/OfxfGwjMVixN 1vUQCRlS4MMNxwGna4DHu7ieTvT3spm4tK4pL3yi4Pj0fd73JbUMKo8uACoVNDHNrDljesHhN5O GREweWxWh/J062mNBDu3bCk0gX04G6FaxvBaf8zhEqqnAcfD3wp5vThXWzqi1UWf+Jz+FXpiSuS 9P00hXa0V/fkhQ4uQfTO8I43ohjnssUbs43zWFXBNKENr6XNISWu+qvhtMhkjb/clZqfarHrThg eJbAJcphPWOGmVCjN9ElCO 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: linux-kernel@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 >