Article View: linux.kernel.netdev
Article #23253Re: [PATCH net] net/mlx5e: TC, use the owner eswitch for encap neigh updates
From: netdev-bot+sashiko
Date: Thu, 26 Nov 2026 21:45
Date: Thu, 26 Nov 2026 21:45
110 lines
12374 bytes
12374 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · 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).
- [High] The fix does not record the owner eswitch for encap entries
created on a Socket Direct (SD) secondary eswitch, so the neigh-update…
--
net/mlx5e: TC, use the owner eswitch for encap neigh updates
The neigh update and neigh-used paths used to derive the eswitch from
netdev_priv(e->out_dev). In MPESW, an encap entry of one eswitch can route
through another eswitch's uplink, so that eswitch was not always the owner.
This patch records the owner eswitch uplink priv in the encap entry, uses it
for flow updates and entry release, and keeps out_dev for neigh handling.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
> index 4f9f8beffbc8d..d23cf60613ea7 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
[ ... ]
> @@ -871,6 +871,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv,
> init_completion(&e->res_ready);
> entry_created = true;
> INIT_LIST_HEAD(&e->route_list);
> + e->priv = netdev_priv(mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH));
[Severity: High]
Does this record the owner eswitch for encap entries created on a Socket
Direct secondary eswitch? mlx5_eswitch_uplink_get_proto_dev() redirects to
the SD primary:
void *mlx5_eswitch_uplink_get_proto_dev(struct mlx5_eswitch *esw, u8 rep_type)
{
struct mlx5_core_dev *primary = mlx5_sd_get_primary(esw->dev);
if (primary)
esw = primary->priv.eswitch;
return mlx5_eswitch_get_proto_dev(esw, MLX5_VPORT_UPLINK, rep_type);
}
SD secondaries also have no uplink representor of their own, as the comment
in mlx5_eswitch_reload_ib_reps() says:
/* SD secondary devices share the primary's uplink and do not
* have their own uplink representor. Only load VF/SF vports.
*/
Take a tc flower encap rule added on a VF representor of an SD secondary:
- is_peer_flow_needed() handles this case explicitly via
mlx5_lag_is_sd(in_mdev) && !mlx5_sd_is_primary(in_mdev).
- mlx5e_tc_add_fdb_flow() installs the original flow in the secondary's
chains.
- e goes into the secondary's encap_tbl under the secondary's
encap_tbl_lock.
- mlx5e_tc_tun_create_header_ipv4() allocates e->pkt_reformat on the
secondary mdev.
But e->priv->mdev->priv.eswitch is the SD primary's eswitch.
On a neighbour change, mlx5e_rep_neigh_update() calls
mlx5e_rep_update_flows(e->priv, ...). It looks like that would:
- take the primary's encap_tbl_lock while walking e->flows in
mlx5e_take_all_encap_flows(). Meanwhile mlx5e_attach_encap() and
mlx5e_detach_encap() change the same list under the secondary's lock.
- add and remove the slow path and encap rules through the primary's
fs_chains, for flows whose rules live in the secondary's chains.
- allocate the replacement pkt_reformat on the primary mdev. Later,
mlx5e_detach_encap() frees it through mlx5e_encap_dealloc(priv, e) with
the secondary's priv.
The other converted paths have the same problem. When
mlx5e_get_next_matching_encap() calls mlx5e_encap_put(e->priv, e) on the
last reference, it would take the primary's lock and call hash_del_rcu() on
an entry in the secondary's encap_tbl. mlx5e_tc_update_neigh_used_value()
also walks e->flows under the primary's lock.
For SD, the old netdev_priv(e->out_dev) resolved to the same SD primary
uplink, so this behavior is not new. Still, the problem the commit message
describes stays reachable for SD secondary owners, including SD under MPESW.
Would it work better to record the owner eswitch or mdev directly, for
example priv->mdev->priv.eswitch without the SD primary redirection, instead
of an uplink priv?
>
> tun_info = mlx5e_dup_tun_info(tun_info);
> if (!tun_info) {
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125210629.239095-1-tariqt%40nvidia.com
Technical Details
Message-ID:
<179572951791.3135.13703182913006010599@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.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-372359-linux-kernel-netdev=dewy.ruReferences:
<20261125210629.239095-1-tariqt@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.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-372359-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net/mlx5e: TC, use the owner eswitch for encap neigh updates Date: Thu, 26 Nov 2026 21:45:17 +0000 Organization: Usenet Network Message-ID: <179572951791.3135.13703182913006010599@kernel.org> References: <20261125210629.239095-1-tariqt@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="573741"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:5sxHUaiM4Tv5JH+XMZ5JYRdDszA= sha256:3cSiH6LnyhkBL5TbZ8snreJfmrJdFLUSIkQnncsUrFU= sha1:eXawSt8dGs40AGG82k/X8uv8P8o= sha256:jwJxxrB35GwKtUTJ6s2G0Z7HW6DMMrLU6nI9qz1w+K4= 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 1F88C125F0A; Fri, 27 Nov 2026 00:46:13 +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 hUZhiUSv4aBM; Fri, 27 Nov 2026 00:46:09 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372359-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id BC047125F04; Fri, 27 Nov 2026 00:45:59 +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 0416837031; Thu, 26 Nov 2026 21:45:20 +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=1795729520; b=qXIShrh61Y1PZgGvXcMOQWRgYmdTLZoNYk/7mqUbUXFZYNb+tOxCetMdR2aOuX5Xa5pu e7YLKVcUhkKm9S0PiUhJMIeg1zXfzo8JdfPmP3da3zNB1QvSWNhwssX3EIZR5nFXDxYdk W58AMrJ6sdMSEwbUfKFUTzLWHq3F0rqHqCrozrEbPUgd1XlBen5JezMVd/ukJAE8lnIAW 0D663kqqzqSi9hbm6Y4NDmtZMUhN0YoEBP+FWMgSqU/krDoEOJNOmHhv8SVVgOs0joU+9 knBNGwr/BCYoykLdr/l/JpLkeoMiwNFJQSEV/akM2rceRvJp5x0kegXYPlP4hvNYcVw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795729520; 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=JRMBNQYtRA98LyRzp6hALbO2ol1NnounkrYHWIiByuQ=; b=F/OJyJ4XuwoxGspwM3mtily8Fh4zKVplVgZa7LjcrPtceih+tPgpezB4YZOk3WHI3pwD /PdJIRi6y4IKxcAsOtqi53nffCSYpyLMYXr8Kz4vp0pjX+gHzq560uKGLub7SF0ovm8L7 FizGIsqk7exesO6yeDysdcWzJQrp23NkuaaLCsvS2h2CK80vgL+sP4y+tyWjNlTa0rcFO cqUTyeRSIixASqGfzbuWs2FDXqtHdJdVhRAV+QKUHsnR0plVzwETb6vsyB5wWtzIuCnMO k/Xj8b54UZvL/egQWjZzJIpO+7EFoDRRdi7tlQHpgJH8rBQbFM9NV2x5UbLaiOAKKWg== 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=YIt1qUb7; 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 CBC24606A31C; Thu, 26 Nov 2026 21:45: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=YIt1qUb7 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=1795729520; b=r/QG2mlt/0LJLOCd/7PYVcfRKkcLK28nuuFJbIsiNNXp1vOmpE+FAu4tlNMQc1RBWKVr hDyyBMhMh5PnGu55OFtlniepl6XJ41vA3CUvxCw4AMzKcTzCqVjLxoBQQGTa4R/GQqsL8 7IIq5Z31rqPVgCNhqZt8XU16xBEv3UljNU/cH5wPwmfnoYIryHzz2Cs+73SEvencKjEdd KmY9D5leNlqhHalcBY49pb0KiFqIVi8P5eOes2NAPjjiimDy5560r1BzEsJ9G3tzL0p9F 0HZXnSycM5SBM0ufky5XYepY04O83wOKF59U9uy4yBOItNcPIKFP1yr+hVAGRxhugjQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795729520; 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=JRMBNQYtRA98LyRzp6hALbO2ol1NnounkrYHWIiByuQ=; b=EmMn0CjB6CS5zdpzCmlRivio9mQKP1PFHnWg0vxmxoFjgxdWBPnEZdFxCdNuEGMFZhae 4MwzzduBZx4PWiZpm4/7ge1cFUwP5j+6jRPkGOi4grX2BuWQc6wtV2k8GaqgAifiAvhU1 zhjlbpAtWB7ZTIdlHwvEbkrXUiDaWBxOhRX4A9gXYMmImgOnWvJJSCUZXJHsvX9PdeOLj i5ulJRDRxpKTLB5isFX/1rla5A2CmZl1klMEs+0HdZS27XiVGrvJdrLcQsBVgAozhmuN7 4ZR+aOw9uxD+CzsT2LLUL843MvC20fvBpYsHtGpr+HvpX+SDqMD38Hky49m4V2RMoCw== 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=YIt1qUb7; 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 E6DC0606A321; Thu, 26 Nov 2026 21:45:19 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F3721F00A2E; Thu, 26 Nov 2026 21:45:18 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795729519; bh=JRMBNQYtRA98LyRzp6hALbO2ol1NnounkrYHWIiByuQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=YIt1qUb7XakBpQxIaZ9BOvQMyjfS0HbR2XtHj8hvAORHsSMcKsVKr0nRQXVumQ7uD M5bo87peyQeAlHiqA9FywvKWLS2I54Q4NqHjfllbs73lj6aVYhqj2TQzsAet+hZ0qB XotjJT7G98Orpagsky4v6sA3mHqjoXL2mZTr24JiYpxcnI2TIrbLhD5clz4qLfiWON MhiRrEjVRH4GK9ehNSu81SM/sHt8UKPBzgIn4hV6qV7UN7wDHCy4kKn8fucwvtsMmY e/NDnx1i6zN9TOxWq9NyZNqB+BRoVwWJMvih2mrvPV/13kwlOER86mQCgmz5syKG/V Kuu9UNBkETbyQ== X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, willemb@google.com, fmancera@suse.de, gal@nvidia.com, idosch@nvidia.com, jianbol@nvidia.com, kuniyu@google.com, leon@kernel.org, linux-rdma@vger.kernel.org, maord@nvidia.com, mbloch@nvidia.com, razor@blackwall.org, roid@nvidia.com, saeedm@nvidia.com, shayd@nvidia.com X-In-Reply-To: <20261125210629.239095-1-tariqt@nvidia.com> X-sashiko-severity: High 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