From patchwork Fri Sep 29 08:11:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao1, Wei" X-Patchwork-Id: 29420 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7DA511B1EB; Fri, 29 Sep 2017 10:23:06 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 38B501B1AD for ; Fri, 29 Sep 2017 10:23:00 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 29 Sep 2017 01:22:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,451,1500966000"; d="scan'208";a="317605448" Received: from dpdk4.bj.intel.com ([172.16.182.85]) by fmsmga004.fm.intel.com with ESMTP; 29 Sep 2017 01:22:58 -0700 From: Wei Zhao To: dev@dpdk.org Cc: Wei Zhao Date: Fri, 29 Sep 2017 16:11:57 +0800 Message-Id: <1506672718-39160-2-git-send-email-wei.zhao1@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506672718-39160-1-git-send-email-wei.zhao1@intel.com> References: <1506653786-28970-1-git-send-email-wei.zhao1@intel.com> <1506672718-39160-1-git-send-email-wei.zhao1@intel.com> Subject: [dpdk-dev] [PATCH v6] app/testpmd: add API for configuration of queue region X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used. Aslo add a document for these new commands. Queue region only support PF by now, so this document is only for configuration of queue region on PF port. Signed-off-by: Wei Zhao --- app/test-pmd/cmdline.c | 389 ++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 41 +++ 2 files changed, 430 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 4f2d731..da7dc24 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -637,6 +637,24 @@ static void cmd_help_long_parsed(void *parsed_result, "ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n" " Update a ptype mapping item on a port\n\n" + "set port (port_id) queue-region region_id (value) " + "queue_start_index (value) queue_num (value)\n" + " Set a queue region on a port\n\n" + + "set port (port_id) queue-region region_id (value) " + "flowtype (value)\n" + " Set a flowtype region index on a port\n\n" + + "set port (port_id) queue-region UP (value) region_id (value)\n" + " Set the mapping of User Priority to " + "queue region on a port\n\n" + + "flush port (port_id) queue-region (on|off)\n" + " flush all queue region related configuration\n\n" + + "get port (port_id) queue-region\n" + " get all queue region related configuration info\n\n" + , list_pkt_forwarding_modes() ); } @@ -8228,6 +8246,372 @@ cmdline_parse_inst_t cmd_syn_filter = { NULL, }, }; +/* *** queue region set *** */ +struct cmd_queue_region_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t port; + uint8_t port_id; + cmdline_fixed_string_t cmd; + cmdline_fixed_string_t region; + uint8_t region_id; + cmdline_fixed_string_t queue_start_index; + uint8_t queue_id; + cmdline_fixed_string_t queue_num; + uint8_t queue_num_value; +}; + +static void +cmd_queue_region_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_queue_region_result *res = parsed_result; + int ret = 0; +#ifdef RTE_LIBRTE_I40E_PMD + struct rte_i40e_rss_region_conf region_conf; + + memset(®ion_conf, 0, sizeof(region_conf)); + region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET; + region_conf.region_id = res->region_id; + region_conf.queue_num = res->queue_num_value; + region_conf.queue_start_index = res->queue_id; + + ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, ®ion_conf); +#endif + + if (ret < 0) + printf("queue region config programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_token_string_t cmd_queue_region_set = +TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, + set, "set"); +cmdline_parse_token_string_t cmd_queue_region_port = + TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port"); +cmdline_parse_token_num_t cmd_queue_region_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result, + port_id, UINT8); +cmdline_parse_token_string_t cmd_queue_region_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, + cmd, "queue-region"); +cmdline_parse_token_string_t cmd_queue_region_id = + TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, + region, "region_id"); +cmdline_parse_token_num_t cmd_queue_region_index = + TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result, + region_id, UINT8); +cmdline_parse_token_string_t cmd_queue_region_queue_start_index = + TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, + queue_start_index, "queue_start_index"); +cmdline_parse_token_num_t cmd_queue_region_queue_id = + TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result, + queue_id, UINT8); +cmdline_parse_token_string_t cmd_queue_region_queue_num = + TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, + queue_num, "queue_num"); +cmdline_parse_token_num_t cmd_queue_region_queue_num_value = + TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result, + queue_num_value, UINT8); + +cmdline_parse_inst_t cmd_queue_region = { + .f = cmd_queue_region_parsed, + .data = NULL, + .help_str = "set port queue-region region_id " + "queue_start_index queue_num : Set a queue region", + .tokens = { + (void *)&cmd_queue_region_set, + (void *)&cmd_queue_region_port, + (void *)&cmd_queue_region_port_id, + (void *)&cmd_queue_region_cmd, + (void *)&cmd_queue_region_id, + (void *)&cmd_queue_region_index, + (void *)&cmd_queue_region_queue_start_index, + (void *)&cmd_queue_region_queue_id, + (void *)&cmd_queue_region_queue_num, + (void *)&cmd_queue_region_queue_num_value, + NULL, + }, +}; + +/* *** queue region and flowtype set *** */ +struct cmd_region_flowtype_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t port; + uint8_t port_id; + cmdline_fixed_string_t cmd; + cmdline_fixed_string_t region; + uint8_t region_id; + cmdline_fixed_string_t flowtype; + uint8_t flowtype_id; +}; + +static void +cmd_region_flowtype_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_region_flowtype_result *res = parsed_result; + int ret = 0; +#ifdef RTE_LIBRTE_I40E_PMD + struct rte_i40e_rss_region_conf region_conf; + + memset(®ion_conf, 0, sizeof(region_conf)); + + region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_SET; + region_conf.region_id = res->region_id; + region_conf.hw_flowtype = res->flowtype_id; + + ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, ®ion_conf); +#endif + + if (ret < 0) + printf("region flowtype config programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_token_string_t cmd_region_flowtype_set = +TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result, + set, "set"); +cmdline_parse_token_string_t cmd_region_flowtype_port = + TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result, + port, "port"); +cmdline_parse_token_num_t cmd_region_flowtype_port_index = + TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result, + port_id, UINT8); +cmdline_parse_token_string_t cmd_region_flowtype_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result, + cmd, "queue-region"); +cmdline_parse_token_string_t cmd_region_flowtype_index = + TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result, + region, "region_id"); +cmdline_parse_token_num_t cmd_region_flowtype_id = + TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result, + region_id, UINT8); +cmdline_parse_token_string_t cmd_region_flowtype_flow_index = + TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result, + flowtype, "flowtype"); +cmdline_parse_token_num_t cmd_region_flowtype_flow_id = + TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result, + flowtype_id, UINT8); +cmdline_parse_inst_t cmd_region_flowtype = { + .f = cmd_region_flowtype_parsed, + .data = NULL, + .help_str = "set port queue-region region_id " + "flowtype : Set a flowtype region index", + .tokens = { + (void *)&cmd_region_flowtype_set, + (void *)&cmd_region_flowtype_port, + (void *)&cmd_region_flowtype_port_index, + (void *)&cmd_region_flowtype_cmd, + (void *)&cmd_region_flowtype_index, + (void *)&cmd_region_flowtype_id, + (void *)&cmd_region_flowtype_flow_index, + (void *)&cmd_region_flowtype_flow_id, + NULL, + }, +}; + +/* *** User Priority (UP) to queue region (region_id) set *** */ +struct cmd_user_priority_region_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t port; + uint8_t port_id; + cmdline_fixed_string_t cmd; + cmdline_fixed_string_t user_priority; + uint8_t user_priority_id; + cmdline_fixed_string_t region; + uint8_t region_id; +}; + +static void +cmd_user_priority_region_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct rte_i40e_rss_region_conf region_conf; + int ret = 0; +#ifdef RTE_LIBRTE_I40E_PMD + struct cmd_user_priority_region_result *res = parsed_result; + + memset(®ion_conf, 0, sizeof(region_conf)); + region_conf.op = RTE_PMD_I40E_USER_PRIORITY_REGION_SET; + region_conf.user_priority = res->user_priority_id; + region_conf.region_id = res->region_id; + + ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, ®ion_conf); +#endif + + if (ret < 0) + printf("user_priority region config programming " + "error: (%s)\n", strerror(-ret)); +} + +cmdline_parse_token_string_t cmd_user_priority_region_set = +TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result, + set, "set"); +cmdline_parse_token_string_t cmd_user_priority_region_port = + TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result, + port, "port"); +cmdline_parse_token_num_t cmd_user_priority_region_port_index = + TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result, + port_id, UINT8); +cmdline_parse_token_string_t cmd_user_priority_region_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result, + cmd, "queue-region"); +cmdline_parse_token_string_t cmd_user_priority_region_UP = + TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result, + user_priority, "UP"); +cmdline_parse_token_num_t cmd_user_priority_region_UP_id = + TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result, + user_priority_id, UINT8); +cmdline_parse_token_string_t cmd_user_priority_region_region = + TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result, + region, "region_id"); +cmdline_parse_token_num_t cmd_user_priority_region_region_id = + TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result, + region_id, UINT8); + +cmdline_parse_inst_t cmd_user_priority_region = { + .f = cmd_user_priority_region_parsed, + .data = NULL, + .help_str = "set port queue-region UP " + "region_id : Set the mapping of User Priority (UP) " + "to queue region (region_id) ", + .tokens = { + (void *)&cmd_user_priority_region_set, + (void *)&cmd_user_priority_region_port, + (void *)&cmd_user_priority_region_port_index, + (void *)&cmd_user_priority_region_cmd, + (void *)&cmd_user_priority_region_UP, + (void *)&cmd_user_priority_region_UP_id, + (void *)&cmd_user_priority_region_region, + (void *)&cmd_user_priority_region_region_id, + NULL, + }, +}; + +/* *** flush all queue region related configuration *** */ +struct cmd_flush_queue_region_result { + cmdline_fixed_string_t flush; + cmdline_fixed_string_t port; + uint8_t port_id; + cmdline_fixed_string_t cmd; + cmdline_fixed_string_t what; +}; + +static void +cmd_flush_queue_region_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_flush_queue_region_result *res = parsed_result; + int ret = 0; +#ifdef RTE_LIBRTE_I40E_PMD + struct rte_i40e_rss_region_conf region_conf; + + memset(®ion_conf, 0, sizeof(region_conf)); + + if (strcmp(res->what, "on") == 0) + region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON; + else + region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF; + + ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, ®ion_conf); +#endif + + if (ret < 0) + printf("queue region config flush error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_token_string_t cmd_flush_queue_region_flush = +TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result, + flush, "flush"); +cmdline_parse_token_string_t cmd_flush_queue_region_port = + TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result, + port, "port"); +cmdline_parse_token_num_t cmd_flush_queue_region_port_index = + TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result, + port_id, UINT8); +cmdline_parse_token_string_t cmd_flush_queue_region_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result, + cmd, "queue-region"); +cmdline_parse_token_string_t cmd_flush_queue_region_what = +TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result, + what, "on#off"); + +cmdline_parse_inst_t cmd_flush_queue_region = { + .f = cmd_flush_queue_region_parsed, + .data = NULL, + .help_str = "flush port queue-region on|off" + ": flush all queue region related configuration", + .tokens = { + (void *)&cmd_flush_queue_region_flush, + (void *)&cmd_flush_queue_region_port, + (void *)&cmd_flush_queue_region_port_index, + (void *)&cmd_flush_queue_region_cmd, + (void *)&cmd_flush_queue_region_what, + NULL, + }, +}; + +/* *** get all queue region related configuration info *** */ +struct cmd_get_queue_region_info { + cmdline_fixed_string_t get; + cmdline_fixed_string_t port; + uint8_t port_id; + cmdline_fixed_string_t cmd; +}; + +static void +cmd_get_queue_region_info_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_get_queue_region_info *res = parsed_result; + int ret = 0; +#ifdef RTE_LIBRTE_I40E_PMD + struct rte_i40e_rss_region_conf region_conf; + + memset(®ion_conf, 0, sizeof(region_conf)); + + region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET; + + ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, ®ion_conf); +#endif + + if (ret < 0) + printf("queue region config info get error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_token_string_t cmd_get_queue_region_info_get = +TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info, + get, "get"); +cmdline_parse_token_string_t cmd_get_queue_region_info_port = + TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info, + port, "port"); +cmdline_parse_token_num_t cmd_get_queue_region_info_port_index = + TOKEN_NUM_INITIALIZER(struct cmd_get_queue_region_info, + port_id, UINT8); +cmdline_parse_token_string_t cmd_get_queue_region_info_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info, + cmd, "queue-region"); + +cmdline_parse_inst_t cmd_get_queue_region_info_all = { + .f = cmd_get_queue_region_info_parsed, + .data = NULL, + .help_str = "get port queue-region" + ": get all queue region related configuration info", + .tokens = { + (void *)&cmd_get_queue_region_info_get, + (void *)&cmd_get_queue_region_info_port, + (void *)&cmd_get_queue_region_info_port_index, + (void *)&cmd_get_queue_region_info_cmd, + NULL, + }, +}; /* *** ADD/REMOVE A 2tuple FILTER *** */ struct cmd_2tuple_filter_result { @@ -14391,6 +14775,11 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_ptype_mapping_replace, (cmdline_parse_inst_t *)&cmd_ptype_mapping_reset, (cmdline_parse_inst_t *)&cmd_ptype_mapping_update, + (cmdline_parse_inst_t *)&cmd_queue_region, + (cmdline_parse_inst_t *)&cmd_region_flowtype, + (cmdline_parse_inst_t *)&cmd_user_priority_region, + (cmdline_parse_inst_t *)&cmd_flush_queue_region, + (cmdline_parse_inst_t *)&cmd_get_queue_region_info_all, NULL, }; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 2ed62f5..2dffa8f 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -842,6 +842,47 @@ Where: Check the NIC Datasheet for hardware limits. +RSS queue region +~~~~~~~~~~~~~~~~ + +Set RSS queue region span on a port:: + + testpmd> set port (port_id) queue-region region_id (value) \ + queue_start_index (value) queue_num (value) + +Set flowtype mapping on a RSS queue region on a port:: + + testpmd> set port (port_id) queue-region region_id (value) flowtype (value) + +where: + +* For the flowtype(pctype) of packet,the specific index for each type has + been defined in file i40e_type.h as enum i40e_filter_pctype. + +Set user priority mapping on a RSS queue region on a port:: + + testpmd> set port (port_id) queue-region UP (value) region_id (value) + +Flush all queue region related configuration on a port:: + + testpmd> flush port (port_id) queue-region (on|off) + +where: +* "on"is just an enable function which server for other configuration, + it is for all configuration about queue region from up layer, + at first will only keep in DPDK softwarestored in driver, + only after "flush on", it commit all configuration to HW. + "off" is just clean all configuration about queue region just now, + and restore all to DPDK i40e driver default config when start up. + +Get all queue region related configuration info on a port:: + + testpmd> get port (port_id) queue-region + +.. note:: +Queue region only support on PF by now, so these command is +only for configuration of queue region on PF port. + csum parse-tunnel ~~~~~~~~~~~~~~~~~