DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] add function to set dedicated queue size
@ 2024-06-24  2:03 Chaoyong He
  2024-06-24  2:03 ` [PATCH 1/2] net/bonding: standard the log message Chaoyong He
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Chaoyong He @ 2024-06-24  2:03 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

This patch series mainly add a function to bonding PMD to set
dedicated queue size, also add a command to testpmd application
to invoke this function.

At the same time, standard the log message of bonding PMD.

Long Wu (2):
  net/bonding: standard the log message
  net/bonding: add command to set dedicated queue size

 .../link_bonding_poll_mode_drv_lib.rst        |   8 ++
 doc/guides/rel_notes/release_24_07.rst        |   4 +
 drivers/net/bonding/bonding_testpmd.c         | 126 ++++++++++++++----
 drivers/net/bonding/eth_bond_8023ad_private.h |   3 +
 drivers/net/bonding/rte_eth_bond_8023ad.c     |  39 ++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h     |  23 ++++
 drivers/net/bonding/rte_eth_bond_pmd.c        |   6 +-
 drivers/net/bonding/version.map               |   1 +
 8 files changed, 185 insertions(+), 25 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/2] net/bonding: standard the log message
  2024-06-24  2:03 [PATCH 0/2] add function to set dedicated queue size Chaoyong He
@ 2024-06-24  2:03 ` Chaoyong He
  2024-10-10 18:10   ` Stephen Hemminger
  2024-06-24  2:03 ` [PATCH 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
  2024-10-11  3:24 ` [PATCH v2 0/2] add function " Chaoyong He
  2 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-06-24  2:03 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Peng Zhang, Chaoyong He

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

According to the check rules in the patch check script,
drivers and libraries must use the logging framework.

So standard the log message of bonding driver by using
the logging framework.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/bonding/bonding_testpmd.c | 42 ++++++++++++---------------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 8fcd6cadd0..45b636fea7 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -34,15 +34,14 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result,
 	 * of device changed.
 	 */
 	if (port->port_status != RTE_PORT_STOPPED) {
-		fprintf(stderr,
-			"\t Error: Can't set bonding mode when port %d is not stopped\n",
+		TESTPMD_LOG(ERR, "\t Error: Can't set bonding mode when port %d is not stopped\n",
 			port_id);
 		return;
 	}
 
 	/* Set the bonding mode for the relevant port. */
 	if (rte_eth_bond_mode_set(port_id, res->value) != 0)
-		fprintf(stderr, "\t Failed to set bonding mode for port = %d.\n",
+		TESTPMD_LOG(ERR, "\t Failed to set bonding mode for port = %d.\n",
 			port_id);
 }
 
@@ -98,23 +97,23 @@ static void cmd_set_bonding_lacp_dedicated_queues_parsed(void *parsed_result,
 
 	/** Check if the port is not started **/
 	if (port->port_status != RTE_PORT_STOPPED) {
-		fprintf(stderr, "Please stop port %d first\n", port_id);
+		TESTPMD_LOG(ERR, "Please stop port %d first\n", port_id);
 		return;
 	}
 
 	if (!strcmp(res->mode, "enable")) {
 		if (rte_eth_bond_8023ad_dedicated_queues_enable(port_id) == 0)
-			printf("Dedicate queues for LACP control packets"
+			TESTPMD_LOG(INFO, "Dedicate queues for LACP control packets"
 					" enabled\n");
 		else
-			printf("Enabling dedicate queues for LACP control "
+			TESTPMD_LOG(ERR, "Enabling dedicate queues for LACP control "
 					"packets on port %d failed\n", port_id);
 	} else if (!strcmp(res->mode, "disable")) {
 		if (rte_eth_bond_8023ad_dedicated_queues_disable(port_id) == 0)
-			printf("Dedicated queues for LACP control packets "
+			TESTPMD_LOG(INFO, "Dedicated queues for LACP control packets "
 					"disabled\n");
 		else
-			printf("Disabling dedicated queues for LACP control "
+			TESTPMD_LOG(ERR, "Disabling dedicated queues for LACP control "
 					"traffic on port %d failed\n", port_id);
 	}
 }
@@ -178,14 +177,13 @@ static void cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result,
 	} else if (!strcmp(res->policy, "l34")) {
 		policy = BALANCE_XMIT_POLICY_LAYER34;
 	} else {
-		fprintf(stderr, "\t Invalid xmit policy selection");
+		TESTPMD_LOG(ERR, "\t Invalid xmit policy selection");
 		return;
 	}
 
 	/* Set the bonding mode for the relevant port. */
 	if (rte_eth_bond_xmit_policy_set(port_id, policy) != 0) {
-		fprintf(stderr,
-			"\t Failed to set bonding balance xmit policy for port = %d.\n",
+		TESTPMD_LOG(ERR, "\t Failed to set bonding balance xmit policy for port = %d.\n",
 			port_id);
 	}
 }
@@ -239,7 +237,7 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 
 	bonding_mode = rte_eth_bond_mode_get(port_id);
 	if (bonding_mode < 0) {
-		fprintf(stderr, "\tFailed to get bonding mode for port = %d\n",
+		TESTPMD_LOG(ERR, "\tFailed to get bonding mode for port = %d\n",
 			port_id);
 		return;
 	}
@@ -292,7 +290,7 @@ static void cmd_set_bonding_primary_parsed(void *parsed_result,
 
 	/* Set the primary member for a bonding device. */
 	if (rte_eth_bond_primary_set(main_port_id, member_port_id) != 0) {
-		fprintf(stderr, "\t Failed to set primary member for port = %d.\n",
+		TESTPMD_LOG(ERR, "\t Failed to set primary member for port = %d.\n",
 			main_port_id);
 		return;
 	}
@@ -348,8 +346,7 @@ static void cmd_add_bonding_member_parsed(void *parsed_result,
 
 	/* add the member for a bonding device. */
 	if (rte_eth_bond_member_add(main_port_id, member_port_id) != 0) {
-		fprintf(stderr,
-			"\t Failed to add member %d to main port = %d.\n",
+		TESTPMD_LOG(ERR, "\t Failed to add member %d to main port = %d.\n",
 			member_port_id, main_port_id);
 		return;
 	}
@@ -407,8 +404,7 @@ static void cmd_remove_bonding_member_parsed(void *parsed_result,
 
 	/* remove the member from a bonding device. */
 	if (rte_eth_bond_member_remove(main_port_id, member_port_id) != 0) {
-		fprintf(stderr,
-			"\t Failed to remove member %d from main port = %d.\n",
+		TESTPMD_LOG(ERR, "\t Failed to remove member %d from main port = %d.\n",
 			member_port_id, main_port_id);
 		return;
 	}
@@ -467,7 +463,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
 	int ret;
 
 	if (test_done == 0) {
-		fprintf(stderr, "Please stop forwarding first\n");
+		TESTPMD_LOG(ERR, "Please stop forwarding first\n");
 		return;
 	}
 
@@ -477,10 +473,10 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
 	/* Create a new bonding device. */
 	port_id = rte_eth_bond_create(ethdev_name, res->mode, res->socket);
 	if (port_id < 0) {
-		fprintf(stderr, "\t Failed to create bonding device.\n");
+		TESTPMD_LOG(ERR, "\t Failed to create bonding device.\n");
 		return;
 	}
-	printf("Created new bonding device %s on (port %d).\n", ethdev_name,
+	TESTPMD_LOG(INFO, "Created new bonding device %s on (port %d).\n", ethdev_name,
 		port_id);
 
 	/* Update number of ports */
@@ -488,7 +484,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
 	reconfig(port_id, res->socket);
 	ret = rte_eth_promiscuous_enable(port_id);
 	if (ret != 0)
-		fprintf(stderr, "Failed to enable promiscuous mode for port %u: %s - ignore\n",
+		TESTPMD_LOG(ERR, "Failed to enable promiscuous mode for port %u: %s - ignore\n",
 			port_id, rte_strerror(-ret));
 
 	ports[port_id].update_conf = 1;
@@ -550,7 +546,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
 
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
-		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
+		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
 			strerror(-ret));
 }
 
@@ -603,7 +599,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
 
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
-		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
+		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
 			strerror(-ret));
 }
 
-- 
2.39.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/2] net/bonding: add command to set dedicated queue size
  2024-06-24  2:03 [PATCH 0/2] add function to set dedicated queue size Chaoyong He
  2024-06-24  2:03 ` [PATCH 1/2] net/bonding: standard the log message Chaoyong He
@ 2024-06-24  2:03 ` Chaoyong He
  2024-10-10 18:13   ` Stephen Hemminger
  2024-10-11  3:24 ` [PATCH v2 0/2] add function " Chaoyong He
  2 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-06-24  2:03 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Peng Zhang, Chaoyong He

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

The testpmd application can not modify the value of
dedicated hardware Rx/Tx queue size, and hardcoded
them as (128/512). This will cause the bonding port
start fail if some NIC requires more Rx/Tx descriptors
than the hardcoded number.

Therefore, add a command into testpmd application to
support the modification of the size of the dedicated
hardware Rx/Tx queue. Also export an external interface
to also let other applications can change it.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 .../link_bonding_poll_mode_drv_lib.rst        |  8 ++
 doc/guides/rel_notes/release_24_07.rst        |  4 +
 drivers/net/bonding/bonding_testpmd.c         | 84 +++++++++++++++++++
 drivers/net/bonding/eth_bond_8023ad_private.h |  3 +
 drivers/net/bonding/rte_eth_bond_8023ad.c     | 39 +++++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h     | 23 +++++
 drivers/net/bonding/rte_eth_bond_pmd.c        |  6 +-
 drivers/net/bonding/version.map               |  1 +
 8 files changed, 166 insertions(+), 2 deletions(-)

diff --git a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
index 60717a3587..6498cf7d3d 100644
--- a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
+++ b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
@@ -637,3 +637,11 @@ in balance mode with a transmission policy of layer 2+3::
         Members (3): [1 3 4]
         Active Members (3): [1 3 4]
         Primary: [3]
+
+set bonding lacp dedicated_queue size
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set hardware dedicated queue size for LACP control traffic in
+mode 4 (link-aggregation-802.3ad)::
+
+   testpmd> set bonding lacp dedicated_queues <port_id> (rxq|txq) queue_size <size>
diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index e68a53d757..a17b5c4302 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -89,6 +89,10 @@ New Features
 
   * Added SSE/NEON vector datapath.
 
+* **Updated bonding driver.**
+
+  * Added new function ``rte_eth_bond_8023ad_dedicated_queue_size_set``
+    to set hardware dedicated Rx/Tx queue size in mode-4.
 
 Removed Items
 -------------
diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 45b636fea7..540f0d64aa 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -154,6 +154,85 @@ static cmdline_parse_inst_t cmd_set_lacp_dedicated_queues = {
 	}
 };
 
+/* *** SET BONDING SLOW_QUEUE HW QUEUE SIZE *** */
+struct cmd_set_bonding_hw_dedicated_queue_size_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t bonding;
+	cmdline_fixed_string_t lacp;
+	cmdline_fixed_string_t dedicated_queues;
+	portid_t port_id;
+	cmdline_fixed_string_t queue_type;
+	cmdline_fixed_string_t queue_size;
+	uint16_t size;
+};
+
+static void cmd_set_bonding_hw_dedicated_queue_size_parsed(void *parsed_result,
+	__rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+	int ret;
+	struct rte_port *port;
+	struct cmd_set_bonding_hw_dedicated_queue_size_result *res = parsed_result;
+
+	port = &ports[res->port_id];
+
+	/** Check if the port is not started **/
+	if (port->port_status != RTE_PORT_STOPPED) {
+		TESTPMD_LOG(ERR, "Please stop port %u first\n", res->port_id);
+		return;
+	}
+
+	ret = rte_eth_bond_8023ad_dedicated_queue_size_set(res->port_id,
+			res->size, res->queue_type);
+	if (ret != 0)
+		TESTPMD_LOG(ERR, "Failed to set port %u hardware dedicated %s "
+				"ring size %u\n",
+				res->port_id, res->queue_type, res->size);
+}
+
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_set =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		set, "set");
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_bonding =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		bonding, "bonding");
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_lacp =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		lacp, "lacp");
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_dedicated =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		dedicated_queues, "dedicated_queues");
+static cmdline_parse_token_num_t cmd_setbonding_hw_dedicated_queue_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_queue_type =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		queue_type, "rxq#txq");
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_queue_size =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		queue_size, "queue_size");
+static cmdline_parse_token_num_t cmd_setbonding_hw_dedicated_queue_size_size =
+	TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		size, RTE_UINT16);
+
+static cmdline_parse_inst_t cmd_set_lacp_dedicated_hw_queue_size = {
+	.f = cmd_set_bonding_hw_dedicated_queue_size_parsed,
+	.help_str = "set bonding lacp dedicated_queues <port_id> (rxq|txq) "
+		"queue_size <size>: "
+		"Set hardware dedicated queue size for LACP control traffic",
+	.data = NULL,
+	.tokens = {
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_set,
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_bonding,
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_lacp,
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_dedicated,
+		(void *)&cmd_setbonding_hw_dedicated_queue_port_id,
+		(void *)&cmd_setbonding_hw_dedicated_queue_queue_type,
+		(void *)&cmd_setbonding_hw_dedicated_queue_queue_size,
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_size,
+		NULL
+	}
+};
+
 /* *** SET BALANCE XMIT POLICY *** */
 struct cmd_set_bonding_balance_xmit_policy_result {
 	cmdline_fixed_string_t set;
@@ -745,6 +824,11 @@ static struct testpmd_driver_commands bonding_cmds = {
 		"set bonding mode IEEE802.3AD aggregator policy (port_id) (agg_name)\n"
 		"	Set Aggregation mode for IEEE802.3AD (mode 4)\n",
 	},
+	{
+		&cmd_set_lacp_dedicated_hw_queue_size,
+		"set bonding lacp dedicated_queues <port_id> (rxq|txq) queue_size <size>\n"
+		"	Set hardware dedicated queue size for LACP control traffic.\n",
+	},
 	{ NULL, NULL },
 	},
 };
diff --git a/drivers/net/bonding/eth_bond_8023ad_private.h b/drivers/net/bonding/eth_bond_8023ad_private.h
index ab7d15f81a..b0264e2275 100644
--- a/drivers/net/bonding/eth_bond_8023ad_private.h
+++ b/drivers/net/bonding/eth_bond_8023ad_private.h
@@ -176,6 +176,9 @@ struct mode8023ad_private {
 
 		uint16_t rx_qid;
 		uint16_t tx_qid;
+
+		uint16_t rx_queue_size;
+		uint16_t tx_queue_size;
 	} dedicated_queues;
 	enum rte_bond_8023ad_agg_selection agg_selection;
 };
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 06c21ebe6d..c19645aa4f 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1254,6 +1254,8 @@ bond_mode_8023ad_conf_assign(struct mode8023ad_private *mode4,
 	mode4->dedicated_queues.enabled = 0;
 	mode4->dedicated_queues.rx_qid = UINT16_MAX;
 	mode4->dedicated_queues.tx_qid = UINT16_MAX;
+	mode4->dedicated_queues.rx_queue_size = SLOW_RX_QUEUE_HW_DEFAULT_SIZE;
+	mode4->dedicated_queues.tx_queue_size = SLOW_TX_QUEUE_HW_DEFAULT_SIZE;
 }
 
 void
@@ -1753,3 +1755,40 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
 
 	return retval;
 }
+
+int
+rte_eth_bond_8023ad_dedicated_queue_size_set(uint16_t port,
+		uint16_t queue_size,
+		char *queue_type)
+{
+	struct rte_eth_dev *dev;
+	struct bond_dev_private *internals;
+
+	if (valid_bonding_port_id(port) != 0) {
+		RTE_BOND_LOG(ERR, "The bonding port id is invalid");
+		return -EINVAL;
+	}
+
+	dev = &rte_eth_devices[port];
+
+	/* Device must be stopped to set up slow queue */
+	if (dev->data->dev_started != 0) {
+		RTE_BOND_LOG(ERR, "Please stop the bonding port");
+		return -EINVAL;
+	}
+
+	internals = dev->data->dev_private;
+	if (internals->mode4.dedicated_queues.enabled == 0) {
+		RTE_BOND_LOG(ERR, "Please enable dedicated queue");
+		return -EINVAL;
+	}
+
+	if (strcmp(queue_type, "rxq") == 0)
+		internals->mode4.dedicated_queues.rx_queue_size = queue_size;
+	else if (strcmp(queue_type, "txq") == 0)
+		internals->mode4.dedicated_queues.tx_queue_size = queue_size;
+	else
+		return -EINVAL;
+
+	return 0;
+}
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index b2deb26e2e..0a36fbe3ed 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -35,6 +35,9 @@ extern "C" {
 #define MARKER_TLV_TYPE_INFO                0x01
 #define MARKER_TLV_TYPE_RESP                0x02
 
+#define SLOW_TX_QUEUE_HW_DEFAULT_SIZE       512
+#define SLOW_RX_QUEUE_HW_DEFAULT_SIZE       128
+
 typedef void (*rte_eth_bond_8023ad_ext_slowrx_fn)(uint16_t member_id,
 						  struct rte_mbuf *lacp_pkt);
 
@@ -309,6 +312,26 @@ rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port_id);
 int
 rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port_id);
 
+
+/**
+ * Set hardware slow queue ring size
+ *
+ * This function set bonding port hardware slow queue ring size.
+ * Bonding port must be stopped to change this configuration.
+ *
+ * @param port_id      Bonding device id
+ * @param queue_size   Slow queue ring size
+ * @param queue_type   Slow queue type, "rxq" or "txq"
+ *
+ * @return
+ *   0 on success, negative value otherwise.
+ *
+ */
+__rte_experimental
+int
+rte_eth_bond_8023ad_dedicated_queue_size_set(uint16_t port,
+		uint16_t queue_size,
+		char *queue_type);
 /*
  * Get aggregator mode for 8023ad
  * @param port_id Bonding device id
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c40d18d128..f53856ff60 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1688,7 +1688,8 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
 		/* Configure slow Rx queue */
 
 		errval = rte_eth_rx_queue_setup(member_eth_dev->data->port_id,
-				internals->mode4.dedicated_queues.rx_qid, 128,
+				internals->mode4.dedicated_queues.rx_qid,
+				internals->mode4.dedicated_queues.rx_queue_size,
 				rte_eth_dev_socket_id(member_eth_dev->data->port_id),
 				NULL, port->slow_pool);
 		if (errval != 0) {
@@ -1701,7 +1702,8 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
 		}
 
 		errval = rte_eth_tx_queue_setup(member_eth_dev->data->port_id,
-				internals->mode4.dedicated_queues.tx_qid, 512,
+				internals->mode4.dedicated_queues.tx_qid,
+				internals->mode4.dedicated_queues.tx_queue_size,
 				rte_eth_dev_socket_id(member_eth_dev->data->port_id),
 				NULL);
 		if (errval != 0) {
diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map
index 09ee21c55f..6626691f0e 100644
--- a/drivers/net/bonding/version.map
+++ b/drivers/net/bonding/version.map
@@ -30,6 +30,7 @@ DPDK_24 {
 EXPERIMENTAL {
 	# added in 23.11
 	global:
+	rte_eth_bond_8023ad_dedicated_queue_size_set;
 	rte_eth_bond_8023ad_member_info;
 	rte_eth_bond_active_members_get;
 	rte_eth_bond_member_add;
-- 
2.39.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/2] net/bonding: standard the log message
  2024-06-24  2:03 ` [PATCH 1/2] net/bonding: standard the log message Chaoyong He
@ 2024-10-10 18:10   ` Stephen Hemminger
  2024-10-11  3:02     ` Chaoyong He
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-10 18:10 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, Long Wu, Peng Zhang

On Mon, 24 Jun 2024 10:03:54 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> From: Long Wu <long.wu@corigine.com>
> 
> According to the check rules in the patch check script,
> drivers and libraries must use the logging framework.
> 
> So standard the log message of bonding driver by using
> the logging framework.
> 
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> ---
>  drivers/net/bonding/bonding_testpmd.c | 42 ++++++++++++---------------
>  1 file changed, 19 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
> index 8fcd6cadd0..45b636fea7 100644
> --- a/drivers/net/bonding/bonding_testpmd.c
> +++ b/drivers/net/bonding/bonding_testpmd.c
> @@ -34,15 +34,14 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result,
>  	 * of device changed.
>  	 */
>  	if (port->port_status != RTE_PORT_STOPPED) {
> -		fprintf(stderr,
> -			"\t Error: Can't set bonding mode when port %d is not stopped\n",
> +		TESTPMD_LOG(ERR, "\t Error: Can't set bonding mode when port %d is not stopped\n",
>  			port_id);

Since the message may now be directed to syslog etc, avoid putting tab characters in.
Please remove the '\t ' from the message. 

>  		return;
>  	}
>  
>  	/* Set the bonding mode for the relevant port. */
>  	if (rte_eth_bond_mode_set(port_id, res->value) != 0)
> -		fprintf(stderr, "\t Failed to set bonding mode for port = %d.\n",
> +		TESTPMD_LOG(ERR, "\t Failed to set bonding mode for port = %d.\n",
>  			port_id);
>  }
>  
> @@ -98,23 +97,23 @@ static void cmd_set_bonding_lacp_dedicated_queues_parsed(void *parsed_result,
>  
>  	/** Check if the port is not started **/
>  	if (port->port_status != RTE_PORT_STOPPED) {
> -		fprintf(stderr, "Please stop port %d first\n", port_id);
> +		TESTPMD_LOG(ERR, "Please stop port %d first\n", port_id);
>  		return;
>  	}
>  
>  	if (!strcmp(res->mode, "enable")) {
>  		if (rte_eth_bond_8023ad_dedicated_queues_enable(port_id) == 0)
> -			printf("Dedicate queues for LACP control packets"
> +			TESTPMD_LOG(INFO, "Dedicate queues for LACP control packets"
>  					" enabled\n");

Don't split messages across source lines, should be able to fit this in 100 characters
or break line after INFO,

>  		else
> -			printf("Enabling dedicate queues for LACP control "
> +			TESTPMD_LOG(ERR, "Enabling dedicate queues for LACP control "
>  					"packets on port %d failed\n", port_id);
>  	} else if (!strcmp(res->mode, "disable")) {
>  		if (rte_eth_bond_8023ad_dedicated_queues_disable(port_id) == 0)
> -			printf("Dedicated queues for LACP control packets "
> +			TESTPMD_LOG(INFO, "Dedicated queues for LACP control packets "
>  					"disabled\n");
>  		else
> -			printf("Disabling dedicated queues for LACP control "
> +			TESTPMD_LOG(ERR, "Disabling dedicated queues for LACP control "
>  					"traffic on port %d failed\n", port_id);
>  	}
>  }
> @@ -178,14 +177,13 @@ static void cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result,
>  	} else if (!strcmp(res->policy, "l34")) {
>  		policy = BALANCE_XMIT_POLICY_LAYER34;
>  	} else {
> -		fprintf(stderr, "\t Invalid xmit policy selection");
> +		TESTPMD_LOG(ERR, "\t Invalid xmit policy selection");
>  		return;
>  	}
>  
>  	/* Set the bonding mode for the relevant port. */
>  	if (rte_eth_bond_xmit_policy_set(port_id, policy) != 0) {
> -		fprintf(stderr,
> -			"\t Failed to set bonding balance xmit policy for port = %d.\n",
> +		TESTPMD_LOG(ERR, "\t Failed to set bonding balance xmit policy for port = %d.\n",
>  			port_id);
>  	}
>  }
> @@ -239,7 +237,7 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
>  
>  	bonding_mode = rte_eth_bond_mode_get(port_id);
>  	if (bonding_mode < 0) {
> -		fprintf(stderr, "\tFailed to get bonding mode for port = %d\n",
> +		TESTPMD_LOG(ERR, "\tFailed to get bonding mode for port = %d\n",
>  			port_id);
>  		return;
>  	}
> @@ -292,7 +290,7 @@ static void cmd_set_bonding_primary_parsed(void *parsed_result,
>  
>  	/* Set the primary member for a bonding device. */
>  	if (rte_eth_bond_primary_set(main_port_id, member_port_id) != 0) {
> -		fprintf(stderr, "\t Failed to set primary member for port = %d.\n",
> +		TESTPMD_LOG(ERR, "\t Failed to set primary member for port = %d.\n",
>  			main_port_id);
>  		return;
>  	}
> @@ -348,8 +346,7 @@ static void cmd_add_bonding_member_parsed(void *parsed_result,
>  
>  	/* add the member for a bonding device. */
>  	if (rte_eth_bond_member_add(main_port_id, member_port_id) != 0) {
> -		fprintf(stderr,
> -			"\t Failed to add member %d to main port = %d.\n",
> +		TESTPMD_LOG(ERR, "\t Failed to add member %d to main port = %d.\n",
>  			member_port_id, main_port_id);
>  		return;
>  	}
> @@ -407,8 +404,7 @@ static void cmd_remove_bonding_member_parsed(void *parsed_result,
>  
>  	/* remove the member from a bonding device. */
>  	if (rte_eth_bond_member_remove(main_port_id, member_port_id) != 0) {
> -		fprintf(stderr,
> -			"\t Failed to remove member %d from main port = %d.\n",
> +		TESTPMD_LOG(ERR, "\t Failed to remove member %d from main port = %d.\n",
>  			member_port_id, main_port_id);
>  		return;
>  	}
> @@ -467,7 +463,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
>  	int ret;
>  
>  	if (test_done == 0) {
> -		fprintf(stderr, "Please stop forwarding first\n");
> +		TESTPMD_LOG(ERR, "Please stop forwarding first\n");
>  		return;
>  	}
>  
> @@ -477,10 +473,10 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
>  	/* Create a new bonding device. */
>  	port_id = rte_eth_bond_create(ethdev_name, res->mode, res->socket);
>  	if (port_id < 0) {
> -		fprintf(stderr, "\t Failed to create bonding device.\n");
> +		TESTPMD_LOG(ERR, "\t Failed to create bonding device.\n");
>  		return;
>  	}
> -	printf("Created new bonding device %s on (port %d).\n", ethdev_name,
> +	TESTPMD_LOG(INFO, "Created new bonding device %s on (port %d).\n", ethdev_name,
>  		port_id);
>  
>  	/* Update number of ports */
> @@ -488,7 +484,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
>  	reconfig(port_id, res->socket);
>  	ret = rte_eth_promiscuous_enable(port_id);
>  	if (ret != 0)
> -		fprintf(stderr, "Failed to enable promiscuous mode for port %u: %s - ignore\n",
> +		TESTPMD_LOG(ERR, "Failed to enable promiscuous mode for port %u: %s - ignore\n",
>  			port_id, rte_strerror(-ret));

This could be NOTICE level since it keeps going.

>  
>  	ports[port_id].update_conf = 1;
> @@ -550,7 +546,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
>  
>  	/* check the return value and print it if is < 0 */
>  	if (ret < 0)
> -		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
> +		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
>  			strerror(-ret));
>  }
>  
> @@ -603,7 +599,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
>  
>  	/* check the return value and print it if is < 0 */
>  	if (ret < 0)
> -		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
> +		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
>  			strerror(-ret));
>  }
>  


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/2] net/bonding: add command to set dedicated queue size
  2024-06-24  2:03 ` [PATCH 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
@ 2024-10-10 18:13   ` Stephen Hemminger
  2024-10-11  3:00     ` Chaoyong He
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-10 18:13 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, Long Wu, Peng Zhang

On Mon, 24 Jun 2024 10:03:55 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
> index 06c21ebe6d..c19645aa4f 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> @@ -1254,6 +1254,8 @@ bond_mode_8023ad_conf_assign(struct mode8023ad_private *mode4,
>  	mode4->dedicated_queues.enabled = 0;
>  	mode4->dedicated_queues.rx_qid = UINT16_MAX;
>  	mode4->dedicated_queues.tx_qid = UINT16_MAX;
> +	mode4->dedicated_queues.rx_queue_size = SLOW_RX_QUEUE_HW_DEFAULT_SIZE;
> +	mode4->dedicated_queues.tx_queue_size = SLOW_TX_QUEUE_HW_DEFAULT_SIZE;
>  }
>  
>  void
> @@ -1753,3 +1755,40 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
>  
>  	return retval;
>  }
> +
> +int
> +rte_eth_bond_8023ad_dedicated_queue_size_set(uint16_t port,
> +		uint16_t queue_size,
> +		char *queue_type)

Should be const char * for queue type

> +{
> +	struct rte_eth_dev *dev;
> +	struct bond_dev_private *internals;
> +
> +	if (valid_bonding_port_id(port) != 0) {
> +		RTE_BOND_LOG(ERR, "The bonding port id is invalid");
> +		return -EINVAL;
> +	}
> +
> +	dev = &rte_eth_devices[port];
> +
> +	/* Device must be stopped to set up slow queue */
> +	if (dev->data->dev_started != 0) {
> +		RTE_BOND_LOG(ERR, "Please stop the bonding port");
> +		return -EINVAL;
> +	}
> +
> +	internals = dev->data->dev_private;
> +	if (internals->mode4.dedicated_queues.enabled == 0) {
> +		RTE_BOND_LOG(ERR, "Please enable dedicated queue");
> +		return -EINVAL;
> +	}
> +
> +	if (strcmp(queue_type, "rxq") == 0)
> +		internals->mode4.dedicated_queues.rx_queue_size = queue_size;
> +	else if (strcmp(queue_type, "txq") == 0)
> +		internals->mode4.dedicated_queues.tx_queue_size = queue_size;
> +	else
> +		return -EINVAL;

Add error message like:
		RTE_BOND_LOG(ERR, "Unknown queue type %s", queue_type);

> +
> +	return 0;
> +}

^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH 2/2] net/bonding: add command to set dedicated queue size
  2024-10-10 18:13   ` Stephen Hemminger
@ 2024-10-11  3:00     ` Chaoyong He
  0 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-11  3:00 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, oss-drivers, Long Wu, Nole Zhang

> On Mon, 24 Jun 2024 10:03:55 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c
> b/drivers/net/bonding/rte_eth_bond_8023ad.c
> > index 06c21ebe6d..c19645aa4f 100644
> > --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> > +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> > @@ -1254,6 +1254,8 @@ bond_mode_8023ad_conf_assign(struct
> mode8023ad_private *mode4,
> >  	mode4->dedicated_queues.enabled = 0;
> >  	mode4->dedicated_queues.rx_qid = UINT16_MAX;
> >  	mode4->dedicated_queues.tx_qid = UINT16_MAX;
> > +	mode4->dedicated_queues.rx_queue_size =
> SLOW_RX_QUEUE_HW_DEFAULT_SIZE;
> > +	mode4->dedicated_queues.tx_queue_size =
> SLOW_TX_QUEUE_HW_DEFAULT_SIZE;
> >  }
> >
> >  void
> > @@ -1753,3 +1755,40 @@
> rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
> >
> >  	return retval;
> >  }
> > +
> > +int
> > +rte_eth_bond_8023ad_dedicated_queue_size_set(uint16_t port,
> > +		uint16_t queue_size,
> > +		char *queue_type)
> 
> Should be const char * for queue type
> 
> > +{
> > +	struct rte_eth_dev *dev;
> > +	struct bond_dev_private *internals;
> > +
> > +	if (valid_bonding_port_id(port) != 0) {
> > +		RTE_BOND_LOG(ERR, "The bonding port id is invalid");
> > +		return -EINVAL;
> > +	}
> > +
> > +	dev = &rte_eth_devices[port];
> > +
> > +	/* Device must be stopped to set up slow queue */
> > +	if (dev->data->dev_started != 0) {
> > +		RTE_BOND_LOG(ERR, "Please stop the bonding port");
> > +		return -EINVAL;
> > +	}
> > +
> > +	internals = dev->data->dev_private;
> > +	if (internals->mode4.dedicated_queues.enabled == 0) {
> > +		RTE_BOND_LOG(ERR, "Please enable dedicated queue");
> > +		return -EINVAL;
> > +	}
> > +
> > +	if (strcmp(queue_type, "rxq") == 0)
> > +		internals->mode4.dedicated_queues.rx_queue_size =
> queue_size;
> > +	else if (strcmp(queue_type, "txq") == 0)
> > +		internals->mode4.dedicated_queues.tx_queue_size =
> queue_size;
> > +	else
> > +		return -EINVAL;
> 
> Add error message like:
> 		RTE_BOND_LOG(ERR, "Unknown queue type %s",
> queue_type);

Okay, will add in next version patch.

> 
> > +
> > +	return 0;
> > +}

^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH 1/2] net/bonding: standard the log message
  2024-10-10 18:10   ` Stephen Hemminger
@ 2024-10-11  3:02     ` Chaoyong He
  0 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-11  3:02 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, oss-drivers, Long Wu, Nole Zhang

> On Mon, 24 Jun 2024 10:03:54 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > From: Long Wu <long.wu@corigine.com>
> >
> > According to the check rules in the patch check script, drivers and
> > libraries must use the logging framework.
> >
> > So standard the log message of bonding driver by using the logging
> > framework.
> >
> > Signed-off-by: Long Wu <long.wu@corigine.com>
> > Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> > Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> > ---
> >  drivers/net/bonding/bonding_testpmd.c | 42
> > ++++++++++++---------------
> >  1 file changed, 19 insertions(+), 23 deletions(-)
> >
> > diff --git a/drivers/net/bonding/bonding_testpmd.c
> > b/drivers/net/bonding/bonding_testpmd.c
> > index 8fcd6cadd0..45b636fea7 100644
> > --- a/drivers/net/bonding/bonding_testpmd.c
> > +++ b/drivers/net/bonding/bonding_testpmd.c
> > @@ -34,15 +34,14 @@ static void cmd_set_bonding_mode_parsed(void
> *parsed_result,
> >  	 * of device changed.
> >  	 */
> >  	if (port->port_status != RTE_PORT_STOPPED) {
> > -		fprintf(stderr,
> > -			"\t Error: Can't set bonding mode when port %d is not
> stopped\n",
> > +		TESTPMD_LOG(ERR, "\t Error: Can't set bonding mode when
> port %d is
> > +not stopped\n",
> >  			port_id);
> 
> Since the message may now be directed to syslog etc, avoid putting tab
> characters in.
> Please remove the '\t ' from the message.

Okay, will do in next version patch.

> 
> >  		return;
> >  	}
> >
> >  	/* Set the bonding mode for the relevant port. */
> >  	if (rte_eth_bond_mode_set(port_id, res->value) != 0)
> > -		fprintf(stderr, "\t Failed to set bonding mode for port
> = %d.\n",
> > +		TESTPMD_LOG(ERR, "\t Failed to set bonding mode for port
> = %d.\n",
> >  			port_id);
> >  }
> >
> > @@ -98,23 +97,23 @@ static void
> > cmd_set_bonding_lacp_dedicated_queues_parsed(void *parsed_result,
> >
> >  	/** Check if the port is not started **/
> >  	if (port->port_status != RTE_PORT_STOPPED) {
> > -		fprintf(stderr, "Please stop port %d first\n", port_id);
> > +		TESTPMD_LOG(ERR, "Please stop port %d first\n", port_id);
> >  		return;
> >  	}
> >
> >  	if (!strcmp(res->mode, "enable")) {
> >  		if (rte_eth_bond_8023ad_dedicated_queues_enable(port_id)
> == 0)
> > -			printf("Dedicate queues for LACP control packets"
> > +			TESTPMD_LOG(INFO, "Dedicate queues for LACP
> control packets"
> >  					" enabled\n");
> 
> Don't split messages across source lines, should be able to fit this in 100
> characters or break line after INFO,
>

Okay, will do in next version patch.
 
> >  		else
> > -			printf("Enabling dedicate queues for LACP control "
> > +			TESTPMD_LOG(ERR, "Enabling dedicate queues for
> LACP control "
> >  					"packets on port %d failed\n",
> port_id);
> >  	} else if (!strcmp(res->mode, "disable")) {
> >  		if (rte_eth_bond_8023ad_dedicated_queues_disable(port_id)
> == 0)
> > -			printf("Dedicated queues for LACP control packets "
> > +			TESTPMD_LOG(INFO, "Dedicated queues for LACP
> control packets "
> >  					"disabled\n");
> >  		else
> > -			printf("Disabling dedicated queues for LACP control "
> > +			TESTPMD_LOG(ERR, "Disabling dedicated queues for
> LACP control "
> >  					"traffic on port %d failed\n", port_id);
> >  	}
> >  }
> > @@ -178,14 +177,13 @@ static void
> cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result,
> >  	} else if (!strcmp(res->policy, "l34")) {
> >  		policy = BALANCE_XMIT_POLICY_LAYER34;
> >  	} else {
> > -		fprintf(stderr, "\t Invalid xmit policy selection");
> > +		TESTPMD_LOG(ERR, "\t Invalid xmit policy selection");
> >  		return;
> >  	}
> >
> >  	/* Set the bonding mode for the relevant port. */
> >  	if (rte_eth_bond_xmit_policy_set(port_id, policy) != 0) {
> > -		fprintf(stderr,
> > -			"\t Failed to set bonding balance xmit policy for port
> = %d.\n",
> > +		TESTPMD_LOG(ERR, "\t Failed to set bonding balance xmit
> policy for
> > +port = %d.\n",
> >  			port_id);
> >  	}
> >  }
> > @@ -239,7 +237,7 @@ static void cmd_show_bonding_config_parsed(void
> > *parsed_result,
> >
> >  	bonding_mode = rte_eth_bond_mode_get(port_id);
> >  	if (bonding_mode < 0) {
> > -		fprintf(stderr, "\tFailed to get bonding mode for port = %d\n",
> > +		TESTPMD_LOG(ERR, "\tFailed to get bonding mode for port
> = %d\n",
> >  			port_id);
> >  		return;
> >  	}
> > @@ -292,7 +290,7 @@ static void cmd_set_bonding_primary_parsed(void
> > *parsed_result,
> >
> >  	/* Set the primary member for a bonding device. */
> >  	if (rte_eth_bond_primary_set(main_port_id, member_port_id) != 0) {
> > -		fprintf(stderr, "\t Failed to set primary member for port
> = %d.\n",
> > +		TESTPMD_LOG(ERR, "\t Failed to set primary member for port
> =
> > +%d.\n",
> >  			main_port_id);
> >  		return;
> >  	}
> > @@ -348,8 +346,7 @@ static void
> cmd_add_bonding_member_parsed(void
> > *parsed_result,
> >
> >  	/* add the member for a bonding device. */
> >  	if (rte_eth_bond_member_add(main_port_id, member_port_id) != 0)
> {
> > -		fprintf(stderr,
> > -			"\t Failed to add member %d to main port = %d.\n",
> > +		TESTPMD_LOG(ERR, "\t Failed to add member %d to main
> port = %d.\n",
> >  			member_port_id, main_port_id);
> >  		return;
> >  	}
> > @@ -407,8 +404,7 @@ static void
> cmd_remove_bonding_member_parsed(void
> > *parsed_result,
> >
> >  	/* remove the member from a bonding device. */
> >  	if (rte_eth_bond_member_remove(main_port_id,
> member_port_id) != 0) {
> > -		fprintf(stderr,
> > -			"\t Failed to remove member %d from main port
> = %d.\n",
> > +		TESTPMD_LOG(ERR, "\t Failed to remove member %d from
> main port =
> > +%d.\n",
> >  			member_port_id, main_port_id);
> >  		return;
> >  	}
> > @@ -467,7 +463,7 @@ static void
> cmd_create_bonding_device_parsed(void *parsed_result,
> >  	int ret;
> >
> >  	if (test_done == 0) {
> > -		fprintf(stderr, "Please stop forwarding first\n");
> > +		TESTPMD_LOG(ERR, "Please stop forwarding first\n");
> >  		return;
> >  	}
> >
> > @@ -477,10 +473,10 @@ static void
> cmd_create_bonding_device_parsed(void *parsed_result,
> >  	/* Create a new bonding device. */
> >  	port_id = rte_eth_bond_create(ethdev_name, res->mode, res-
> >socket);
> >  	if (port_id < 0) {
> > -		fprintf(stderr, "\t Failed to create bonding device.\n");
> > +		TESTPMD_LOG(ERR, "\t Failed to create bonding device.\n");
> >  		return;
> >  	}
> > -	printf("Created new bonding device %s on (port %d).\n",
> ethdev_name,
> > +	TESTPMD_LOG(INFO, "Created new bonding device %s on
> (port %d).\n",
> > +ethdev_name,
> >  		port_id);
> >
> >  	/* Update number of ports */
> > @@ -488,7 +484,7 @@ static void
> cmd_create_bonding_device_parsed(void *parsed_result,
> >  	reconfig(port_id, res->socket);
> >  	ret = rte_eth_promiscuous_enable(port_id);
> >  	if (ret != 0)
> > -		fprintf(stderr, "Failed to enable promiscuous mode for
> port %u: %s - ignore\n",
> > +		TESTPMD_LOG(ERR, "Failed to enable promiscuous mode for
> port %u: %s
> > +- ignore\n",
> >  			port_id, rte_strerror(-ret));
> 
> This could be NOTICE level since it keeps going.

Okay, will do in next version patch.

> 
> >
> >  	ports[port_id].update_conf = 1;
> > @@ -550,7 +546,7 @@ static void cmd_set_bond_mac_addr_parsed(void
> > *parsed_result,
> >
> >  	/* check the return value and print it if is < 0 */
> >  	if (ret < 0)
> > -		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
> > +		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
> >  			strerror(-ret));
> >  }
> >
> > @@ -603,7 +599,7 @@ static void
> cmd_set_bond_mon_period_parsed(void
> > *parsed_result,
> >
> >  	/* check the return value and print it if is < 0 */
> >  	if (ret < 0)
> > -		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
> > +		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
> >  			strerror(-ret));
> >  }
> >


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 0/2] add function to set dedicated queue size
  2024-06-24  2:03 [PATCH 0/2] add function to set dedicated queue size Chaoyong He
  2024-06-24  2:03 ` [PATCH 1/2] net/bonding: standard the log message Chaoyong He
  2024-06-24  2:03 ` [PATCH 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
@ 2024-10-11  3:24 ` Chaoyong He
  2024-10-11  3:24   ` [PATCH v2 1/2] net/bonding: standard the log message Chaoyong He
  2024-10-11  3:24   ` [PATCH v2 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
  2 siblings, 2 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-11  3:24 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

This patch series mainly add a function to bonding PMD to set
dedicated queue size, also add a command to testpmd application
to invoke this function.

At the same time, standard the log message of bonding PMD.

---
v2:
* Adjust some logs following the request of reviewer.
---

Long Wu (2):
  net/bonding: standard the log message
  net/bonding: add command to set dedicated queue size

 .../link_bonding_poll_mode_drv_lib.rst        |   8 ++
 doc/guides/rel_notes/release_24_11.rst        |   4 +
 drivers/net/bonding/bonding_testpmd.c         | 136 ++++++++++++++----
 drivers/net/bonding/eth_bond_8023ad_private.h |   3 +
 drivers/net/bonding/rte_eth_bond_8023ad.c     |  41 ++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h     |  23 +++
 drivers/net/bonding/rte_eth_bond_pmd.c        |   6 +-
 drivers/net/bonding/version.map               |   1 +
 8 files changed, 193 insertions(+), 29 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 1/2] net/bonding: standard the log message
  2024-10-11  3:24 ` [PATCH v2 0/2] add function " Chaoyong He
@ 2024-10-11  3:24   ` Chaoyong He
  2024-10-11  5:10     ` Stephen Hemminger
  2024-10-29  1:51     ` lihuisong (C)
  2024-10-11  3:24   ` [PATCH v2 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
  1 sibling, 2 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-11  3:24 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Peng Zhang, Chaoyong He

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

According to the check rules in the patch check script,
drivers and libraries must use the logging framework.

So standard the log message of bonding driver by using
the logging framework.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/bonding/bonding_testpmd.c | 52 +++++++++++++--------------
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 8fcd6cadd0..fc0bfd8f74 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -34,15 +34,14 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result,
 	 * of device changed.
 	 */
 	if (port->port_status != RTE_PORT_STOPPED) {
-		fprintf(stderr,
-			"\t Error: Can't set bonding mode when port %d is not stopped\n",
+		TESTPMD_LOG(ERR, "Error: Can't set bonding mode when port %d is not stopped\n",
 			port_id);
 		return;
 	}
 
 	/* Set the bonding mode for the relevant port. */
 	if (rte_eth_bond_mode_set(port_id, res->value) != 0)
-		fprintf(stderr, "\t Failed to set bonding mode for port = %d.\n",
+		TESTPMD_LOG(ERR, "Failed to set bonding mode for port = %d.\n",
 			port_id);
 }
 
@@ -98,24 +97,26 @@ static void cmd_set_bonding_lacp_dedicated_queues_parsed(void *parsed_result,
 
 	/** Check if the port is not started **/
 	if (port->port_status != RTE_PORT_STOPPED) {
-		fprintf(stderr, "Please stop port %d first\n", port_id);
+		TESTPMD_LOG(ERR, "Please stop port %d first\n", port_id);
 		return;
 	}
 
 	if (!strcmp(res->mode, "enable")) {
 		if (rte_eth_bond_8023ad_dedicated_queues_enable(port_id) == 0)
-			printf("Dedicate queues for LACP control packets"
-					" enabled\n");
+			TESTPMD_LOG(INFO,
+				"Dedicate queues for LACP control packets enabled\n");
 		else
-			printf("Enabling dedicate queues for LACP control "
-					"packets on port %d failed\n", port_id);
+			TESTPMD_LOG(ERR,
+				"Enabling dedicate queues for LACP control "
+				"packets on port %d failed\n", port_id);
 	} else if (!strcmp(res->mode, "disable")) {
 		if (rte_eth_bond_8023ad_dedicated_queues_disable(port_id) == 0)
-			printf("Dedicated queues for LACP control packets "
-					"disabled\n");
+			TESTPMD_LOG(INFO,
+				"Dedicated queues for LACP control packets disabled\n");
 		else
-			printf("Disabling dedicated queues for LACP control "
-					"traffic on port %d failed\n", port_id);
+			TESTPMD_LOG(ERR,
+				"Disabling dedicated queues for LACP control "
+				"traffic on port %d failed\n", port_id);
 	}
 }
 
@@ -178,14 +179,13 @@ static void cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result,
 	} else if (!strcmp(res->policy, "l34")) {
 		policy = BALANCE_XMIT_POLICY_LAYER34;
 	} else {
-		fprintf(stderr, "\t Invalid xmit policy selection");
+		TESTPMD_LOG(ERR, "Invalid xmit policy selection\n");
 		return;
 	}
 
 	/* Set the bonding mode for the relevant port. */
 	if (rte_eth_bond_xmit_policy_set(port_id, policy) != 0) {
-		fprintf(stderr,
-			"\t Failed to set bonding balance xmit policy for port = %d.\n",
+		TESTPMD_LOG(ERR, "Failed to set bonding balance xmit policy for port = %d.\n",
 			port_id);
 	}
 }
@@ -239,7 +239,7 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 
 	bonding_mode = rte_eth_bond_mode_get(port_id);
 	if (bonding_mode < 0) {
-		fprintf(stderr, "\tFailed to get bonding mode for port = %d\n",
+		TESTPMD_LOG(ERR, "Failed to get bonding mode for port = %d\n",
 			port_id);
 		return;
 	}
@@ -292,7 +292,7 @@ static void cmd_set_bonding_primary_parsed(void *parsed_result,
 
 	/* Set the primary member for a bonding device. */
 	if (rte_eth_bond_primary_set(main_port_id, member_port_id) != 0) {
-		fprintf(stderr, "\t Failed to set primary member for port = %d.\n",
+		TESTPMD_LOG(ERR, "Failed to set primary member for port = %d.\n",
 			main_port_id);
 		return;
 	}
@@ -348,8 +348,7 @@ static void cmd_add_bonding_member_parsed(void *parsed_result,
 
 	/* add the member for a bonding device. */
 	if (rte_eth_bond_member_add(main_port_id, member_port_id) != 0) {
-		fprintf(stderr,
-			"\t Failed to add member %d to main port = %d.\n",
+		TESTPMD_LOG(ERR, "Failed to add member %d to main port = %d.\n",
 			member_port_id, main_port_id);
 		return;
 	}
@@ -407,8 +406,7 @@ static void cmd_remove_bonding_member_parsed(void *parsed_result,
 
 	/* remove the member from a bonding device. */
 	if (rte_eth_bond_member_remove(main_port_id, member_port_id) != 0) {
-		fprintf(stderr,
-			"\t Failed to remove member %d from main port = %d.\n",
+		TESTPMD_LOG(ERR, "Failed to remove member %d from main port = %d.\n",
 			member_port_id, main_port_id);
 		return;
 	}
@@ -467,7 +465,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
 	int ret;
 
 	if (test_done == 0) {
-		fprintf(stderr, "Please stop forwarding first\n");
+		TESTPMD_LOG(ERR, "Please stop forwarding first\n");
 		return;
 	}
 
@@ -477,10 +475,10 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
 	/* Create a new bonding device. */
 	port_id = rte_eth_bond_create(ethdev_name, res->mode, res->socket);
 	if (port_id < 0) {
-		fprintf(stderr, "\t Failed to create bonding device.\n");
+		TESTPMD_LOG(ERR, "Failed to create bonding device.\n");
 		return;
 	}
-	printf("Created new bonding device %s on (port %d).\n", ethdev_name,
+	TESTPMD_LOG(INFO, "Created new bonding device %s on (port %d).\n", ethdev_name,
 		port_id);
 
 	/* Update number of ports */
@@ -488,7 +486,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
 	reconfig(port_id, res->socket);
 	ret = rte_eth_promiscuous_enable(port_id);
 	if (ret != 0)
-		fprintf(stderr, "Failed to enable promiscuous mode for port %u: %s - ignore\n",
+		TESTPMD_LOG(NOTICE, "Failed to enable promiscuous mode for port %u: %s - ignore\n",
 			port_id, rte_strerror(-ret));
 
 	ports[port_id].update_conf = 1;
@@ -550,7 +548,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
 
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
-		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
+		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
 			strerror(-ret));
 }
 
@@ -603,7 +601,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
 
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
-		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
+		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
 			strerror(-ret));
 }
 
-- 
2.39.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 2/2] net/bonding: add command to set dedicated queue size
  2024-10-11  3:24 ` [PATCH v2 0/2] add function " Chaoyong He
  2024-10-11  3:24   ` [PATCH v2 1/2] net/bonding: standard the log message Chaoyong He
@ 2024-10-11  3:24   ` Chaoyong He
  2024-10-17 16:05     ` Thomas Monjalon
                       ` (3 more replies)
  1 sibling, 4 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-11  3:24 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Peng Zhang, Chaoyong He

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

The testpmd application can not modify the value of
dedicated hardware Rx/Tx queue size, and hardcoded
them as (128/512). This will cause the bonding port
start fail if some NIC requires more Rx/Tx descriptors
than the hardcoded number.

Therefore, add a command into testpmd application to
support the modification of the size of the dedicated
hardware Rx/Tx queue. Also export an external interface
to also let other applications can change it.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 .../link_bonding_poll_mode_drv_lib.rst        |  8 ++
 doc/guides/rel_notes/release_24_11.rst        |  4 +
 drivers/net/bonding/bonding_testpmd.c         | 84 +++++++++++++++++++
 drivers/net/bonding/eth_bond_8023ad_private.h |  3 +
 drivers/net/bonding/rte_eth_bond_8023ad.c     | 41 +++++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h     | 23 +++++
 drivers/net/bonding/rte_eth_bond_pmd.c        |  6 +-
 drivers/net/bonding/version.map               |  1 +
 8 files changed, 168 insertions(+), 2 deletions(-)

diff --git a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
index 60717a3587..6498cf7d3d 100644
--- a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
+++ b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
@@ -637,3 +637,11 @@ in balance mode with a transmission policy of layer 2+3::
         Members (3): [1 3 4]
         Active Members (3): [1 3 4]
         Primary: [3]
+
+set bonding lacp dedicated_queue size
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set hardware dedicated queue size for LACP control traffic in
+mode 4 (link-aggregation-802.3ad)::
+
+   testpmd> set bonding lacp dedicated_queues <port_id> (rxq|txq) queue_size <size>
diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst
index 9bfc719e02..bec466f58d 100644
--- a/doc/guides/rel_notes/release_24_11.rst
+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -98,6 +98,10 @@ New Features
   * Added SR-IOV VF support.
   * Added recent 1400/14000 and 15000 models to the supported list.
 
+* **Updated bonding driver.**
+
+  * Added new function ``rte_eth_bond_8023ad_dedicated_queue_size_set``
+    to set hardware dedicated Rx/Tx queue size in mode-4.
 
 Removed Items
 -------------
diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index fc0bfd8f74..ce0e47d8ea 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -156,6 +156,85 @@ static cmdline_parse_inst_t cmd_set_lacp_dedicated_queues = {
 	}
 };
 
+/* *** SET BONDING SLOW_QUEUE HW QUEUE SIZE *** */
+struct cmd_set_bonding_hw_dedicated_queue_size_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t bonding;
+	cmdline_fixed_string_t lacp;
+	cmdline_fixed_string_t dedicated_queues;
+	portid_t port_id;
+	cmdline_fixed_string_t queue_type;
+	cmdline_fixed_string_t queue_size;
+	uint16_t size;
+};
+
+static void cmd_set_bonding_hw_dedicated_queue_size_parsed(void *parsed_result,
+	__rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+	int ret;
+	struct rte_port *port;
+	struct cmd_set_bonding_hw_dedicated_queue_size_result *res = parsed_result;
+
+	port = &ports[res->port_id];
+
+	/** Check if the port is not started **/
+	if (port->port_status != RTE_PORT_STOPPED) {
+		TESTPMD_LOG(ERR, "Please stop port %u first\n", res->port_id);
+		return;
+	}
+
+	ret = rte_eth_bond_8023ad_dedicated_queue_size_set(res->port_id,
+			res->size, res->queue_type);
+	if (ret != 0)
+		TESTPMD_LOG(ERR, "Failed to set port %u hardware dedicated %s "
+				"ring size %u\n",
+				res->port_id, res->queue_type, res->size);
+}
+
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_set =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		set, "set");
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_bonding =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		bonding, "bonding");
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_lacp =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		lacp, "lacp");
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_dedicated =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		dedicated_queues, "dedicated_queues");
+static cmdline_parse_token_num_t cmd_setbonding_hw_dedicated_queue_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_queue_type =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		queue_type, "rxq#txq");
+static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_queue_size =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		queue_size, "queue_size");
+static cmdline_parse_token_num_t cmd_setbonding_hw_dedicated_queue_size_size =
+	TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
+		size, RTE_UINT16);
+
+static cmdline_parse_inst_t cmd_set_lacp_dedicated_hw_queue_size = {
+	.f = cmd_set_bonding_hw_dedicated_queue_size_parsed,
+	.help_str = "set bonding lacp dedicated_queues <port_id> (rxq|txq) "
+		"queue_size <size>: "
+		"Set hardware dedicated queue size for LACP control traffic",
+	.data = NULL,
+	.tokens = {
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_set,
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_bonding,
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_lacp,
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_dedicated,
+		(void *)&cmd_setbonding_hw_dedicated_queue_port_id,
+		(void *)&cmd_setbonding_hw_dedicated_queue_queue_type,
+		(void *)&cmd_setbonding_hw_dedicated_queue_queue_size,
+		(void *)&cmd_setbonding_hw_dedicated_queue_size_size,
+		NULL
+	}
+};
+
 /* *** SET BALANCE XMIT POLICY *** */
 struct cmd_set_bonding_balance_xmit_policy_result {
 	cmdline_fixed_string_t set;
@@ -747,6 +826,11 @@ static struct testpmd_driver_commands bonding_cmds = {
 		"set bonding mode IEEE802.3AD aggregator policy (port_id) (agg_name)\n"
 		"	Set Aggregation mode for IEEE802.3AD (mode 4)\n",
 	},
+	{
+		&cmd_set_lacp_dedicated_hw_queue_size,
+		"set bonding lacp dedicated_queues <port_id> (rxq|txq) queue_size <size>\n"
+		"	Set hardware dedicated queue size for LACP control traffic.\n",
+	},
 	{ NULL, NULL },
 	},
 };
diff --git a/drivers/net/bonding/eth_bond_8023ad_private.h b/drivers/net/bonding/eth_bond_8023ad_private.h
index ab7d15f81a..b0264e2275 100644
--- a/drivers/net/bonding/eth_bond_8023ad_private.h
+++ b/drivers/net/bonding/eth_bond_8023ad_private.h
@@ -176,6 +176,9 @@ struct mode8023ad_private {
 
 		uint16_t rx_qid;
 		uint16_t tx_qid;
+
+		uint16_t rx_queue_size;
+		uint16_t tx_queue_size;
 	} dedicated_queues;
 	enum rte_bond_8023ad_agg_selection agg_selection;
 };
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 7f885ab521..37a3f8528d 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1254,6 +1254,8 @@ bond_mode_8023ad_conf_assign(struct mode8023ad_private *mode4,
 	mode4->dedicated_queues.enabled = 0;
 	mode4->dedicated_queues.rx_qid = UINT16_MAX;
 	mode4->dedicated_queues.tx_qid = UINT16_MAX;
+	mode4->dedicated_queues.rx_queue_size = SLOW_RX_QUEUE_HW_DEFAULT_SIZE;
+	mode4->dedicated_queues.tx_queue_size = SLOW_TX_QUEUE_HW_DEFAULT_SIZE;
 }
 
 void
@@ -1753,3 +1755,42 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
 
 	return retval;
 }
+
+int
+rte_eth_bond_8023ad_dedicated_queue_size_set(uint16_t port,
+		uint16_t queue_size,
+		const char *queue_type)
+{
+	struct rte_eth_dev *dev;
+	struct bond_dev_private *internals;
+
+	if (valid_bonding_port_id(port) != 0) {
+		RTE_BOND_LOG(ERR, "The bonding port id is invalid");
+		return -EINVAL;
+	}
+
+	dev = &rte_eth_devices[port];
+
+	/* Device must be stopped to set up slow queue */
+	if (dev->data->dev_started != 0) {
+		RTE_BOND_LOG(ERR, "Please stop the bonding port");
+		return -EINVAL;
+	}
+
+	internals = dev->data->dev_private;
+	if (internals->mode4.dedicated_queues.enabled == 0) {
+		RTE_BOND_LOG(ERR, "Please enable dedicated queue");
+		return -EINVAL;
+	}
+
+	if (strcmp(queue_type, "rxq") == 0) {
+		internals->mode4.dedicated_queues.rx_queue_size = queue_size;
+	} else if (strcmp(queue_type, "txq") == 0) {
+		internals->mode4.dedicated_queues.tx_queue_size = queue_size;
+	} else {
+		RTE_BOND_LOG(ERR, "Unknown queue type %s", queue_type);
+		return -EINVAL;
+	}
+
+	return 0;
+}
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index b2deb26e2e..a8c9dadbd0 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -35,6 +35,9 @@ extern "C" {
 #define MARKER_TLV_TYPE_INFO                0x01
 #define MARKER_TLV_TYPE_RESP                0x02
 
+#define SLOW_TX_QUEUE_HW_DEFAULT_SIZE       512
+#define SLOW_RX_QUEUE_HW_DEFAULT_SIZE       512
+
 typedef void (*rte_eth_bond_8023ad_ext_slowrx_fn)(uint16_t member_id,
 						  struct rte_mbuf *lacp_pkt);
 
@@ -309,6 +312,26 @@ rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port_id);
 int
 rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port_id);
 
+
+/**
+ * Set hardware slow queue ring size
+ *
+ * This function set bonding port hardware slow queue ring size.
+ * Bonding port must be stopped to change this configuration.
+ *
+ * @param port_id      Bonding device id
+ * @param queue_size   Slow queue ring size
+ * @param queue_type   Slow queue type, "rxq" or "txq"
+ *
+ * @return
+ *   0 on success, negative value otherwise.
+ *
+ */
+__rte_experimental
+int
+rte_eth_bond_8023ad_dedicated_queue_size_set(uint16_t port,
+		uint16_t queue_size,
+		const char *queue_type);
 /*
  * Get aggregator mode for 8023ad
  * @param port_id Bonding device id
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 34131f0e35..d995fe62b2 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1688,7 +1688,8 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
 		/* Configure slow Rx queue */
 
 		errval = rte_eth_rx_queue_setup(member_eth_dev->data->port_id,
-				internals->mode4.dedicated_queues.rx_qid, 128,
+				internals->mode4.dedicated_queues.rx_qid,
+				internals->mode4.dedicated_queues.rx_queue_size,
 				rte_eth_dev_socket_id(member_eth_dev->data->port_id),
 				NULL, port->slow_pool);
 		if (errval != 0) {
@@ -1701,7 +1702,8 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
 		}
 
 		errval = rte_eth_tx_queue_setup(member_eth_dev->data->port_id,
-				internals->mode4.dedicated_queues.tx_qid, 512,
+				internals->mode4.dedicated_queues.tx_qid,
+				internals->mode4.dedicated_queues.tx_queue_size,
 				rte_eth_dev_socket_id(member_eth_dev->data->port_id),
 				NULL);
 		if (errval != 0) {
diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map
index a309469b1f..f9c935a04f 100644
--- a/drivers/net/bonding/version.map
+++ b/drivers/net/bonding/version.map
@@ -30,6 +30,7 @@ DPDK_25 {
 EXPERIMENTAL {
 	# added in 23.11
 	global:
+	rte_eth_bond_8023ad_dedicated_queue_size_set;
 	rte_eth_bond_8023ad_member_info;
 	rte_eth_bond_active_members_get;
 	rte_eth_bond_member_add;
-- 
2.39.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/2] net/bonding: standard the log message
  2024-10-11  3:24   ` [PATCH v2 1/2] net/bonding: standard the log message Chaoyong He
@ 2024-10-11  5:10     ` Stephen Hemminger
  2024-10-29  1:51     ` lihuisong (C)
  1 sibling, 0 replies; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-11  5:10 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, Long Wu, Peng Zhang

On Fri, 11 Oct 2024 11:24:11 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> From: Long Wu <long.wu@corigine.com>
> 
> According to the check rules in the patch check script,
> drivers and libraries must use the logging framework.
> 
> So standard the log message of bonding driver by using
> the logging framework.
> 
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/2] net/bonding: add command to set dedicated queue size
  2024-10-11  3:24   ` [PATCH v2 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
@ 2024-10-17 16:05     ` Thomas Monjalon
  2024-10-29  1:49     ` lihuisong (C)
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2024-10-17 16:05 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, Long Wu, Peng Zhang, Vignesh PS

11/10/2024 05:24, Chaoyong He:
> From: Long Wu <long.wu@corigine.com>
> 
> The testpmd application can not modify the value of
> dedicated hardware Rx/Tx queue size, and hardcoded
> them as (128/512). This will cause the bonding port
> start fail if some NIC requires more Rx/Tx descriptors
> than the hardcoded number.
> 
> Therefore, add a command into testpmd application to
> support the modification of the size of the dedicated
> hardware Rx/Tx queue. Also export an external interface
> to also let other applications can change it.
> 
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>

There is a lack of review in general for bonding patches.
Please could you review this one:
https://patches.dpdk.org/project/dpdk/patch/20241015082049.3910138-1-vignesh.purushotham.srinivas@ericsson.com/

Maybe he will do the same for you.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/2] net/bonding: add command to set dedicated queue size
  2024-10-11  3:24   ` [PATCH v2 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
  2024-10-17 16:05     ` Thomas Monjalon
@ 2024-10-29  1:49     ` lihuisong (C)
  2024-12-03 18:39     ` Stephen Hemminger
  2024-12-03 19:57     ` Stephen Hemminger
  3 siblings, 0 replies; 19+ messages in thread
From: lihuisong (C) @ 2024-10-29  1:49 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, Long Wu, Peng Zhang

Very useful,
Acked-by: Huisong Li <lihuisong@huawei.com>

在 2024/10/11 11:24, Chaoyong He 写道:
> From: Long Wu <long.wu@corigine.com>
>
> The testpmd application can not modify the value of
> dedicated hardware Rx/Tx queue size, and hardcoded
> them as (128/512). This will cause the bonding port
> start fail if some NIC requires more Rx/Tx descriptors
> than the hardcoded number.
>
> Therefore, add a command into testpmd application to
> support the modification of the size of the dedicated
> hardware Rx/Tx queue. Also export an external interface
> to also let other applications can change it.
>
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> ---
>   .../link_bonding_poll_mode_drv_lib.rst        |  8 ++
>   doc/guides/rel_notes/release_24_11.rst        |  4 +
>   drivers/net/bonding/bonding_testpmd.c         | 84 +++++++++++++++++++
>   drivers/net/bonding/eth_bond_8023ad_private.h |  3 +
>   drivers/net/bonding/rte_eth_bond_8023ad.c     | 41 +++++++++
>   drivers/net/bonding/rte_eth_bond_8023ad.h     | 23 +++++
>   drivers/net/bonding/rte_eth_bond_pmd.c        |  6 +-
>   drivers/net/bonding/version.map               |  1 +
>   8 files changed, 168 insertions(+), 2 deletions(-)
>
> diff --git a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
> index 60717a3587..6498cf7d3d 100644
> --- a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
> +++ b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
> @@ -637,3 +637,11 @@ in balance mode with a transmission policy of layer 2+3::
>           Members (3): [1 3 4]
>           Active Members (3): [1 3 4]
>           Primary: [3]
> +
> +set bonding lacp dedicated_queue size
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Set hardware dedicated queue size for LACP control traffic in
> +mode 4 (link-aggregation-802.3ad)::
> +
> +   testpmd> set bonding lacp dedicated_queues <port_id> (rxq|txq) queue_size <size>
> diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst
> index 9bfc719e02..bec466f58d 100644
> --- a/doc/guides/rel_notes/release_24_11.rst
> +++ b/doc/guides/rel_notes/release_24_11.rst
> @@ -98,6 +98,10 @@ New Features
>     * Added SR-IOV VF support.
>     * Added recent 1400/14000 and 15000 models to the supported list.
>   
> +* **Updated bonding driver.**
> +
> +  * Added new function ``rte_eth_bond_8023ad_dedicated_queue_size_set``
> +    to set hardware dedicated Rx/Tx queue size in mode-4.
>   
>   Removed Items
>   -------------
> diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
> index fc0bfd8f74..ce0e47d8ea 100644
> --- a/drivers/net/bonding/bonding_testpmd.c
> +++ b/drivers/net/bonding/bonding_testpmd.c
> @@ -156,6 +156,85 @@ static cmdline_parse_inst_t cmd_set_lacp_dedicated_queues = {
>   	}
>   };
>   
> +/* *** SET BONDING SLOW_QUEUE HW QUEUE SIZE *** */
> +struct cmd_set_bonding_hw_dedicated_queue_size_result {
> +	cmdline_fixed_string_t set;
> +	cmdline_fixed_string_t bonding;
> +	cmdline_fixed_string_t lacp;
> +	cmdline_fixed_string_t dedicated_queues;
> +	portid_t port_id;
> +	cmdline_fixed_string_t queue_type;
> +	cmdline_fixed_string_t queue_size;
> +	uint16_t size;
> +};
> +
> +static void cmd_set_bonding_hw_dedicated_queue_size_parsed(void *parsed_result,
> +	__rte_unused struct cmdline *cl, __rte_unused void *data)
> +{
> +	int ret;
> +	struct rte_port *port;
> +	struct cmd_set_bonding_hw_dedicated_queue_size_result *res = parsed_result;
> +
> +	port = &ports[res->port_id];
> +
> +	/** Check if the port is not started **/
> +	if (port->port_status != RTE_PORT_STOPPED) {
> +		TESTPMD_LOG(ERR, "Please stop port %u first\n", res->port_id);
> +		return;
> +	}
> +
> +	ret = rte_eth_bond_8023ad_dedicated_queue_size_set(res->port_id,
> +			res->size, res->queue_type);
> +	if (ret != 0)
> +		TESTPMD_LOG(ERR, "Failed to set port %u hardware dedicated %s "
> +				"ring size %u\n",
> +				res->port_id, res->queue_type, res->size);
> +}
> +
> +static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_set =
> +	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
> +		set, "set");
> +static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_bonding =
> +	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
> +		bonding, "bonding");
> +static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_lacp =
> +	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
> +		lacp, "lacp");
> +static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_size_dedicated =
> +	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
> +		dedicated_queues, "dedicated_queues");
> +static cmdline_parse_token_num_t cmd_setbonding_hw_dedicated_queue_port_id =
> +	TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
> +		port_id, RTE_UINT16);
> +static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_queue_type =
> +	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
> +		queue_type, "rxq#txq");
> +static cmdline_parse_token_string_t cmd_setbonding_hw_dedicated_queue_queue_size =
> +	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
> +		queue_size, "queue_size");
> +static cmdline_parse_token_num_t cmd_setbonding_hw_dedicated_queue_size_size =
> +	TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_hw_dedicated_queue_size_result,
> +		size, RTE_UINT16);
> +
> +static cmdline_parse_inst_t cmd_set_lacp_dedicated_hw_queue_size = {
> +	.f = cmd_set_bonding_hw_dedicated_queue_size_parsed,
> +	.help_str = "set bonding lacp dedicated_queues <port_id> (rxq|txq) "
> +		"queue_size <size>: "
> +		"Set hardware dedicated queue size for LACP control traffic",
> +	.data = NULL,
> +	.tokens = {
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_set,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_bonding,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_lacp,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_dedicated,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_port_id,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_queue_type,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_queue_size,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_size,
> +		NULL
> +	}
> +};
> +
>   /* *** SET BALANCE XMIT POLICY *** */
>   struct cmd_set_bonding_balance_xmit_policy_result {
>   	cmdline_fixed_string_t set;
> @@ -747,6 +826,11 @@ static struct testpmd_driver_commands bonding_cmds = {
>   		"set bonding mode IEEE802.3AD aggregator policy (port_id) (agg_name)\n"
>   		"	Set Aggregation mode for IEEE802.3AD (mode 4)\n",
>   	},
> +	{
> +		&cmd_set_lacp_dedicated_hw_queue_size,
> +		"set bonding lacp dedicated_queues <port_id> (rxq|txq) queue_size <size>\n"
> +		"	Set hardware dedicated queue size for LACP control traffic.\n",
> +	},
>   	{ NULL, NULL },
>   	},
>   };
> diff --git a/drivers/net/bonding/eth_bond_8023ad_private.h b/drivers/net/bonding/eth_bond_8023ad_private.h
> index ab7d15f81a..b0264e2275 100644
> --- a/drivers/net/bonding/eth_bond_8023ad_private.h
> +++ b/drivers/net/bonding/eth_bond_8023ad_private.h
> @@ -176,6 +176,9 @@ struct mode8023ad_private {
>   
>   		uint16_t rx_qid;
>   		uint16_t tx_qid;
> +
> +		uint16_t rx_queue_size;
> +		uint16_t tx_queue_size;
>   	} dedicated_queues;
>   	enum rte_bond_8023ad_agg_selection agg_selection;
>   };
> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
> index 7f885ab521..37a3f8528d 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> @@ -1254,6 +1254,8 @@ bond_mode_8023ad_conf_assign(struct mode8023ad_private *mode4,
>   	mode4->dedicated_queues.enabled = 0;
>   	mode4->dedicated_queues.rx_qid = UINT16_MAX;
>   	mode4->dedicated_queues.tx_qid = UINT16_MAX;
> +	mode4->dedicated_queues.rx_queue_size = SLOW_RX_QUEUE_HW_DEFAULT_SIZE;
> +	mode4->dedicated_queues.tx_queue_size = SLOW_TX_QUEUE_HW_DEFAULT_SIZE;
>   }
>   
>   void
> @@ -1753,3 +1755,42 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
>   
>   	return retval;
>   }
> +
> +int
> +rte_eth_bond_8023ad_dedicated_queue_size_set(uint16_t port,
> +		uint16_t queue_size,
> +		const char *queue_type)
> +{
> +	struct rte_eth_dev *dev;
> +	struct bond_dev_private *internals;
> +
> +	if (valid_bonding_port_id(port) != 0) {
> +		RTE_BOND_LOG(ERR, "The bonding port id is invalid");
> +		return -EINVAL;
> +	}
> +
> +	dev = &rte_eth_devices[port];
> +
> +	/* Device must be stopped to set up slow queue */
> +	if (dev->data->dev_started != 0) {
> +		RTE_BOND_LOG(ERR, "Please stop the bonding port");
> +		return -EINVAL;
> +	}
> +
> +	internals = dev->data->dev_private;
> +	if (internals->mode4.dedicated_queues.enabled == 0) {
> +		RTE_BOND_LOG(ERR, "Please enable dedicated queue");
> +		return -EINVAL;
> +	}
> +
> +	if (strcmp(queue_type, "rxq") == 0) {
> +		internals->mode4.dedicated_queues.rx_queue_size = queue_size;
> +	} else if (strcmp(queue_type, "txq") == 0) {
> +		internals->mode4.dedicated_queues.tx_queue_size = queue_size;
> +	} else {
> +		RTE_BOND_LOG(ERR, "Unknown queue type %s", queue_type);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
> index b2deb26e2e..a8c9dadbd0 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.h
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
> @@ -35,6 +35,9 @@ extern "C" {
>   #define MARKER_TLV_TYPE_INFO                0x01
>   #define MARKER_TLV_TYPE_RESP                0x02
>   
> +#define SLOW_TX_QUEUE_HW_DEFAULT_SIZE       512
> +#define SLOW_RX_QUEUE_HW_DEFAULT_SIZE       512
> +
>   typedef void (*rte_eth_bond_8023ad_ext_slowrx_fn)(uint16_t member_id,
>   						  struct rte_mbuf *lacp_pkt);
>   
> @@ -309,6 +312,26 @@ rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port_id);
>   int
>   rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port_id);
>   
> +
> +/**
> + * Set hardware slow queue ring size
> + *
> + * This function set bonding port hardware slow queue ring size.
> + * Bonding port must be stopped to change this configuration.
> + *
> + * @param port_id      Bonding device id
> + * @param queue_size   Slow queue ring size
> + * @param queue_type   Slow queue type, "rxq" or "txq"
> + *
> + * @return
> + *   0 on success, negative value otherwise.
> + *
> + */
> +__rte_experimental
> +int
> +rte_eth_bond_8023ad_dedicated_queue_size_set(uint16_t port,
> +		uint16_t queue_size,
> +		const char *queue_type);
>   /*
>    * Get aggregator mode for 8023ad
>    * @param port_id Bonding device id
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 34131f0e35..d995fe62b2 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1688,7 +1688,8 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
>   		/* Configure slow Rx queue */
>   
>   		errval = rte_eth_rx_queue_setup(member_eth_dev->data->port_id,
> -				internals->mode4.dedicated_queues.rx_qid, 128,
> +				internals->mode4.dedicated_queues.rx_qid,
> +				internals->mode4.dedicated_queues.rx_queue_size,
>   				rte_eth_dev_socket_id(member_eth_dev->data->port_id),
>   				NULL, port->slow_pool);
>   		if (errval != 0) {
> @@ -1701,7 +1702,8 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
>   		}
>   
>   		errval = rte_eth_tx_queue_setup(member_eth_dev->data->port_id,
> -				internals->mode4.dedicated_queues.tx_qid, 512,
> +				internals->mode4.dedicated_queues.tx_qid,
> +				internals->mode4.dedicated_queues.tx_queue_size,
>   				rte_eth_dev_socket_id(member_eth_dev->data->port_id),
>   				NULL);
>   		if (errval != 0) {
> diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map
> index a309469b1f..f9c935a04f 100644
> --- a/drivers/net/bonding/version.map
> +++ b/drivers/net/bonding/version.map
> @@ -30,6 +30,7 @@ DPDK_25 {
>   EXPERIMENTAL {
>   	# added in 23.11
>   	global:
> +	rte_eth_bond_8023ad_dedicated_queue_size_set;
>   	rte_eth_bond_8023ad_member_info;
>   	rte_eth_bond_active_members_get;
>   	rte_eth_bond_member_add;

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/2] net/bonding: standard the log message
  2024-10-11  3:24   ` [PATCH v2 1/2] net/bonding: standard the log message Chaoyong He
  2024-10-11  5:10     ` Stephen Hemminger
@ 2024-10-29  1:51     ` lihuisong (C)
  1 sibling, 0 replies; 19+ messages in thread
From: lihuisong (C) @ 2024-10-29  1:51 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, Long Wu, Peng Zhang

Acked-by: Huisong Li <lihuisong@huawei.com>
在 2024/10/11 11:24, Chaoyong He 写道:
> From: Long Wu <long.wu@corigine.com>
>
> According to the check rules in the patch check script,
> drivers and libraries must use the logging framework.
>
> So standard the log message of bonding driver by using
> the logging framework.
>
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> ---
>   drivers/net/bonding/bonding_testpmd.c | 52 +++++++++++++--------------
>   1 file changed, 25 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
> index 8fcd6cadd0..fc0bfd8f74 100644
> --- a/drivers/net/bonding/bonding_testpmd.c
> +++ b/drivers/net/bonding/bonding_testpmd.c
> @@ -34,15 +34,14 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result,
>   	 * of device changed.
>   	 */
>   	if (port->port_status != RTE_PORT_STOPPED) {
> -		fprintf(stderr,
> -			"\t Error: Can't set bonding mode when port %d is not stopped\n",
> +		TESTPMD_LOG(ERR, "Error: Can't set bonding mode when port %d is not stopped\n",
>   			port_id);
>   		return;
>   	}
>   
>   	/* Set the bonding mode for the relevant port. */
>   	if (rte_eth_bond_mode_set(port_id, res->value) != 0)
> -		fprintf(stderr, "\t Failed to set bonding mode for port = %d.\n",
> +		TESTPMD_LOG(ERR, "Failed to set bonding mode for port = %d.\n",
>   			port_id);
>   }
>   
> @@ -98,24 +97,26 @@ static void cmd_set_bonding_lacp_dedicated_queues_parsed(void *parsed_result,
>   
>   	/** Check if the port is not started **/
>   	if (port->port_status != RTE_PORT_STOPPED) {
> -		fprintf(stderr, "Please stop port %d first\n", port_id);
> +		TESTPMD_LOG(ERR, "Please stop port %d first\n", port_id);
>   		return;
>   	}
>   
>   	if (!strcmp(res->mode, "enable")) {
>   		if (rte_eth_bond_8023ad_dedicated_queues_enable(port_id) == 0)
> -			printf("Dedicate queues for LACP control packets"
> -					" enabled\n");
> +			TESTPMD_LOG(INFO,
> +				"Dedicate queues for LACP control packets enabled\n");
>   		else
> -			printf("Enabling dedicate queues for LACP control "
> -					"packets on port %d failed\n", port_id);
> +			TESTPMD_LOG(ERR,
> +				"Enabling dedicate queues for LACP control "
> +				"packets on port %d failed\n", port_id);
>   	} else if (!strcmp(res->mode, "disable")) {
>   		if (rte_eth_bond_8023ad_dedicated_queues_disable(port_id) == 0)
> -			printf("Dedicated queues for LACP control packets "
> -					"disabled\n");
> +			TESTPMD_LOG(INFO,
> +				"Dedicated queues for LACP control packets disabled\n");
>   		else
> -			printf("Disabling dedicated queues for LACP control "
> -					"traffic on port %d failed\n", port_id);
> +			TESTPMD_LOG(ERR,
> +				"Disabling dedicated queues for LACP control "
> +				"traffic on port %d failed\n", port_id);
>   	}
>   }
>   
> @@ -178,14 +179,13 @@ static void cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result,
>   	} else if (!strcmp(res->policy, "l34")) {
>   		policy = BALANCE_XMIT_POLICY_LAYER34;
>   	} else {
> -		fprintf(stderr, "\t Invalid xmit policy selection");
> +		TESTPMD_LOG(ERR, "Invalid xmit policy selection\n");
>   		return;
>   	}
>   
>   	/* Set the bonding mode for the relevant port. */
>   	if (rte_eth_bond_xmit_policy_set(port_id, policy) != 0) {
> -		fprintf(stderr,
> -			"\t Failed to set bonding balance xmit policy for port = %d.\n",
> +		TESTPMD_LOG(ERR, "Failed to set bonding balance xmit policy for port = %d.\n",
>   			port_id);
>   	}
>   }
> @@ -239,7 +239,7 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
>   
>   	bonding_mode = rte_eth_bond_mode_get(port_id);
>   	if (bonding_mode < 0) {
> -		fprintf(stderr, "\tFailed to get bonding mode for port = %d\n",
> +		TESTPMD_LOG(ERR, "Failed to get bonding mode for port = %d\n",
>   			port_id);
>   		return;
>   	}
> @@ -292,7 +292,7 @@ static void cmd_set_bonding_primary_parsed(void *parsed_result,
>   
>   	/* Set the primary member for a bonding device. */
>   	if (rte_eth_bond_primary_set(main_port_id, member_port_id) != 0) {
> -		fprintf(stderr, "\t Failed to set primary member for port = %d.\n",
> +		TESTPMD_LOG(ERR, "Failed to set primary member for port = %d.\n",
>   			main_port_id);
>   		return;
>   	}
> @@ -348,8 +348,7 @@ static void cmd_add_bonding_member_parsed(void *parsed_result,
>   
>   	/* add the member for a bonding device. */
>   	if (rte_eth_bond_member_add(main_port_id, member_port_id) != 0) {
> -		fprintf(stderr,
> -			"\t Failed to add member %d to main port = %d.\n",
> +		TESTPMD_LOG(ERR, "Failed to add member %d to main port = %d.\n",
>   			member_port_id, main_port_id);
>   		return;
>   	}
> @@ -407,8 +406,7 @@ static void cmd_remove_bonding_member_parsed(void *parsed_result,
>   
>   	/* remove the member from a bonding device. */
>   	if (rte_eth_bond_member_remove(main_port_id, member_port_id) != 0) {
> -		fprintf(stderr,
> -			"\t Failed to remove member %d from main port = %d.\n",
> +		TESTPMD_LOG(ERR, "Failed to remove member %d from main port = %d.\n",
>   			member_port_id, main_port_id);
>   		return;
>   	}
> @@ -467,7 +465,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
>   	int ret;
>   
>   	if (test_done == 0) {
> -		fprintf(stderr, "Please stop forwarding first\n");
> +		TESTPMD_LOG(ERR, "Please stop forwarding first\n");
>   		return;
>   	}
>   
> @@ -477,10 +475,10 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
>   	/* Create a new bonding device. */
>   	port_id = rte_eth_bond_create(ethdev_name, res->mode, res->socket);
>   	if (port_id < 0) {
> -		fprintf(stderr, "\t Failed to create bonding device.\n");
> +		TESTPMD_LOG(ERR, "Failed to create bonding device.\n");
>   		return;
>   	}
> -	printf("Created new bonding device %s on (port %d).\n", ethdev_name,
> +	TESTPMD_LOG(INFO, "Created new bonding device %s on (port %d).\n", ethdev_name,
>   		port_id);
>   
>   	/* Update number of ports */
> @@ -488,7 +486,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result,
>   	reconfig(port_id, res->socket);
>   	ret = rte_eth_promiscuous_enable(port_id);
>   	if (ret != 0)
> -		fprintf(stderr, "Failed to enable promiscuous mode for port %u: %s - ignore\n",
> +		TESTPMD_LOG(NOTICE, "Failed to enable promiscuous mode for port %u: %s - ignore\n",
>   			port_id, rte_strerror(-ret));
>   
>   	ports[port_id].update_conf = 1;
> @@ -550,7 +548,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
>   
>   	/* check the return value and print it if is < 0 */
>   	if (ret < 0)
> -		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
> +		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
>   			strerror(-ret));
>   }
>   
> @@ -603,7 +601,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
>   
>   	/* check the return value and print it if is < 0 */
>   	if (ret < 0)
> -		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
> +		TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n",
>   			strerror(-ret));
>   }
>   

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/2] net/bonding: add command to set dedicated queue size
  2024-10-11  3:24   ` [PATCH v2 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
  2024-10-17 16:05     ` Thomas Monjalon
  2024-10-29  1:49     ` lihuisong (C)
@ 2024-12-03 18:39     ` Stephen Hemminger
  2024-12-03 19:57     ` Stephen Hemminger
  3 siblings, 0 replies; 19+ messages in thread
From: Stephen Hemminger @ 2024-12-03 18:39 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, Long Wu, Peng Zhang

On Fri, 11 Oct 2024 11:24:12 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> +	.tokens = {
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_set,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_bonding,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_lacp,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_dedicated,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_port_id,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_queue_type,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_queue_size,
> +		(void *)&cmd_setbonding_hw_dedicated_queue_size_size,
> +		NULL

No void * casts are needed here.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/2] net/bonding: add command to set dedicated queue size
  2024-10-11  3:24   ` [PATCH v2 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
                       ` (2 preceding siblings ...)
  2024-12-03 18:39     ` Stephen Hemminger
@ 2024-12-03 19:57     ` Stephen Hemminger
  2024-12-04  6:21       ` Chaoyong He
  3 siblings, 1 reply; 19+ messages in thread
From: Stephen Hemminger @ 2024-12-03 19:57 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, Long Wu, Peng Zhang

On Fri, 11 Oct 2024 11:24:12 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> From: Long Wu <long.wu@corigine.com>
> 
> The testpmd application can not modify the value of
> dedicated hardware Rx/Tx queue size, and hardcoded
> them as (128/512). This will cause the bonding port
> start fail if some NIC requires more Rx/Tx descriptors
> than the hardcoded number.
> 
> Therefore, add a command into testpmd application to
> support the modification of the size of the dedicated
> hardware Rx/Tx queue. Also export an external interface
> to also let other applications can change it.
> 
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>

24.11 is released, this patch if still of interest will need to be rebased.

The definition of what a "dedicated queue" is a bit confusing.
If it is only for LACP packets, it should never need to be very big.
Only under a mis-configuration and DoS kind of flood should there
ever be many packets.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH v2 2/2] net/bonding: add command to set dedicated queue size
  2024-12-03 19:57     ` Stephen Hemminger
@ 2024-12-04  6:21       ` Chaoyong He
  2024-12-04 16:00         ` Stephen Hemminger
  0 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-12-04  6:21 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, oss-drivers, Long Wu, Nole Zhang

> On Fri, 11 Oct 2024 11:24:12 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > From: Long Wu <long.wu@corigine.com>
> >
> > The testpmd application can not modify the value of dedicated hardware
> > Rx/Tx queue size, and hardcoded them as (128/512). This will cause the
> > bonding port start fail if some NIC requires more Rx/Tx descriptors
> > than the hardcoded number.
> >
> > Therefore, add a command into testpmd application to support the
> > modification of the size of the dedicated hardware Rx/Tx queue. Also
> > export an external interface to also let other applications can change
> > it.
> >
> > Signed-off-by: Long Wu <long.wu@corigine.com>
> > Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> > Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> 
> 24.11 is released, this patch if still of interest will need to be rebased.

Okay, we will send new version patch later.

> 
> The definition of what a "dedicated queue" is a bit confusing.
> If it is only for LACP packets, it should never need to be very big.
> Only under a mis-configuration and DoS kind of flood should there ever be
> many packets.

Yes, the dedicated queue is only for LACP packets now and it doesn't need be set very big.

But if we use a hardware queue as the "dedicated queue", we must consider the hardware
capability. The minimum queue size of some NICs may be larger than the hardcode dedicated
queue size. In this case, I think it is better to add an interface to set the dedicated queue size.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/2] net/bonding: add command to set dedicated queue size
  2024-12-04  6:21       ` Chaoyong He
@ 2024-12-04 16:00         ` Stephen Hemminger
  2024-12-05  2:53           ` Chaoyong He
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Hemminger @ 2024-12-04 16:00 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, Long Wu, Nole Zhang

On Wed, 4 Dec 2024 06:21:00 +0000
Chaoyong He <chaoyong.he@corigine.com> wrote:

> > The definition of what a "dedicated queue" is a bit confusing.
> > If it is only for LACP packets, it should never need to be very big.
> > Only under a mis-configuration and DoS kind of flood should there ever be
> > many packets.  
> 
> Yes, the dedicated queue is only for LACP packets now and it doesn't need be set very big.
> 
> But if we use a hardware queue as the "dedicated queue", we must consider the hardware
> capability. The minimum queue size of some NICs may be larger than the hardcode dedicated
> queue size. In this case, I think it is better to add an interface to set the dedicated queue size.

How about using the existing descriptor queue limits api for that?
It is reported by info get

^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH v2 2/2] net/bonding: add command to set dedicated queue size
  2024-12-04 16:00         ` Stephen Hemminger
@ 2024-12-05  2:53           ` Chaoyong He
  0 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-12-05  2:53 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, oss-drivers, Long Wu, Nole Zhang

> On Wed, 4 Dec 2024 06:21:00 +0000
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > > The definition of what a "dedicated queue" is a bit confusing.
> > > If it is only for LACP packets, it should never need to be very big.
> > > Only under a mis-configuration and DoS kind of flood should there
> > > ever be many packets.
> >
> > Yes, the dedicated queue is only for LACP packets now and it doesn't need be
> set very big.
> >
> > But if we use a hardware queue as the "dedicated queue", we must
> > consider the hardware capability. The minimum queue size of some NICs
> > may be larger than the hardcode dedicated queue size. In this case, I think it
> is better to add an interface to set the dedicated queue size.
> 
> How about using the existing descriptor queue limits api for that?
> It is reported by info get

Using existing descriptor queue limits api is good enough for current problem(hardware capability),
but I think it is not very flexible.
Now we use a macro as a default value for dedicated queue size, but we can replace the macro with queue limit
while still retaining the interface for modifying queue size.
What do you think of this?

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-12-05  2:53 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24  2:03 [PATCH 0/2] add function to set dedicated queue size Chaoyong He
2024-06-24  2:03 ` [PATCH 1/2] net/bonding: standard the log message Chaoyong He
2024-10-10 18:10   ` Stephen Hemminger
2024-10-11  3:02     ` Chaoyong He
2024-06-24  2:03 ` [PATCH 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
2024-10-10 18:13   ` Stephen Hemminger
2024-10-11  3:00     ` Chaoyong He
2024-10-11  3:24 ` [PATCH v2 0/2] add function " Chaoyong He
2024-10-11  3:24   ` [PATCH v2 1/2] net/bonding: standard the log message Chaoyong He
2024-10-11  5:10     ` Stephen Hemminger
2024-10-29  1:51     ` lihuisong (C)
2024-10-11  3:24   ` [PATCH v2 2/2] net/bonding: add command to set dedicated queue size Chaoyong He
2024-10-17 16:05     ` Thomas Monjalon
2024-10-29  1:49     ` lihuisong (C)
2024-12-03 18:39     ` Stephen Hemminger
2024-12-03 19:57     ` Stephen Hemminger
2024-12-04  6:21       ` Chaoyong He
2024-12-04 16:00         ` Stephen Hemminger
2024-12-05  2:53           ` Chaoyong He

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).