From: Beilei Xing <beilei.xing@intel.com>
To: jingjing.wu@intel.com
Cc: dev@dpdk.org, andrey.chilikin@intel.com
Subject: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add configuration for input set
Date: Wed, 29 Nov 2017 17:43:11 +0800 [thread overview]
Message-ID: <1511948591-73251-3-git-send-email-beilei.xing@intel.com> (raw)
In-Reply-To: <1511948591-73251-1-git-send-email-beilei.xing@intel.com>
This patch adds command to configure input set for
RSS/flow director/flow director flexible payload.
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
app/test-pmd/cmdline.c | 232 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 232 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f71d963..2057dd5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -864,6 +864,15 @@ static void cmd_help_long_parsed(void *parsed_result,
"port config (port_id) pctype mapping update"
" (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n"
" Update a flow type to pctype mapping item on a port\n\n"
+
+ "port config (port_id) pctype (pctype_id) hash_inset|"
+ "fdir_inset|fdir_flx_inset get|set|clear field\n"
+ " (field_idx)\n"
+ " Configure RSS|FDIR|FDIR_FLX input set for some pctype\n\n"
+
+ "port config (port_id) pctype (pctype_id) hash_inset|"
+ "fdir_inset|fdir_flx_inset reset"
+ " Clear RSS|FDIR|FDIR_FLX input set completely for some pctype\n\n"
);
}
@@ -14652,6 +14661,227 @@ cmdline_parse_inst_t cmd_ddp_get_list = {
},
};
+/* Configure input set */
+struct cmd_cfg_input_set_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t cfg;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ uint8_t pctype_id;
+ cmdline_fixed_string_t inset_type;
+ cmdline_fixed_string_t opt;
+ cmdline_fixed_string_t field;
+ uint8_t field_idx;
+};
+
+static void
+cmd_cfg_input_set_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_cfg_input_set_result *res = parsed_result;
+#ifdef RTE_LIBRTE_I40E_PMD
+ enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
+ struct rte_pmd_i40e_inset inset;
+ int ret;
+#endif
+
+ if (res->port_id > nb_ports) {
+ printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
+ return;
+ }
+
+ if (!all_ports_stopped()) {
+ printf("Please stop all ports first\n");
+ return;
+ }
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (!strcmp(res->inset_type, "hash_inset"))
+ inset_type = INSET_HASH;
+ else if (!strcmp(res->inset_type, "fdir_inset"))
+ inset_type = INSET_FDIR;
+ else if (!strcmp(res->inset_type, "fdir_flx_inset"))
+ inset_type = INSET_FDIR_FLX;
+ ret = rte_pmd_i40e_inset_get(res->port_id, res->pctype_id,
+ &inset, inset_type);
+ if (ret) {
+ printf("Failed to get input set.\n");
+ return;
+ }
+
+ if (!strcmp(res->opt, "get")) {
+ ret = rte_pmd_i40e_inset_field_get(inset.inset,
+ res->field_idx);
+ if (ret)
+ printf("Field index %d is set.\n", res->field_idx);
+ else
+ printf("Field index %d is not set.\n", res->field_idx);
+ return;
+ } else if (!strcmp(res->opt, "set"))
+ ret = rte_pmd_i40e_inset_field_set(&inset.inset,
+ res->field_idx);
+ else if (!strcmp(res->opt, "clear"))
+ ret = rte_pmd_i40e_inset_field_clear(&inset.inset,
+ res->field_idx);
+ if (ret) {
+ printf("Failed to configure input set field.\n");
+ return;
+ }
+
+ ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
+ &inset, inset_type);
+ if (ret) {
+ printf("Failed to set input set.\n");
+ return;
+ }
+
+#endif
+}
+
+cmdline_parse_token_string_t cmd_cfg_input_set_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ port, "port");
+cmdline_parse_token_string_t cmd_cfg_input_set_cfg =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ cfg, "config");
+cmdline_parse_token_num_t cmd_cfg_input_set_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ port_id, UINT16);
+cmdline_parse_token_string_t cmd_cfg_input_set_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ pctype, "pctype");
+cmdline_parse_token_num_t cmd_cfg_input_set_pctype_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ pctype_id, UINT8);
+cmdline_parse_token_string_t cmd_cfg_input_set_inset_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ inset_type,
+ "hash_inset#fdir_inset#fdir_flx_inset");
+cmdline_parse_token_string_t cmd_cfg_input_set_opt =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ opt, "get#set#clear");
+cmdline_parse_token_string_t cmd_cfg_input_set_field =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ field, "field");
+cmdline_parse_token_num_t cmd_cfg_input_set_field_idx =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ field_idx, UINT8);
+
+cmdline_parse_inst_t cmd_cfg_input_set = {
+ .f = cmd_cfg_input_set_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype <pctype_id> hash_inset|"
+ "fdir_inset|fdir_flx_inset get|set|clear field <field_idx>",
+ .tokens = {
+ (void *)&cmd_cfg_input_set_port,
+ (void *)&cmd_cfg_input_set_cfg,
+ (void *)&cmd_cfg_input_set_port_id,
+ (void *)&cmd_cfg_input_set_pctype,
+ (void *)&cmd_cfg_input_set_pctype_id,
+ (void *)&cmd_cfg_input_set_inset_type,
+ (void *)&cmd_cfg_input_set_opt,
+ (void *)&cmd_cfg_input_set_field,
+ (void *)&cmd_cfg_input_set_field_idx,
+ NULL,
+ },
+};
+
+/* Reset input set */
+struct cmd_reset_input_set_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t cfg;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ uint8_t pctype_id;
+ cmdline_fixed_string_t inset_type;
+ cmdline_fixed_string_t reset;
+};
+
+static void
+cmd_reset_input_set_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_reset_input_set_result *res = parsed_result;
+#ifdef RTE_LIBRTE_I40E_PMD
+ enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
+ struct rte_pmd_i40e_inset inset;
+ int ret;
+#endif
+
+ if (res->port_id > nb_ports) {
+ printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
+ return;
+ }
+
+ if (!all_ports_stopped()) {
+ printf("Please stop all ports first\n");
+ return;
+ }
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (!strcmp(res->inset_type, "hash_inset"))
+ inset_type = INSET_HASH;
+ else if (!strcmp(res->inset_type, "fdir_inset"))
+ inset_type = INSET_FDIR;
+ else if (!strcmp(res->inset_type, "fdir_flx_inset"))
+ inset_type = INSET_FDIR_FLX;
+
+ memset(&inset, 0, sizeof(inset));
+
+ ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
+ &inset, inset_type);
+ if (ret) {
+ printf("Failed to set input set.\n");
+ return;
+ }
+
+#endif
+}
+
+cmdline_parse_token_string_t cmd_reset_input_set_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_reset_input_set_result,
+ port, "port");
+cmdline_parse_token_string_t cmd_reset_input_set_cfg =
+ TOKEN_STRING_INITIALIZER(struct cmd_reset_input_set_result,
+ cfg, "config");
+cmdline_parse_token_num_t cmd_reset_input_set_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_reset_input_set_result,
+ port_id, UINT16);
+cmdline_parse_token_string_t cmd_reset_input_set_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_reset_input_set_result,
+ pctype, "pctype");
+cmdline_parse_token_num_t cmd_reset_input_set_pctype_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_reset_input_set_result,
+ pctype_id, UINT8);
+cmdline_parse_token_string_t cmd_reset_input_set_inset_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_reset_input_set_result,
+ inset_type,
+ "hash_inset#fdir_inset#fdir_flx_inset");
+cmdline_parse_token_string_t cmd_reset_input_set_reset =
+ TOKEN_STRING_INITIALIZER(struct cmd_reset_input_set_result,
+ reset, "reset");
+
+cmdline_parse_inst_t cmd_reset_input_set = {
+ .f = cmd_reset_input_set_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype <pctype_id> hash_inset|"
+ "fdir_inset|fdir_flx_inset reset",
+ .tokens = {
+ (void *)&cmd_reset_input_set_port,
+ (void *)&cmd_reset_input_set_cfg,
+ (void *)&cmd_reset_input_set_port_id,
+ (void *)&cmd_reset_input_set_pctype,
+ (void *)&cmd_reset_input_set_pctype_id,
+ (void *)&cmd_reset_input_set_inset_type,
+ (void *)&cmd_reset_input_set_reset,
+ NULL,
+ },
+};
+
/* show vf stats */
/* Common result structure for show vf stats */
@@ -15737,6 +15967,8 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_ddp_del,
(cmdline_parse_inst_t *)&cmd_ddp_get_list,
(cmdline_parse_inst_t *)&cmd_ddp_get_info,
+ (cmdline_parse_inst_t *)&cmd_cfg_input_set,
+ (cmdline_parse_inst_t *)&cmd_reset_input_set,
(cmdline_parse_inst_t *)&cmd_show_vf_stats,
(cmdline_parse_inst_t *)&cmd_clear_vf_stats,
(cmdline_parse_inst_t *)&cmd_ptype_mapping_get,
--
2.5.5
next prev parent reply other threads:[~2017-11-29 9:42 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-24 14:59 [dpdk-dev] [PATCH 0/2] net/i40e: support input set configuration Beilei Xing
2017-11-24 14:59 ` [dpdk-dev] [PATCH 1/2] " Beilei Xing
2017-11-24 14:59 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add configuration for input set Beilei Xing
2017-11-27 7:16 ` [dpdk-dev] [PATCH v2 0/2] net/i40e: support input set configuration Beilei Xing
2017-11-27 7:16 ` [dpdk-dev] [PATCH v2 1/2] " Beilei Xing
2017-11-27 7:16 ` [dpdk-dev] [PATCH v2 2/2] app/testpmd: add configuration for input set Beilei Xing
2017-11-29 9:43 ` [dpdk-dev] [PATCH v3 0/2] net/i40e: support input set configuration Beilei Xing
2017-11-29 9:43 ` [dpdk-dev] [PATCH v3 1/2] " Beilei Xing
2017-11-29 9:43 ` Beilei Xing [this message]
2017-12-07 6:00 ` [dpdk-dev] [PATCH v4 0/2] " Beilei Xing
2017-12-07 6:00 ` [dpdk-dev] [PATCH v4 1/2] " Beilei Xing
2017-12-07 6:00 ` [dpdk-dev] [PATCH v4 2/2] app/testpmd: add configuration for input set Beilei Xing
2017-12-07 8:43 ` [dpdk-dev] [PATCH v5 0/2] net/i40e: support input set configuration Beilei Xing
2017-12-07 8:43 ` [dpdk-dev] [PATCH v5 1/2] " Beilei Xing
2017-12-07 8:43 ` [dpdk-dev] [PATCH v5 2/2] app/testpmd: add configuration for input set Beilei Xing
2017-12-08 7:51 ` [dpdk-dev] [PATCH v6 0/2] net/i40e: support input set configuration Beilei Xing
2017-12-08 7:51 ` [dpdk-dev] [PATCH v6 1/2] " Beilei Xing
2018-01-02 12:48 ` Zhang, Qi Z
2017-12-08 7:51 ` [dpdk-dev] [PATCH v6 2/2] app/testpmd: add configuration for input set Beilei Xing
2018-01-04 6:51 ` Lu, Wenzhuo
2018-01-05 3:03 ` [dpdk-dev] [PATCH v7 0/2] support input set configuration Beilei Xing
2018-01-05 3:03 ` [dpdk-dev] [PATCH v7 1/2] net/i40e: " Beilei Xing
2018-01-05 3:03 ` [dpdk-dev] [PATCH v7 2/2] app/testpmd: add configuration for input set Beilei Xing
2018-01-08 3:09 ` [dpdk-dev] [PATCH v8 0/2] support input set configuration Beilei Xing
2018-01-08 3:09 ` [dpdk-dev] [PATCH v8 1/2] net/i40e: " Beilei Xing
2018-01-10 12:12 ` Ferruh Yigit
2018-01-10 12:40 ` Xing, Beilei
2018-01-08 3:09 ` [dpdk-dev] [PATCH v8 2/2] app/testpmd: add configuration for input set Beilei Xing
2018-01-08 3:18 ` Lu, Wenzhuo
2018-01-09 7:44 ` [dpdk-dev] [PATCH v8 0/2] support input set configuration Zhang, Helin
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=1511948591-73251-3-git-send-email-beilei.xing@intel.com \
--to=beilei.xing@intel.com \
--cc=andrey.chilikin@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.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).