🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21724

Re: [PATCH net v8 2/2] net: wangxun: access queue counts consistently

#21724
From: Simon Horman
Date: Tue, 24 Nov 2026 11:24
25 lines
8917 bytes
On Wed, Nov 18, 2026 at 04:13:29PM +0800, Mengyuan Lou wrote:
> Queue-vector teardown clears wx->num_tx_queues and
> wx->num_rx_queues while the netdev can remain registered. Lockless
> readers may use these counts as ring-array loop bounds while teardown
> is clearing the ring slots. wx_xmit_frame() also uses the Tx count to
> select a ring and must not divide by zero during teardown.
> 
> Use READ_ONCE() to take a single count snapshot in the lockless readers,
> and use WRITE_ONCE() for queue-count updates during scheme setup,
> teardown, and allocation-error handling, including the VF queue setup
> callbacks. Keep the existing NULL checks so a reader that observed an
> old non-zero count can safely skip ring slots that have since been
> cleared. wx_xmit_frame() retains its zero-count guard before
> queue-index modulo.
> 
> Fixes: 3f703186113f ("net: libwx: Add irq flow functions")
> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>

This patch feels more like hardening for net-next than a fix for net.
But regardless the code changes look good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

...
Technical Details
Message-ID: <20261124112414.GJ31322@horms.kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370278-linux-kernel-netdev=dewy.ru
References: <20261118081329.39551-1-mengyuanlou@net-swift.com> <20261118081329.39551-3-mengyuanlou@net-swift.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370278-linux-kernel-netdev=dewy.ru
From: horms@kernel.org (Simon Horman)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v8 2/2] net: wangxun: access queue counts consistently
Date: Tue, 24 Nov 2026 11:24:14 +0000
Organization: Usenet Network
Message-ID: <20261124112414.GJ31322@horms.kernel.org>
References: <20261118081329.39551-1-mengyuanlou@net-swift.com>
 <20261118081329.39551-3-mengyuanlou@net-swift.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="4122958"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BWcJ+uajOLXHppEDO1jiYOAEwAM= sha256:vHHl6tHaWYFd3NiqV6UpPgrKe5yLU3OqHqN0eFKHSwM=
	sha1:BBj/g03dt8Bf6jWE8Y2BRQATOLw= sha256:upSPUiCaZl3a/35HRDBol0XDyRIu+3ZWzvNgr9fKRxQ=
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 9C94A125DFF; Tue, 24 Nov 2026 14:24:35 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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=kernel.org
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 vk5HauB-5dab;
	Tue, 24 Nov 2026 14:24:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-370278-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 189C4125DFC; Tue, 24 Nov 2026 14:24:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id DA62A35C97; Tue, 24 Nov 2026 11:24:22 +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=1795519460;
	b=fOhc950UQdc/DBM6a8ZhqLqBIoQAVq6V9ihRzuvLgnwFNbp5eqehz09AD5FUqxj0TzAx
	 IdkzlSMun8VodFM8iMNIUplCSAcOwUSLz3MOvA6prsB+1HVkmkfVfDYNKiWbTsgCU8ObL
	 FYRDdNFpjFp1tuyqd5UUWDCqkwtScAe8PVuIqR6p8WVUmY+NQZk4e6VGjFz9BqBQJI/h3
	 /iFx1wwotjwhy5vLoc5ZO5DeoG1iyiNIv7zaMTWq/M1Z/QTPBYozUzXyxvIrtLFzxdSMU
	 fOc2JPTRU+NK6wWvh19+S6Ca4C9Q+iAP1lZkNih2YZn5NO1DScVpJpV+0NK9PGQvhOg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795519460;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID: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=FKub91r/RkReMDO68rIDG4TvNPrvwOOPa0wxW/nGePA=;
	b=IiHud4N4cdBLAjD97ava9WJ7vogGbA3rObBK98Vk6OoBp0pv9F/zDx792mUkCms0PdYa
	 zdCqfWH5KxWQlEAg5EiPdhmS8bZ1EVtvJWNfWC0gQzgp7n7VnVRBq06l+bjp+iUZhJs3h
	 m2TTvFSeCEhZ0vXZf6AskRKCRz2na4O3bHDU6VmJiUbP4eYDPjDKDKk1jaINeg/OunYgI
	 uSX6LbhtDQ2AYc6mWwqg2WKCwuIHAHPxRahqlkjjtNE9yKdRK06yivs0iDv8QeIfqC+qN
	 z3RXYH3pYIVVqVBYygzq9qf9mI3Od4fIARJG61z7f7sPoDVDCQ/VjCbD1qHiIBGm8oQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h583xEgu;
	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 CDC69606A32C;
	Tue, 24 Nov 2026 11:24:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h583xEgu
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795519460;
	b=Q5iHFPb1M6XIHIJl7FjlcErKGCEte2H6XopKOvw1MeK1Mz+oRHuWa/Xg65+YKIN2ltER
	 Pte3NLGwz9Fxex2i1wnXze5vOR1gvDwns2bXjxs/e2t9qhg62rYUETYNUvKpuK2rr1b9k
	 DfLjfjuSLkWYdeffTlqd4XcQruWoYF/m24cS4FqxSFwdYIiZ4zqrWd66nl9uRW+8/DACm
	 wkQnyFOapLYEOCRAqRRfvbP9EjkWzYKaIdFAHn1yBihIo15yxJnoZbjGNL5ADCt63zpY0
	 27Oxg4HlSVSqYiD4UjShPrVW53HBVOz2xqkk7ymov05wM0Sv0fePo9H51ukm7d31A+A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795519460;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=FKub91r/RkReMDO68rIDG4TvNPrvwOOPa0wxW/nGePA=;
	b=FnyHCzvHIedoW3ie13MUooL/9juTjPOEHo3xWnOS8NRnY7VkhIedGUyGaDJgrhUmnX9w
	 I0Voj+04wlUhx+6AanhORATNum0659I2Do9A9MDDfLjB1RB4q6AY07Xgsm4kTJ5K60gEv
	 TVKeBz0e3dkYbNGdqqpFGUJzFwXYr/DVm4Gnw78lIJngmFeNfzyFom9tYJaIqejP1Ln/m
	 XavCQ8QLrMLINzPy3tHvAITQGH/Boh2B272vNx4TOJCiATYNFtDmbKqDBZB0E3wYomSLv
	 SM7cnwfJI9KyBjJZqInlHz4ZVvyo/UxB5z9k8CrEdggCmh69RJ5uY1coeV34CQI/5oA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h583xEgu;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7D25606A321
	for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 11:24:19 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B6261F000C6;
	Tue, 24 Nov 2026 11:24:16 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795519459;
	bh=FKub91r/RkReMDO68rIDG4TvNPrvwOOPa0wxW/nGePA=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=h583xEgu9aNmOvJpStbk8LsNltRvJuQkVeIJ/RvCWYgqBRjcH1b0oHxURdsf9D/ss
	 yAbZFd4WgJx3qHWsWt5oFat6/GGn6clO6f8la8AFVjjcJ8CyXHWPd4SA2xlWiEKiKy
	 SfolpHXf4R0/tOLQ8d4q1qJ03o6bLSGnN0JTb9SPqcMq436Y8f8sKoC3P2Z1fN/aDa
	 aC1rJyK2FvIBgXQf03IEX1R9r7oTdHGTBmRS7Y2J/0mFtaEmaiW/DLuYeVCRBpPX2g
	 I77NsQAM5smXlXGg1HgyArWII5zyRObzTmZyOfhz3XZvh5tCG7GZx+nCVjtnqRqbp2
	 o+o5rSIubId3w==
X-Cc: netdev@vger.kernel.org, jiawenwu@trustnetic.com,
	duanqiangwen@net-swift.com, linglingzhang@net-swift.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, hramamurthy@google.com,
	jacob.e.keller@intel.com, przemyslaw.kitszel@intel.com
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: <20261118081329.39551-3-mengyuanlou@net-swift.com>