DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>,
	James Hershaw <james.hershaw@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH v6 06/14] net/bonding: add commands for bonding port notification
Date: Tue, 26 Dec 2023 15:28:16 +0800	[thread overview]
Message-ID: <20231226072824.3163121-7-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231226072824.3163121-1-chaoyong.he@corigine.com>

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

Add some commands to support bonding port notification in
dpdk-testpmd.

1. Users can enable the notification by command:
"set bonding notify_member (port_id) (enable|disable)"

2. If member port firmware try to create the bonding port after
notification users can get the status by command:
"get bonding member firmware create (member_port_id) (bonding_port_id)"

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 .../link_bonding_poll_mode_drv_lib.rst        |  18 +++
 drivers/net/bonding/bonding_testpmd.c         | 128 ++++++++++++++++++
 2 files changed, 146 insertions(+)

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..653d2f850d 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,21 @@ 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 notify_member
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the notify member flag of bonding port::
+
+   testpmd> set bonding notify_member (port_id) (enable|disable)
+
+This command just set the flag of notification.
+If we enable it, bonding PMD will notify member ports when its some
+configurations changed.
+
+get bonding member firmware create
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Get the status of member port hardware creating the bonding port::
+
+   testpmd> get bonding member firmware create (member_port_id) (bonding_port_id)
diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 8fcd6cadd0..48f71da3a7 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -692,6 +692,124 @@ static cmdline_parse_inst_t cmd_set_bonding_agg_mode_policy = {
 	}
 };
 
+struct cmd_set_bonding_notify_member_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t bonding;
+	cmdline_fixed_string_t notify_member;
+	uint16_t port_num;
+	cmdline_fixed_string_t mode;
+};
+
+static void
+cmd_set_bonding_notify_member_parsed(void *parsed_result,
+	__rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+	struct cmd_set_bonding_notify_member_result *res = parsed_result;
+	bool notify_member = false;
+
+	if (strcmp(res->notify_member, "enable") == 0)
+		notify_member = true;
+	else if (strcmp(res->notify_member, "disable") == 0)
+		notify_member = false;
+
+	rte_eth_bond_notify_member_flag_set(res->port_num, notify_member);
+}
+
+static cmdline_parse_token_string_t cmd_set_bonding_notify_member_set =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_notify_member_result,
+		set, "set");
+static cmdline_parse_token_string_t cmd_set_bonding_notify_member_bonding =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_notify_member_result,
+		bonding, "bonding");
+static cmdline_parse_token_string_t cmd_set_bonding_notify_member =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_notify_member_result,
+		notify_member, "notify_member");
+static cmdline_parse_token_num_t cmd_set_bonding_notify_member_portnum =
+	TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_notify_member_result,
+		port_num, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_bonding_notify_member_mode_string =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_notify_member_result,
+		mode, "enable#disable");
+
+static cmdline_parse_inst_t cmd_set_bonding_notify_member_ports = {
+	.f = cmd_set_bonding_notify_member_parsed,
+	.data = NULL,
+	.help_str = "set bonding notify_member (port_id) (enable|disable)",
+	.tokens = {
+		(void *)&cmd_set_bonding_notify_member_set,
+		(void *)&cmd_set_bonding_notify_member_bonding,
+		(void *)&cmd_set_bonding_notify_member,
+		(void *)&cmd_set_bonding_notify_member_portnum,
+		(void *)&cmd_set_bonding_notify_member_mode_string,
+		NULL
+	}
+};
+
+struct cmd_get_bonding_member_hw_create_result {
+	cmdline_fixed_string_t get;
+	cmdline_fixed_string_t bonding;
+	cmdline_fixed_string_t member;
+	cmdline_fixed_string_t firmware;
+	cmdline_fixed_string_t create;
+	uint16_t member_port_id;
+	uint16_t bonding_port_id;
+};
+
+static void
+cmd_get_bonding_member_hw_create_parsed(void *parsed_result,
+	__rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+	struct cmd_get_bonding_member_hw_create_result *res = parsed_result;
+	int ret;
+
+	ret = rte_eth_bond_fw_create_get(res->bonding_port_id, res->member_port_id);
+	if (ret == 0)
+		printf("Member port %u firmware creates bonding port %u successfully\n",
+			res->member_port_id, res->bonding_port_id);
+	else
+		printf("Failed to get status of member port %u firmware creating"
+			" bonding port %u, %d\n",
+			res->member_port_id, res->bonding_port_id, ret);
+}
+
+static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_get =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result,
+		get, "get");
+static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_bonding =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result,
+		bonding, "bonding");
+static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_member =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result,
+		member, "member");
+static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_firmware =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result,
+		create, "firmware");
+static cmdline_parse_token_string_t cmd_get_bonding_member_hw_create_create =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_bonding_member_hw_create_result,
+		create, "create");
+static cmdline_parse_token_num_t cmd_get_bonding_member_hw_create_memberportid =
+	TOKEN_NUM_INITIALIZER(struct cmd_get_bonding_member_hw_create_result,
+		member_port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_get_bonding_member_hw_create_bondingportid =
+	TOKEN_NUM_INITIALIZER(struct cmd_get_bonding_member_hw_create_result,
+		bonding_port_id, RTE_UINT16);
+
+static cmdline_parse_inst_t cmd_get_member_hw_create_bonding = {
+	.f = cmd_get_bonding_member_hw_create_parsed,
+	.data = NULL,
+	.help_str = "get bonding member firmware create (member_port_id) (bonding_port_id)",
+	.tokens = {
+		(void *)&cmd_get_bonding_member_hw_create_get,
+		(void *)&cmd_get_bonding_member_hw_create_bonding,
+		(void *)&cmd_get_bonding_member_hw_create_member,
+		(void *)&cmd_get_bonding_member_hw_create_firmware,
+		(void *)&cmd_get_bonding_member_hw_create_create,
+		(void *)&cmd_get_bonding_member_hw_create_memberportid,
+		(void *)&cmd_get_bonding_member_hw_create_bondingportid,
+		NULL
+	}
+};
+
 static struct testpmd_driver_commands bonding_cmds = {
 	.commands = {
 	{
@@ -749,6 +867,16 @@ 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_bonding_notify_member_ports,
+		"set bonding notify_member (port_id) (enable|disable)\n"
+		"	Enable/disable the notify member flag of bonding port\n",
+	},
+	{
+		&cmd_get_member_hw_create_bonding,
+		"get bonding member firmware create (member_port_id) (bonding_port_id)\n"
+		"	Get the status of member port firmware creating the bonding port\n",
+	},
 	{ NULL, NULL },
 	},
 };
-- 
2.39.1


  parent reply	other threads:[~2023-12-26  7:29 UTC|newest]

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

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20231226072824.3163121-7-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=james.hershaw@corigine.com \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    /path/to/YOUR_REPLY

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

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