[dpdk-dev] [PATCH 2/2] test-pmd: add set bonding slow_queue hw/sw

Tomasz Kulasek tomaszx.kulasek at intel.com
Sat May 27 13:27:44 CEST 2017


This patch adds new command:

    set bonding slow_queue <port_id> sw|hw

"set bonding slow_queue <bonding_port_id> hw" sets hardware management
of slow packets and chooses simplified paths for tx/rx bursts.

"set bonding slow_queue <bonding_port_id> sw" turns back to the software
handling of slow packets. This option is default.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek at intel.com>
---
 app/test-pmd/cmdline.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0afac68..11fa4a5 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>
@@ -4279,6 +4280,62 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result,
 		}
 };
 
+/* *** SET BONDING SLOW_QUEUE SW/HW *** */
+struct cmd_set_bonding_slow_queue_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t bonding;
+	cmdline_fixed_string_t slow_queue;
+	uint8_t port_id;
+	cmdline_fixed_string_t mode;
+};
+
+static void cmd_set_bonding_slow_queue_parsed(void *parsed_result,
+		__attribute__((unused))  struct cmdline *cl,
+		__attribute__((unused)) void *data)
+{
+	struct cmd_set_bonding_slow_queue_result *res = parsed_result;
+	portid_t port_id = res->port_id;
+
+	if (!strcmp(res->mode, "hw")) {
+		rte_eth_bond_8023ad_slow_queue_enable(port_id);
+		printf("Hardware slow queue enabled\n");
+	} else if (!strcmp(res->mode, "sw")) {
+		rte_eth_bond_8023ad_slow_queue_disable(port_id);
+	}
+}
+
+cmdline_parse_token_string_t cmd_setbonding_slow_queue_set =
+TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_slow_queue_result,
+		set, "set");
+cmdline_parse_token_string_t cmd_setbonding_slow_queue_bonding =
+TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_slow_queue_result,
+		bonding, "bonding");
+cmdline_parse_token_string_t cmd_setbonding_slow_queue_slow_queue =
+TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_slow_queue_result,
+		slow_queue, "slow_queue");
+cmdline_parse_token_num_t cmd_setbonding_slow_queue_port =
+TOKEN_NUM_INITIALIZER(struct cmd_set_bonding_slow_queue_result,
+		port_id, UINT8);
+cmdline_parse_token_string_t cmd_setbonding_slow_queue_mode =
+TOKEN_STRING_INITIALIZER(struct cmd_set_bonding_slow_queue_result,
+		mode, "sw#hw");
+
+cmdline_parse_inst_t cmd_set_slow_queue = {
+		.f = cmd_set_bonding_slow_queue_parsed,
+		.help_str = "set bonding slow_queue <port_id> "
+			"sw|hw: "
+			"Set the bonding slow queue acceleration for port_id",
+		.data = NULL,
+		.tokens = {
+				(void *)&cmd_setbonding_slow_queue_set,
+				(void *)&cmd_setbonding_slow_queue_bonding,
+				(void *)&cmd_setbonding_slow_queue_slow_queue,
+				(void *)&cmd_setbonding_slow_queue_port,
+				(void *)&cmd_setbonding_slow_queue_mode,
+				NULL
+		}
+};
+
 /* *** SET BALANCE XMIT POLICY *** */
 struct cmd_set_bonding_balance_xmit_policy_result {
 	cmdline_fixed_string_t set;
@@ -13613,6 +13670,7 @@ struct cmd_cmdfile_result {
 	(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_slow_queue,
 #endif
 	(cmdline_parse_inst_t *)&cmd_vlan_offload,
 	(cmdline_parse_inst_t *)&cmd_vlan_tpid,
-- 
1.9.1



More information about the dev mailing list