DPDK patches and discussions
 help / color / mirror / Atom feed
From: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
To: declan.doherty@intel.com
Cc: dev@dpdk.org, Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: add support for different aggregation mode in IEEE802.3ad bonding
Date: Fri, 26 May 2017 16:35:28 +0200	[thread overview]
Message-ID: <20170526143528.16533-3-danielx.t.mrzyglod@intel.com> (raw)
In-Reply-To: <20170526143528.16533-1-danielx.t.mrzyglod@intel.com>

This patch add support for different aggregator modes in similar manner
that is provided in linux kernel.

testpmd> set bonding agg_mode <port_id> <agg_name>
testpmd> show bonding config <port_id>

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 app/test-pmd/cmdline.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 89 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0afac68..11a3000 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -87,6 +87,7 @@
 #include <cmdline.h>
 #ifdef RTE_LIBRTE_PMD_BOND
 #include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
 #endif
 #ifdef RTE_LIBRTE_IXGBE_PMD
 #include <rte_pmd_ixgbe.h>
@@ -4359,7 +4360,7 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 		__attribute__((unused)) void *data)
 {
 	struct cmd_show_bonding_config_result *res = parsed_result;
-	int bonding_mode;
+	int bonding_mode, agg_mode;
 	uint8_t slaves[RTE_MAX_ETHPORTS];
 	int num_slaves, num_active_slaves;
 	int primary_id;
@@ -4400,6 +4401,23 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 		}
 	}
 
+	if (bonding_mode == BONDING_MODE_8023AD) {
+		agg_mode = rte_eth_bond_8023ad_agg_selection_get(port_id);
+		printf("\t802.11AD Aggregator Mode: ");
+		switch (agg_mode) {
+		case AGG_BANDWIDTH:
+			printf("bandwidth");
+			break;
+		case AGG_STABLE:
+			printf("stable");
+			break;
+		case AGG_COUNT:
+			printf("count");
+			break;
+		}
+		printf("\n");
+	}
+
 	num_slaves = rte_eth_bond_slaves_get(port_id, slaves, RTE_MAX_ETHPORTS);
 
 	if (num_slaves < 0) {
@@ -4832,6 +4850,75 @@ cmdline_parse_inst_t cmd_set_bond_mon_period = {
 		}
 };
 
+
+
+struct cmd_set_bonding_agg_mode_policy_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t bonding;
+	cmdline_fixed_string_t agg_mode;
+	uint8_t port_num;
+	cmdline_fixed_string_t policy;
+};
+
+
+static void
+cmd_set_bonding_agg_mode(void *parsed_result,
+		__attribute__((unused)) struct cmdline *cl,
+		__attribute__((unused)) void *data)
+{
+	struct cmd_set_bonding_agg_mode_policy_result *res = parsed_result;
+	uint8_t policy = AGG_BANDWIDTH;
+
+	if (res->port_num >= nb_ports) {
+		printf("Port id %d must be less than %d\n", res->port_num, nb_ports);
+		return;
+	}
+
+	if (!strcmp(res->policy, "bandwidth"))
+		policy = AGG_BANDWIDTH;
+	else if (!strcmp(res->policy, "stable"))
+		policy = AGG_STABLE;
+	else if (!strcmp(res->policy, "count"))
+		policy = AGG_COUNT;
+
+	rte_eth_bond_8023ad_agg_selection_set(res->port_num, policy);
+}
+
+
+cmdline_parse_token_string_t cmd_set_bonding_agg_mode_set =
+		TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_agg_mode_policy_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_set_bonding_agg_mode_bonding =
+		TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_agg_mode_policy_result,
+				bonding, "bonding");
+
+cmdline_parse_token_string_t cmd_set_bonding_agg_mode_agg_mode =
+		TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_agg_mode_policy_result,
+				agg_mode, "agg_mode");
+
+cmdline_parse_token_num_t cmd_set_bonding_agg_mode_portnum =
+		TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_agg_mode_policy_result,
+				port_num, UINT8);
+
+cmdline_parse_token_string_t cmd_set_bonding_agg_mode_policy_string =
+TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_balance_xmit_policy_result,
+		policy, "stable#bandwidth#count");
+
+cmdline_parse_inst_t cmd_set_bonding_agg_mode_policy = {
+		.f = cmd_set_bonding_agg_mode,
+		.data = (void *) 0,
+		.help_str = "set bonding mode802.11 aggregator policy <port_id> <agg_name>",
+		.tokens = {
+				(void *)&cmd_set_bonding_agg_mode_set,
+				(void *)&cmd_set_bonding_agg_mode_bonding,
+				(void *)&cmd_set_bonding_agg_mode_agg_mode,
+				(void *)&cmd_set_bonding_agg_mode_portnum,
+				(void *)&cmd_set_bonding_agg_mode_policy_string,
+				NULL
+		}
+};
+
+
 #endif /* RTE_LIBRTE_PMD_BOND */
 
 /* *** SET FORWARDING MODE *** */
@@ -13613,6 +13700,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *) &cmd_set_bond_mac_addr,
 	(cmdline_parse_inst_t *) &cmd_set_balance_xmit_policy,
 	(cmdline_parse_inst_t *) &cmd_set_bond_mon_period,
+	(cmdline_parse_inst_t *) &cmd_set_bonding_agg_mode_policy,
 #endif
 	(cmdline_parse_inst_t *)&cmd_vlan_offload,
 	(cmdline_parse_inst_t *)&cmd_vlan_tpid,
-- 
2.9.4

  parent reply	other threads:[~2017-05-26 14:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 14:35 [dpdk-dev] [PATCH 0/2] Bonding add additional aggregators mode for 802.3AD Daniel Mrzyglod
2017-05-26 14:35 ` [dpdk-dev] [PATCH 1/2] drivers/bonding: add other agg selection modes for mode4 Daniel Mrzyglod
2017-05-26 14:35 ` Daniel Mrzyglod [this message]
2017-06-20  2:18   ` [dpdk-dev] [PATCH 2/2] app/testpmd: add support for different aggregation mode in IEEE802.3ad bonding Wu, Jingjing
2017-07-19 14:31 ` [dpdk-dev] [PATCH v2 0/3] Bonding add additional aggregators mode for 802.3AD Daniel Mrzyglod
2017-07-19 14:31   ` [dpdk-dev] [PATCH v2 1/3] drivers/bonding: add other agg selection modes Daniel Mrzyglod
2017-07-19 15:04     ` Declan Doherty
2017-07-19 15:13   ` [dpdk-dev] [PATCH v2 0/3] Bonding add additional aggregators mode for 802.3AD Ferruh Yigit
2017-07-19 14:46 ` [dpdk-dev] [PATCH v2 2/3] testpmd: add cmndlines to support different aggregation modes Daniel Mrzyglod
2017-07-19 15:06   ` Declan Doherty
2017-07-19 15:17   ` Ferruh Yigit
2017-07-19 14:54 ` [dpdk-dev] [PATCH v2 3/3] test/bonding: add test case for agg selection in mode4 Daniel Mrzyglod
2017-07-19 15:07   ` Declan Doherty

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=20170526143528.16533-3-danielx.t.mrzyglod@intel.com \
    --to=danielx.t.mrzyglod@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    /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).