DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shiri Kuzin <shirik@mellanox.com>
To: dev@dpdk.org
Cc: matan@mellanox.com, viacheslavo@mellanox.com
Subject: [dpdk-dev] [PATCH 3/3] net/mlx5: add new devarg for LACP packets control
Date: Tue, 23 Jun 2020 11:41:07 +0300	[thread overview]
Message-ID: <1592901667-12161-4-git-send-email-shirik@mellanox.com> (raw)
In-Reply-To: <1592901667-12161-1-git-send-email-shirik@mellanox.com>

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>
Acked-by: Matan Azrad <matan@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


  parent reply	other threads:[~2020-06-23  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  8:41 [dpdk-dev] [PATCH 0/3] mlx5: LACP handling for bonded devices Shiri Kuzin
2020-06-23  8:41 ` [dpdk-dev] [PATCH 1/3] common/mlx5: add default miss action Shiri Kuzin
2020-06-23  8:41 ` [dpdk-dev] [PATCH 2/3] net/mlx5: add default miss action to flow engine Shiri Kuzin
2020-06-23  8:41 ` Shiri Kuzin [this message]
2020-06-28 10:19 ` [dpdk-dev] [PATCH 0/3] mlx5: LACP handling for bonded devices Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1592901667-12161-4-git-send-email-shirik@mellanox.com \
    --to=shirik@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=viacheslavo@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).