NVIDIA NICs and DPUs have an embedded switch (E-Switch)
to which all associated functions (PFs, VFs, SFs) and physical ports
are connected through virtual ports (vports).
mlx5 PMD supports devices with E-Switch enabled and
also exposes flow rule offloading to the E-Switch
through transfer flow rules.

Flow rules matching on vports (with flow item REPRESENTED_PORT)
can match on specific vport using one of the two internal mechanisms:

- vport metadata - E-Switch internally tags all packets with a metadata value
  associated with originating vport.
  mlx5 PMD can match on that metadata through a specialized HW register in each 
flow rule.
  vport metadata enables features such as VF-LAG, Multiport E-Switch and
  others mentioned in [1].
- legacy match - A static value known as "source vport" is assigned to each 
vport.
  These values are not globally unique, because they are statically assigned 
per E-Switch
  (e.g., VF0 on each of the PFs will have the same source_vport number).

Users can select the vport matching mode through devlink [1].
vport metadata matching mode is the default and is enough for most of the use 
cases.
However, internally tagging all the packets with metadata values,
increases the packet latency in the E-Switch. As described in the linked kernel 
docs,
disabling vport metadata matching can increase packet rate up to 20%.
If features provided by vport metadata matching are not required,
it can be disabled to increase E-Switch's throughput.

mlx5 PMD with HW Steering flow engine enabled, only supported
vport metadata mode when running on a device with enabled E-Switch.
Goal of this patchset is to enable support of devices with
disabled vport metadata matching. This is purely an internal change in mlx5 PMD.
No changes in DPDK applications should be required.

- Patches 1-2 - Extend information queried from the device by mlx5 PMD
  to include information necessary to implement legacy vport match.
  This data is always available, regardless of selected E-Switch matching mode.
- Patch 3 - Adjusts internal translation of DPDK port ID to flow rule matching 
data,
  so that returned data is always valid even if vport metadata matching is 
disabled.
  Also adds detection of vport matching mode to HWS layer.
- Patch 4 - Adds support for REPRESENTED_PORT item in HWS layer
  whenever vport metadata matching mode is disabled.
  This involves correctly translating DPDK port index to "source vport".
- Patch 5 - Removes all validation checks from mlx5 PMD which prevented probing
  on devices with disabled vport metadata matching mode.
  Adjusts internal PMD logic to work with "source vport" whenever needed.

[1]: https://docs.kernel.org/networking/devlink/mlx5.html

Dariusz Sosnowski (5):
  common/mlx5: query vport VHCA ID
  net/mlx5: store port VHCA ID
  net/mlx5: return port info regardless of register mask
  net/mlx5/hws: add source vport match in HWS
  net/mlx5: allow legacy source vport match

 drivers/common/mlx5/linux/mlx5_glue.c |  4 ++
 drivers/common/mlx5/linux/mlx5_glue.h |  2 +
 drivers/net/mlx5/hws/mlx5dr_cmd.c     | 13 +++-
 drivers/net/mlx5/hws/mlx5dr_cmd.h     |  1 +
 drivers/net/mlx5/hws/mlx5dr_definer.c | 99 ++++++++++++++++++++++-----
 drivers/net/mlx5/hws/mlx5dr_definer.h |  2 +
 drivers/net/mlx5/hws/mlx5dr_table.c   |  6 ++
 drivers/net/mlx5/linux/mlx5_os.c      | 38 +++-------
 drivers/net/mlx5/mlx5.h               |  4 ++
 drivers/net/mlx5/mlx5_flow.h          |  3 +-
 drivers/net/mlx5/mlx5_flow_dv.c       |  3 +
 drivers/net/mlx5/mlx5_flow_hw.c       | 34 ++++-----
 12 files changed, 140 insertions(+), 69 deletions(-)

--
2.47.3

Reply via email to