Netdev List
 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>,
	<agoldberger@nvidia.com>, <gal@nvidia.com>, <jgg@ziepe.ca>,
	<leon@kernel.org>, <linux-rdma@vger.kernel.org>,
	<mbloch@nvidia.com>, <moshe@nvidia.com>, <ohartoov@nvidia.com>,
	<saeedm@nvidia.com>
Subject: Re: [PATCH net-next V2 3/5] net/mlx5: E-switch, drop master egress rule under a SW vport LAG
Date: Tue, 24 Nov 2026 12:51:39 +0200	[thread overview]
Message-ID: <1d674c41-a897-4aee-a88b-b41280b8419a@nvidia.com> (raw)
In-Reply-To: <179550916987.3135.15857697066223649709@kernel.org>



On 24/11/2026 10:32, netdev-bot+sashiko@kernel.org wrote:
> External email: Use caution opening links or attachments
> 
> 
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 · Medium: 1 · Low: 1
> 
> 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] mlx5_eswitch_offloads_vport_lag_del_one() calls
>    esw_set_master_egress_rule() for every slave that passes…
> - [Low] The commit message describes the conflict as a general property
>    of the software vport LAG: the master egress rule redirects the…
> 
> --
> 
> net/mlx5: E-switch, drop master egress rule under a SW vport LAG
> 
> This commit removes a slave's eswitch master egress rule when the
> software vport LAG slave egress rule is installed. It restores the rule
> when the vport LAG is removed. It also moves the MPESW metadata cleanup
> in mlx5_lag_disable_mpesw() to after the shared FDB is destroyed.
> 
>> The software vport LAG emulation cannot. It is a catch-all rule in the
>> slave eswitch's egress ACL that forwards to the master's manager vport,
>> while the master egress rule redirects the packet after the FDB - past
>> the point where the slave egress rule is evaluated - so the bounced
>> packet never reaches it.
>>
>> The two therefore cannot coexist: drop the master egress rule when the
>> software vport LAG is installed, and restore it when it is removed.
> 
> [Severity: Low]
> Is this conflict already present in shipped kernels for MPESW over SD
> groups?
> 
> Before this patch, MPESW over SD appears to install both rules for the
> other SD primary:
> 
> mlx5_lag_enable_mpesw()
>    mlx5_mpesw_teardown_sd_fdb()          /* clears fn->sd_fdb_active */
>    mlx5_lag_shared_fdb_create(FILTER_ALL)
>      mlx5_activate_lag()
>        mlx5_create_lag()
>          mlx5_lag_create_single_fdb()
>            mlx5_eswitch_offloads_single_fdb_add_one()
>              /* master egress rule for each SD-primary slave */
> 
> Then mlx5_ib loads on the master:
> 
> mlx5_eth_lag_init()
>    mlx5_cmd_create_vport_lag()           /* sw path, group_id != 0 */
>      mlx5_lag_create_vport_lag()         /* FILTER_ALL */
>        mlx5_eswitch_offloads_vport_lag_add_one()
>          esw_set_slave_egress_rule()     /* only this, pre-patch */
> 
> Following the commit message's own reasoning, that pair of rules
> misdelivers traffic.
> 
> The software vport LAG came from 98d56915eef5 ("net/mlx5: LAG, introduce
> software vport LAG implementation"). MPESW over SD came from
> de464720489c ("net/mlx5: LAG, add MPESW over SD LAG support").
> 
> Could the commit message say that the existing MPESW over SD
> configuration is affected, and add the matching Fixes: tag?
> 
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> index 57f58e79478e4..2072921c1fffa 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
>> @@ -3380,12 +3380,32 @@ void mlx5_eswitch_offloads_single_fdb_del_one(struct mlx5_eswitch *master_esw,
>>   int mlx5_eswitch_offloads_vport_lag_add_one(struct mlx5_eswitch *master_esw,
>>                                            struct mlx5_eswitch *slave_esw)
>>   {
>> -     return esw_set_slave_egress_rule(master_esw->dev, slave_esw->dev);
>> +     int err;
>> +
>> +     err = esw_set_slave_egress_rule(master_esw->dev, slave_esw->dev);
>> +     if (err)
>> +             return err;
>> +
>> +     esw_unset_master_egress_rule(master_esw->dev, slave_esw->dev);
>> +
>> +     return 0;
>>   }
>>
>>   void mlx5_eswitch_offloads_vport_lag_del_one(struct mlx5_eswitch *master_esw,
>> -                                          struct mlx5_eswitch *slave_esw)
>> +                                          struct mlx5_eswitch *slave_esw,
>> +                                          int max_slaves)
>>   {
>> +     int err;
>> +
>> +     if (mlx5_sd_is_primary(slave_esw->dev)) {
>> +             err = esw_set_master_egress_rule(master_esw->dev,
>> +                                              slave_esw->dev, max_slaves);
> 
> [Severity: Medium]
> Is this restore correct when no master egress rule existed before
> mlx5_eswitch_offloads_vport_lag_add_one() ran?
> 
> On the add side, esw_unset_master_egress_rule() returns early when
> vport->egress.acl is NULL and does not record whether it removed
> anything. Here the rule is recreated for any SD-primary slave. The two
> sides only match when a shared FDB installed the rule beforehand.
> 
> mlx5_eth_lag_init() creates the vport LAG whenever mlx5_lag_is_active()
> and mlx5_lag_is_sw_managed() are true. Neither checks the shared FDB
> state. With an active LAG that has no MLX5_LAG_MODE_FLAG_SHARED_FDB
> (ROCE, or SRIOV with shared_fdb false), the sequence would be:
> 
> mlx5_do_bond()                          /* no shared FDB */
> mlx5_eth_lag_init()
>    mlx5_cmd_create_vport_lag()
>      mlx5_eswitch_offloads_vport_lag_add_one()
>        esw_unset_master_egress_rule()    /* no-op, egress.acl NULL */
> mlx5_eth_lag_cleanup()
>    mlx5_cmd_destroy_vport_lag()
>      mlx5_eswitch_offloads_vport_lag_del_one()
>        esw_set_master_egress_rule()      /* new ACL, group, bounce rule */
> 
> Does this leak the egress ACL table, flow group and bounce rule on the
> master's manager vport? mlx5_deactivate_lag() only tears down master
> egress state for a shared FDB:
> 
>          if (test_bit(MLX5_LAG_MODE_FLAG_SHARED_FDB, &flags)) {
>                  mlx5_lag_destroy_single_fdb(ldev);
> 
> The leftover bounce rule would also redirect traffic that reaches the
> master's manager vport into the slave eswitch. On a later shared FDB
> activation, esw_set_master_egress_rule() would find the stale entry:
> 
>          if (xa_load(&vport->egress.offloads.bounce_rules, slave_index))
>                  return -EINVAL;
> 
> so mlx5_lag_create_single_fdb_filter() would keep failing until the
> driver is reloaded.
> 
> A non shared FDB LAG from mlx5_do_bond() needs the netdev notifier.
> mlx5_lag_dev_alloc() registers that notifier only when the allocating
> device is not SD capable. So this path seems to need an SD primary in
> the same ldev as a function that is not SD capable. It is not clear
> from the code that such an ldev can exist.
> 
> Would it be safer for add_one to record whether it actually removed a
> master egress rule, and for del_one to restore it only in that case?

No. vport_lag_del_one() is reached only for a SW-managed (SD or virt)
LAG, and such a LAG is only ever active with a shared FDB.

> 
>> +             if (err)
>> +                     esw_warn(master_esw->dev,
>> +                              "Failed to restore master egress rule (%d)\n",
>> +                              err);
>> +     }
>> +
>>        esw_unset_slave_egress_rule(master_esw->dev, slave_esw->dev);
>>   }
> 
> [ ... ]
> 
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120075959.2533702-1-tariqt%40nvidia.com


  reply	other threads:[~2026-11-24 10:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  7:59 [PATCH net-next V2 0/5] net/mlx5: LAG over VFs/SFs (virtual LAG) Tariq Toukan
2026-11-20  7:59 ` [PATCH net-next V2 1/5] net/mlx5: E-switch, add match-metadata allocator for nested VF/SF eswitches Tariq Toukan
2026-11-24  8:32   ` netdev-bot+sashiko
2026-11-24 10:39     ` Shay Drori
2026-11-20  7:59 ` [PATCH net-next V2 2/5] net/mlx5: E-switch, match master egress rule by vport metadata Tariq Toukan
2026-11-20  7:59 ` [PATCH net-next V2 3/5] net/mlx5: E-switch, drop master egress rule under a SW vport LAG Tariq Toukan
2026-11-24  8:32   ` netdev-bot+sashiko
2026-11-24 10:51     ` Shay Drori [this message]
2026-11-20  7:59 ` [PATCH net-next V2 4/5] net/mlx5e: Register eswitch-manager VF/SF self-port with switch-id Tariq Toukan
2026-11-24  8:32   ` netdev-bot+sashiko
2026-11-20  7:59 ` [PATCH net-next V2 5/5] net/mlx5: LAG, enable LAG over functions that do not represent a physical port Tariq Toukan
2026-11-24  8:32   ` netdev-bot+sashiko
2026-11-24 11:06     ` Shay Drori

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=1d674c41-a897-4aee-a88b-b41280b8419a@nvidia.com \
    --to=shayd@nvidia.com \
    --cc=agoldberger@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gal@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=moshe@nvidia.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ohartoov@nvidia.com \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.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