🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17949

Re: [PATCH net-next 5/5] net/mlx4: flush pending doorbell when dropping a TX skb

#17949
From: Joe Damato
Date: Tue, 17 Nov 2026 15:33
49 lines
13455 bytes
On Thu, Nov 12, 2026 at 02:43:46PM +0100, Daniel Machon wrote:
> > If mlx4_en_xmit drops an skb (for example because DMA mapping fails) and
> > that skb happens to be the last one in the batch, the doorbell for the
> > WQEs posted earlier in the batch isn't written.
> > 
> > The queue stays awake, though, so those WQEs are eventually announced to
> > the HW after the next TX, but that depends on traffic and could induce
> > latency.
> > 
> > Avoid all of that by writing the pending doorbell in the drop path.
> > 
> > Signed-off-by: Joe Damato <joe@dama.to>
> > ---
> >  drivers/net/ethernet/mellanox/mlx4/en_tx.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > index 123071a47bed..3166837711be 100644
> > --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > @@ -1135,6 +1135,9 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
> >  
> >  tx_drop_count:
> >  	ring->tx_dropped++;
> > +	/* an earlier skb in this batch may have deferred the doorbell */
> > +	if (ring->doorbell_pending)
> 
> I think checking !netdev_xmit_more() here would let you ditch the new ring
> state, but it seems bnxt does it the same way, so fine by me.

I need the state for the SW USO followup I mentioned in the cover letter.

That aside, every mlx4 doorbell site today writes it only after posting at
least one WQE. I think replacing this with !netdev_xmit_more() might write a
doorbell with no new WQEs and idk if that is supported by the hardware. It
looks like the XDP path gates against that specifically.
 
> > +		mlx4_en_xmit_doorbell(ring);
> >  tx_drop:
> >  	dev_kfree_skb_any(skb);
> >  	return NETDEV_TX_OK;
> > -- 
> > 2.53.0-Meta
> >
> 
> Reviewed-by: Daniel Machon <daniel.machon@microchip.com>

Thanks
Technical Details
Message-ID: <avxzsj1Ro8Mzazmz@devvm20253.cco0.facebook.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365399-linux-kernel-netdev=dewy.ru
References: <20261110231304.1859217-1-joe@dama.to> <20261110231304.1859217-6-joe@dama.to> <20261112134346.zvctvknj4mc5s2pm@DEN-DL-M70577>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365399-linux-kernel-netdev=dewy.ru
From: joe@dama.to (Joe Damato)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 5/5] net/mlx4: flush pending doorbell when
 dropping a TX skb
Date: Tue, 17 Nov 2026 07:33:06 -0800
Organization: Usenet Network
Message-ID: <avxzsj1Ro8Mzazmz@devvm20253.cco0.facebook.com>
References: <20261110231304.1859217-1-joe@dama.to>
 <20261110231304.1859217-6-joe@dama.to>
 <20261112134346.zvctvknj4mc5s2pm@DEN-DL-M70577>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2365696"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:yFqfGbAUffdqnjQQE4KasEH3geg= sha256:pVpvTvT8Zb69qdzBnSSrwXBdaLrCMtAMrqUtXjPjkVg=
	sha1:MtMSMjCwqlDNlCkmNGWAWtGULOY= sha256:nBb5xh/Zt1wpESQvrv2u8wG3qN5TwmsJOXK5W8S7QHA=
Content-Disposition: inline
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 C3250114FC6; Tue, 17 Nov 2026 18:33:29 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-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=dama-to.20260707.gappssmtp.com
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 yadZXdNWkSkE;
	Tue, 17 Nov 2026 18:33:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-365399-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=dama.to
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id F04A6114FBA; Tue, 17 Nov 2026 18:33:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 52A733C8A3; Tue, 17 Nov 2026 15:33:12 +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=1794929590;
	b=hAZNCAse5o1AbBZz42elJpG0XtbRpsmk3alndUThmgFBXC55e7xKDaFIDbfBZBPLvOrd
	 GS9xxkdroWuFG7udDf4zsllTsstEzfxJrYtiFbJI05vSn2VzfFtOszBb/pkxEYwf9xdgR
	 KtC2CQLSrlSQk+gJEsV4k3ffvX62bkYk5H24zwuKvN5r6NSI0KiFes45O+VuT2zeXTpZE
	 7JtY0BdYhQllyatg/6SqUJyhbcNiSmdisKLSkDaoBjnObSxc+oaqaW608s4DhRMBkqzMw
	 t3FONVlOdrq1nIe1e5MbRJ6p02kUkXZcXCG7F/YC9Yr22QxENSageluRngLVPc1B1RQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794929590;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=ic0ZV2l8vdmrXTqu+lMUrh7Ne4ma2q8MNEr28fS3hxw=;
	b=1s/UXmEpT0ghpS6ADX7C5aLKi12v7r0Vmd1SaEDSsuUD2jpVNlIY9yPL1iPyfvG0SwKJ
	 VGsmEq2eP1Do5VL4Ao7g8zz/UiHgA6320TT1K30ofsaMT+s0zdxIjo2Hvk9FITtigAiP5
	 zfy/khS9DwLfYYPJZ/bAb9DMcKyxF9TAF1KMgmUaJk0ATNAO+h/ojs+n91qDoVumOPfuH
	 K5mRxdAQiCOshK7DbHP6FkrRH2xv7gmfu+hQHxHx883Tx4/PdseQnY5MBBWiRNh86jr2t
	 ovhUoQQzSFH6KtBlxpW7oxPS7ubSoRWcH2OzO4ePb4Z2T0LJte6HHYjqdZ6K5ljeNIg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b="Nq2As/OY";
	dmarc=none header.from=dama.to;
	spf=none smtp.mailfrom=dama.to;
	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 DBBEB606A881;
	Tue, 17 Nov 2026 15:33:10 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=Nq2As/OY
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.178
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794929590;
	b=Qw469meVg0GR4mzRAWZnfGZjl4KNaBwc+GKj4cNJ+m+qv9Pq7v3amXq4PVtGnleqjPhJ
	 NU0gC/+iwfleXkOTKf7Sh7+Aqm0dUUQSlvoiggdyXWJ8cvoI2RM4NEKufic2bLLG5iqMd
	 KU241Tu59wVD7uHJCREdHQo9gMsJFrDoHzccI9L9//wm8f6zDTNu2bnjXX6D1l/gYOvVR
	 btcplMk2J9d6ehR4aPsJHLdrlIOBuoKxz5h7rlFQWRwBxb5KW8qc7p/byUKlYLwpC50xN
	 im0slKRfuLZSMA4O+hoY2gqpC+QIr9DOqmy3xKyhGdmj8/COHPWEDufXKv8gAMTp0TA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794929590;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc:
	 Subject:Message-ID:Mail-Followup-To:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To;
	bh=ic0ZV2l8vdmrXTqu+lMUrh7Ne4ma2q8MNEr28fS3hxw=;
	b=PSvjpWXVzRnWgDnXrWNnk9Qr1yg62aKB0bAYmJ59t9kX0s81h+Dj+vGiRLJ3GeNmd/bE
	 HME8g1LV4o8285jPQnCVLAg1ql4JiZ7h4LtOICJCjvY4vBnG6JtdqQFf87Ks3Avhow8t/
	 Yi/iAc2Bv2HjarwzmlUb+X0OErkqOK9zi/GCeUl299U0kKr5QWZib2gBzta61ztTexL8o
	 vR5NMMUdw0V/rFCf/PB8BzUL1NMECTA5m49cr0OIeYElM1IhNUdZs9IeaCKb+Tn4tj4lC
	 djhGoT4GQQ9EVcY8vqR+BOakhpRlaukIuQwlal/yvIihwtvxdq5bzkf8tvYmkn2n3Tg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=dama.to;
	spf=none smtp.mailfrom=dama.to;
	dkim=pass header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b="Nq2As/OY";
	arc=none smtp.remote-ip=209.85.210.178
X-Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46497606A31C
	for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 15:33:09 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 46497606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to
X-Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-8b32bc605d9so2291393b3a.2
        for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 07:33:09 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=dama-to.20260707.gappssmtp.com; s=20260707; t=1794929588; x=1795534388; darn=vger.kernel.org;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:mail-followup-to:message-id:subject:cc:to:from:date:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=ic0ZV2l8vdmrXTqu+lMUrh7Ne4ma2q8MNEr28fS3hxw=;
        b=Nq2As/OYS8Rk/AJs+LfYrpJSfF6Buvx+xKdbIX4flq+eZrRjURbUNWDmvARrjsOMyp
         G4Gx7PLMS4t+lD5oQcYMVZipAItazYPQ/M4meWE5SJxFxatVGe9ROPR8uYtsVXSKDFFO
         ktD3ViGsehj7fvmOS+rsJFzMQP/LL7SrApPeoCrIZkRytaDjhZQ0X7IYsR5XOepFhFt+
         JKJ3eI8Od+PvKhxlcvAMz0AvFtM/rG8vP7w8MNFXVtYOsThIy0qp3z1ylgviHTV2ORwT
         6txojRUx4fE/Wz5UNh/Mhq0JSCVkqHb7tGYrHXiJfW2XoLH9t7s6zh9hLk+TgqK7sshF
         VhkQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794929588; x=1795534388;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:mail-followup-to:message-id:subject:cc:to:from:date
         :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=ic0ZV2l8vdmrXTqu+lMUrh7Ne4ma2q8MNEr28fS3hxw=;
        b=JDir4BKI2cj2pXyUbUz7l6jAx775MPzbD/RgBNTtkaQ6SgqpXcXa1iyuL74wrp3QBE
         R00Qv2BIXAjG3iq6vdffPE4YF8LaDSv5Tf1pcYxlTjpuLW99wOLyes9MjQd3ThOjGYTX
         1BZ79FfJkD3KMYqPNDZaYD3n9sY5gsrJ6RZiRXwJeC8JYoGolKKsPf1BcmnzgFn1s0a5
         Ll8sK6jA12Z6QT5NU9DRzJPwiz4dGroGR/WJ3DZmfsEm42zK8u6hsKLputVt1cHjh+Kt
         swfGmWhynL5mEGcFvVKBLdyf+TwiDItFmG024MDOEKY8hal/OOWXqUXS7AZbapWHHYu+
         jRWw==
X-Gm-Message-State: APuU4Z9ujK6uVPZdDcD9nBNCZOOiboJ8u2HLnFJd1tIdP06jhmxcICFY
	mqxz1RMGDUa/Bhmge/GCIYafbblgZq1CZCnpGuBLk5MtQxeruUgL8y1Iwo+4tXeTeNc=
X-Gm-Gg: AYBFou0F1331cxN0M1n2qQXb5iunVgb7VkTcsM4P2wU83dj0oPLdDJUQH3KhbkOCtCJ
	rZtLNPUgLCjcF0a6/qiY6ylTeX5QJb/WZUjNalk/BNwYoYgUbdOUq8MXhduWzgO0mKWmabO8E8+
	U0RRKE8nFG/vU5YOmJlsMOnPDwgNgAW6Pf2nx7OlJa+4h6qOThBngbEygZc+jTd22VXmYF4Y9Zn
	SgIovh/bvxZWhJP+ckLR3OG3aS+cu2/5Mr8QB0rPkN4RofM9iffGaeWwOQSXaZUuP/llKvJbnkN
	CS9fn9Ocfw/kXBFizBZASWUfFvmhe+tY8VzqWw9gb3hRHET2bKnDb3gwzgkD4ulXAV71qxh25/N
	AFIFG5N+5Y8yu9y9kqSYuz6RYl6tUVOJMrtIK12v5Qbtec8f4NSoVLI94KWRhzSf5twpmdc77a7
	aM/e7gIIAKCLeb8Cy+tybPhu4qVZhFuzXgF499K16OtDJv2xJC9QxkVWRH33YbvnHRpzlyFdtrH
	nnTQ6rygmhtVigkG6YT1Uilh+JxkExR0TGfI7zlBryi4lIjhkFu41qozuVbwU9hENaxu0N+YNXQ
	cuW794cJG58CiE3EBpUMpssW5vqwpSSz/AkoRAMDtw==
X-Received: by 2002:a05:6a00:17a8:b0:8a0:70ff:ab2c with SMTP id d2e1a72fcca58-8beb7e12866mr12534223b3a.57.1794929588396;
        Tue, 17 Nov 2026 07:33:08 -0800 (PST)
X-Received: from localhost ([2a03:2880:2ff:3::])
        by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8bed12a8f63sm5517226b3a.9.2026.11.17.07.33.07
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 17 Nov 2026 07:33:07 -0800 (PST)
X-Cc: netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	edumazet@google.com, horms@kernel.org, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org
X-Mail-Followup-To: Joe Damato <joe@dama.to>,
	Daniel Machon <daniel.machon@microchip.com>, netdev@vger.kernel.org,
	Tariq Toukan <tariqt@nvidia.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	edumazet@google.com, horms@kernel.org, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org
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: <20261112134346.zvctvknj4mc5s2pm@DEN-DL-M70577>