DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
	James Hershaw <james.hershaw@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH v2 4/8] net/bonding: add bonding port arguments
Date: Sat,  7 Oct 2023 09:34:36 +0800	[thread overview]
Message-ID: <20231007013440.1309422-5-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231007013440.1309422-1-chaoyong.he@corigine.com>

From: Long Wu <long.wu@corigine.com>

Include the following new arguments for bonding ports:
- "notify_member" to enable/disable member notification.
- "dedicated_queue" to enable/disable dedicated queue.

Add these two arguments in initial argument.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/bonding/eth_bond_private.h  | 10 ++++
 drivers/net/bonding/rte_eth_bond.h      | 14 ++++++
 drivers/net/bonding/rte_eth_bond_api.c  | 14 ++++++
 drivers/net/bonding/rte_eth_bond_args.c | 44 ++++++++++++++++++
 drivers/net/bonding/rte_eth_bond_pmd.c  | 61 ++++++++++++++++++++++++-
 5 files changed, 142 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h
index 1344f8c002..b217d98c31 100644
--- a/drivers/net/bonding/eth_bond_private.h
+++ b/drivers/net/bonding/eth_bond_private.h
@@ -28,6 +28,8 @@
 #define PMD_BOND_LSC_POLL_PERIOD_KVARG		("lsc_poll_period_ms")
 #define PMD_BOND_LINK_UP_PROP_DELAY_KVARG	("up_delay")
 #define PMD_BOND_LINK_DOWN_PROP_DELAY_KVARG	("down_delay")
+#define PMD_BOND_NOTIFY_MEMBER_KVARG		("notify_member")
+#define PMD_BOND_DEDICATED_QUEUE_KVARG		("dedicated_queue")
 
 #define PMD_BOND_XMIT_POLICY_LAYER2_KVARG	("l2")
 #define PMD_BOND_XMIT_POLICY_LAYER23_KVARG	("l23")
@@ -320,6 +322,14 @@ int
 bond_ethdev_parse_time_ms_kvarg(const char *key,
 		const char *value, void *extra_args);
 
+int
+bond_ethdev_parse_notify_member_kvarg(const char *key __rte_unused,
+		const char *value, void *extra_args);
+
+int
+bond_ethdev_parse_dedicated_queue_kvarg(const char *key __rte_unused,
+		const char *value, void *extra_args);
+
 void
 bond_tlb_disable(struct bond_dev_private *internals);
 
diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h
index 28aa341d2f..3f427b6bab 100644
--- a/drivers/net/bonding/rte_eth_bond.h
+++ b/drivers/net/bonding/rte_eth_bond.h
@@ -385,6 +385,20 @@ rte_eth_bond_link_up_prop_delay_set(uint16_t bonding_port_id,
 int
 rte_eth_bond_link_up_prop_delay_get(uint16_t bonding_port_id);
 
+/**
+ * Set the flag that whether bonding device enable dedicated queue.
+ *
+ * @param bonding_port_id
+ *   Port ID of bonding device.
+ * @param queue_flag
+ *   The flag of enable bond dedicated queue
+ *
+ * @return
+ *   0 on success, negative value otherwise.
+ */
+int
+rte_eth_bond_dedicated_queue_flag_set(uint16_t bonding_port_id, bool queue_flag);
+
 /**
  * Set the flag of whether bonding port notifies member ports.
  *
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 0be580b19b..a042f05a4c 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -1114,6 +1114,20 @@ rte_eth_bond_link_up_prop_delay_get(uint16_t bonding_port_id)
 	return internals->link_up_delay_ms;
 }
 
+int
+rte_eth_bond_dedicated_queue_flag_set(uint16_t bonding_port_id, bool queue_flag)
+{
+	struct bond_dev_private *internals;
+
+	if (valid_bonding_port_id(bonding_port_id) != 0)
+		return -1;
+
+	internals = rte_eth_devices[bonding_port_id].data->dev_private;
+	internals->mode4.dedicated_queues.enabled = queue_flag;
+
+	return 0;
+}
+
 int
 rte_eth_bond_notify_member_flag_set(uint16_t bonding_port_id, bool notify_member)
 {
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index bdec5d61d4..8a3e4656ef 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -20,6 +20,8 @@ const char *pmd_bond_init_valid_arguments[] = {
 	PMD_BOND_MAC_ADDR_KVARG,
 	PMD_BOND_AGG_MODE_KVARG,
 	RTE_DEVARGS_KEY_DRIVER,
+	PMD_BOND_NOTIFY_MEMBER_KVARG,
+	PMD_BOND_DEDICATED_QUEUE_KVARG,
 	NULL
 };
 
@@ -297,3 +299,45 @@ bond_ethdev_parse_time_ms_kvarg(const char *key __rte_unused,
 
 	return 0;
 }
+
+int
+bond_ethdev_parse_notify_member_kvarg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	bool *notify_member;
+
+	if (value == NULL || extra_args == NULL)
+		return -1;
+
+	notify_member = extra_args;
+
+	if (strcmp("enable", value) == 0)
+		*notify_member = true;
+	else if (strcmp("disable", value) == 0)
+		*notify_member = false;
+	else
+		return -1;
+
+	return 0;
+}
+
+int
+bond_ethdev_parse_dedicated_queue_kvarg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	bool *dedicated_queue;
+
+	if (value == NULL || extra_args == NULL)
+		return -1;
+
+	dedicated_queue = extra_args;
+
+	if (strcmp("enable", value) == 0)
+		*dedicated_queue = true;
+	else if (strcmp("disable", value) == 0)
+		*dedicated_queue = false;
+	else
+		return -1;
+
+	return 0;
+}
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b99b8b8938..1ebeb270c8 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -4227,6 +4227,63 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
 		return -1;
 	}
 
+	/* Parse/set notify member flag */
+	arg_count = rte_kvargs_count(kvlist, PMD_BOND_NOTIFY_MEMBER_KVARG);
+	if (arg_count == 1) {
+		bool notify_member;
+		if (rte_kvargs_process(kvlist,
+				       PMD_BOND_NOTIFY_MEMBER_KVARG,
+				       &bond_ethdev_parse_notify_member_kvarg,
+				       &notify_member) < 0) {
+			RTE_BOND_LOG(ERR,
+				     "Invalid notify member value specified"
+				     " for bonding device %s", name);
+			return -1;
+		}
+
+		if (rte_eth_bond_notify_member_flag_set(port_id, notify_member) != 0) {
+			RTE_BOND_LOG(ERR,
+				     "Failed to set notify member (%u) on"
+				     " bonding device %s", notify_member, name);
+			return -1;
+		}
+	} else if (arg_count > 1) {
+		RTE_BOND_LOG(ERR,
+			     "notify member flag can be specified only once"
+			     " for bonding device %s", name);
+		return -1;
+	}
+
+	/* Parse/set dedicated queue flag */
+	arg_count = rte_kvargs_count(kvlist, PMD_BOND_DEDICATED_QUEUE_KVARG);
+	if (arg_count == 1) {
+		bool dedicated_queue;
+		if (rte_kvargs_process(kvlist,
+				       PMD_BOND_DEDICATED_QUEUE_KVARG,
+				       &bond_ethdev_parse_dedicated_queue_kvarg,
+				       &dedicated_queue) < 0) {
+			RTE_BOND_LOG(ERR,
+				     "Invalid dedicated queue flag specified"
+				     " for bonding device %s", name);
+			return -1;
+		}
+
+		if (internals->mode == BONDING_MODE_8023AD) {
+			if (rte_eth_bond_dedicated_queue_flag_set(port_id, dedicated_queue) != 0) {
+				RTE_BOND_LOG(ERR,
+					     "Failed to enable/disable dedicated"
+					     " queue flag on bonding device %s",
+					     name);
+				return -1;
+			}
+		}
+	} else if (arg_count > 1) {
+		RTE_BOND_LOG(ERR,
+			     "dedicated queue flag can be specified only once"
+			     " for bonding device %s", name);
+		return -1;
+	}
+
 	/* configure members so we can pass mtu setting */
 	for (i = 0; i < internals->member_count; i++) {
 		struct rte_eth_dev *member_ethdev =
@@ -4264,7 +4321,9 @@ RTE_PMD_REGISTER_PARAM_STRING(net_bonding,
 	"mac=<mac addr> "
 	"lsc_poll_period_ms=<int> "
 	"up_delay=<int> "
-	"down_delay=<int>");
+	"down_delay=<int>"
+	"notify_member=[enable | disable] "
+	"dedicated_queue=[enable | disable] ");
 
 /* We can't use RTE_LOG_REGISTER_DEFAULT because of the forced name for
  * this library, see meson.build.
-- 
2.39.1


  parent reply	other threads:[~2023-10-07  1:35 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05  2:40 [PATCH 0/8] Enhance the bond framework to support offload Chaoyong He
2023-10-05  2:40 ` [PATCH 1/8] ethdev: add member notification for bonding port Chaoyong He
2023-10-05  2:40 ` [PATCH 2/8] ethdev: add API to get hardware creation of " Chaoyong He
2023-10-05  2:40 ` [PATCH 3/8] net/bonding: modify interface comment format Chaoyong He
2023-10-05  2:40 ` [PATCH 4/8] net/bonding: add bonding port arguments Chaoyong He
2023-10-05  2:40 ` [PATCH 5/8] net/bonding: support add port by data name Chaoyong He
2023-10-05  2:40 ` [PATCH 6/8] net/bonding: create new rte flow header file Chaoyong He
2023-10-05  2:40 ` [PATCH 7/8] net/bonding: support checking valid bonding port ID Chaoyong He
2023-10-05  2:40 ` [PATCH 8/8] net/bonding: add commands for bonding port notification Chaoyong He
2023-10-07  1:34 ` [PATCH v2 0/8] Enhance the bond framework to support offload Chaoyong He
2023-10-07  1:34   ` [PATCH v2 1/8] ethdev: add member notification for bonding port Chaoyong He
2023-10-07 15:49     ` Stephen Hemminger
2023-10-08  1:37       ` Chaoyong He
2023-10-07  1:34   ` [PATCH v2 2/8] ethdev: add API to get hardware creation of " Chaoyong He
2023-10-07  1:34   ` [PATCH v2 3/8] net/bonding: modify interface comment format Chaoyong He
2023-10-07  1:34   ` Chaoyong He [this message]
2023-10-07  1:34   ` [PATCH v2 5/8] net/bonding: support add port by data name Chaoyong He
2023-10-07  1:34   ` [PATCH v2 6/8] net/bonding: create new rte flow header file Chaoyong He
2023-10-07  1:34   ` [PATCH v2 7/8] net/bonding: support checking valid bonding port ID Chaoyong He
2023-10-07  1:34   ` [PATCH v2 8/8] net/bonding: add commands for bonding port notification Chaoyong He
2023-10-08  1:50   ` [PATCH v3 0/8] Enhance the bond framework to support offload Chaoyong He
2023-10-08  1:50     ` [PATCH v3 1/8] ethdev: add member notification for bonding port Chaoyong He
2023-10-08  2:49       ` lihuisong (C)
2023-10-09  3:11         ` 回复: " Long Wu
2023-10-17  8:27           ` lihuisong (C)
2023-10-18  2:16             ` Chaoyong He
2023-10-08  1:50     ` [PATCH v3 2/8] ethdev: add API to get hardware creation of " Chaoyong He
2023-10-08  1:50     ` [PATCH v3 3/8] net/bonding: modify interface comment format Chaoyong He
2023-10-08  1:50     ` [PATCH v3 4/8] net/bonding: add bonding port arguments Chaoyong He
2023-10-08  1:50     ` [PATCH v3 5/8] net/bonding: support add port by data name Chaoyong He
2023-10-08  1:50     ` [PATCH v3 6/8] net/bonding: create new rte flow header file Chaoyong He
2023-10-08  1:50     ` [PATCH v3 7/8] net/bonding: support checking valid bonding port ID Chaoyong He
2023-10-17  8:33       ` lihuisong (C)
2023-10-17  9:25         ` Chaoyong He
2023-10-17 11:34           ` lihuisong (C)
2023-10-18  1:53             ` Chaoyong He
2023-10-17 15:56         ` Stephen Hemminger
2023-10-08  1:50     ` [PATCH v3 8/8] net/bonding: add commands for bonding port notification Chaoyong He
2023-10-13  2:22     ` [PATCH v3 0/8] Enhance the bond framework to support offload Chaoyong He
2023-10-13 12:53       ` Ferruh Yigit
2023-10-18  7:48     ` [PATCH v4 0/6] " Chaoyong He
2023-10-18  7:48       ` [PATCH v4 1/6] ethdev: add member notification for bonding port Chaoyong He
2023-10-18  7:48       ` [PATCH v4 2/6] ethdev: add API to get hardware creation of " Chaoyong He
2023-10-18  7:48       ` [PATCH v4 3/6] net/bonding: add bonding port arguments Chaoyong He
2023-10-18  7:48       ` [PATCH v4 4/6] net/bonding: support add port by data name Chaoyong He
2023-10-18  7:48       ` [PATCH v4 5/6] net/bonding: support checking valid bonding port ID Chaoyong He
2023-10-18  7:48       ` [PATCH v4 6/6] net/bonding: add commands for bonding port notification Chaoyong He
2023-11-15 16:01       ` [PATCH v4 0/6] Enhance the bond framework to support offload Ferruh Yigit
2023-11-16  1:45         ` Chaoyong He
2023-12-26  2:37       ` [PATCH v5 00/14] " Chaoyong He
2023-12-26  2:37         ` [PATCH v5 01/14] ethdev: add member notification for bonding port Chaoyong He
2023-12-26  2:37         ` [PATCH v5 02/14] ethdev: add API to get firmware creation of " Chaoyong He
2023-12-26  2:37         ` [PATCH v5 03/14] net/bonding: add bonding port arguments Chaoyong He
2023-12-26  2:37         ` [PATCH v5 04/14] net/bonding: support add port by data name Chaoyong He
2023-12-26  2:37         ` [PATCH v5 05/14] net/bonding: support checking valid bonding port ID Chaoyong He
2023-12-26  2:37         ` [PATCH v5 06/14] net/bonding: add commands for bonding port notification Chaoyong He
2023-12-26  2:37         ` [PATCH v5 07/14] net/bonding: create new rte flow header file Chaoyong He
2023-12-26  2:37         ` [PATCH v5 08/14] net/nfp: add bond firmware creation initialization Chaoyong He
2023-12-26  2:37         ` [PATCH v5 09/14] net/nfp: reset bond configuration of firmware Chaoyong He
2023-12-26  2:37         ` [PATCH v5 10/14] net/nfp: handle link event of bond firmware creation Chaoyong He
2023-12-26  2:37         ` [PATCH v5 11/14] net/nfp: support bond member notification Chaoyong He
2023-12-26  2:37         ` [PATCH v5 12/14] net/nfp: handle bond packets from firmware Chaoyong He
2023-12-26  2:37         ` [PATCH v5 13/14] net/nfp: support getting bond firmware creation Chaoyong He
2023-12-26  2:37         ` [PATCH v5 14/14] net/nfp: support offloading bond-flow Chaoyong He
2023-12-26  7:28         ` [PATCH v6 00/14] Enhance the bond framework to support offload Chaoyong He
2023-12-26  7:28           ` [PATCH v6 01/14] ethdev: add member notification for bonding port Chaoyong He
2023-12-26  7:28           ` [PATCH v6 02/14] ethdev: add API to get firmware creation of " Chaoyong He
2023-12-26  7:28           ` [PATCH v6 03/14] net/bonding: add bonding port arguments Chaoyong He
2023-12-26  7:28           ` [PATCH v6 04/14] net/bonding: support add port by data name Chaoyong He
2023-12-26  7:28           ` [PATCH v6 05/14] net/bonding: support checking valid bonding port ID Chaoyong He
2023-12-26  7:28           ` [PATCH v6 06/14] net/bonding: add commands for bonding port notification Chaoyong He
2023-12-26  7:28           ` [PATCH v6 07/14] net/bonding: create new rte flow header file Chaoyong He
2023-12-26  7:28           ` [PATCH v6 08/14] net/nfp: add bond firmware creation initialization Chaoyong He
2023-12-26  7:28           ` [PATCH v6 09/14] net/nfp: reset bond configuration of firmware Chaoyong He
2023-12-26  7:28           ` [PATCH v6 10/14] net/nfp: handle link event of bond firmware creation Chaoyong He
2023-12-26  7:28           ` [PATCH v6 11/14] net/nfp: support bond member notification Chaoyong He
2023-12-26  7:28           ` [PATCH v6 12/14] net/nfp: handle bond packets from firmware Chaoyong He
2023-12-26  7:28           ` [PATCH v6 13/14] net/nfp: support getting bond firmware creation Chaoyong He
2023-12-26  7:28           ` [PATCH v6 14/14] net/nfp: support offloading bond-flow Chaoyong He
2024-09-22 22:30           ` [PATCH v6 00/14] Enhance the bond framework to support offload Ferruh Yigit

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=20231007013440.1309422-5-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=james.hershaw@corigine.com \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.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).