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 91904A0540; Thu, 16 Jul 2020 05:27:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6CB4A1BEAC; Thu, 16 Jul 2020 05:27:11 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 513FA4C7B for ; Thu, 16 Jul 2020 05:27:09 +0200 (CEST) IronPort-SDR: zSarWCfa8DLsK3/jOr9RyjkLbMbpwm9BEw56U8xjAIZvvbL057ThGDAeE/yb4CvwkCfO4iE/is iKh7yGxfF1pA== X-IronPort-AV: E=McAfee;i="6000,8403,9683"; a="129384805" X-IronPort-AV: E=Sophos;i="5.75,357,1589266800"; d="scan'208";a="129384805" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2020 20:27:08 -0700 IronPort-SDR: VVw3Jis6b8JjWfNetcwAn/Qusp5BuXF1yuobY26a8z3AT6Cr0y/UBEpiOAtU5SH92DNBAFrLvu GYZQDaJIImYw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,357,1589266800"; d="scan'208";a="286339542" Received: from npg-dpdk-cvl-simeisu-118d193.sh.intel.com ([10.67.110.178]) by orsmga006.jf.intel.com with ESMTP; 15 Jul 2020 20:27:06 -0700 From: Simei Su To: qi.z.zhang@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, junfeng.guo@intel.com, ting.xu@intel.com, Simei Su Date: Thu, 16 Jul 2020 11:24:54 +0800 Message-Id: <1594869894-419486-1-git-send-email-simei.su@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1594808751-138882-1-git-send-email-simei.su@intel.com> References: <1594808751-138882-1-git-send-email-simei.su@intel.com> Subject: [dpdk-dev] [PATCH v5] net/ice: fix invalid RSS type 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" When a RSS rule with only SRC/DST_ONLY or IPV6 prefix RSS type, it should return failure. Besides, when a RSS rule with symmetric hash function, the RSS type shouldn't carry with SRC/DST_ONLY. This patch adds invalid RSS type check for the two cases. Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") Signed-off-by: Simei Su --- v5: * Refactor code to avoid duplicate. v4: * Modify check logic for symmetric case. v3: * Add invalid RSS type check for symmetric case. * Consider IPV6 prefix. * Refine commit log. v2: * Add specific macro value in check rather than hard code. --- drivers/net/ice/ice_hash.c | 47 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index e57feff..af29ab6 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -994,7 +994,9 @@ struct ice_hash_match_type ice_hash_type_list[] = { enum rte_flow_action_type action_type; const struct rte_flow_action_rss *rss; const struct rte_flow_action *action; - uint64_t combine_type; + uint64_t rss_attr_src_dst; + uint64_t rss_attr_l3_pre; + uint64_t rss_attr_all; uint64_t rss_type; uint16_t i; @@ -1046,18 +1048,41 @@ struct ice_hash_match_type ice_hash_type_list[] = { */ rss_type = rte_eth_rss_hf_refine(rss_type); - combine_type = ETH_RSS_L2_SRC_ONLY | - ETH_RSS_L2_DST_ONLY | - RTE_ETH_RSS_L3_PRE32 | - RTE_ETH_RSS_L3_PRE48 | - RTE_ETH_RSS_L3_PRE64 | - ETH_RSS_L3_SRC_ONLY | - ETH_RSS_L3_DST_ONLY | - ETH_RSS_L4_SRC_ONLY | - ETH_RSS_L4_DST_ONLY; + rss_attr_src_dst = ETH_RSS_L2_SRC_ONLY | + ETH_RSS_L2_DST_ONLY | + ETH_RSS_L3_SRC_ONLY | + ETH_RSS_L3_DST_ONLY | + ETH_RSS_L4_SRC_ONLY | + ETH_RSS_L4_DST_ONLY; + + rss_attr_l3_pre = RTE_ETH_RSS_L3_PRE32 | + RTE_ETH_RSS_L3_PRE48 | + RTE_ETH_RSS_L3_PRE64; + + rss_attr_all = rss_attr_src_dst | rss_attr_l3_pre; + + /* Check if only SRC/DST_ONLY or ipv6 prefix exists. */ + if ((rss_type & ~rss_attr_all) == 0) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "invalid rss types"); + + /** + * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ + * hash function. + */ + if (rss->func == + RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) { + if (rss_type & rss_attr_src_dst) + return rte_flow_error_set(error, + ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "invalid rss types"); + } /* Check if rss types match pattern. */ - if (rss_type & ~combine_type & ~m->eth_rss_hint) { + if (rss_type & ~rss_attr_all & ~m->eth_rss_hint) { return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, action, "Not supported RSS types"); -- 1.8.3.1