Article View: linux.kernel.netdev
Article #10187[PATCH net-next v6 1/9] net: bcmgenet: ring the doorbell when the last frame of a batch is dropped
From: Nicolai Buchwitz
Date: Tue, 03 Nov 2026 10:04
Date: Tue, 03 Nov 2026 10:04
86 lines
11344 bytes
11344 bytes
bcmgenet_xmit() only writes the producer index at the end of a batch. The
error exits return before that write. If the dropped frame was the last of
an xmit_more batch, the frames queued before it stay in the ring until the
next transmit. The queue is still running, so the watchdog does not fire.
Found by a sashiko review, not by a bug report. The existing exits only
trigger on an allocation or DMA mapping failure, and the padding in a later
patch adds three more.
Write the producer index on those exits too.
Fixes: ddd0ca5d60b3 ("net: bcmgenet: add support for xmit_more")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4d2be2a21ed1b..f28b32f62a7c6 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2122,6 +2122,15 @@ static void bcmgenet_hide_tsb(struct sk_buff *skb)
__skb_pull(skb, sizeof(struct status_64));
}
+static void bcmgenet_tx_kick(struct bcmgenet_priv *priv,
+ struct bcmgenet_tx_ring *ring,
+ struct netdev_queue *txq)
+{
+ if (!netdev_xmit_more() || netif_xmit_stopped(txq))
+ bcmgenet_tdma_ring_writel(priv, ring->index,
+ ring->prod_index, TDMA_PROD_INDEX);
+}
+
static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
@@ -2168,10 +2177,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
/* add the Transmit Status Block */
skb = bcmgenet_add_tsb(dev, skb, ring);
- if (!skb) {
- ret = NETDEV_TX_OK;
- goto out;
- }
+ if (!skb)
+ goto drop;
for (i = 0; i <= nr_frags; i++) {
tx_cb_ptr = bcmgenet_get_txcb(priv, ring);
@@ -2196,7 +2203,6 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
if (ret) {
priv->mib.tx_dma_failed++;
netif_err(priv, tx_err, dev, "Tx DMA map failed\n");
- ret = NETDEV_TX_OK;
goto out_unmap_frags;
}
dma_unmap_addr_set(tx_cb_ptr, dma_addr, mapping);
@@ -2238,10 +2244,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
if (ring->free_bds <= (MAX_SKB_FRAGS + 1))
netif_tx_stop_queue(txq);
- if (!netdev_xmit_more() || netif_xmit_stopped(txq))
- /* Packets are ready, update producer index */
- bcmgenet_tdma_ring_writel(priv, ring->index,
- ring->prod_index, TDMA_PROD_INDEX);
+ bcmgenet_tx_kick(priv, ring, txq);
out:
spin_unlock(&ring->lock);
@@ -2258,6 +2261,10 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
}
dev_kfree_skb(skb);
+drop:
+ /* The dropped frame may have been the last one of the batch */
+ bcmgenet_tx_kick(priv, ring, txq);
+ ret = NETDEV_TX_OK;
goto out;
}
--
2.53.0
Technical Details
Message-ID:
<20261103-nb-genet-mtu-nn-v2-v6-1-61d5631676e5@tipi-net.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355365-linux-kernel-netdev=dewy.ruReferences:
<20261103-nb-genet-mtu-nn-v2-v6-0-61d5631676e5@tipi-net.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355365-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v6 1/9] net: bcmgenet: ring the doorbell when the last frame of a batch is dropped Date: Tue, 03 Nov 2026 11:04:55 +0100 Organization: Usenet Network Message-ID: <20261103-nb-genet-mtu-nn-v2-v6-1-61d5631676e5@tipi-net.de> References: <20261103-nb-genet-mtu-nn-v2-v6-0-61d5631676e5@tipi-net.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3140695"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:YAJIJj0MdQeKAnXXc6lOHeOEgX8= sha256:xUmLwWsKuc2/aPwPpAWZAgMkJtLlnQ5Sd9U7ongcDUs= sha1:JkBOsMfgSXVcZ8ZNxowvEVmG8ew= sha256:apv/qxeZFVRdRr4CSsbAhgCYOxOismoQZfbYv+i3mik= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A0C201127B7; Tue, 3 Nov 2026 13:21:03 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.151 X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=tipi-net.de X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nClv8QDXyM4t; Tue, 3 Nov 2026 13:21:01 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-355365-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 75AD5112756; Tue, 3 Nov 2026 13:20:53 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 7DECA60ABF8; Tue, 3 Nov 2026 10:07:48 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793700335; b=KXSXrnr6mH95edgsnjP9HpHbrNVNzgJF0rQaFCZBXB8Kz+AKO+E3poeIwSH+MtOJ/Co5 RrEa1AxBdTgVu0VqG0VvsjzAUSBeEKlpextmgHFDT7FfUtIhq/tcl3dbgCC6EEfEccKD0 nxCu7AiUDOJNQbctduaTmIf3Qoy2JgDDOmrKzSDEoPEIv8Iy2f8AqaLVxoNW8TZ/uMuyt gPq081vWWSagdpIzUetDyDwHnbxQOQ2Fltax5y8TncdUcT135K363ShA/8qsjrwmQCHuI MjSOGM9RMfsI99JQ3Q8TMdmkiJ3e6JHua20gemo/Ysjt3sinKt9ucXKw1BpdijbGyqg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793700335; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From: Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Last-TLS-Session-Version; bh=eMhYrEXhK+jNgEjEWTh9+AJn7+8+y5YB3TQvTD1Q6tA=; b=4s/Ya2wK8ssMaDF20T0N/I71xmA+hmQW9BSgtsJk/3s+v+5Nt8MOG+AiugpNVkXJrOrC LeVK0WCDLl5eB5lbRYaqcuHkz37bQL+1nPE7ungxkfIA3ekDqHfwu6Jtx5/QQnyzxqMCO rSeodAU92AUSLCqDnA30XZ0ek2SulaDjsuQo8IyQ005RRQYk3oyL6QXtcuI0maQSaB6RJ W1TXgiKKheM/b0cmZY4rmTdnXdRtHiV+PrHKltvfIsT1Ps6RDR1byqDx8LvDsZ/RJcksl Khx5316BDvhZbpoJsjCZiBz4vcJ5kc7c0QF9+fD/Y/tOG04oWSUhAk83Hk29LBdxv3Q== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=regW97Ie; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CE496085085; Tue, 3 Nov 2026 10:05:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=regW97Ie X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793700329; b=G5WlL82FAu001Zo0QyG3tUYpmTzvLXYkVbd//eBgo1O3yxqkB5pEKfIa1+247caKjIOT 7S6SGX9Z86Q3gr0mVQcWxq+4qcnYE6iTjfGM82E8aUFhh8mMvCAlz3hibU3YQpU/fBjya dJGhU5TMqdaLhAXp5/K/jgKjD0DyNNHHkRaPDSPJW/GONu8/3IfgHMk+uPVhXae/DWcm/ xWPcCNBxyluPFM6oh+kl5SsdFNbiWgVTSCDZu+n2So6QmiQmHCdmMd9Eo8yTfBtOifX3a ev+pw1Mx6OYJAS0q4ql85LhUg11fEloPG1qIrXC6ZhkJkScBHxd1GHlsjCSwULvG6Bg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793700329; h=DMARC-Filter:Received:DKIM-Signature:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Last-TLS-Session-Version; bh=eMhYrEXhK+jNgEjEWTh9+AJn7+8+y5YB3TQvTD1Q6tA=; b=4jFSZJkd21jvFT1VKJyB33yDKdbSdezaePpHFciM3rml61twhaS8iw6rKNv4wjFMJiDo /y24veSl5Gi+69HEuvcYd9xYxpaAnPQRN3YKOjNVzxnjr+PyKk5LHmbG+mp8vGB18dbOs JKItXqqhjPV6hjIh/q4XnHJyUsjJmekl6c4/6p3BpzmXeO0b83f72dh26/Kapd5GGWGtS qihsFOQzyTV/R+6Rs0aPgxjTdQtMWhCDqLG+tnAvnNMxl7abU6TuIEzBgZCd3e53TOU8y ehuMooVgxg3MVqypPWWhtDln59uIbgt9FhDb8ikDES11JXNz+HYcbvBiS5A46BykNEg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=regW97Ie; arc=none smtp.remote-ip=194.13.80.246 X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDEAB606A808; Tue, 3 Nov 2026 10:05:27 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BDEAB606A808 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9610CA1648; Tue, 03 Nov 2026 11:05:25 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1793700326; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=eMhYrEXhK+jNgEjEWTh9+AJn7+8+y5YB3TQvTD1Q6tA=; b=regW97IexwV6kx+XlflsLJ3m1UK0MBab70xex4UyBDyDi+k1LifhVOw7hM+sGKhePWy2JE vvsCaLWo/X1MRACUpvU5CRYOEV2erkgtC97gk8MO6exYy49rJLhIbIwBaH+PHvZJcglCog eirPvTSLsSny2LyNJdyJ1Ot169yhd8iIEMLgsTF/9971zrIw2ORAdEqsKzR8pRcfmVgtl2 UcEscRO1YRCv9cqBYABXKI4+OV0px9Da4bo87Lx/r8cVOVbMm5FCU/wfaad68Q8bGAMkVo n+raraf4wBeYsOdkQZ/Vfi85UueuT/oSCmg37asNy3CdSnLUwlZXDepze7ezqQ== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261103-nb-genet-mtu-nn-v2-v6-0-61d5631676e5@tipi-net.de> X-Cc: Florian Fainelli <f.fainelli@gmail.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3