In multi-port E-Switch setup, the MLX5 PMD always added
PF representor port.
For example, `representor=pf1vf[0,1]` implicitly added PF1 representor
port:

```
Port     Name
0        p0
1        p1
2        representor_c0pf1vf0
3        representor_c0pf1vf1
```

The patch adds support for the new representor format that suppresses
PF representor attachment:

Example: `representor=(pf1)vf[0,1]`

```
Port     Name
0        p0
1        representor_c0pf1vf0
2        representor_c0pf1vf1
```

Signed-off-by: Gregory Etelson <[email protected]>
---
v2: Use updated rte_eth_devargs::flags.
v3: Fix typo in comment.
v4: Use update devarg macro name.
---
 drivers/net/mlx5/linux/mlx5_os.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index c742e0f282..dba3b61b68 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -2284,6 +2284,12 @@ mlx5_device_mpesw_pci_match(struct ibv_device *ibv,
        return -1;
 }
 
+static inline bool
+mlx5_ignore_pf_representor(const struct rte_eth_devargs *eth_da)
+{
+       return (eth_da->flags & RTE_ETH_DEVARG_REPRESENTOR_IGNORE_PF) != 0;
+}
+
 /**
  * Register a PCI device within bonding.
  *
@@ -2592,6 +2598,8 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,
                                        if (list[ns].info.port_name == mpesw) {
                                                list[ns].info.master = 1;
                                                list[ns].info.representor = 0;
+                                       } else if 
(mlx5_ignore_pf_representor(&eth_da)) {
+                                               continue;
                                        } else {
                                                list[ns].info.master = 0;
                                                list[ns].info.representor = 1;
-- 
2.51.0

Reply via email to