Skip to contentSkip to conversation

net/i40e: API to configure queue regions for RSS

PATCH In review Wei Zhao 5 participants 87 messages Aug 24, 2017 – Oct 19, 2017 Network drivers Page 2 of 2

lore
Share & tools
lore
author
#57 lore raw

PATCH v6 1/1 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

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.

---
 app/test-pmd/cmdline.c                      | 389 ++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 2 files changed, 430 insertions(+)
app/test-pmd/cmdline.c +389 -0
index 4f2d731..da7dc24 100644
@@ -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(&region_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, &region_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 <port_id> queue-region region_id <value> "
+		"queue_start_index <value> queue_num <value>: 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(&region_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, &region_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 <port_id> queue-region region_id <value> "
+		"flowtype <value>: 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(&region_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, &region_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 <port_id> queue-region UP <value> "
+		"region_id <value>: 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(&region_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, &region_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 <port_id> 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(&region_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, &region_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 <port_id> 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,
 };
 
doc/guides/testpmd_app_ug/testpmd_funcs.rst +41 -0

47 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#58 lore raw

PATCH v6 1/1 net/i40e: queue region set and flush

In reply to Wei Zhao

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 520 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 641 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +21 -6
index 720f067..9a67b6d 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -309,7 +305,6 @@ static int i40e_pf_parameter_init(struct rte_eth_dev *dev);
 static int i40e_pf_setup(struct i40e_pf *pf);
 static int i40e_dev_rxtx_init(struct i40e_pf *pf);
 static int i40e_vmdq_setup(struct rte_eth_dev *dev);
-static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
 static int i40e_dcb_setup(struct rte_eth_dev *dev);
 static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
 		bool offset_loaded, uint64_t *offset, uint64_t *stat);
@@ -1036,6 +1031,20 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i;
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1311,6 +1320,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+		/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -2123,6 +2135,9 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
+	/* Remove all the queue region configuration */
+	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+
 	hw->adapter_stopped = 1;
 }
 
@@ -10419,7 +10434,7 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
  *
  * Returns 0 on success, negative value on failure
  */
-static int
+int
 i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
drivers/net/i40e/i40e_ethdev.h +39 -0
index ad80f0f..3d237cd 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +547,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +810,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1038,10 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
+int i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+		struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on);
+void i40e_init_queue_region_conf(struct rte_eth_dev *dev);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +520 -0

529 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +60 -0

76 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..29d6b74 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_rss_queue_region_conf;
 
 } DPDK_17.08;
Signature · 1 line
2.7.4
#59 lore raw

Re: [PATCH v6] net/i40e: queue region set and flush

Quoted 71 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Friday, September 29, 2017 4:12 PM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v6] net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 520
++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 641 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +0 -4
index 720f067..9a67b6d 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -309,7 +305,6 @@ static int i40e_pf_parameter_init(struct rte_eth_dev
 *dev);  static int i40e_pf_setup(struct i40e_pf *pf);  static int

i40e_dev_rxtx_init(struct i40e_pf *pf); static int i40e_vmdq_setup(struct rte_eth_dev *dev); -static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb); static int i40e_dcb_setup(struct rte_eth_dev *dev); static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
bool offset_loaded, uint64_t *offset, uint64_t *stat); @@ -
1036,6 +1031,20 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)

drivers/net/i40e/i40e_ethdev.c +3 -0
 	return ret;
 }
 
+void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev) {
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
Quoted 1 line

dev_private);

drivers/net/i40e/i40e_ethdev.c +1 -0
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-
Quoted 1 line

dev_private);

drivers/net/i40e/i40e_ethdev.c +8 -0
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i;
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info)); }
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)  { @@ -1311,6 +1320,9 @@

eth_i40e_dev_init(struct rte_eth_dev *dev)

drivers/net/i40e/i40e_ethdev.c eth_i40e_dev_init(struct rte_eth_dev *dev) · line 1323

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +1 -0
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+		/* initialize queue region configuration */

Indent too much.

[......]

Quoted 13 lines
drivers/net/i40e/i40e_ethdev.c +13 -0
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	int32_t ret = -EINVAL;
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_DRV_LOG(ERR, "there is no that region id been set
Quoted 1 line

before");

How about "No queue region has been set"?
[......]

drivers/net/i40e/i40e_ethdev.c

Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +7 -0
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_SET,   /**< add pf region pctype

set */

drivers/net/i40e/i40e_ethdev.c +1 -0
+	/*** add queue region user priority set */

"***" -> "**"

Quoted 24 lines
drivers/net/i40e/i40e_ethdev.c +19 -0
+	RTE_PMD_I40E_USER_PRIORITY_REGION_SET,
+	/**
+	 * 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.
+	 * Because PMD had to set hardware configuration at a time, so
+	 * it will record all up layer command at first.
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON,
+	/**
+	 * "FLUSH_OFF " is just clean all configuration about queue
+	 * region just now, and restore all to DPDK i40e driver default
+	 * config when start up.
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF,
+	RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET,
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +173,27 @@ struct rte_pmd_i40e_ptype_mapping {  };
 

drivers/net/i40e/i40e_ethdev.c struct rte_pmd_i40e_ptype_mapping { }; · line 183

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +9 -0
 /**
+ * Queue region related information.
+ */
+struct rte_i40e_rss_region_conf {
+	/**< the region id for this configuration */
+	uint8_t region_id;
+	/**< the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */

Please change "/**<" to "/**", and please check all comments!!!

drivers/net/i40e/i40e_ethdev.c struct rte_pmd_i40e_ptype_mapping { }; · line 194

Quoted 11 lines
drivers/net/i40e/i40e_ethdev.c +11 -0
+	uint8_t hw_flowtype;
+	/**< the start queue index for this region */
+	uint8_t queue_start_index;
+	/**< the total queue number of this queue region */
+	uint8_t queue_num;
+	/**< the packet's user priority for this region */
+	uint8_t user_priority;
+	 /**< Option types of queue region */
+	enum rte_pmd_i40e_queue_region_op op;
+};
+

Thanks
Jingjing

author
#60 lore raw

v7 cover net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

v5:
-fix patchcheck warning.
-add port id check.

v6:
-split this patch set into 2 patch.

v7:
-change some PMD_DRV_LOG log.

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

 app/test-pmd/cmdline.c                      | 389 +++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 drivers/net/i40e/i40e_ethdev.c              |  27 +-
 drivers/net/i40e/i40e_ethdev.h              |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c             | 520 ++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h             |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |   1 +
 7 files changed, 1071 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
author
#61 lore raw

PATCH v7 1/2 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 520 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 641 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +21 -6
index 720f067..03511f1 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -309,7 +305,6 @@ static int i40e_pf_parameter_init(struct rte_eth_dev *dev);
 static int i40e_pf_setup(struct i40e_pf *pf);
 static int i40e_dev_rxtx_init(struct i40e_pf *pf);
 static int i40e_vmdq_setup(struct rte_eth_dev *dev);
-static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
 static int i40e_dcb_setup(struct rte_eth_dev *dev);
 static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
 		bool offset_loaded, uint64_t *offset, uint64_t *stat);
@@ -1036,6 +1031,20 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i;
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1311,6 +1320,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -2123,6 +2135,9 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
+	/* Remove all the queue region configuration */
+	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+
 	hw->adapter_stopped = 1;
 }
 
@@ -10419,7 +10434,7 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
  *
  * Returns 0 on success, negative value on failure
  */
-static int
+int
 i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
drivers/net/i40e/i40e_ethdev.h +39 -0
index ad80f0f..3d237cd 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +547,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +810,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1038,10 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
+int i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+		struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on);
+void i40e_init_queue_region_conf(struct rte_eth_dev *dev);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +520 -0

529 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +60 -0

76 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..29d6b74 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_rss_queue_region_conf;
 
 } DPDK_17.08;
Signature · 1 line
2.7.4
#62 lore raw

Re: [PATCH v7 1/2] net/i40e: queue region set and flush

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2230

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+			sizeof(vsi->info.queue_mapping));

(void) can be omitted.

[......]

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2587

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+static int
+i40e_queue_region_display_all_info(struct i40e_pf *pf, uint16_t port_id)
+{

Not only the function name changes from "get info" to "display info". You may also need to change the command name.

But, what I like is changing the keep the "get", but change the function to return the a struct which contains the info, and user can call it. Otherwise it is only used for show.

[.....]

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 101

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_SET,   /**< add pf region pctype set */
+	/*** add queue region user priority set */

I think you missed my comments in last mail. NOT "***" but "**", please read
http://www.dpdk.org/doc/guides/contributing/documentation.html#doxygen-guidelines

Quoted 37 lines
drivers/net/i40e/rte_pmd_i40e.h +27 -0
+	RTE_PMD_I40E_USER_PRIORITY_REGION_SET,
+	/**
+	 * 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.
+	 * Because PMD had to set hardware configuration at a time, so
+	 * it will record all up layer command at first.
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON,
+	/**
+	 * "FLUSH_OFF " is just clean all configuration about queue
+	 * region just now, and restore all to DPDK i40e driver default
+	 * config when start up.
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF,
+	RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET,
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +173,27 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**
+ * Queue region related information.
+ */
+struct rte_i40e_rss_region_conf {
+	/*** the region id for this configuration */
 
 
 
+	uint8_t region_id;
+	/** the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 196

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10 -0
+	 */
+	uint8_t hw_flowtype;
+	/*** the start queue index for this region */
+	uint8_t queue_start_index;
+	/*** the total queue number of this queue region */
+	uint8_t queue_num;
+	/*** the packet's user priority for this region */
+	uint8_t user_priority;
+	 /*** Option types of queue region */
+	enum rte_pmd_i40e_queue_region_op op;

The same *** -> **

Thanks
Jingjing

author
#63 lore raw

Re: [PATCH v7 1/2] net/i40e: queue region set and flush

HI, jingjing

I will rework code as your comments in v8.

Quoted 92 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Friday, September 29, 2017 8:23 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v7 1/2] net/i40e: queue region set and flush

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2230

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+			sizeof(vsi->info.queue_mapping));

(void) can be omitted.

[......]

Review

Quoted 3 lines
(quoted diff) +3 -0
+static int
+i40e_queue_region_display_all_info(struct i40e_pf *pf, uint16_t
+port_id) {

Not only the function name changes from "get info" to "display info". You may also need to change the command name.

But, what I like is changing the keep the "get", but change the function to return the a struct which contains the info, and user can call it. Otherwise it is only used for show.

[.....]

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info {

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.h +3 -0
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set

*/

Review

Quoted 1 line
(quoted diff) +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_SET,   /**< add pf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 101

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	/*** add queue region user priority set */

I think you missed my comments in last mail. NOT "***" but "**", please read
http://www.dpdk.org/doc/guides/contributing/documentation.html#doxyg
en-guidelines

Quoted 36 lines
drivers/net/i40e/rte_pmd_i40e.h +27 -0
+	RTE_PMD_I40E_USER_PRIORITY_REGION_SET,
+	/**
+	 * 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.
+	 * Because PMD had to set hardware configuration at a time, so
+	 * it will record all up layer command at first.
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON,
+	/**
+	 * "FLUSH_OFF " is just clean all configuration about queue
+	 * region just now, and restore all to DPDK i40e driver default
+	 * config when start up.
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF,
+	RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET,
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +173,27 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
 /**
+ * Queue region related information.
+ */
+struct rte_i40e_rss_region_conf {
+	/*** the region id for this configuration */
 
 
 
+	uint8_t region_id;
+	/** the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { }; · line 195

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10 -0
+	 */
+	uint8_t hw_flowtype;
+	/*** the start queue index for this region */
+	uint8_t queue_start_index;
+	/*** the total queue number of this queue region */
+	uint8_t queue_num;
+	/*** the packet's user priority for this region */
+	uint8_t user_priority;
+	 /*** Option types of queue region */
+	enum rte_pmd_i40e_queue_region_op op;

The same *** -> **

Thanks
Jingjing

#64 lore raw

Re: [PATCH v7 1/2] net/i40e: queue region set and flush

In reply to Wei Zhao
Quoted 12 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---

<...>

Quoted 17 lines
drivers/net/i40e/i40e_ethdev.h +13 -0
@@ -541,6 +547,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */

drivers/net/i40e/i40e_ethdev.h struct i40e_ethertype_rule { · line 572

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.h +10 -0
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {

What do you think renaming:
i40e_region_info -> i40e_queue_region_info
i40e_queue_region_info -> i40e_queue_regions

Quoted 8 lines
drivers/net/i40e/i40e_ethdev.h +5 -0
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 

<...>

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2293

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+static int
+i40e_queue_region_set_flowtype(struct i40e_pf *pf,
+			struct rte_i40e_rss_region_conf *rss_region_conf)
+{
+	int32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j;
+	uint16_t region_index, flowtype_index;
+
+	/**

This is doxygen sytle comment, only nedeed for public headers.

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	 * For the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+

<...>

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2224

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+		}
+	}
+}

Missing line.

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+static int
+i40e_queue_region_set_user_priority(struct i40e_pf *pf,
+		struct rte_i40e_rss_region_conf *rss_region_conf)
+{
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	int32_t ret = -EINVAL;
+	uint16_t i, j, region_index;
+

<...>

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2597

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+static int
+i40e_queue_region_display_all_info(struct i40e_pf *pf, uint16_t port_id)
+{
+	uint16_t i, j;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	static const char *queue_region_info_stats_border = "-------";
+
+	if (!info->queue_region_number)
+		PMD_DRV_LOG(ERR, "there is no has been region set before");
+
+	printf("\n  %s All queue region info for port=%2d %s",
+			queue_region_info_stats_border, port_id,
+			queue_region_info_stats_border);

printf ? Please use driver logging functions.

Quoted 65 lines
drivers/net/i40e/rte_pmd_i40e.c +65 -0
+	printf("\n  queue_region_number: %-14u \n", info->queue_region_number);
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		printf("\n  region_id: %-14u queue_number: %-14u "
+			"queue_start_index: %-14u \n",
+			info->region[i].region_id,
+			info->region[i].queue_num,
+			info->region[i].queue_start_index);
+
+		printf("  user_priority_num is  %-14u :",
+				info->region[i].user_priority_num);
+		for (j = 0; j < info->region[i].user_priority_num; j++)
+			printf(" %-14u ", info->region[i].user_priority[j]);
+
+		printf("\n  flowtype_num is  %-14u :",
+				info->region[i].flowtype_num);
+		for (j = 0; j < info->region[i].flowtype_num; j++)
+			printf(" %-14u ", info->region[i].hw_flowtype[j]);
+	}
+
+	printf("\n\n");
+	return 0;
+}
+
+int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id,
+			struct rte_i40e_rss_region_conf *rss_region_conf)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	enum rte_pmd_i40e_queue_region_op op_type = rss_region_conf->op;
+	int32_t ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+
+	if (!(!i40e_queue_region_pf_check_rss(pf)))
+		return -ENOTSUP;
+
+	/**
+	 * This queue region feature only support pf by now. It should
+	 * be called after dev_start, and will be clear after dev_stop.
+	 * "RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_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.
+	 * Because PMD had to set hardware configuration at a time, so
+	 * it will record all up layer command at first.
+	 * "RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF" is
+	 * just clean all configuration about queue region just now,
+	 * and restore all to DPDK i40e driver default
+	 * config when start up.
+	 */
+
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_queue_region_set_region(pf, rss_region_conf);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_SET:
+		ret = i40e_queue_region_set_flowtype(pf, rss_region_conf);
+		break;
+	case RTE_PMD_I40E_USER_PRIORITY_REGION_SET:

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2672

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		ret = i40e_queue_region_set_user_priority(pf, rss_region_conf);
+		break;
+	case RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 1);
+		break;
+	case RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+		break;
+	case RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET:
+		ret = i40e_queue_region_display_all_info(pf, port_id);

Displaying is not always very useful in API level.
What do you think get fills the rss_region_conf with current device settings and return back to the caller?

Quoted 34 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+		break;
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
drivers/net/i40e/rte_pmd_i40e.h +15 -0
index 155b7e8..2219318 100644
@@ -91,6 +91,33 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
 };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_SET,   /**< add pf region pctype set */
+	/*** add queue region user priority set */
+	RTE_PMD_I40E_USER_PRIORITY_REGION_SET,
+	/**
+	 * 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.
+	 * Because PMD had to set hardware configuration at a time, so
+	 * it will record all up layer command at first.

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 118

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10 -0
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON,
+	/**
+	 * "FLUSH_OFF " is just clean all configuration about queue
+	 * region just now, and restore all to DPDK i40e driver default
+	 * config when start up.
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF,
+	RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET,
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX

These are in public header now.
Can you please use same namespace for all ops.
It can be "RTE_PMD_I40E_RSS_QUEUE_REGION_"

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 178

Quoted 12 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +173,27 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**
+ * Queue region related information.
+ */
+struct rte_i40e_rss_region_conf {

Can you please be consistant in using public names. There are:
rss_region
queue_region
rss_queue_region

Also there is confusion between using:
rte_i40e_
rte_pmd_i40e_

Quoted 22 lines
drivers/net/i40e/rte_pmd_i40e.h +18 -0
+	/*** the region id for this configuration */
+	uint8_t region_id;
+	/** the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype;
+	/*** the start queue index for this region */
+	uint8_t queue_start_index;
+	/*** the total queue number of this queue region */
+	uint8_t queue_num;
+	/*** the packet's user priority for this region */
+	uint8_t user_priority;
+	 /*** Option types of queue region */
+	enum rte_pmd_i40e_queue_region_op op;
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 713

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
@@ -657,4 +705,16 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
 int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Do RSS queue region configuration for that port as
+ * the command option type
+ *
+ * @param port
+ *    pointer id for that port device

port id ?

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 718

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id,

By defining port_id uint16_t, this patches becomes dependent to the port_id update patchset, please clarify this in cover letter.

Quoted 14 lines
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+		struct rte_i40e_rss_region_conf *rss_region_conf);
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..29d6b74 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_rss_queue_region_conf;
 
 } DPDK_17.08;
author
#65 lore raw

Re: [PATCH v7 1/2] net/i40e: queue region set and flush

Quoted 47 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, October 4, 2017 1:55 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v7 1/2] net/i40e: queue region set and flush

Quoted 12 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---

<...>

Quoted 23 lines
drivers/net/i40e/i40e_ethdev.h +19 -0
@@ -541,6 +547,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
Quoted 8 lines

drivers/net/i40e/i40e_ethdev.h struct i40e_ethertype_rule { · line 572

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.h +4 -0
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {

What do you think renaming:
i40e_region_info -> i40e_queue_region_info i40e_queue_region_info -> i40e_queue_regions

Ok

Quoted 11 lines
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.h +4 -0
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1]; };
+
 /* Tunnel filter number HW supports */  #define

I40E_MAX_TUNNEL_FILTER_NUM 400

<...>

Quoted 11 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2293

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+static int
+i40e_queue_region_set_flowtype(struct i40e_pf *pf,
+			struct rte_i40e_rss_region_conf *rss_region_conf) {
+	int32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j;
+	uint16_t region_index, flowtype_index;
+
+	/**

This is doxygen sytle comment, only nedeed for public headers.

Ok, I will change to this mode :

	/* For the pctype or hardware flowtype of packet,
	 * the specific index for each type has been defined
	 * in file i40e_type.h as enum i40e_filter_pctype.
	 */
Quoted 8 lines
Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	 * For the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+

<...>

Quoted 5 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2224

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+		}
+	}
+}

Missing line.

Ok

Quoted 20 lines
Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -0
+static int
+i40e_queue_region_set_user_priority(struct i40e_pf *pf,
+		struct rte_i40e_rss_region_conf *rss_region_conf) {
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	int32_t ret = -EINVAL;
+	uint16_t i, j, region_index;
+

<...>

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+static int
+i40e_queue_region_display_all_info(struct i40e_pf *pf, uint16_t
+port_id) {
+	uint16_t i, j;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	static const char *queue_region_info_stats_border = "-------";
+
+	if (!info->queue_region_number)
+		PMD_DRV_LOG(ERR, "there is no has been region set

before");

Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2597

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+
+	printf("\n  %s All queue region info for port=%2d %s",
+			queue_region_info_stats_border, port_id,
+			queue_region_info_stats_border);

printf ? Please use driver logging functions.

Ok, I will change to PMD_DRV_LOG()

Quoted 70 lines
Quoted 59 lines
drivers/net/i40e/rte_pmd_i40e.c +29 -0
+	printf("\n  queue_region_number: %-14u \n",
+info->queue_region_number);
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		printf("\n  region_id: %-14u queue_number: %-14u "
+			"queue_start_index: %-14u \n",
+			info->region[i].region_id,
+			info->region[i].queue_num,
+			info->region[i].queue_start_index);
+
+		printf("  user_priority_num is  %-14u :",
+				info->region[i].user_priority_num);
+		for (j = 0; j < info->region[i].user_priority_num; j++)
+			printf(" %-14u ", info->region[i].user_priority[j]);
+
+		printf("\n  flowtype_num is  %-14u :",
+				info->region[i].flowtype_num);
+		for (j = 0; j < info->region[i].flowtype_num; j++)
+			printf(" %-14u ", info->region[i].hw_flowtype[j]);
+	}
+
+	printf("\n\n");
+	return 0;
+}
+
+int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id,
+			struct rte_i40e_rss_region_conf *rss_region_conf) {
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-

dev_private);

(quoted diff) +1 -0
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-

dev_private);

(quoted diff) +1 -0
+	enum rte_pmd_i40e_queue_region_op op_type = rss_region_conf-

op;

drivers/net/i40e/rte_pmd_i40e.c +25 -0
+	int32_t ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+
+	if (!(!i40e_queue_region_pf_check_rss(pf)))
+		return -ENOTSUP;
+
+	/**
+	 * This queue region feature only support pf by now. It should
+	 * be called after dev_start, and will be clear after dev_stop.
+	 * "RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_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.
+	 * Because PMD had to set hardware configuration at a time, so
+	 * it will record all up layer command at first.
+	 * "RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF" is
+	 * just clean all configuration about queue region just now,
+	 * and restore all to DPDK i40e driver default
+	 * config when start up.
+	 */

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_queue_region_set_region(pf, rss_region_conf);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_SET:
+		ret = i40e_queue_region_set_flowtype(pf, rss_region_conf);
+		break;
+	case RTE_PMD_I40E_USER_PRIORITY_REGION_SET:
+		ret = i40e_queue_region_set_user_priority(pf,

rss_region_conf);

Quoted 13 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2672

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+		break;
+	case RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 1);
+		break;
+	case RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+		break;
+	case RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET:
+		ret = i40e_queue_region_display_all_info(pf, port_id);

Displaying is not always very useful in API level.
What do you think get fills the rss_region_conf with current device settings and return back to the caller?

Ok, it will not only print all region info, but also fill a struct like rss_region_conf. With the CLI command "show port # queue-region..."

Quoted 42 lines
Quoted 17 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+		break;
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.h index 155b7e8..2219318 100644

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 98

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
@@ -91,6 +91,33 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF  };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set

*/

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 99

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_SET,   /**< add pf region

pctype set */

Quoted 14 lines
drivers/net/i40e/rte_pmd_i40e.h +14 -0
+	/*** add queue region user priority set */
+	RTE_PMD_I40E_USER_PRIORITY_REGION_SET,
+	/**
+	 * 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.
+	 * Because PMD had to set hardware configuration at a time, so
+	 * it will record all up layer command at first.
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON,
+	/**
+	 * "FLUSH_OFF " is just clean all configuration about queue
+	 * region just now, and restore all to DPDK i40e driver default
+	 * config when start up.
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 118

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.h +4 -0
+	 */
+	RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF,
+	RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET,
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX

These are in public header now.
Can you please use same namespace for all ops.
It can be "RTE_PMD_I40E_RSS_QUEUE_REGION_"

Ok

Quoted 19 lines

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { }; · line 177

Quoted 12 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +173,27 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
 /**
+ * Queue region related information.
+ */
+struct rte_i40e_rss_region_conf {

Can you please be consistant in using public names. There are:
rss_region
queue_region
rss_queue_region

Quoted 3 lines

Also there is confusion between using:
rte_i40e_
rte_pmd_i40e_

Ok

Quoted 26 lines

drivers/net/i40e/rte_pmd_i40e.h int

Quoted 22 lines
drivers/net/i40e/rte_pmd_i40e.h +17 -0
+	/*** the region id for this configuration */
+	uint8_t region_id;
+	/** the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype;
+	/*** the start queue index for this region */
+	uint8_t queue_start_index;
+	/*** the total queue number of this queue region */
+	uint8_t queue_num;
+	/*** the packet's user priority for this region */
+	uint8_t user_priority;
+	 /*** Option types of queue region */
+	enum rte_pmd_i40e_queue_region_op op; };
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -657,4 +705,16 @@ int

rte_pmd_i40e_ptype_mapping_replace(uint8_t

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.h +0 -0
 port,  int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 713

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
+/**
+ * Do RSS queue region configuration for that port as
+ * the command option type
+ *
+ * @param port
+ *    pointer id for that port device

port id ?

Ok

Quoted 9 lines

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 718

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id,

By defining port_id uint16_t, this patches becomes dependent to the port_id update patchset, please clarify this in cover letter.

Ok

Quoted 16 lines
Quoted 16 lines
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+		struct rte_i40e_rss_region_conf *rss_region_conf);
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..29d6b74 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_rss_queue_region_conf;
 
 } DPDK_17.08;
author
#66 lore raw

PATCH v7 2/2 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

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.

---
 app/test-pmd/cmdline.c                      | 389 ++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 2 files changed, 430 insertions(+)
app/test-pmd/cmdline.c +389 -0
index 4f2d731..da7dc24 100644
@@ -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(&region_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, &region_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 <port_id> queue-region region_id <value> "
+		"queue_start_index <value> queue_num <value>: 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(&region_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, &region_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 <port_id> queue-region region_id <value> "
+		"flowtype <value>: 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(&region_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, &region_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 <port_id> queue-region UP <value> "
+		"region_id <value>: 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(&region_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, &region_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 <port_id> 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(&region_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, &region_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 <port_id> 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,
 };
 
doc/guides/testpmd_app_ug/testpmd_funcs.rst +41 -0

47 lines not on this page · raw message

Signature · 1 line
2.7.4
#67 lore raw

Re: [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

Quoted 13 lines
app/test-pmd/cmdline.c +13 -0
+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(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;

app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_syn_filter = { · line 8285

Quoted 10 lines
app/test-pmd/cmdline.c +10 -0
+	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, &region_conf);
+#endif
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}

If the RTE_LIBRTE_I40E_PMD is not built. The printf info would be incorrect. And you need to check it the port id is valid or not.

Please check all new functions in this patch.

Thanks
Jingjing

#68 lore raw

Re: [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

In reply to Wei Zhao
Quoted 32 lines · Wei Zhao

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.

---
 app/test-pmd/cmdline.c                      | 389 ++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 2 files changed, 430 insertions(+)
app/test-pmd/cmdline.c +8 -0
index 4f2d731..da7dc24 100644
@@ -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"
+

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 657

Quoted 10 lines
app/test-pmd/cmdline.c +10 -0
+			"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"
+

You did same thing and created "flush" and "get" root level commands this time.

For get, existing "show port #P .." can be used:
"show port #P queue-region"

For flush, what do you think:
"set port #P queue-region flush (on|off)" ?

Quoted 18 lines
app/test-pmd/cmdline.c +11 -0
 			, 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;

app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_syn_filter = { · line 8269

Quoted 10 lines
app/test-pmd/cmdline.c +10 -0
+	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;

For port_id other than i40e, this call should return "Not supported", not success. There are samples to this usage can you please check them?

Quoted 16 lines
app/test-pmd/cmdline.c +16 -0
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_i40e_rss_region_conf region_conf;
+
+	memset(&region_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, &region_conf);
+#endif
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}

<...>

author
#69 lore raw

Re: [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

HI, Ferruh

I will rework code as your comments in v8.

Quoted 114 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, October 4, 2017 2:04 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

Quoted 10 lines · Wei Zhao

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.

Quoted 3 lines
---
 app/test-pmd/cmdline.c                      | 389

++++++++++++++++++++++++++++

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void

Quoted 8 lines
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 2 files changed, 430 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

4f2d731..da7dc24 100644

app/test-pmd/cmdline.c +0 -0
@@ -637,6 +637,24 @@ static void cmd_help_long_parsed(void

*parsed_result,

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 637

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			"ptype mapping update (port_id) (hw_ptype)

(sw_ptype)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 11 lines
app/test-pmd/cmdline.c +9 -0
 			"    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"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 8 lines
app/test-pmd/cmdline.c +8 -0
+			"    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"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 657

Quoted 1 line
app/test-pmd/cmdline.c +1 -0
+

You did same thing and created "flush" and "get" root level commands this time.

For get, existing "show port #P .." can be used:
"show port #P queue-region"

For flush, what do you think:
"set port #P queue-region flush (on|off)" ?

Quoted 17 lines
app/test-pmd/cmdline.c +10 -0
 			, 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;

app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_syn_filter = { · line 8268

Quoted 10 lines
app/test-pmd/cmdline.c +10 -0
+	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;

For port_id other than i40e, this call should return "Not supported", not success. There are samples to this usage can you please check them?

Quoted 16 lines
app/test-pmd/cmdline.c +16 -0
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_i40e_rss_region_conf region_conf;
+
+	memset(&region_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,
+&region_conf); #endif
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}

<...>

author
#70 lore raw

Re: [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

In reply to Ferruh Yigit

Hi,

Quoted 56 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, October 4, 2017 2:04 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

Quoted 10 lines · Wei Zhao

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.

Quoted 3 lines
---
 app/test-pmd/cmdline.c                      | 389

++++++++++++++++++++++++++++

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void

Quoted 8 lines
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 2 files changed, 430 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

4f2d731..da7dc24 100644

app/test-pmd/cmdline.c +0 -0
@@ -637,6 +637,24 @@ static void cmd_help_long_parsed(void

*parsed_result,

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 637

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			"ptype mapping update (port_id) (hw_ptype)

(sw_ptype)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 11 lines
app/test-pmd/cmdline.c +9 -0
 			"    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"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 8 lines
app/test-pmd/cmdline.c +8 -0
+			"    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"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 657

Quoted 1 line
app/test-pmd/cmdline.c +1 -0
+
Quoted 8 lines

You did same thing and created "flush" and "get" root level commands this time.

For get, existing "show port #P .." can be used:
"show port #P queue-region"

For flush, what do you think:
"set port #P queue-region flush (on|off)" ?

Ok.

Quoted 23 lines
Quoted 23 lines
app/test-pmd/cmdline.c +15 -0
 			, 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
Quoted 8 lines

app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_syn_filter = { · line 8269

Quoted 5 lines
app/test-pmd/cmdline.c +5 -0
+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;

For port_id other than i40e, this call should return "Not supported", not success. There are samples to this usage can you please check them?

Do you mean to add the check code :

	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
		return;

maybe all CLI parser function NEED it.

Quoted 19 lines
Quoted 17 lines
app/test-pmd/cmdline.c +16 -0
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_i40e_rss_region_conf region_conf;
+
+	memset(&region_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,
+&region_conf); #endif
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}

<...>

author
#71 lore raw

Re: [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

In reply to Ferruh Yigit

Hi,Ferruh

Quoted 108 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Tuesday, October 10, 2017 10:56 AM
To: Yigit, Ferruh <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

Hi,

Quoted 56 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, October 4, 2017 2:04 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

Quoted 10 lines · Wei Zhao

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.

Quoted 3 lines
---
 app/test-pmd/cmdline.c                      | 389

++++++++++++++++++++++++++++

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void

Quoted 8 lines
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 2 files changed, 430 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

4f2d731..da7dc24 100644

app/test-pmd/cmdline.c +0 -0
@@ -637,6 +637,24 @@ static void cmd_help_long_parsed(void

*parsed_result,

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 637

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			"ptype mapping update (port_id) (hw_ptype)

(sw_ptype)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 11 lines
app/test-pmd/cmdline.c +9 -0
 			"    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"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 8 lines
app/test-pmd/cmdline.c +8 -0
+			"    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"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 657

Quoted 1 line
app/test-pmd/cmdline.c +1 -0
+
Quoted 8 lines

You did same thing and created "flush" and "get" root level commands this time.

For get, existing "show port #P .." can be used:
"show port #P queue-region"

For flush, what do you think:
"set port #P queue-region flush (on|off)" ?

Ok.

Quoted 23 lines
Quoted 23 lines
app/test-pmd/cmdline.c +15 -0
 			, 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
Quoted 8 lines

app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_syn_filter = { · line 8269

Quoted 5 lines
app/test-pmd/cmdline.c +5 -0
+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;

For port_id other than i40e, this call should return "Not supported", not success. There are samples to this usage can you please check them?

Quoted 6 lines

Do you mean to add the check code :

	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
		return;

maybe all CLI parser function NEED it.

Sorry, maybe it should be this mode.

	int ret = -ENOTSUP;

	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
		return ret;
Quoted 21 lines
Quoted 21 lines
Quoted 19 lines
app/test-pmd/cmdline.c +16 -0
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_i40e_rss_region_conf region_conf;
+
+	memset(&region_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,
+&region_conf); #endif
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}

<...>

#72 lore raw

Re: [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

Quoted 115 lines · Wei

Hi,Ferruh

Quoted 113 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Tuesday, October 10, 2017 10:56 AM
To: Yigit, Ferruh <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

Hi,

Quoted 56 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, October 4, 2017 2:04 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v7 2/2] app/testpmd: add API for configuration of queue region

Quoted 10 lines · Wei Zhao

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.

Quoted 3 lines
---
 app/test-pmd/cmdline.c                      | 389

++++++++++++++++++++++++++++

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void

Quoted 8 lines
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 2 files changed, 430 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

4f2d731..da7dc24 100644

app/test-pmd/cmdline.c +0 -0
@@ -637,6 +637,24 @@ static void cmd_help_long_parsed(void

*parsed_result,

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 637

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			"ptype mapping update (port_id) (hw_ptype)

(sw_ptype)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 11 lines
app/test-pmd/cmdline.c +9 -0
 			"    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"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 8 lines
app/test-pmd/cmdline.c +8 -0
+			"    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"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 657

Quoted 1 line
app/test-pmd/cmdline.c +1 -0
+
Quoted 8 lines

You did same thing and created "flush" and "get" root level commands this time.

For get, existing "show port #P .." can be used:
"show port #P queue-region"

For flush, what do you think:
"set port #P queue-region flush (on|off)" ?

Ok.

Quoted 23 lines
Quoted 23 lines
app/test-pmd/cmdline.c +15 -0
 			, 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
Quoted 8 lines

app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_syn_filter = { · line 8269

Quoted 5 lines
app/test-pmd/cmdline.c +5 -0
+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;

For port_id other than i40e, this call should return "Not supported", not success. There are samples to this usage can you please check them?

Do you mean to add the check code :

	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
		return;
Quoted 8 lines
Quoted 1 line

maybe all CLI parser function NEED it.

Sorry, maybe it should be this mode.

	int ret = -ENOTSUP;

	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
		return ret;

Yep, this one.
For the case I40E config not enabled, and when called for devices other than i40e, function should return -ENOTSUP;

Tested-by on the v7 series
#73 lore raw
In reply to Wei Zhao

- Tested Branch: dpdk-next-net/master
- Tested Commit: 9d660ac14ed6aa8688141b33fd6cd69fe3f0e5dd
- OS: 4.5.5-300.fc24.x86_64
- GCC: gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
- CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
- NIC: Intel Corporation Device Fortville [8086:1572]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 3 cases, 3 passed, 0 failed

- Prerequisites command / instruction:
1. Hardware:
Fortville

2. software:
dpdk: http://dpdk.org/git/dpdk
scapy: http://www.secdev.org/projects/scapy/

3. bind the port to dpdk driver::

    ./usertools/dpdk-devbind.py -b igb_uio 05:00.0

the mac address of 05:00.0 is 00:00:00:00:01:00

4. start the testpmd::

./x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 -- -i --rxq=16 --txq=16 testpmd> port config all rss all
testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start

- Cases:

Test case 1: different pctype packet can enter the expected queue region
========================================================================

1. Set queue region on a port::

testpmd> set port 0 queue-region region_id 0 queue_start_index 1 queue_num 1 testpmd> set port 0 queue-region region_id 1 queue_start_index 3 queue_num 2 testpmd> set port 0 queue-region region_id 2 queue_start_index 6 queue_num 2 testpmd> set port 0 queue-region region_id 3 queue_start_index 8 queue_num 2 testpmd> set port 0 queue-region region_id 4 queue_start_index 11 queue_num 4 testpmd> set port 0 queue-region region_id 5 queue_start_index 15 queue_num 1

2. Set the mapping of flowtype to region index on a port::

testpmd> set port 0 queue-region region_id 0 flowtype 31 testpmd> set port 0 queue-region region_id 1 flowtype 32 testpmd> set port 0 queue-region region_id 2 flowtype 33 testpmd> set port 0 queue-region region_id 3 flowtype 34 testpmd> set port 0 queue-region region_id 4 flowtype 35 testpmd> set port 0 queue-region region_id 5 flowtype 45 testpmd> set port 0 queue-region region_id 2 flowtype 41 testpmd> flush port 0 queue-region on

3. send packet::

    pkt1 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=23,dport=24)/Raw('x'*20)
    pkt2 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=33,dport=34,flags="S")/Raw('x'*20)
    pkt3 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=33,dport=34,flags="PA")/Raw('x' * 20)
    pkt4 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=44,dport=45,tag=1)/SCTPChunkData(data="X" * 20)
    pkt5 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/Raw('x'*20)
    pkt6 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IPv6(src="2001::1", dst="2001::2")/Raw('x' * 20)
    pkt7 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IPv6(src="2001::1", dst="2001::2")/UDP(sport=24,dport=25)/Raw('x'*20)
    pkt8 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=1)/IP(src="192.168.0.1", dst="192.168.0.2")/Raw('x'*20)

verify the pkt1 to queue 1, pkt2 to queue 3 or queue 4, pkt3 to queue 6 or queue 7, pkt4 to queue 8 or queue 9, pkt5 to queue 11 or 12 or 13 or 14,
pkt6 to queue 15, pkt7 to queue 6 or queue 7, pkt8 enter the same queue with pkt5.

4. verified the rules can be listed and flushed::

testpmd> get port 0 queue-region
testpmd> flush port 0 queue-region off

Notes: fortville can't parse the TCP SYN type packet, fortpark can parse it. So if fortville, pkt2 to queue 6 or queue 7.

Test case 2: different user priority packet can enter the expected queue region
===============================================================================

1. Set queue region on a port::

testpmd> set port 0 queue-region region_id 0 queue_start_index 0 queue_num 1 testpmd> set port 0 queue-region region_id 7 queue_start_index 1 queue_num 8 testpmd> set port 0 queue-region region_id 2 queue_start_index 10 queue_num 4

2. Set the mapping of User Priority to Traffic Classes on a port::

testpmd> set port 0 queue-region UP 3 region_id 0 testpmd> set port 0 queue-region UP 1 region_id 7 testpmd> set port 0 queue-region UP 2 region_id 2 testpmd> set port 0 queue-region UP 7 region_id 2 testpmd> flush port 0 queue-region on

3. send packet::

    pkt1=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=3)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=22, dport=23)/Raw('x'*20)
    pkt2=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=1)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=22, dport=23)/Raw('x'*20)
    pkt3=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=2)/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32, dport=33)/Raw('x'*20)
    pkt4=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=7)/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32, dport=33)/Raw('x'*20)
    pkt5=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=7)/IP(src="192.168.0.3", dst="192.168.0.4")/UDP(sport=22, dport=23)/Raw('x'*20)
    pkt6=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.3", dst="192.168.0.4")/UDP(sport=22, dport=23)/Raw('x'*20)

verify the pkt1 to queue 0,
pkt2 to queue 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8. pkt3 to queue 10 or 11 or 12 or 13.
pkt4 enter the same queue with pkt3.
pkt5 to queue 10 or 11 or 12 or 13.
pkt6 enter different queue from pkt5.

4. verified the rules can be listed and flushed::

testpmd> get port 0 queue-region
testpmd> flush port 0 queue-region off

Test case 3: boundary value testing
===================================

1. boundary value testing of "Set a queue region on a port"

the following three rules are set successfully::

testpmd> set port 0 queue-region region_id 0 queue_start_index 0 queue_num 16 testpmd> flush port 0 queue-region on
testpmd> flush port 0 queue-region off
testpmd> set port 0 queue-region region_id 0 queue_start_index 15 queue_num 1 testpmd> flush port 0 queue-region on
testpmd> flush port 0 queue-region off
testpmd> set port 0 queue-region region_id 7 queue_start_index 2 queue_num 8 testpmd> flush port 0 queue-region on

all the three rules can be listed::

testpmd> get port 0 queue-region
testpmd> flush port 0 queue-region off

the following four rules can't be set successfully.::

testpmd> set port 0 queue-region region_id 8 queue_start_index 2 queue_num 2 testpmd> set port 0 queue-region region_id 1 queue_start_index 16 queue_num 1 testpmd> set port 0 queue-region region_id 2 queue_start_index 15 queue_num 2 testpmd> set port 0 queue-region region_id 3 queue_start_index 2 queue_num 3

no rules can be listed::

testpmd> get port 0 queue-region
testpmd> flush port 0 queue-region off

2. boundary value testing of "Set the mapping of flowtype to region index on a port"::

testpmd> set port 0 queue-region region_id 0 queue_start_index 2 queue_num 2 testpmd> set port 0 queue-region region_id 7 queue_start_index 4 queue_num 4

the first two rules can be set successfully::

testpmd> set port 0 queue-region region_id 0 flowtype 63 testpmd> set port 0 queue-region region_id 7 flowtype 0

the first two rules can be listed::

testpmd> get port 0 queue-region

the last two rule can't be set successfully::

testpmd> set port 0 queue-region region_id 0 flowtype 64 testpmd> set port 0 queue-region region_id 2 flowtype 34 testpmd> flush port 0 queue-region on

the last two rules can't be listed::

testpmd> get port 0 queue-region
testpmd> flush port 0 queue-region off

3. boundary value testing of "Set the mapping of UP to region index on a port"::

testpmd> set port 0 queue-region region_id 0 queue_start_index 2 queue_num 2 testpmd> set port 0 queue-region region_id 7 queue_start_index 4 queue_num 4

the first two rules can be set successfully::

testpmd> set port 0 queue-region UP 7 region_id 0 testpmd> set port 0 queue-region UP 0 region_id 7

the first two rules can be listed::

testpmd> get port 0 queue-region

the last two rule can't be set successfully::

testpmd> set port 0 queue-region UP 8 region_id 0 testpmd> set port 0 queue-region UP 1 region_id 2 testpmd> flush port 0 queue-region on

the last two rules can't be listed::

testpmd> get port 0 queue-region
testpmd> flush port 0 queue-region off

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Friday, September 29, 2017 5:16 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v7 0/2] net/i40e: API to configure queue regions for RSS

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

v5:
-fix patchcheck warning.
-add port id check.

v6:
-split this patch set into 2 patch.

v7:
-change some PMD_DRV_LOG log.

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

 app/test-pmd/cmdline.c                      | 389 +++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 drivers/net/i40e/i40e_ethdev.c              |  27 +-
 drivers/net/i40e/i40e_ethdev.h              |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c             | 520 ++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h             |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |   1 +
 7 files changed, 1071 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
author
#74 lore raw

v8 cover net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

v5:
-fix patchcheck warning.
-add port id check.

v6:
-split this patch set into 2 patch.

v7:
-change some PMD_DRV_LOG log.

v8:
-change CLI command format.
-change some functions name.

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

 app/test-pmd/cmdline.c                      | 424 ++++++++++++++++++++++++
 app/test-pmd/config.c                       |  44 +++
 app/test-pmd/testpmd.h                      |   3 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 drivers/net/i40e/i40e_ethdev.c              |  27 +-
 drivers/net/i40e/i40e_ethdev.h              |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c             | 494 ++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h             |  91 +++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |   2 +-
 9 files changed, 1158 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
author
#75 lore raw

PATCH v8 1/2 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 494 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  91 ++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   2 +-
 5 files changed, 646 insertions(+), 7 deletions(-)
drivers/net/i40e/i40e_ethdev.c +21 -6
index f7dfb97..814f458 100644
@@ -138,10 +138,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -310,7 +306,6 @@ static int i40e_pf_parameter_init(struct rte_eth_dev *dev);
 static int i40e_pf_setup(struct i40e_pf *pf);
 static int i40e_dev_rxtx_init(struct i40e_pf *pf);
 static int i40e_vmdq_setup(struct rte_eth_dev *dev);
-static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
 static int i40e_dcb_setup(struct rte_eth_dev *dev);
 static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
 		bool offset_loaded, uint64_t *offset, uint64_t *stat);
@@ -1058,6 +1053,20 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	pf->gtp_support = false;
 }
 
+void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_regions *info = &pf->queue_region;
+	uint16_t i;
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_regions));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1337,6 +1346,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -2142,6 +2154,9 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
+	/* Remove all the queue region configuration */
+	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+
 	hw->adapter_stopped = 1;
 }
 
@@ -10471,7 +10486,7 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
  *
  * Returns 0 on success, negative value on failure
  */
-static int
+int
 i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
drivers/net/i40e/i40e_ethdev.h +39 -0
index 4125a35..2f1905e 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -646,6 +652,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_queue_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_regions {
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_queue_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -902,6 +936,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_regions queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1150,6 +1185,10 @@ struct i40e_customized_pctype*
 i40e_find_customized_pctype(struct i40e_pf *pf, uint8_t index);
 void i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 				 uint32_t pkg_size);
+int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
+int i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+		struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on);
+void i40e_init_queue_region_conf(struct rte_eth_dev *dev);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +494 -0

503 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +91 -0

108 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e_version.map +1 -1
index 9292454..81946ae 100644
@@ -53,5 +53,5 @@ DPDK_17.11 {
 	rte_pmd_i40e_flow_type_mapping_update;
 	rte_pmd_i40e_flow_type_mapping_get;
 	rte_pmd_i40e_flow_type_mapping_reset;
-
+	rte_pmd_i40e_rss_queue_region_conf;
 } DPDK_17.08;
Signature · 1 line
2.7.4
author
#76 lore raw

PATCH v8 2/2 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

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.

---
 app/test-pmd/cmdline.c                      | 424 ++++++++++++++++++++++++++++
 app/test-pmd/config.c                       |  44 +++
 app/test-pmd/testpmd.h                      |   3 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 4 files changed, 512 insertions(+)
app/test-pmd/cmdline.c +424 -0
index f996ee3..f873b29 100644
@@ -660,6 +660,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"
+
+			"set port (port_id) queue-region flush (on|off)\n"
+			"    flush all queue region related configuration\n\n"
+
+			"show port (port_id) queue-region\n"
+			"	 show all queue region related configuration info\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8469,6 +8487,407 @@ cmdline_parse_inst_t cmd_syn_filter = {
 	},
 };
 
+/* *** 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 = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_region_conf region_conf;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	op_type = 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,
+				op_type, &region_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 <port_id> queue-region region_id <value> "
+		"queue_start_index <value> queue_num <value>: 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 = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_region_conf region_conf;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	op_type = 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,
+			op_type, &region_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 <port_id> queue-region region_id <value> "
+		"flowtype <value>: 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 cmd_user_priority_region_result *res = parsed_result;
+	int ret = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_region_conf region_conf;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	op_type = 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,
+				op_type, &region_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 <port_id> queue-region UP <value> "
+		"region_id <value>: 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 set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	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 = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_region_conf region_conf;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "on") == 0)
+		op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON;
+	else
+		op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+				op_type, &region_conf);
+#endif
+
+	if (ret < 0)
+		printf("queue region config flush error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_set =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				set, "set");
+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_flush =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+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 = "set port <port_id> queue-region flush on|off"
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_set,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_what,
+		NULL,
+	},
+};
+
+/* *** get all queue region related configuration info *** */
+struct cmd_show_queue_region_info {
+	cmdline_fixed_string_t show;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t cmd;
+};
+
+static void
+cmd_show_queue_region_info_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_show_queue_region_info *res = parsed_result;
+	int ret = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_regions rte_pmd_regions;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&rte_pmd_regions, 0, sizeof(rte_pmd_regions));
+
+	op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+					op_type, &rte_pmd_regions);
+
+	port_queue_region_info_display(res->port_id, &rte_pmd_regions);
+
+#endif
+
+	if (ret < 0)
+		printf("queue region config info show error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_show_queue_region_info_get =
+TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+				show, "show");
+cmdline_parse_token_string_t cmd_show_queue_region_info_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+				port, "port");
+cmdline_parse_token_num_t cmd_show_queue_region_info_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_queue_region_info,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_show_queue_region_info_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+				cmd, "queue-region");
+
+cmdline_parse_inst_t cmd_show_queue_region_info_all = {
+	.f = cmd_show_queue_region_info_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> queue-region"
+		": show all queue region related configuration info",
+	.tokens = {
+		(void *)&cmd_show_queue_region_info_get,
+		(void *)&cmd_show_queue_region_info_port,
+		(void *)&cmd_show_queue_region_info_port_index,
+		(void *)&cmd_show_queue_region_info_cmd,
+		NULL,
+	},
+};
+
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
 	cmdline_fixed_string_t filter;
@@ -15130,6 +15549,11 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_pctype_mapping_get,
 	(cmdline_parse_inst_t *)&cmd_pctype_mapping_reset,
 	(cmdline_parse_inst_t *)&cmd_pctype_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_show_queue_region_info_all,
 	NULL,
 };
 
app/test-pmd/config.c +44 -0

53 lines not on this page · raw message

app/test-pmd/testpmd.h +3 -0
index 7c79f17..10aeeeb 100644
@@ -718,6 +718,9 @@ uint8_t *open_ddp_package_file(const char *file_path, uint32_t *size);
 int save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size);
 int close_ddp_package_file(uint8_t *buf);
 
+void port_queue_region_info_display(uint8_t port_id,
+			void *buf);
+
 enum print_warning {
 	ENABLED_WARN = 0,
 	DISABLED_WARN
doc/guides/testpmd_app_ug/testpmd_funcs.rst +41 -0

47 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#77 lore raw

v8 cover net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

v5:
-fix patchcheck warning.
-add port id check.

v6:
-split this patch set into 2 patch.

v7:
-change some PMD_DRV_LOG log.

v8:
-change CLI command format.
-change some functions name.

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

 app/test-pmd/cmdline.c                      | 424 ++++++++++++++++++++++++
 app/test-pmd/config.c                       |  44 +++
 app/test-pmd/testpmd.h                      |   3 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 drivers/net/i40e/i40e_ethdev.c              |  27 +-
 drivers/net/i40e/i40e_ethdev.h              |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c             | 494 ++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h             |  91 +++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |   2 +-
 9 files changed, 1158 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
author
#78 lore raw

PATCH v8 1/2 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 494 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  91 ++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   2 +-
 5 files changed, 646 insertions(+), 7 deletions(-)
drivers/net/i40e/i40e_ethdev.c +21 -6
index f7dfb97..814f458 100644
@@ -138,10 +138,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -310,7 +306,6 @@ static int i40e_pf_parameter_init(struct rte_eth_dev *dev);
 static int i40e_pf_setup(struct i40e_pf *pf);
 static int i40e_dev_rxtx_init(struct i40e_pf *pf);
 static int i40e_vmdq_setup(struct rte_eth_dev *dev);
-static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
 static int i40e_dcb_setup(struct rte_eth_dev *dev);
 static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
 		bool offset_loaded, uint64_t *offset, uint64_t *stat);
@@ -1058,6 +1053,20 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	pf->gtp_support = false;
 }
 
+void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_regions *info = &pf->queue_region;
+	uint16_t i;
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_regions));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1337,6 +1346,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -2142,6 +2154,9 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
+	/* Remove all the queue region configuration */
+	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+
 	hw->adapter_stopped = 1;
 }
 
@@ -10471,7 +10486,7 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
  *
  * Returns 0 on success, negative value on failure
  */
-static int
+int
 i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
drivers/net/i40e/i40e_ethdev.h +39 -0
index 4125a35..2f1905e 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -646,6 +652,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_queue_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_regions {
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_queue_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -902,6 +936,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_regions queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1150,6 +1185,10 @@ struct i40e_customized_pctype*
 i40e_find_customized_pctype(struct i40e_pf *pf, uint8_t index);
 void i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 				 uint32_t pkg_size);
+int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
+int i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+		struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on);
+void i40e_init_queue_region_conf(struct rte_eth_dev *dev);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +494 -0

503 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +91 -0

108 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e_version.map +1 -1
index 9292454..81946ae 100644
@@ -53,5 +53,5 @@ DPDK_17.11 {
 	rte_pmd_i40e_flow_type_mapping_update;
 	rte_pmd_i40e_flow_type_mapping_get;
 	rte_pmd_i40e_flow_type_mapping_reset;
-
+	rte_pmd_i40e_rss_queue_region_conf;
 } DPDK_17.08;
Signature · 1 line
2.7.4
#79 lore raw

Re: [PATCH v8 1/2] net/i40e: queue region set and flush

Hi Wei

Sorry for the late comment, but I was not included to the patchset CC list and just found this new version.

Quoted 6 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, October 11, 2017 9:56 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and flush

<snip>

Quoted 18 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+int
+i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+	struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on)
+{
+	int32_t ret = -EINVAL;
+	struct i40e_queue_regions *info = &pf->queue_region;
+
+	if (on) {
+		i40e_queue_region_pf_flowtype_conf(hw, pf);
+
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+			return ret;
+		}
+
+		ret = i40e_queue_region_dcb_configure(hw, pf);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_flow_type_mapping_update( · line 2818

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			return ret;
+		}
+
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;

Why number of queues is hardcoded to a magic number 64? How it will work if VSI is enabled with smaller number of queues, for example, 1 or 6? 64 is the maximum number of queues that can be used for RSS, but VSI might be created with only few queues.

Quoted 17 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	info->region[0].queue_start_index = 0;
+
+	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

drivers/net/i40e/rte_pmd_i40e.c +11 -0
+
+	ret = i40e_dcb_init_configure(dev, TRUE);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+		pf->flags &= ~I40E_FLAG_DCB;
+	}
+
+	i40e_init_queue_region_conf(dev);
+
+	return 0;
+}
author
#80 lore raw

Re: [PATCH v8 1/2] net/i40e: queue region set and flush

Hi,Andrey

Quoted 49 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, October 13, 2017 6:07 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and flush

Hi Wei

Sorry for the late comment, but I was not included to the patchset CC list and just found this new version.

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, October 11, 2017 9:56 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and flush

<snip>

Quoted 24 lines
drivers/net/i40e/rte_pmd_i40e.c +12 -0
+int
+i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+	struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on) {
+	int32_t ret = -EINVAL;
+	struct i40e_queue_regions *info = &pf->queue_region;
+
+	if (on) {
+		i40e_queue_region_pf_flowtype_conf(hw, pf);
+
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

drivers/net/i40e/rte_pmd_i40e.c +11 -0
+			return ret;
+		}
+
+		ret = i40e_queue_region_dcb_configure(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			return ret;
+		}
+
+		return 0;
+	}
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_flow_type_mapping_update( · line 2818

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;

Why number of queues is hardcoded to a magic number 64? How it will work if VSI is enabled with smaller number of queues, for example, 1 or 6? 64 is the maximum number of queues that can be used for RSS, but VSI might be created with only few queues.

Yes, I know what is your mean, may be it should be change to

struct i40e_vsi *main_vsi = pf->main_vsi; info->region[0].queue_num = main_vsi->nb_used_qps;

Do you think so?

Quoted 18 lines
Quoted 18 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	info->region[0].queue_start_index = 0;
+
+	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

drivers/net/i40e/rte_pmd_i40e.c +11 -0
+
+	ret = i40e_dcb_init_configure(dev, TRUE);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+		pf->flags &= ~I40E_FLAG_DCB;
+	}
+
+	i40e_init_queue_region_conf(dev);
+
+	return 0;
+}
#81 lore raw

Re: [PATCH v8 1/2] net/i40e: queue region set and flush

Hi Wei,

Is there number of RX queues configured for the port?
If main_vsi->nb_used_qps reflects number of enabled RX queues, then it can be used.

Regards,
Andrey

Quoted 97 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Wednesday, October 18, 2017 4:01 AM
To: Chilikin, Andrey <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and flush

Hi,Andrey

Quoted 8 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, October 13, 2017 6:07 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and

flush

Quoted 4 lines

Hi Wei

Sorry for the late comment, but I was not included to the patchset CC list

and

Quoted 34 lines

just found this new version.

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, October 11, 2017 9:56 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and flush

<snip>

Quoted 21 lines
drivers/net/i40e/rte_pmd_i40e.c +12 -0
+int
+i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+	struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on) {
+	int32_t ret = -EINVAL;
+	struct i40e_queue_regions *info = &pf->queue_region;
+
+	if (on) {
+		i40e_queue_region_pf_flowtype_conf(hw, pf);
+
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

drivers/net/i40e/rte_pmd_i40e.c +8 -0
+			return ret;
+		}
+
+		ret = i40e_queue_region_dcb_configure(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			return ret;
+		}
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_flow_type_mapping_update( · line 2818

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;

Why number of queues is hardcoded to a magic number 64? How it will

work

Quoted 2 lines

if VSI is enabled with smaller number of queues, for example, 1 or 6? 64 is the maximum number of queues that can be used for RSS, but VSI might

be

Quoted 1 line

created with only few queues.

Yes, I know what is your mean, may be it should be change to

struct i40e_vsi *main_vsi = pf->main_vsi; info->region[0].queue_num = main_vsi->nb_used_qps;

Do you think so?

Quoted 18 lines
Quoted 18 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	info->region[0].queue_start_index = 0;
+
+	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

drivers/net/i40e/rte_pmd_i40e.c +11 -0
+
+	ret = i40e_dcb_init_configure(dev, TRUE);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+		pf->flags &= ~I40E_FLAG_DCB;
+	}
+
+	i40e_init_queue_region_conf(dev);
+
+	return 0;
+}
author
#82 lore raw

Re: [PATCH v8 1/2] net/i40e: queue region set and flush

Hi, Andrey

Yes, it is the number of queue pairs for pf.

Quoted 118 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Wednesday, October 18, 2017 9:01 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and flush

Hi Wei,

Is there number of RX queues configured for the port?
If main_vsi->nb_used_qps reflects number of enabled RX queues, then it can be used.

Regards,
Andrey

Quoted 101 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Wednesday, October 18, 2017 4:01 AM
To: Chilikin, Andrey <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and flush

Hi,Andrey

Quoted 9 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, October 13, 2017 6:07 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and

flush

Quoted 5 lines

Hi Wei

Sorry for the late comment, but I was not included to the patchset CC list

and

Quoted 34 lines

just found this new version.

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, October 11, 2017 9:56 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v8 1/2] net/i40e: queue region set and flush

<snip>

Quoted 21 lines
drivers/net/i40e/rte_pmd_i40e.c +12 -0
+int
+i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+	struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on) {
+	int32_t ret = -EINVAL;
+	struct i40e_queue_regions *info = &pf->queue_region;
+
+	if (on) {
+		i40e_queue_region_pf_flowtype_conf(hw, pf);
+
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

drivers/net/i40e/rte_pmd_i40e.c +8 -0
+			return ret;
+		}
+
+		ret = i40e_queue_region_dcb_configure(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			return ret;
+		}
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_flow_type_mapping_update( · line 2818

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;

Why number of queues is hardcoded to a magic number 64? How it will

work

Quoted 3 lines

if VSI is enabled with smaller number of queues, for example, 1 or 6? 64 is the maximum number of queues that can be used for RSS, but VSI might

be

Quoted 1 line

created with only few queues.

Yes, I know what is your mean, may be it should be change to

struct i40e_vsi *main_vsi = pf->main_vsi; info->region[0].queue_num = main_vsi->nb_used_qps;

Do you think so?

Quoted 18 lines
Quoted 18 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	info->region[0].queue_start_index = 0;
+
+	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

drivers/net/i40e/rte_pmd_i40e.c +11 -0
+
+	ret = i40e_dcb_init_configure(dev, TRUE);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+		pf->flags &= ~I40E_FLAG_DCB;
+	}
+
+	i40e_init_queue_region_conf(dev);
+
+	return 0;
+}
author
#83 lore raw

PATCH v8 2/2 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

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.

---
 app/test-pmd/cmdline.c                      | 424 ++++++++++++++++++++++++++++
 app/test-pmd/config.c                       |  44 +++
 app/test-pmd/testpmd.h                      |   3 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 4 files changed, 512 insertions(+)
app/test-pmd/cmdline.c +424 -0
index f996ee3..f873b29 100644
@@ -660,6 +660,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"
+
+			"set port (port_id) queue-region flush (on|off)\n"
+			"    flush all queue region related configuration\n\n"
+
+			"show port (port_id) queue-region\n"
+			"    show all queue region related configuration info\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8469,6 +8487,407 @@ cmdline_parse_inst_t cmd_syn_filter = {
 	},
 };
 
+/* *** 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 = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_region_conf region_conf;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	op_type = 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,
+				op_type, &region_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 <port_id> queue-region region_id <value> "
+		"queue_start_index <value> queue_num <value>: 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 = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_region_conf region_conf;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	op_type = 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,
+			op_type, &region_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 <port_id> queue-region region_id <value> "
+		"flowtype <value>: 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 cmd_user_priority_region_result *res = parsed_result;
+	int ret = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_region_conf region_conf;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	op_type = 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,
+				op_type, &region_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 <port_id> queue-region UP <value> "
+		"region_id <value>: 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 set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	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 = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_region_conf region_conf;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "on") == 0)
+		op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON;
+	else
+		op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+				op_type, &region_conf);
+#endif
+
+	if (ret < 0)
+		printf("queue region config flush error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_set =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				set, "set");
+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_flush =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+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 = "set port <port_id> queue-region flush on|off"
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_set,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_what,
+		NULL,
+	},
+};
+
+/* *** get all queue region related configuration info *** */
+struct cmd_show_queue_region_info {
+	cmdline_fixed_string_t show;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t cmd;
+};
+
+static void
+cmd_show_queue_region_info_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_show_queue_region_info *res = parsed_result;
+	int ret = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+	struct rte_pmd_i40e_queue_regions rte_pmd_regions;
+	enum rte_pmd_i40e_queue_region_op op_type;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	memset(&rte_pmd_regions, 0, sizeof(rte_pmd_regions));
+
+	op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+					op_type, &rte_pmd_regions);
+
+	port_queue_region_info_display(res->port_id, &rte_pmd_regions);
+
+#endif
+
+	if (ret < 0)
+		printf("queue region config info show error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_show_queue_region_info_get =
+TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+				show, "show");
+cmdline_parse_token_string_t cmd_show_queue_region_info_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+				port, "port");
+cmdline_parse_token_num_t cmd_show_queue_region_info_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_queue_region_info,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_show_queue_region_info_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+				cmd, "queue-region");
+
+cmdline_parse_inst_t cmd_show_queue_region_info_all = {
+	.f = cmd_show_queue_region_info_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> queue-region"
+		": show all queue region related configuration info",
+	.tokens = {
+		(void *)&cmd_show_queue_region_info_get,
+		(void *)&cmd_show_queue_region_info_port,
+		(void *)&cmd_show_queue_region_info_port_index,
+		(void *)&cmd_show_queue_region_info_cmd,
+		NULL,
+	},
+};
+
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
 	cmdline_fixed_string_t filter;
@@ -15130,6 +15549,11 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_pctype_mapping_get,
 	(cmdline_parse_inst_t *)&cmd_pctype_mapping_reset,
 	(cmdline_parse_inst_t *)&cmd_pctype_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_show_queue_region_info_all,
 	NULL,
 };
 
app/test-pmd/config.c +44 -0

53 lines not on this page · raw message

app/test-pmd/testpmd.h +3 -0
index 7c79f17..10aeeeb 100644
@@ -718,6 +718,9 @@ uint8_t *open_ddp_package_file(const char *file_path, uint32_t *size);
 int save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size);
 int close_ddp_package_file(uint8_t *buf);
 
+void port_queue_region_info_display(uint8_t port_id,
+			void *buf);
+
 enum print_warning {
 	ENABLED_WARN = 0,
 	DISABLED_WARN
doc/guides/testpmd_app_ug/testpmd_funcs.rst +41 -0

47 lines not on this page · raw message

Signature · 1 line
2.7.4
Tested-by on the v8 series
#84 lore raw
In reply to Wei Zhao

- Tested Branch: dpdk-master
- Tested Commit: 7a8889324654c9e39f9e18097ccc74d6ff2588cf
- OS: 4.5.5-300.fc24.x86_64
- GCC: gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
- CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
- NIC: Intel Corporation Device Fortville [8086:1572]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 3 cases, 3 passed, 0 failed

- Prerequisites command / instruction:
1. Hardware:
Fortville

2. software:
dpdk: http://dpdk.org/git/dpdk
scapy: http://www.secdev.org/projects/scapy/

3. bind the port to dpdk driver::

    ./usertools/dpdk-devbind.py -b igb_uio 05:00.0

the mac address of 05:00.0 is 00:00:00:00:01:00

4. start the testpmd::

./x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 -- -i --rxq=16 --txq=16 testpmd> port config all rss all
testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start

- Cases:

Test case 1: different pctype packet can enter the expected queue region
========================================================================

1. Set queue region on a port::

testpmd> set port 0 queue-region region_id 0 queue_start_index 1 queue_num 1 testpmd> set port 0 queue-region region_id 1 queue_start_index 3 queue_num 2 testpmd> set port 0 queue-region region_id 2 queue_start_index 6 queue_num 2 testpmd> set port 0 queue-region region_id 3 queue_start_index 8 queue_num 2 testpmd> set port 0 queue-region region_id 4 queue_start_index 11 queue_num 4 testpmd> set port 0 queue-region region_id 5 queue_start_index 15 queue_num 1

2. Set the mapping of flowtype to region index on a port::

testpmd> set port 0 queue-region region_id 0 flowtype 31 testpmd> set port 0 queue-region region_id 1 flowtype 32 testpmd> set port 0 queue-region region_id 2 flowtype 33 testpmd> set port 0 queue-region region_id 3 flowtype 34 testpmd> set port 0 queue-region region_id 4 flowtype 35 testpmd> set port 0 queue-region region_id 5 flowtype 45 testpmd> set port 0 queue-region region_id 2 flowtype 41 testpmd> set port 0 queue-region flush on

3. send packet::

    pkt1 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=23,dport=24)/Raw('x'*20)
    pkt2 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=33,dport=34,flags="S")/Raw('x'*20)
    pkt3 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=33,dport=34,flags="PA")/Raw('x' * 20)
    pkt4 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=44,dport=45,tag=1)/SCTPChunkData(data="X" * 20)
    pkt5 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.1", dst="192.168.0.2")/Raw('x'*20)
    pkt6 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IPv6(src="2001::1", dst="2001::2")/Raw('x' * 20)
    pkt7 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IPv6(src="2001::1", dst="2001::2")/UDP(sport=24,dport=25)/Raw('x'*20)
    pkt8 = Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=1)/IP(src="192.168.0.1", dst="192.168.0.2")/Raw('x'*20)

verify the pkt1 to queue 1, pkt2 to queue 3 or queue 4, pkt3 to queue 6 or queue 7, pkt4 to queue 8 or queue 9, pkt5 to queue 11 or 12 or 13 or 14,
pkt6 to queue 15, pkt7 to queue 6 or queue 7, pkt8 enter the same queue with pkt5.

4. verified the rules can be listed and flushed::

testpmd> show port 0 queue-region
testpmd> set port 0 queue-region flush off

Notes: fortville can't parse the TCP SYN type packet, fortpark can parse it. So if fortville, pkt2 to queue 6 or queue 7.

Test case 2: different user priority packet can enter the expected queue region
===============================================================================

1. Set queue region on a port::

testpmd> set port 0 queue-region region_id 0 queue_start_index 0 queue_num 1 testpmd> set port 0 queue-region region_id 7 queue_start_index 1 queue_num 8 testpmd> set port 0 queue-region region_id 2 queue_start_index 10 queue_num 4

2. Set the mapping of User Priority to Traffic Classes on a port::

testpmd> set port 0 queue-region UP 3 region_id 0 testpmd> set port 0 queue-region UP 1 region_id 7 testpmd> set port 0 queue-region UP 2 region_id 2 testpmd> set port 0 queue-region UP 7 region_id 2 testpmd> set port 0 queue-region flush on

3. send packet::

    pkt1=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=3)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=22, dport=23)/Raw('x'*20)
    pkt2=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=1)/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=22, dport=23)/Raw('x'*20)
    pkt3=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=2)/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32, dport=33)/Raw('x'*20)
    pkt4=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=7)/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32, dport=33)/Raw('x'*20)
    pkt5=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/Dot1Q(prio=7)/IP(src="192.168.0.3", dst="192.168.0.4")/UDP(sport=22, dport=23)/Raw('x'*20)
    pkt6=Ether(dst="00:00:00:00:01:00", src="00:02:00:00:00:01")/IP(src="192.168.0.3", dst="192.168.0.4")/UDP(sport=22, dport=23)/Raw('x'*20)

verify the pkt1 to queue 0,
pkt2 to queue 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8. pkt3 to queue 10 or 11 or 12 or 13.
pkt4 enter the same queue with pkt3.
pkt5 to queue 10 or 11 or 12 or 13.
pkt6 enter different queue from pkt5.

4. verified the rules can be listed and flushed::

testpmd> show port 0 queue-region
testpmd> set port 0 queue-region flush off

Test case 3: boundary value testing
===================================

1. boundary value testing of "Set a queue region on a port"

the following three rules are set successfully::

testpmd> set port 0 queue-region region_id 0 queue_start_index 0 queue_num 16 testpmd> set port 0 queue-region flush on
testpmd> set port 0 queue-region flush off
testpmd> set port 0 queue-region region_id 0 queue_start_index 15 queue_num 1 testpmd> set port 0 queue-region flush on
testpmd> set port 0 queue-region flush off
testpmd> set port 0 queue-region region_id 7 queue_start_index 2 queue_num 8 testpmd> set port 0 queue-region flush on

all the three rules can be listed::

testpmd> show port 0 queue-region
testpmd> set port 0 queue-region flush off

the following four rules can't be set successfully.::

testpmd> set port 0 queue-region region_id 8 queue_start_index 2 queue_num 2 testpmd> set port 0 queue-region region_id 1 queue_start_index 16 queue_num 1 testpmd> set port 0 queue-region region_id 2 queue_start_index 15 queue_num 2 testpmd> set port 0 queue-region region_id 3 queue_start_index 2 queue_num 3

no rules can be listed::

testpmd> show port 0 queue-region
testpmd> set port 0 queue-region flush off

2. boundary value testing of "Set the mapping of flowtype to region index on a port"::

testpmd> set port 0 queue-region region_id 0 queue_start_index 2 queue_num 2 testpmd> set port 0 queue-region region_id 7 queue_start_index 4 queue_num 4

the first two rules can be set successfully::

testpmd> set port 0 queue-region region_id 0 flowtype 63 testpmd> set port 0 queue-region region_id 7 flowtype 0

the first two rules can be listed::

testpmd> show port 0 queue-region

the last two rule can't be set successfully::

testpmd> set port 0 queue-region region_id 0 flowtype 64 testpmd> set port 0 queue-region region_id 2 flowtype 34 testpmd> set port 0 queue-region flush on

the last two rules can't be listed::

testpmd> show port 0 queue-region
testpmd> set port 0 queue-region flush off

3. boundary value testing of "Set the mapping of UP to region index on a port"::

testpmd> set port 0 queue-region region_id 0 queue_start_index 2 queue_num 2 testpmd> set port 0 queue-region region_id 7 queue_start_index 4 queue_num 4

the first two rules can be set successfully::

testpmd> set port 0 queue-region UP 7 region_id 0 testpmd> set port 0 queue-region UP 0 region_id 7

the first two rules can be listed::

testpmd> show port 0 queue-region

the last two rule can't be set successfully::

testpmd> set port 0 queue-region UP 8 region_id 0 testpmd> set port 0 queue-region UP 1 region_id 2 testpmd> set port 0 queue-region flush on

the last two rules can't be listed::

testpmd> show port 0 queue-region
testpmd> set port 0 queue-region flush off

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, October 11, 2017 4:56 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v8 0/2] net/i40e: API to configure queue regions for RSS

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

v5:
-fix patchcheck warning.
-add port id check.

v6:
-split this patch set into 2 patch.

v7:
-change some PMD_DRV_LOG log.

v8:
-change CLI command format.
-change some functions name.

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

 app/test-pmd/cmdline.c                      | 424 ++++++++++++++++++++++++
 app/test-pmd/config.c                       |  44 +++
 app/test-pmd/testpmd.h                      |   3 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  41 +++
 drivers/net/i40e/i40e_ethdev.c              |  27 +-
 drivers/net/i40e/i40e_ethdev.h              |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c             | 494 ++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h             |  91 +++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |   2 +-
 9 files changed, 1158 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
#85 lore raw
In reply to Wei Zhao
Quoted 33 lines · Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:

(quoted diff) +0 -3
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to  " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:

(quoted diff) +0 -2
-fix patch check warning
-fix a bug in cmdline.c

v4:

(quoted diff) +0 -4
-fix bug for flowtype config.
-add a new command for get all queue region configuration.
-change function name to "rss" related.
-add document info about queue region CLI.

v5:

(quoted diff) +0 -2
-fix patchcheck warning.
-add port id check.

v6:
-split this patch set into 2 patch.

v7:
-change some PMD_DRV_LOG log.

v8:

(quoted diff) +0 -2
-change CLI command format.
-change some functions name.
Quoted 3 lines

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

Series applied to dpdk-next-net/master, thanks.

(patches updated here and there based on previous comments, please confirm latest commit.)

author
#86 lore raw

Thank you.

Quoted 50 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Thursday, October 12, 2017 5:07 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v8 0/2] net/i40e: API to configure queue regions for RSS

Quoted 34 lines · Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:

(quoted diff) +0 -3
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to  " hw_flowtype " in struct

rte_i40e_rss_region_conf

v3:

(quoted diff) +0 -2
-fix patch check warning
-fix a bug in cmdline.c

v4:

(quoted diff) +0 -4
-fix bug for flowtype config.
-add a new command for get all queue region configuration.
-change function name to "rss" related.
-add document info about queue region CLI.

v5:

(quoted diff) +0 -2
-fix patchcheck warning.
-add port id check.

v6:
-split this patch set into 2 patch.

v7:
-change some PMD_DRV_LOG log.

v8:

(quoted diff) +0 -2
-change CLI command format.
-change some functions name.
Quoted 3 lines

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

Series applied to dpdk-next-net/master, thanks.

(patches updated here and there based on previous comments, please confirm latest commit.)