From patchwork Tue Sep 29 12:01:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 79190 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B83F9A04C0; Tue, 29 Sep 2020 14:02:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 641271DA62; Tue, 29 Sep 2020 14:01:34 +0200 (CEST) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id D6E991BE9A for ; Tue, 29 Sep 2020 14:01:26 +0200 (CEST) X-ASG-Debug-ID: 1601380884-149d11049a296790001-TfluYd Received: from mail.chinasoftinc.com (inccas001.ito.icss [10.168.0.51]) by incedge.chinasoftinc.com with ESMTP id JDjHaM3JBAX9KAQ7 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 29 Sep 2020 20:01:24 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.51 X-ASG-Whitelist: Client Received: from localhost.localdomain (120.133.139.157) by INCCAS001.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 29 Sep 2020 20:01:24 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: CC: Date: Tue, 29 Sep 2020 20:01:11 +0800 X-ASG-Orig-Subj: [PATCH v2 3/9] net/hns3: fix error type when validating RSS flow action Message-ID: <20200929120117.50394-4-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200929120117.50394-1-huwei013@chinasoftinc.com> References: <20200929110945.70761-1-huwei013@chinasoftinc.com> <20200929120117.50394-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 X-Originating-IP: [120.133.139.157] X-Barracuda-Connect: inccas001.ito.icss[10.168.0.51] X-Barracuda-Start-Time: 1601380884 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://incspam.chinasofti.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 3758 Subject: [dpdk-dev] [PATCH v2 3/9] net/hns3: fix error type when validating RSS flow 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" From: "Wei Hu (Xavier)" Because the macro named RTE_FLOW_ERROR_TYPE_ACTION_CONF indicates a action configuration and the macro named RTE_FLOW_ERROR_TYPE_ACTION indicates a specific action, the driver needs to return RTE_FLOW_ERROR_ACTION_CONF type and notify the user when a RSS configuration is invalid with actions list in the internal function named hns3_parse_rss_filter called by the '.validate' ops implementation function named hns3_flow_validate. Besides, this patch removes some unnecessary judgment lines in hns3_parse_rss_filter. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Cc: stable@dpdk.org Signed-off-by: Lijun Ou Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_flow.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index f8e5f05..a6676d6 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1356,7 +1356,6 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, const struct rte_flow_action_rss *rss; const struct rte_flow_action *act; uint32_t act_index = 0; - uint64_t flow_types; uint16_t n; NEXT_ITEM_OF_ACTION(act, actions, act_index); @@ -1364,7 +1363,7 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, if (rss == NULL) { return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, "no valid queues"); } @@ -1372,48 +1371,32 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, if (rss->queue[n] < dev->data->nb_rx_queues) continue; return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, "queue id > max number of queues"); } - /* Parse flow types of RSS */ if (!(rss->types & HNS3_ETH_RSS_SUPPORT) && rss->types) return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, "Flow types is unsupported by " "hns3's RSS"); - - flow_types = rss->types & HNS3_ETH_RSS_SUPPORT; - if (flow_types != rss->types) - hns3_warn(hw, "RSS flow types(%" PRIx64 ") include unsupported " - "flow types", rss->types); - - /* Parse RSS related parameters from RSS configuration */ - switch (rss->func) { - case RTE_ETH_HASH_FUNCTION_DEFAULT: - case RTE_ETH_HASH_FUNCTION_TOEPLITZ: - case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR: - case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ: - break; - default: + if (rss->func >= RTE_ETH_HASH_FUNCTION_MAX) return rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, act, - "input RSS hash functions are not supported"); - } - + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, + "RSS hash func are not supported"); if (rss->level) return rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, act, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, "a nonzero RSS encapsulation level is not supported"); if (rss->key_len && rss->key_len != RTE_DIM(rss_conf->key)) return rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, act, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, "RSS hash key must be exactly 40 bytes"); if (rss->queue_num > RTE_DIM(rss_conf->queue)) return rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, act, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, "too many queues for RSS context"); if (rss->types & (ETH_RSS_L4_DST_ONLY | ETH_RSS_L4_SRC_ONLY) &&