From patchwork Thu Jul 9 07:50:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simei Su X-Patchwork-Id: 73592 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 9DEF8A0526; Thu, 9 Jul 2020 09:51:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5FD021DCD1; Thu, 9 Jul 2020 09:51:42 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D91CB1DCAE for ; Thu, 9 Jul 2020 09:51:40 +0200 (CEST) IronPort-SDR: H96u/lKhUzZdLDVp8zmjxzApCUN01q5SwBgY6/KGZRSOMSUlOaGXR+H8J3Wq9N8s2uIvv8m0QH IAe+7RIxvm2Q== X-IronPort-AV: E=McAfee;i="6000,8403,9676"; a="147027943" X-IronPort-AV: E=Sophos;i="5.75,331,1589266800"; d="scan'208";a="147027943" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2020 00:51:39 -0700 IronPort-SDR: LlHz9snO+41yiLG9YvNM01kxbozjO3MbkJHJyscaf38CDPQfeJ22sV2sODRckKPbCZLi8xRAsx 0+LSrMTXXpbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,331,1589266800"; d="scan'208";a="306340524" Received: from unknown (HELO npg-dpdk-cvl-simeisu-118d193.sh.intel.com) ([10.67.110.178]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2020 00:51:38 -0700 From: Simei Su To: qi.z.zhang@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, Simei Su Date: Thu, 9 Jul 2020 15:50:20 +0800 Message-Id: <1594281020-457174-1-git-send-email-simei.su@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1594275994-318254-1-git-send-email-simei.su@intel.com> References: <1594275994-318254-1-git-send-email-simei.su@intel.com> Subject: [dpdk-dev] [PATCH v2] 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 RSS type modifier L2/L3/L4 SRC/DST_ONLY, it should return failure. This patch adds invalid RSS type check. Fixes: dfaedcf20170 ("net/ice: refactor PF hash flow") Signed-off-by: Simei Su --- v2: * Add specific macro value in check rather than hard code. --- drivers/net/ice/ice_hash.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index cbd6116..2c79458 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -722,6 +722,17 @@ struct ice_hash_match_type ice_hash_type_list[] = { */ rss_type = rte_eth_rss_hf_refine(rss_type); + /* Check if only L2/L3/L4 SRC/DST_ONLY exists. */ + if ((rss_type & ~(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)) == 0) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "rss type with only L2/L3/L4 src/dst only is invalid"); + combine_type = ETH_RSS_L2_SRC_ONLY | ETH_RSS_L2_DST_ONLY | ETH_RSS_L3_SRC_ONLY |