From 17d5c9234b85b8fc8ca19f91f3f326d398421d39 Mon Sep 17 00:00:00 2001 From: Wei Zhao Date: Wed, 11 Apr 2018 11:24:32 +0800 Subject: [PATCH] net/i40e: add comment and clean code for flow RSS This patch add comment for flow rss parse function in order to explain some important info. This patch also delete some useless code for queue index check for RSS queue region configuration. Fixes: ecad87d22383 ("net/i40e: move RSS to flow API") Cc: stable@dpdk.org Signed-off-by: Wei Zhao Tested-by: Yuan Peng Acked-by: Qi Zhang --- drivers/net/i40e/i40e_flow.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index f4d08bb247..5f78a15160 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -4171,6 +4171,19 @@ i40e_flow_parse_rss_pattern(__rte_unused struct rte_eth_dev *dev, return 0; } +/** + * This function is used to parse rss queue index, total queue number and + * hash functions, If the purpose of this configuration is for queue region + * configuration, it will set queue_region_conf flag to TRUE, else to FALSE. + * In queue region configuration, it also need to parse hardware flowtype + * and user_priority from configuration, it will also cheeck the validity + * of these parameters. For example, The queue region sizes should + * be any of the following values: 1, 2, 4, 8, 16, 32, 64, the + * hw_flowtype or PCTYPE max index should be 63, the user priority + * max index should be 7, and so on. And also, queue index should be + * continuous sequence and queue region index should be part of rss + * queue index for this port. + */ static int i40e_flow_parse_rss_action(struct rte_eth_dev *dev, const struct rte_flow_action *actions, @@ -4216,6 +4229,12 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, } } + /** + * Do some queue region related parameters check + * in order to keep queue index for queue region to be + * continuous sequence and also to be part of RSS + * queue index for this port. + */ if (conf_info->queue_region_number) { for (i = 0; i < rss->num; i++) { for (j = 0; j < rss_info->num; j++) { @@ -4242,6 +4261,7 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, } } + /* Parse queue region related parameters from configuration */ for (n = 0; n < conf_info->queue_region_number; n++) { if (conf_info->region[n].user_priority_num || conf_info->region[n].flowtype_num) { @@ -4264,17 +4284,6 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, return -rte_errno; } - if (rss_info->num < rss->num || - rss->queue[0] < rss_info->queue[0] || - (rss->queue[0] + rss->num > - rss_info->num + rss_info->queue[0])) { - rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - act, - "no valid queues"); - return -rte_errno; - } - for (i = 0; i < info->queue_region_number; i++) { if (info->region[i].queue_num == rss->num && info->region[i].queue_start_index == @@ -4329,6 +4338,9 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, rss_config->queue_region_conf = TRUE; } + /** + * Return function if this flow is used for queue region configuration + */ if (rss_config->queue_region_conf) return 0; @@ -4349,6 +4361,8 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, return -rte_errno; } } + + /* Parse RSS related parameters from configuration */ if (rss->rss_conf) rss_config->rss_conf = *rss->rss_conf; else -- 2.20.1