From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5E009A057C; Wed, 18 Mar 2020 13:38:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2671B1C02D; Wed, 18 Mar 2020 13:38:24 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 53BCF1BF30 for ; Wed, 18 Mar 2020 13:38:21 +0100 (CET) IronPort-SDR: 5Nz7y0NnEdcvMYm94Z0L9Y7gY4TUYEAcb3ezNlQEUzWq9zE6M20poUnmj1R5vynZdTFqWB+dgw +jCbXj1Qk8nw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 05:38:20 -0700 IronPort-SDR: UWUHqdZUuw5cZ+d6XXSR/XpZGKS4DA4AHBmFE6pMKEiRVivDWyHIdyOLowtv2RqwE9D8OGwH5P ZKo6EOEAw6fw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,567,1574150400"; d="scan'208";a="236626446" Received: from sivswdev08.ir.intel.com (HELO localhost.localdomain) ([10.237.217.47]) by fmsmga007.fm.intel.com with ESMTP; 18 Mar 2020 05:38:19 -0700 From: Bernard Iremonger To: dev@dpdk.org, beilei.xing@intel.com, qi.z.zhang@intel.com, declan.doherty@intel.com Cc: konstantin.ananyev@intel.com, Bernard Iremonger Date: Wed, 18 Mar 2020 12:38:09 +0000 Message-Id: <1584535089-29499-4-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1584535089-29499-1-git-send-email-bernard.iremonger@intel.com> References: <1584535089-29499-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH 3/3] net/i40e: configure RSS hash from RSS action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" handle RSS offload types in RSS action handle ipv4, ipv6 and udp RSS patterns handle queue_num 0 in RSS action Signed-off-by: Bernard Iremonger --- drivers/net/i40e/i40e_flow.c | 46 ++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index d877ac2..b9a928c 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -4461,6 +4461,12 @@ i40e_flow_parse_rss_pattern(__rte_unused struct rte_eth_dev *dev, case RTE_FLOW_ITEM_TYPE_ETH: *action_flag = 1; break; + case RTE_FLOW_ITEM_TYPE_IPV4: + break; + case RTE_FLOW_ITEM_TYPE_IPV6: + break; + case RTE_FLOW_ITEM_TYPE_UDP: + break; case RTE_FLOW_ITEM_TYPE_VLAN: vlan_spec = item->spec; vlan_mask = item->mask; @@ -4516,12 +4522,14 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, struct i40e_rte_flow_rss_conf *rss_config = &filter->rss_conf; struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info; + struct rte_eth_rss_conf eth_rss_conf; + int ret; uint16_t i, j, n, tmp; uint32_t index = 0; uint64_t hf_bit = 1; + uint64_t rss_hf; NEXT_ITEM_OF_ACTION(act, actions, index); - rss = act->conf; /** * rss only supports forwarding, @@ -4535,6 +4543,23 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, return -rte_errno; } + rss = act->conf; + rss_hf = rss->types; + + if (rss->queue_num == 0) { + memset(ð_rss_conf, 0, sizeof(eth_rss_conf)); + ret = rte_eth_dev_rss_hash_conf_get(dev->data->port_id, + ð_rss_conf); + if (ret != 0) + return ret; + + eth_rss_conf.rss_hf |= rss_hf; + ret = rte_eth_dev_rss_hash_update(dev->data->port_id, + ð_rss_conf); + if (ret != 0) + return ret; + } + if (action_flag) { for (n = 0; n < 64; n++) { if (rss->types & (hf_bit << n)) { @@ -4552,7 +4577,7 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, * continuous sequence and also to be part of RSS * queue index for this port. */ - if (conf_info->queue_region_number) { + if (conf_info->queue_region_number && rss->queue_num > 0) { for (i = 0; i < rss->queue_num; i++) { for (j = 0; j < rss_info->conf.queue_num; j++) { if (rss->queue[i] == rss_info->conf.queue[j]) @@ -4579,7 +4604,8 @@ 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++) { + for (n = 0; n < conf_info->queue_region_number && + rss->queue_num > 0; n++) { if (conf_info->region[n].user_priority_num || conf_info->region[n].flowtype_num) { if (!((rte_is_power_of_2(rss->queue_num)) && @@ -4674,14 +4700,6 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, if (rss_config->queue_region_conf) return 0; - if (!rss || !rss->queue_num) { - rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - act, - "no valid queues"); - return -rte_errno; - } - for (n = 0; n < rss->queue_num; n++) { if (rss->queue[n] >= dev->data->nb_rx_queues) { rte_flow_error_set(error, EINVAL, @@ -4692,7 +4710,7 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, } } - if (rss_info->conf.queue_num) { + if (rss_info->conf.queue_num && rss->queue_num) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act, @@ -4709,6 +4727,10 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev, return rte_flow_error_set (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act, "a nonzero RSS encapsulation level is not supported"); + if (rss->types > ETH_RSS_ESP) + return rte_flow_error_set + (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act, + "pctype greater than max allowed"); if (rss->key_len && rss->key_len > RTE_DIM(rss_config->key)) return rte_flow_error_set (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act, -- 2.7.4