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. Example: testpmd> create bonded device 4 0 testpmd> add bonding slave 0 <bond_id> testpmd> add bonding slave 1 <bond_id> testpmd> set bonding slow_queue <bond_id> [sw|hw] testpmd> port start <bond_id> Signed-off-by: Tomasz Kulasek <tomaszx.kula...@intel.com> --- v2 changes: - changed name of rte_eth_bond_8023ad_slow_queue_enable/disable to rte_eth_bond_8023ad_slow_pkt_hw_filter_enable/disable, - added "set bonding slow_queue <port_id> [sw|hw]" description in documentation --- app/test-pmd/cmdline.c | 75 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 +++ 2 files changed, 83 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 632d6f0..194d986 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> @@ -4300,6 +4301,79 @@ 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; + struct rte_port *port; + + port = &ports[port_id]; + + /** Check if the port is not started **/ + if (port->port_status != RTE_PORT_STOPPED) { + printf("Please stop port %d first\n", port_id); + return; + } + + if (!strcmp(res->mode, "hw")) { + if (rte_eth_bond_8023ad_slow_pkt_hw_filter_enable(port_id) == 0) + printf("Hardware slow queue enabled\n"); + else + printf("Enabling hardware slow queue on port %d " + "failed\n", port_id); + } else if (!strcmp(res->mode, "sw")) { + if (rte_eth_bond_8023ad_slow_pkt_hw_filter_disable(port_id) + == 0) + printf("Software slow queue enabled\n"); + else + printf("Enabling software slow queue on port %d " + "failed\n", 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; @@ -13846,6 +13920,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, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 18ee8a3..3da2a38 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1759,6 +1759,14 @@ For example, to set the link status monitoring polling period of bonded device ( testpmd> set bonding mon_period 5 150 +set bonding slow_queue +~~~~~~~~~~~~~~~~~~~~~~ + +Set software or hardware slow packet processing in mode 4. + + testpmd> set bonding slow_queue (port_id) (sw|hw) + + show bonding config ~~~~~~~~~~~~~~~~~~~ -- 1.9.1