From patchwork Mon Jul 27 07:58:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 74835 X-Patchwork-Delegate: qi.z.zhang@intel.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 8C7EEA0524; Mon, 27 Jul 2020 10:02:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A31B1BFE2; Mon, 27 Jul 2020 10:02:00 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id AD64F1BFC9 for ; Mon, 27 Jul 2020 10:01:58 +0200 (CEST) IronPort-SDR: 2AZ/cJbdQn/Z8zep9AerULFL+HYLVJkcv30BgN1MELshiT6r13i4HFCuDVybJa/nhh3SLusKj1 usVeTCca9N5w== X-IronPort-AV: E=McAfee;i="6000,8403,9694"; a="152229746" X-IronPort-AV: E=Sophos;i="5.75,401,1589266800"; d="scan'208";a="152229746" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2020 01:01:57 -0700 IronPort-SDR: 0LWD0cfrJLmpfBzkbow5sDEHiE79KXztZ7iTlXE0el9eCIViuq1q3MMl3WvIbMlPDJxoIOX9pY ytaTZ5os/gkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,401,1589266800"; d="scan'208";a="327938566" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by FMSMGA003.fm.intel.com with ESMTP; 27 Jul 2020 01:01:55 -0700 From: Jeff Guo To: qi.z.zhang@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, simei.su@intel.com, jia.guo@intel.com Date: Mon, 27 Jul 2020 15:58:31 +0800 Message-Id: <20200727075831.69856-1-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [dpdk-dev] [dpdk-dev v1] net/ice: fix invalid hash validation 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" An invalid rule should not be validated successfully. If the rule is not in the supporting list, just return failure to application. Signed-off-by: Jeff Guo Acked-by: Qi Zhang --- drivers/net/ice/ice_hash.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index 2845ca0bd..fdfaff7f6 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -1012,6 +1012,7 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, enum rte_flow_action_type action_type; const struct rte_flow_action_rss *rss; const struct rte_flow_action *action; + bool hash_map_found = false; uint64_t rss_attr_src_dst; uint64_t rss_attr_l3_pre; uint64_t rss_attr_symm; @@ -1125,10 +1126,18 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, if (rss_type == ht_map->hash_type) { hash_meta->hash_flds = ht_map->hash_flds; + hash_map_found = true; break; } } + if (pattern_match_item->pattern_list != + pattern_empty && !hash_map_found) { + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "Not supported flow"); + } + /* update hash field for nat-t esp. */ if (rss_type == ETH_RSS_ESP && (m->eth_rss_hint & ETH_RSS_NONFRAG_IPV4_UDP ||