Article View: linux.kernel.netdev
Article #7345Re: [PATCH net] net: dsa: clear the conduit RX queue on user port receive
From: netdev-bot+sashiko
Date: Mon, 26 Oct 2026 07:24
Date: Mon, 26 Oct 2026 07:24
141 lines
12945 bytes
12945 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message says "TX queue selection is unaffected: the
user port's own netdev_pick_tx() sets queue_mapping again before the…
- [Medium] The fix is incomplete because one delivery path in
dsa_switch_rcv() skips it.
--
net: dsa: clear the conduit RX queue on user port receive
This commit resets skb->queue_mapping to 0 in dsa_switch_rcv() before the
skb is handed to the user port. Without the reset, the RX queue index
recorded by a multi-queue conduit makes get_rps_cpu() skip RPS on the
single-RX-queue user port.
> Clear the queue mapping when the skb is handed to the user port. TX
> queue selection is unaffected: the user port's own netdev_pick_tx() sets
> queue_mapping again before the conduit transmits.
[Severity: Medium]
Does this hold for skbs that arrive on a user port and are then forwarded
by a software bridge or by routing?
skb_set_queue_mapping(skb, 0) marks the skb as having no recorded RX
queue. That is not the same as skb_record_rx_queue(skb, 0).
On the egress device, netdev_pick_tx() falls back to skb_tx_hash() when
there is no socket queue and no XPS choice. skb_tx_hash() uses the
recorded RX queue when there is one:
net/core/dev.c:skb_tx_hash() {
...
if (skb_rx_queue_recorded(skb)) {
DEBUG_NET_WARN_ON_ONCE(qcount == 0);
hash = skb_get_rx_queue(skb);
...
return hash + qoffset;
}
return (u16) reciprocal_scale(skb_get_hash(skb), qcount) + qoffset;
}
dsa_user_create() allocates user ports with ds->num_tx_queues TX queues,
and user ports have no ndo_select_queue. So forwarded flows now pick their
egress TX queue by flow hash, not by the conduit RX ring.
Several taggers write skb_get_queue_mapping() into the switch tag:
tag_brcm, tag_ksz, tag_sja1105, tag_ocelot_8021q, tag_netc and
tag_vsc73xx_8021q. For those, the switch egress queue changes too.
Socket RX queue tracking also looks affected. With
CONFIG_SOCK_RX_QUEUE_MAPPING, __sk_rx_queue_set() only updates
sk_rx_queue_mapping when an RX queue is recorded:
include/net/sock.h:__sk_rx_queue_set() {
if (skb_rx_queue_recorded(skb)) {
u16 rx_queue = skb_get_rx_queue(skb);
...
}
After this change, sockets fed by user ports never get an RX queue
recorded. That includes traffic from conduit queue 0, which used to record
rxq 0, and it changes XPS rxqs selection.
The new behaviour may well be better. Since the patch has a Fixes: tag and
will probably be backported, could the changelog describe these side
effects? Could it also say why "not recorded" was chosen over recording
queue 0?
> diff --git a/net/dsa/tag.c b/net/dsa/tag.c
> index 6a5aa7fc331c3..ecd4d86696acc 100644
> --- a/net/dsa/tag.c
> +++ b/net/dsa/tag.c
> @@ -115,6 +115,12 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
> skb = nskb;
> }
>
> + /* The conduit's RX queue index means nothing on the user port, which
> + * has a single RX queue, and get_rps_cpu() skips RPS when the index
> + * is out of range.
> + */
> + skb_set_queue_mapping(skb, 0);
[Severity: Medium]
Is the case where skb->dev is not a DSA user port missed here? Earlier in
dsa_switch_rcv(), this branch returns before the reset is reached:
if (unlikely(!dsa_user_dev_check(skb->dev))) {
/* Packet is to be injected directly on an upper
* device, e.g. a team/bond, so skip all DSA-port
* specific actions.
*/
netif_rx(skb);
return 0;
}
For trunk-tagged frames, dsa_rcv_ll() in net/dsa/tag_dsa.c sets skb->dev
straight to the LAG netdev:
lag = dsa_lag_by_id(cpu_dp->dst, source_port + 1);
skb->dev = lag ? lag->dev : NULL;
Take a multi-queue conduit such as fec, which calls
skb_record_rx_queue(skb, rxq->bd.qid) in fec_enet_rx_queue(). The skb
reaches netif_rx() on the bond/team with the conduit's RX queue index
still set.
get_rps_cpu() then compares that index against the bond/team's
real_num_rx_queues. That value is set separately (numrxqueues, default
16) and has nothing to do with the conduit.
There are three possible outcomes:
- RPS is skipped silently, the same symptom this patch fixes for user
ports.
- If the bond has more than one RX queue but fewer than the conduit ring
index, the WARN_ONCE in get_rps_cpu() fires.
- Otherwise, the RPS map of whichever bond/team rx-N queue matches the
conduit ring number gets used.
Would moving the reset to right after skb = nskb, before the
dsa_user_dev_check() branch, cover both paths?
> +
> dev_sw_netstats_rx_add(skb->dev, skb->len + ETH_HLEN);
>
> if (dsa_skb_defer_rx_timestamp(p, skb))
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261025072203.1519561-1-dencity7%40gmail.com
Technical Details
Message-ID:
<179299947310.3134.16517017879498438401@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351721-linux-kernel-netdev=dewy.ruReferences:
<20261025072203.1519561-1-dencity7@gmail.com>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-351721-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: dsa: clear the conduit RX queue on user port receive Date: Mon, 26 Oct 2026 07:24:33 +0000 Organization: Usenet Network Message-ID: <179299947310.3134.16517017879498438401@kernel.org> References: <20261025072203.1519561-1-dencity7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1249457"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:QzIpbiYVzVg9LwgJ9tP0j2aPV98= sha256:uItAQOlYRvnZGEKeOnzQCfJQSMHhnYYR9Twkowjv/M0= sha1:LZL8lxexGdCZdsRr6m94mVqTiec= sha256:sQg/gof51SMFR/7izK3zAplbZSwGCWeybuPkrnTsK/Y= 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 484CE125B8C; Mon, 26 Oct 2026 10:26:03 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.738 X-Spam-Status: No, score=-3.738 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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, URIBL_BLOCKED=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 woDHZ419diHc; Mon, 26 Oct 2026 10:25:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-351721-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 0FF59125B7B; Mon, 26 Oct 2026 10:25:51 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 8FA3E23912; Mon, 26 Oct 2026 07:24:37 +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=1792999475; b=sa6LQHSjMRy5S/EJZKDm8QW62V9JoPTJ4PgqmFKSIop60Hpd46bZjpboz9hT9XjYh9Eg mlPDuvxSCvMBS4TxjyWzIXrKABgil5CcLhMURv0VLjYB5M0CBwuaPgvGRmrI4cMQ4+exP LvjaCZ31VXCqIWizhbFB/ve5BSSSLqsXkyzJMCg2Wwya2/UNW9BbBD+NSxQZSap0mBeMT jMz5OFGioxb6hVLa2pD2uaI+pnYR6Xcff9fNBABkA/gWecily3SGtirzEQZ0aBr2UvONI z9iQ7y37mJDlvrN9tHQkFNt/1Z6FQ2uwZn13LqXPCi2adrmDrkQbN/Fcu8sOJn2amJA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792999475; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=RZGpFzKZl+KjUUy06+TwAJ42tacxdNOCCa1aBYxsIy8=; b=IZxeE02Pu65bS2ceAqRnA414R0o52NNylQGxn3uCYejrolQ84eBhjQ111wKPf/1sIKA7 nuu1EenJak8oXuOYRdOITeo++tvol9qqLM2w2l0KDOsKIBuXam/ZsDHKKZ4feCOZEzDYe tfr41xH2PiYXZcUWU2ThC3Xv3Nzm2WLiB23U4mEtO5oThXMdGapLrsKH0KerRp3LKTiBt jAfD4HXAwBv5HQogOcreTxtNwm9BJSZfZx/cwSspxE3em2YJ/oYkYAiZD6JOXS4EFqddj 5ogqTcm0UujigI8iIfl/Y+lV4urDcNncnt3lISXzeZbxr+hlSAIo0FdzZye/1U6Cl1Q== 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=CvV8R9CB; 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 5759B606A330; Mon, 26 Oct 2026 07:24:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CvV8R9CB 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=1792999474; b=KGRqYZtaWqNQATDDj5bxP33mUqUKh9pJwq6oeDg92JQgMCkim1D0RctA3lEKSzsJRSIa Gi8+XUiisfN3UmG3c9Zv24ASfe13k4fK7p+0R3i51uSoMBIpIKB3jANgGm6nbnGsnMVO+ KjIeciS864jda20xpjG5yfrNhZU2wBULCr8oDAnnVP4gv3qlsdj8DYzalxiOmO9+H5QOB 958jVZmM57StF/+c8ufqtaXv0PL4eaDDfS35BQ02X+WmjVk5nX57zkvFTqNk0zUasbPgP 1nMuC2xmzTZW7I1PmdwtOaY6rVNPUv4eMKEiTtvQb1IPzZExIkr6dzvSMjEkF/SUmzQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792999474; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=RZGpFzKZl+KjUUy06+TwAJ42tacxdNOCCa1aBYxsIy8=; b=wow9VDpriHZTPSnhK0+0dd64Z/Nar681eiEhfXVpnZrU6nEZbMgbHwcvDU1aUE6kRT3e 9PRF4u+pIGhWkoUL12skxGhJxGOOk9VuVznmMJrvjjchz9p0PfR5LgiOcFCzppT0+d53n HHNBsM97skfYuRwKcRlFuS0LTTYFescD2XOoiYKK1LaIpysKqgqwGoiPD3TAUYj2OYbB1 H/IIy82gEmi7YW38HxqnGSnUmbz+vFN/RSIUYu8AM8kSAqayTENE8nWTb9fLgh01hWWC+ FEF2/YbUMqhfUSaJ45o2hH1madeiK72G0D7L2PfsuCKAXp1ENBfrsZpZ/nI0ZcC7nLQ== 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=CvV8R9CB; 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 37DCB606A31B; Mon, 26 Oct 2026 07:24:34 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8689F1F01825; Mon, 26 Oct 2026 07:24:33 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792999474; bh=RZGpFzKZl+KjUUy06+TwAJ42tacxdNOCCa1aBYxsIy8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=CvV8R9CBR1eYI+aWr6Qp6lof4Wke04swz3qvCZ7iSvAEGD6f68s313+uMhuAciwek a1HO2DPG8IsRpfVHxEyBXyTBTSFSNkjwNVh87klHXBVWq7eWFX33s+OQtheKLeXZcx l+KnDFUL/24gSdLYZnNJ9enW+ZTedg20nm3NoYJdSikiIQ1L3Zs/DwnomXZDptKaH8 7rS8tJyp6Z+tLYagPakbex259rUfXm9IB31fH3R08ea1q0RsP5ubYj6fawjosKBWQo F6RpRRd8ntWmRmBW3teWLHW/59Zs4/GAmjpoiYqlZDRCF5E/D5LwM7htoqRHU9KzzA PuXiTDxJKUUWQ== X-Cc: netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261025072203.1519561-1-dencity7@gmail.com> X-sashiko-severity: Medium 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