Subject: [PATCH net-next 0/3] devlink eswitch active/inactive state

From: Saeed Mahameed <[email-masked]>
Date: Wed, 15 Oct 2025 18:36:15 -0700

From: Saeed Mahameed <[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 states for an eswitch that allows
dynamically switching between active and inactive states. 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 state 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 mode in either active or inactive
state. To preserve backwards compatibility, the default state is active.

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

An example of starting the switch in active state is following.
  1. Default is active (backward compatible)
$ devlink dev eswitch set pci/0000:08:00.1 mode switchdev

  2. Explicitly set the state
$ devlink dev eswitch set pci/0000:08:00.1 mode switchdev state active

To bring up the esw in 'inactive' state:

$ devlink dev eswitch set pci/0000:08:00.1 mode switchdev state inactive

When querying the eswitch, we also see the state of it:

$ devlink dev eswitch show pci/0000:01:01.0
pci/0000:01:01.0: mode switchdev inline-mode none encap-mode basic state inactive

Signed-off-by: Saeed Mahameed <[email-masked]>
Signed-off-by: Adithya Jayachandran <[email-masked]>
Reviewed-by: Jiri Pirko <[email-masked]>

Parav Pandit (1):
  devlink: Introduce devlink eswitch state

Saeed Mahameed (2):
  net/mlx5: MPFS, add support for dynamic enable/disable
  net/mlx5: E-Switch, support eswitch state

 Documentation/netlink/specs/devlink.yaml      |  13 ++
 .../devlink/devlink-eswitch-attr.rst          |  15 ++
 .../net/ethernet/mellanox/mlx5/core/devlink.c |   2 +
 .../mellanox/mlx5/core/esw/adj_vport.c        |  15 +-
 .../net/ethernet/mellanox/mlx5/core/eswitch.c |   1 +
 .../net/ethernet/mellanox/mlx5/core/eswitch.h |  12 ++
 .../mellanox/mlx5/core/eswitch_offloads.c     | 157 ++++++++++++++++++
 .../net/ethernet/mellanox/mlx5/core/fs_core.c |   5 +
 .../ethernet/mellanox/mlx5/core/lib/mpfs.c    | 111 +++++++++++--
 .../ethernet/mellanox/mlx5/core/lib/mpfs.h    |   9 +
 include/linux/mlx5/fs.h                       |   1 +
 include/net/devlink.h                         |   5 +
 include/uapi/linux/devlink.h                  |   7 +
 net/devlink/dev.c                             |  30 ++++
 net/devlink/netlink_gen.c                     |   5 +-
 15 files changed, 358 insertions(+), 30 deletions(-)

-- 
2.51.0