Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Shay Drori <shayd@nvidia.com>
To: <netdev-bot+sashiko@kernel.org>, <tariqt@nvidia.com>
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>
Subject: Re: [PATCH net] net/mlx5e: TC, use the owner eswitch for encap neigh updates
Date: Mon, 30 Nov 2026 09:49:16 +0200	[thread overview]
Message-ID: <1b7839bc-e300-4684-a771-5badc8a9c5df@nvidia.com> (raw)
In-Reply-To: <179572951791.3135.13703182913006010599@kernel.org>



On 26/11/2026 23:45, netdev-bot+sashiko@kernel.org wrote:
> External email: Use caution opening links or attachments
> 
> 
> 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?

This is correct, but this is a pre-existing issue; this patch is fixing
the MPESW case. a fix for the Socket-Direct will be sent separately

> 
>>
>>        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


      reply	other threads:[~2026-11-30  7:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 21:06 [PATCH net] net/mlx5e: TC, use the owner eswitch for encap neigh updates Tariq Toukan
2026-11-26 21:07 ` sashiko-bot
2026-11-26 21:45 ` netdev-bot+sashiko
2026-11-30  7:49   ` Shay Drori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b7839bc-e300-4684-a771-5badc8a9c5df@nvidia.com \
    --to=shayd@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fmancera@suse.de \
    --cc=gal@nvidia.com \
    --cc=idosch@nvidia.com \
    --cc=jianbol@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maord@nvidia.com \
    --cc=mbloch@nvidia.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox