The new devarg will control the steering of the lacp traffic.
When setting dv_lacp_by_user = 0 the lacp traffic will be
steered to kernel and managed there.

When setting dv_lacp_by_user = 1 the lacp traffic will
not be steered and the user will need to manage it.

Signed-off-by: Shiri Kuzin <shi...@mellanox.com>
Acked-by: Matan Azrad <ma...@mellanox.com>
---
 doc/guides/nics/mlx5.rst               | 10 ++++++++++
 doc/guides/rel_notes/release_20_08.rst |  1 +
 drivers/net/mlx5/mlx5.c                |  6 ++++++
 drivers/net/mlx5/mlx5.h                |  2 ++
 drivers/net/mlx5/mlx5_trigger.c        |  9 +++++++++
 5 files changed, 28 insertions(+)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 0ff3c53..b51aa67 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -796,6 +796,16 @@ Driver options
 
   Enabled by default if supported.
 
+- ``lacp_by_user`` parameter [int]
+
+  A nonzero value enables the control of LACP traffic by the user application.
+  When a bond exists in the driver, by default it should be managed by the
+  kernel and therefore LACP traffic should be steered to the kernel.
+  If this devarg is set to 1 it will allow the user to manage the bond by
+  itself and not steer LACP traffic to the kernel.
+
+  Disabled by default (set to 0).
+
 - ``mr_ext_memseg_en`` parameter [int]
 
   A nonzero value enables extending memseg when registering DMA memory. If
diff --git a/doc/guides/rel_notes/release_20_08.rst 
b/doc/guides/rel_notes/release_20_08.rst
index cc39984..f03762b 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -67,6 +67,7 @@ New Features
   Updated Mellanox mlx5 driver with new features and improvements, including:
 
   * Added new PMD devarg ``reclaim_mem_mode``.
+  * Added new devarg ``lacp_by_user``.
 
 * **Added vDPA device APIs to query virtio queue statistics.**
 
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ddbe29d..07c6add 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -140,6 +140,9 @@
 /* Enable extensive flow metadata support. */
 #define MLX5_DV_XMETA_EN "dv_xmeta_en"
 
+/* Device parameter to let the user manage the lacp traffic of bonded device */
+#define MLX5_LACP_BY_USER "lacp_by_user"
+
 /* Activate Netlink support in VF mode. */
 #define MLX5_VF_NL_EN "vf_nl_en"
 
@@ -1352,6 +1355,8 @@ struct mlx5_dev_ctx_shared *
                        return -rte_errno;
                }
                config->dv_xmeta_en = tmp;
+       } else if (strcmp(MLX5_LACP_BY_USER, key) == 0) {
+               config->lacp_by_user = !!tmp;
        } else if (strcmp(MLX5_MR_EXT_MEMSEG_EN, key) == 0) {
                config->mr_ext_memseg_en = !!tmp;
        } else if (strcmp(MLX5_MAX_DUMP_FILES_NUM, key) == 0) {
@@ -1419,6 +1424,7 @@ struct mlx5_dev_ctx_shared *
                MLX5_DV_ESW_EN,
                MLX5_DV_FLOW_EN,
                MLX5_DV_XMETA_EN,
+               MLX5_LACP_BY_USER,
                MLX5_MR_EXT_MEMSEG_EN,
                MLX5_REPRESENTOR,
                MLX5_MAX_DUMP_FILES_NUM,
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 93bde5a..46e66eb 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -210,6 +210,8 @@ struct mlx5_dev_config {
        unsigned int dv_esw_en:1; /* Enable E-Switch DV flow. */
        unsigned int dv_flow_en:1; /* Enable DV flow. */
        unsigned int dv_xmeta_en:2; /* Enable extensive flow metadata. */
+       unsigned int lacp_by_user:1;
+       /* Enable user to manage LACP traffic. */
        unsigned int swp:1; /* Tx generic tunnel checksum and TSO offload. */
        unsigned int devx:1; /* Whether devx interface is available or not. */
        unsigned int dest_tir:1; /* Whether advanced DR API is available. */
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index c7c2ee6..ef74609 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -464,6 +464,15 @@
                                " configured - only Eswitch group 0 flows are"
                                " supported.", dev->data->port_id);
        }
+       if (!priv->config.lacp_by_user && priv->pf_bond >= 0) {
+               ret = mlx5_flow_lacp_miss(dev);
+               if (ret)
+                       DRV_LOG(INFO, "port %u LACP rule cannot be created - "
+                               "forward LACP to kernel.", dev->data->port_id);
+               else
+                       DRV_LOG(INFO, "LACP traffic will be missed in port %u."
+                               , dev->data->port_id);
+       }
        if (priv->isolated)
                return 0;
        if (dev->data->promiscuous) {
-- 
1.8.3.1

Reply via email to