🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23977

Re: [PATCH net-next v3 08/11] net/mlx5e: TC, offload RX queue mapping in NIC flows

#23977
From: Alexandre Cassen
Date: Sat, 28 Nov 2026 20:14
85 lines
11771 bytes

On 11/23/26 22:34, netdev-bot+sashiko@kernel.org wrote:
> [Severity: Low]
> 
> Is this read of priv->channels.params.num_channels safe against a
> concurrent channel change?
> 
> The NIC flower offload path runs without RTNL, because mlx5e_setup_tc()
> sets:
> 
> 	f->unlocked_driver_cb = true;
> 
> and mlx5e_configure_flower()->parse_tc_actions() does not take
> priv->state_lock either.
> 
> Meanwhile, ethtool set_channels rewrites the whole struct in
> mlx5e_switch_priv_channels() while holding state_lock and RTNL:
> 
> 	priv->channels = *new_chs;
> 
> So a "tc filter add" that races with "ethtool -L" is a plain data race
> on num_channels, which KCSAN would report.
> 
> The commit message says:
> 
>    "Direct TIRs exist up to the maximum channel count. The rule always
>    points to a valid one."
> 
> That claim depends on this unannotated read always returning a value
> <= max_nch. This check is the only bound applied before
> tc_act_parse_rx_queue() indexes res->channels[] through
> mlx5e_rx_res_get_tirn_direct().
> 
> Would it make sense to use READ_ONCE() here, or to also check
> act->rx_queue against mlx5e_rx_res_get_max_nch(priv->rx_res)?



No... as on v2 [1]. num_channels never exceeds the maximum channel 
count. Any value read here is a valid bound for the direct TIRs.



> [Severity: Medium]
> 
> The rx_queue range check in tc_act_can_offload_rx_queue() runs only when
> the rule is added. Nothing looks at the TIR number stored here again.
> 
> What happens to this rule if the channel count is later reduced, for
> example with "ethtool -L <dev> combined N" where N <= rx_queue?
> 
> mlx5e_add_offloaded_nic_rule() installs nic_attr->rx_tirn as the FTE
> destination. When the channel becomes inactive, the RQT behind that TIR
> is redirected to the drop RQ in
> mlx5e_rx_res_channel_deactivate_direct():
> 
> 	err = mlx5e_rqt_redirect_direct(&res->channels[ix].direct_rqt, res->drop_rqn, NULL);
> 
> The hardware rule keeps matching, so all matching traffic is dropped.
> The rule is not rejected and the user is not told.
> 
> ethtool ntuple rules use the same direct TIRs, and the ethtool core
> protects them: it refuses the reduction through
> ethtool_get_max_rxnfc_channel() in net/ethtool/common.c.
> mlx5e_ethtool_set_channels() has no equivalent check for TC rules.
> 
> The commit message notes this:
> 
>    "ethtool refuses such a change for its own rules but nothing tracks
>    the queues of TC rules."
> 
> Could the driver track the highest rx_queue used by TC rules and refuse
> a channel reduction below it in mlx5e_ethtool_set_channels(), the same
> way ethtool rules are handled?


Not in this series... as on v2 [1]. The commit message and the 
documentation describe the drop. ice behaves the same. Tracking the 
queues of TC rules would help every driver that offloads queue mapping. 
That is a separate change.

[1] 
https://lore.kernel.org/netdev/9e26c923-381e-4b2f-a267-d5dcfc4cbb4f@corp.free.fr/
Technical Details
Message-ID: <5a36ec9d-1ac2-44fe-8320-1c0783ba257f@corp.free.fr>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373271-linux-kernel-netdev=dewy.ru
References: <20261122213200.3207385-9-acassen@corp.free.fr> <179546967077.3135.3838730458941932181@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373271-linux-kernel-netdev=dewy.ru
From: acassen@corp.free.fr (Alexandre Cassen)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 08/11] net/mlx5e: TC, offload RX queue mapping
 in NIC flows
Date: Sat, 28 Nov 2026 21:14:30 +0100
Organization: Usenet Network
Message-ID: <5a36ec9d-1ac2-44fe-8320-1c0783ba257f@corp.free.fr>
References: <20261122213200.3207385-9-acassen@corp.free.fr>
 <179546967077.3135.3838730458941932181@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1020957"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:O2B0IoDPRlxpGOJ8X74xGuTYuMM= sha256:NRtxgtjriXcmV91IttopgxQbbWvAjtfnUzvcRp9STWY=
	sha1:+oOcnnwHzXRAFwFjyXMFT3khXFI= sha256:2ZEesSgEtlAUJWhiM5+cCXOO9alOqK/iFy5dYiTSgAY=
Content-Language: en-US
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 468C7125F8B; Sat, 28 Nov 2026 23:14:56 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=corp.free.fr
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 2dJ6bgkfnvUX;
	Sat, 28 Nov 2026 23:14:52 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373271-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=corp.free.fr
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 3EF65125F88; Sat, 28 Nov 2026 23:14:43 +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 45D23279DE; Sat, 28 Nov 2026 20:14:38 +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=1795896877;
	b=CS3X7YFcGtT1ZFgyo82bAQwT8VHsNWwPBWSq9+tSZv5jaWCCfWRT8M/IY10bGDwpe3bX
	 eN1CMDdwk/VTghF/OpJ9nlQKEdggghm+mP+UmHqLoqBIPDNAIbnFu26EI+gtLkJW3MvwS
	 qBCFCy4AQUaV2drrxgFUrgh7/oMue0RV6FhOtqIgnvNqyb9kJRtE+x2gj/epZxGaHANhV
	 /cJlempCZPfzscH7HkfPe/juVxxUkEBA+wNbNKguIXdXB+ica3EGpkWQ1lKP61Z2VHUpE
	 7lC1p1KMFfdCYj1K56IUA2gLtlRretBnlFPZj4jIw2ub+VhqXGpUcxqwSReEnENE7Dw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795896877;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:
	 Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=UuYr0stUGtqO+sHNfaowKDejfAZCE+IrOSM4n6Bokl8=;
	b=v4BDehMHe/iOyg7ddOe4oPPtB5NBKJxjJ/tgVfokcJXkoVFXJSxBEpgnCW9aJg/6ZEsY
	 zyhSJFbTPv5/9OhSRo3JYifWWXVaQ13aKk/uuuo66fivAyAlP8SgnGOhDypdpJW1spl5g
	 rWWkYt8ZGtI5cIsa1apjXyoeUyYB54Q29sPlzCT+/NEY9oF4cOABNLXffD8SMoB2S6Jp9
	 ZSAcunZhbJyCGiXKFIM+XeeiPN7hb6T5wIHp9P21fpIR4Un21SjSrAKav7Y9/cG8Re/Bf
	 hy4R1ERRhWTlM0McFYAS8cvENfInzUKVFvM6Po9t8HDOvy7uF07Bl2HdIrHpIaPTcvw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=corp.free.fr header.i=@corp.free.fr header.a=rsa-sha256 header.s=rcs header.b=Jkq2qed0;
	dmarc=pass header.from=corp.free.fr;
	spf=pass smtp.mailfrom=corp.free.fr;
	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 8710B606A330;
	Sat, 28 Nov 2026 20:14:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=corp.free.fr header.i=@corp.free.fr header.a=rsa-sha256 header.s=rcs header.b=Jkq2qed0
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=212.27.60.169
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795896876;
	b=4O+pacf+/3asaRG8pAP5F26WVw2T/IvhacCdFp1qY3I3H+57i9tKk4uLG55FixnJTe9x
	 OfQPyac4EIIshXsCP78Htksg38lbA+3ozB2uCJwO9yAYgDBc7ZBujA3G121074oZIAEit
	 8RtEXl0tAichXevIocYs7JxdLLOOVuUbkKPZ97aV9uuKyj84A2WsmiBR0qz3Touod17Om
	 huhNibWsNGrDIOsHg47pxWDURdTQGn/PeYP2tn5tBcP4FelHtw6lZnlID9QbYnrzJ2tdT
	 M18qtChP4QXrTY5bovd+BKAzl2dqLutCozkpTGTnZ+kU8/jTs/ab8taFdTIv3lUnRYA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795896876;
	h=DMARC-Filter:DKIM-Signature:Received:Message-ID:Date:MIME-Version:
	 User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=UuYr0stUGtqO+sHNfaowKDejfAZCE+IrOSM4n6Bokl8=;
	b=ujUbi49Gypbhbf9w4rfoSDdeDQiKI3BwDRidvzLuXPW0/6x0Mb207r9pKnB65qBwz595
	 vw3p2R1Odfx9qhgU3Gbif08pcpOYOPbm4gfTnvrP8cZMbAmhQwWe+cDaUCz/4rbYtAbYd
	 x4zqy9YUoG2EfqznEj6fcEIbzbuq05M0dENSE+9VXYeIV/ICfOW/6lWYO4yrr9EdiygFn
	 7SJrG7v7NQPS5N3zKd8GnUtoPxlQ539jMtPcIcyHRJSYrqMBT0nB0U315YfEzh/WU3vIA
	 LcAiBseihv26BuC9J9nYlPLzJGdPOMlVOleaQSH0dK+rPZ07ltmK/mIZ3/rYQOWx1bw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=corp.free.fr;
	spf=pass smtp.mailfrom=corp.free.fr;
	dkim=pass header.d=corp.free.fr header.i=@corp.free.fr header.a=rsa-sha256 header.s=rcs header.b=Jkq2qed0;
	arc=none smtp.remote-ip=212.27.60.169
X-Received: from rcs.proxad.net (rcs.proxad.net [212.27.60.169])
	(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 6C41E606A31C;
	Sat, 28 Nov 2026 20:14:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6C41E606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=corp.free.fr
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=corp.free.fr
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=corp.free.fr; s=rcs;
	t=1795896873; bh=MKSRogMXBjnkngsy+0tJwrGNFNc0eptKuV8KT7dVh9g=;
	h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
	b=Jkq2qed0e1Kdgv8XRkM8GoXrezoZYyE9gVsS92JnVxKqjKVUoKJqzuK4Tu2NyorT9
	 r+J0J7vRuH1g8ucyodTwgPMKALu6e+TJ6D7phlQDZiZaYzuxgnMBZecD57REC8Aa9R
	 8i9KytphUxpimOJoXN/7SG4yqSkPgpNbDjw9WtPMQd8MKk7b8VSLJg1Xc3bE7Rn7S0
	 RPefoK+M8ct8hCMiiE6/eqhWDwFdVD5t00ig2s/W8Isyr7L9osZ7Rhg5RAuoPVaZTU
	 7lZ3UQxTZ+xvrxDgoBpjy6FwZFQWehficLf1q4iZazbSx1ZGzdE6TLRfFzl66W663P
	 /D2hnsK2KJMbw==
X-Received: from [0.0.0.0] (unknown [213.228.1.188])
	by rcs.proxad.net (Postfix) with ESMTPSA id 573F444C0156;
	Sat, 28 Nov 2026 21:14:31 +0100 (CET)
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-User-Agent: Mozilla Thunderbird
X-Cc: saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com,
 jhs@mojatatu.com, jiri@resnulli.us, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, horms@kernel.org, michael.chan@broadcom.com,
 pavan.chebbi@broadcom.com, bharat@chelsio.com, donald.hunter@gmail.com,
 corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org,
 dsahern@kernel.org, idosch@nvidia.com, shuah@kernel.org,
 netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
 linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
 oss-drivers@corigine.com
X-In-Reply-To: <179546967077.3135.3838730458941932181@kernel.org>