From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.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 A257A423A62 for ; Tue, 5 May 2026 13:14:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777986861; cv=none; b=RxUj772xg2I1U0StAhGvPMK5LGlVX2CU6OcoIchhl1zXzvMmK28Tv/h9HvzFH+IkiVTK/f0/MYegQIhyWUYZC/kGhMyjKUzlFLHOBu0zDLj0nesQkvrSBLDhgq2X34sNMbU7pSn/eTWDJTzySbhKbcW10jyJRbEmu/VW25yV91E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777986861; c=relaxed/simple; bh=q28iWBuu6TPcU54v8k5R72S0oXL9TmtHnN5OMgn5yFg=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qFqr74li2LvVyF95sHx0b0Lk7WA+aYm28yFgcFxomTg8RKD4dIDt5AfCua9HVZJuK3HA/vdJaz1rZhdlV1/rwIUua33r4cN1toeyR7FPiRJsuqSCIOODc/sctsMsyIyyNfR8mrGg6MsS5JLqOyE7pPe1R/YZd+qQ3BKFqCu2TR8= 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=EY5O1JZ0; arc=none smtp.client-ip=209.85.221.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="EY5O1JZ0" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-44e1860558fso1520319f8f.0 for ; Tue, 05 May 2026 06:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1777986858; x=1778591658; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=00Gzf353kwdb1ZwQdVZ5r/R1yScWtg1pxdKWd+hUbQI=; b=EY5O1JZ0AxJyOflmP6TW9SlKGaicce7fpPKTDUvDYIqYGabzD1QgPul+5f4x12w31s ECiWrjyBOPtkaxNB4DrSmnXgzQG2UHJd4Rl5LxBJ3OwzUNOuy+ui4+o8crDVTebSEUlK wXaArfJ4jbZ1eFZQd3hf3eS/IIqm9gSapZOH+qFWihI/VnJ4T1tmNHZaEkU1xcqRjgZW xF6oHUZLSMj4Ehpkxb9HrwnPEbR66vUEZh/T+TpBET032TCuczJGMp/pa98RwcXr2qnF pUlSkzIMpB9N+cEsyRbWgo3X1UJ/W/aXv1pYM9zwDFFzbbZiGrW4yPEzkQ54kszeYdrM kvbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777986858; x=1778591658; h=in-reply-to: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=00Gzf353kwdb1ZwQdVZ5r/R1yScWtg1pxdKWd+hUbQI=; b=WWSU2Li45TXjYUOVsEUMzK4CzpMaNi/ecEVlt/XWx7+yD/LF+hqv8fR+m0p3gPpuE1 h9xVEr0dUX/07BKsKphb1WYJTKvyTGNJqbXfLK7t9ZjpcrM3FYb61Qa6bxueuZwAnRfk mlPk+Za47Ez59+/hAhDZWykEXnTvTe3B5dmcysQwIedVZIO/V6CDgmXdthDIwAoIR4RH MnmV2ZeowoB7kDR/V5VJ9jX5S2DDvXp8O7bq+EOiedUns2j0bSBweRxUTVuK2vFGmmMa GfJvxj2IbpU6FEw2ygV8YfwhnjgIP3y9P1hKydZh74/0NfTWyrRwjldVtBFxz3+zSZW4 JKBA== X-Forwarded-Encrypted: i=1; AFNElJ81Jq1mb9YZaqG1U+AJ37Ie4u/vL2g95Uuce3OP4un2n+UTsSQL4PgFwuTrVJVFsdUOpDCr43oghErXsAk=@vger.kernel.org X-Gm-Message-State: AOJu0YxPW94uhOuwRWPpRFt5VlofM0xLNTj2Kb1PFF11AhVMdvQnDM+1 EBXgf1EoOsJVQV3VZBcu3HpP8F14kNhklxItGR4jwK0fdSbUZrFRZPw7nJP39aKMchE= X-Gm-Gg: AeBDiesgii4VIJjYPmUxxowqI6dXi69MI2ATtAGNNnCHJklbIYU5VwLiY5/ejolTbST C05kLvqWUbYA9XXJ9l2mqlMsNBv8oyM/a6HBFCMtsdJml7cSC+Elxo++XeuHlMlgGAkuuUDaiFN KmgnZ/Miu7qKQroZMErRVYfFP8TFYSEDRuLkKqPk48ynXRRT6Y2f+Rc1eTE9B/AH40PZLPO+BBT 33RZJzGfu5GTxSSuf5epDnCB9N1cknR1P8WJQH5d+WYF8wdS73bWSlfPuBnoi5HXtiGhwoPO9tw Esqt3K71DIMOYe4Z3lXVMwPkoQ3Wg11YepVXxgGb/QVZY+I8FyfYw29GOiVQFuQo+rsIurjjOUn B9IBwqwWrk6WeKLjPHnLygNfvpPn1Ek7ChmtP4VJjEdn7KAHWCAy89NJHaDg+mrrQntoH+9c+1O HNCxa3DPQJ2rTvGFJBta38uo7mPZLMXMfHspfUTzv2EJ5Vrn7JjAF1z906rC0NHuYtFBKstvqd1 DTtlG0= X-Received: by 2002:a05:6000:2911:b0:441:3144:efc5 with SMTP id ffacd0b85a97d-44bb67cf042mr24716352f8f.42.1777986857973; Tue, 05 May 2026 06:14:17 -0700 (PDT) Received: from localhost (host-79-47-155-212.retail.telecomitalia.it. [79.47.155.212]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45055960902sm4932144f8f.28.2026.05.05.06.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 06:14:17 -0700 (PDT) From: Andrea della Porta X-Google-Original-From: Andrea della Porta Date: Tue, 5 May 2026 15:17:33 +0200 To: Lukasz Raczylo Cc: 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 Subject: Re: [RFC PATCH net-next 1/3] net: macb: flush PCIe posted write after TSTART doorbell Message-ID: References: <3106d546d494f2f52ec832e7f7d04f534286e254.1777064117.git.lukasz@raczylo.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=us-ascii Content-Disposition: inline In-Reply-To: <3106d546d494f2f52ec832e7f7d04f534286e254.1777064117.git.lukasz@raczylo.com> Hi Lukasz, On 23:38 Fri 24 Apr , Lukasz Raczylo wrote: > macb_start_xmit() and macb_tx_restart() kick transmission by > OR-ing MACB_BIT(TSTART) into NCR. On PCIe-attached macb instances > (BCM2712 + RP1 PCIe south bridge on Raspberry Pi 5 is the setup we > have in front of us), writes to NCR are posted PCIe writes: they > are not guaranteed to reach the device before the issuing CPU > returns. If the TSTART doorbell does not reach the MAC, no TX > begins, no TCOMP completion arrives, and the ring remains > quiescent without any kernel-visible indication. > > Note that the raspberrypi/linux vendor fork carries a local patch > around the TSTART site (a queue->tx_pending breadcrumb that is > promoted to queue->txubr_pending by the next TCOMP interrupt, > triggering macb_tx_restart()). That workaround makes the loss > recoverable under traffic, but it cannot help if TCOMP itself is > not raised because no TX started -- which is exactly the case we > are targeting here. The handshake is not present in mainline. > > Add a read-back of NCR after each TSTART write in macb_start_xmit() > and macb_tx_restart(). The read is an architected PCIe read > barrier for earlier posted writes on the same path; it ensures the > doorbell has reached the MAC before the functions return. > > We do not yet have direct hardware evidence that TSTART is being > lost on the RP1 path (that would require a PCIe protocol analyser, > or at minimum a before/after counter on queue->tx_stall_last_tail > with and without this patch applied in isolation). This patch is > one of a three-patch series ("candidate fixes for silent TX stall > on BCM2712/RP1"); see the cover letter for context. We have > verified the series compiles and applies cleanly against mainline > HEAD and against raspberrypi/linux rpi-6.18.y @ f2f68e79f16f; > runtime verification is pending. > > Link: https://github.com/cilium/cilium/issues/43198 > Link: https://bugs.launchpad.net/ubuntu/+source/linux-raspi/+bug/2133877 > Signed-off-by: Lukasz Raczylo > --- > drivers/net/ethernet/cadence/macb_main.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c > index a12aa2124..b6cca55ad 100644 > --- a/drivers/net/ethernet/cadence/macb_main.c > +++ b/drivers/net/ethernet/cadence/macb_main.c > @@ -1922,6 +1922,13 @@ static void macb_tx_restart(struct macb_queue *queue) > > spin_lock(&bp->lock); > macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); > + /* > + * Flush the PCIe posted-write queue so the TSTART doorbell > + * reliably reaches the MAC. Without this, the write can sit > + * in the fabric and the MAC never advances, causing a silent > + * TX stall. > + */ > + (void)macb_readl(bp, NCR); Do you expect it to be a temporal issue (in the comment you stated that the write should be delivered before the function returns) or is it just a dropped packet error? In the former case can you please explain why? If it's the latter, I'd expect the dropped packet to increment the counter in the AER, and I'm pretty sure it didn't when I performed my tests. Many thanks, Andrea > spin_unlock(&bp->lock); > > out_tx_ptr_unlock: > @@ -2560,6 +2567,11 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, struct net_device *dev) > spin_lock(&bp->lock); > macb_tx_lpi_wake(bp); > macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); > + /* > + * Flush the PCIe posted-write queue; see the comment in > + * macb_tx_restart() for the reasoning. > + */ > + (void)macb_readl(bp, NCR); > spin_unlock(&bp->lock); > > if (CIRC_SPACE(queue->tx_head, queue->tx_tail, bp->tx_ring_size) < 1) > -- > 2.53.0 >