mirror of https://lore.kernel.org/lkml/
 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@google.com>, <kuba@kernel.org>,
	<netdev@vger.kernel.org>, <pabeni@redhat.com>,
	<agoldberger@nvidia.com>, <cratiu@nvidia.com>, <gal@nvidia.com>,
	<leon@kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-rdma@vger.kernel.org>, <mbloch@nvidia.com>,
	<moshe@nvidia.com>, <ohartoov@nvidia.com>, <saeedm@nvidia.com>
Subject: Re: [PATCH net-next 09/13] net/mlx5: E-switch, derive manager vport from device capability
Date: Mon, 28 Sep 2026 18:13:44 +0300	[thread overview]
Message-ID: <eafbf4ff-e1e6-4cf1-b784-7adb233c7e15@nvidia.com> (raw)
In-Reply-To: <179027196200.2160803.11089100690642035873@kernel.org>



On 24/09/2026 20:46, 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: 0 · Medium: 1 · 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] mlx5_eswitch_manager_vport() (include/linux/mlx5/eswitch.h)
>    now returns MLX5_CAP_ESW(dev, esw_manager_vport_number) when…
> 
> --
> 
> net/mlx5: E-switch, derive manager vport from device capability
> 
> The commit changes mlx5_eswitch_manager_vport() to return
> esw_manager_vport_number from the e-switch capability when
> esw_manager_vport_number_valid is set, so the manager vport can be a VF.
> The old ECPF/host PF mapping stays as the fallback. mlx5_esw_vports_init()
> now allocates the manager vport if it is not already in esw->vports.
> 
>> diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h
>> index a0dd162baa787..03d3620141c83 100644
>> --- a/include/linux/mlx5/eswitch.h
>> +++ b/include/linux/mlx5/eswitch.h
>> @@ -222,6 +222,9 @@ static inline bool is_mdev_switchdev_mode(struct mlx5_core_dev *dev)
>>   /* The returned number is valid only when the dev is eswitch manager. */
>>   static inline u16 mlx5_eswitch_manager_vport(struct mlx5_core_dev *dev)
>>   {
>> +     if (MLX5_CAP_ESW(dev, esw_manager_vport_number_valid))
>> +             return MLX5_CAP_ESW(dev, esw_manager_vport_number);
>> +
> 
> [Severity: Medium]
> Do the SW and HW steering backends agree with this new manager vport
> number?
> 
> esw->manager_vport can now be a vport N that is neither ECPF nor 0. Both
> steering backends still hardcode the old rule to decide which vport is
> the manager.
> 
> In steering/hws/vport.c:
> 
> static bool hws_vport_is_esw_mgr_vport(struct mlx5hws_context *ctx, u16 vport)
> {
>          return ctx->caps->is_ecpf ? vport == MLX5_VPORT_ECPF :
>                                      vport == MLX5_VPORT_HOST_PF;
> }
> 
> In steering/sws/dr_domain.c, dr_domain_is_esw_mgr_vport():
> 
>          return (caps->is_ecpf && vport == MLX5_VPORT_ECPF) ||
>                 (!caps->is_ecpf && vport == 0);
> 
> The e-switch core passes esw->manager_vport to these backends as a
> destination or source port, with no vhca_id. Some examples:
> 
> eswitch_offloads.c (slow-path miss):
>          dest.vport.num = esw->manager_vport;
> 
> rdma.c:
>          mlx5_esw_set_spec_source_port(esw, esw->manager_vport, spec);
> 
> The peer and slave miss rules in eswitch_offloads.c and en/tc/sample.c
> also use it.
> 
> If firmware reports a manager vport N other than ECPF/0, it looks like
> mlx5dr_domain_get_vport_cap() and mlx5hws_vport_get_gvmi() would treat N
> as a foreign vport. They would not return the cached esw_manager_caps or
> esw_manager_gvmi. Instead they would go through dr_domain_add_vport_cap()
> or hws_vport_add_gvmi(), which query N with other_vport or other_function
> set to true. Vport 0 would also keep mapping to the local manager's
> caps/gvmi.
> 
> Could this lead to failed rule creation, or to rules that resolve to the
> wrong vport context, when SMFS or HMFS steering is used on such a device?
> 
> HWS already reads the capability in mlx5hws_cmd_query_caps() into
> caps->eswitch_manager_vport_number, and hws/table.c and hws/action.c use
> it. hws/vport.c does not. Should hws_vport_is_esw_mgr_vport() and
> dr_domain_is_esw_mgr_vport() be updated to use the capability-reported
> number as well?

VFs e-switch managers don't support SWS, and HWS only uses the hardcoded
manager check for source_port matching. FW doesn't support source_port
matching for a VF e-switch manager, so a VF manager always matches the
source by vport metadata (reg_c_0), and this helper is never reached for
it. HWS destination vport actions take the vport number directly,
without this lookup, and table/action defaults already use
esw_manager_vport_number. So this isn't a regression for VF e-switch
managers.


> 
> The later patches in this series don't appear to touch the steering
> backends. Current firmware probably reports numbers that match the
> hardcoded mapping, so this would only show up with firmware that reports
> a VF as the e-switch manager.
> 
>>        return mlx5_core_is_ecpf_esw_manager(dev) ?
>>                MLX5_VPORT_ECPF : MLX5_VPORT_HOST_PF;
>>   }
> 
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260923103830.1183-1-tariqt%40nvidia.com


  reply	other threads:[~2026-09-28 15:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 10:38 [PATCH net-next 00/13] net/mlx5: Preparations for nested E-switch Tariq Toukan
2026-09-23 10:38 ` [PATCH net-next 01/13] net/mlx5e: Assign a random MAC to any netdev with a zero MAC address Tariq Toukan
2026-09-24 17:45   ` netdev-bot+sashiko
2026-09-23 10:38 ` [PATCH net-next 02/13] net/mlx5: E-switch, do not leave an unpaired devcom registered Tariq Toukan
2026-09-24 17:45   ` netdev-bot+sashiko
2026-09-23 10:38 ` [PATCH net-next 03/13] net/mlx5: LAG, allocate v2p_map dynamically Tariq Toukan
2026-09-24 17:45   ` netdev-bot+sashiko
2026-09-28 14:56     ` Shay Drori
2026-09-23 10:38 ` [PATCH net-next 04/13] net/mlx5: LAG, allocate port-indexed scratch buffers dynamically Tariq Toukan
2026-09-24 17:45   ` netdev-bot+sashiko
2026-09-28 14:57     ` Shay Drori
2026-09-23 10:38 ` [PATCH net-next 05/13] net/mlx5: LAG, drop per-port scratch array in drop-rule setup Tariq Toukan
2026-09-23 10:38 ` [PATCH net-next 06/13] net/mlx5: LAG, size debugfs buffers by port count Tariq Toukan
2026-09-24 17:45   ` netdev-bot+sashiko
2026-09-23 10:38 ` [PATCH net-next 07/13] net/mlx5e: TC, anchor peer-flow reverse index on the duplicated flow Tariq Toukan
2026-09-24 17:45   ` netdev-bot+sashiko
2026-09-23 10:38 ` [PATCH net-next 08/13] net/mlx5e: TC, track peer flows in a vhca_id xarray Tariq Toukan
2026-09-24 17:46   ` netdev-bot+sashiko
2026-09-23 10:38 ` [PATCH net-next 09/13] net/mlx5: E-switch, derive manager vport from device capability Tariq Toukan
2026-09-24 17:46   ` netdev-bot+sashiko
2026-09-28 15:13     ` Shay Drori [this message]
2026-09-23 10:38 ` [PATCH net-next 10/13] net/mlx5: LAG, don't print port mapping to debugfs in MPESW mode Tariq Toukan
2026-09-23 10:38 ` [PATCH net-next 11/13] net/mlx5: LAG, drop stale esw_shared_ingress_acl gate from shared FDB Tariq Toukan
2026-09-23 10:38 ` [PATCH net-next 12/13] net/mlx5: E-switch, correct stale VF/PF wording in esw-allowed comments Tariq Toukan
2026-09-23 10:38 ` [PATCH net-next 13/13] net/mlx5: E-switch, disable host functions for a non PF e-switch manager Tariq Toukan
2026-09-29  0:20 ` [PATCH net-next 00/13] net/mlx5: Preparations for nested E-switch patchwork-bot+netdevbpf

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=eafbf4ff-e1e6-4cf1-b784-7adb233c7e15@nvidia.com \
    --to=shayd@nvidia.com \
    --cc=agoldberger@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=cratiu@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®