[RFC,3/3] net/mlx5: add new devarg dv_lacp_by_user

Message ID e392b00e68422842473b84dd67f785b44ccc56df.1591088325.git.shirik@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series mlx5: LACP handling for bonded devices |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Shiri Kuzin June 2, 2020, 9:38 a.m. UTC
  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 <shirik@mellanox.com>
---
 drivers/net/mlx5/mlx5.c         | 6 ++++++
 drivers/net/mlx5/mlx5.h         | 2 ++
 drivers/net/mlx5/mlx5_trigger.c | 9 +++++++++
 3 files changed, 17 insertions(+)
  

Patch

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 469ff73..f015050 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_DV_LACP_BY_USER "dv_lacp_by_user" 
+
 /* Activate Netlink support in VF mode. */
 #define MLX5_VF_NL_EN "vf_nl_en"
 
@@ -1852,6 +1855,8 @@  struct mlx5_flow_id_pool *
 			return -rte_errno;
 		}
 		config->dv_xmeta_en = tmp;
+	} else if (strcmp(MLX5_DV_LACP_BY_USER, key) == 0) {
+		config->dv_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) {
@@ -1910,6 +1915,7 @@  struct mlx5_flow_id_pool *
 		MLX5_DV_ESW_EN,
 		MLX5_DV_FLOW_EN,
 		MLX5_DV_XMETA_EN,
+		MLX5_DV_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 bc57fb5..ff6bd83 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -157,6 +157,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 dv_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 f123193..ef5c8f2 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -434,6 +434,10 @@ 
 	const struct rte_ether_addr cmp = {
 		.addr_bytes = "\x00\x00\x00\x00\x00\x00",
 	};
+	struct rte_flow_item_eth lacp_spec = {
+		.type = 0x8809,
+		.dst.addr_bytes = "\x01\x80\xc2\x00\x00\x02",
+	};
 	unsigned int i;
 	unsigned int j;
 	int ret;
@@ -464,6 +468,11 @@ 
 				" configured - only Eswitch group 0 flows are"
 				" supported.", dev->data->port_id);
 	}
+	if (!priv->config.dv_lacp_by_user && priv->pf_bond) {
+		ret = mlx5_flow_default_miss(dev,&lacp_spec);
+		if (ret)
+			goto error;
+	}
 	if (priv->isolated)
 		return 0;
 	if (dev->data->promiscuous) {