Subject: [PATCH net-next V3 0/3] devlink eswitch inactive mode

From: Saeed Mahameed <[email-masked]>
Date: Fri, 7 Nov 2025 23:04:01 -0800

From: Saeed Mahameed <[email-masked]>

v2->v3:
  - Fix cocci check %pe
  - minor improvement: create FDB drop counter once.

v1->v2:
  - Introduce new devlink mode instead of state, Jiri's suggestion.
  - Address kernel robot issues reported in v1.
      no previous prototype for 'mlx5_mpfs_enable'

v2: https://lore.kernel.org/all/[email-masked]/
v1: https://lore.kernel.org/all/[email-masked]/

Before having traffic flow through an eswitch, a user may want to have the
ability to block traffic towards the FDB until FDB is fully programmed and the
user is ready to send traffic to it. For example: when two eswitches are present
for vports in a multi-PF setup, one eswitch may take over the traffic from the
other when the user chooses. Before this take over, a user may want to first
program the inactive eswitch and then once ready redirect traffic to this new
eswitch.

This series introduces a user-configurable mode for an eswitch that allows
dynamically switching between active and inactive modes. When inactive, traffic
does not flow through the eswitch. While inactive, steering pipeline
configuration can be done (e.g. adding TC rules, discovering representors,
enabling the desired SDN modes such as bridge/OVS/DPDK/etc). Once configuration
is completed, a user can set the eswitch mode to active and have traffic flow
through. This allows admins to upgrade forwarding pipeline rules with very
minimal downtime and packet drops.

A user can start the eswitch in switchdev or switchdev_inactive mode.

Active: Traffic is enabled on this eswitch FDB.
Inactive: Traffic is ignored/dropped on this eswitch FDB.

An example use case:
$ devlink dev eswitch set pci/0000:08:00.1 mode switchdev_inactive
Setup FDB pipeline and netdev representors
...
Once ready to start receiving traffic
$ devlink dev eswitch set pci/0000:08:00.1 mode switchdev

Saeed Mahameed (3):
  devlink: Introduce switchdev_inactive eswitch mode
  net/mlx5: MPFS, add support for dynamic enable/disable
  net/mlx5: E-Switch, support eswitch inactive mode

 Documentation/netlink/specs/devlink.yaml      |   2 +
 .../devlink/devlink-eswitch-attr.rst          |  13 ++
 .../mellanox/mlx5/core/esw/adj_vport.c        |  15 +-
 .../net/ethernet/mellanox/mlx5/core/eswitch.h |   6 +
 .../mellanox/mlx5/core/eswitch_offloads.c     | 207 +++++++++++++++++-
 .../net/ethernet/mellanox/mlx5/core/fs_core.c |   5 +
 .../ethernet/mellanox/mlx5/core/lib/mpfs.c    | 116 ++++++++--
 .../ethernet/mellanox/mlx5/core/lib/mpfs.h    |   9 +
 include/linux/mlx5/fs.h                       |   1 +
 include/uapi/linux/devlink.h                  |   1 +
 net/devlink/netlink_gen.c                     |   2 +-
 11 files changed, 338 insertions(+), 39 deletions(-)

-- 
2.51.1