From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 691B7A052A; Wed, 27 Jan 2021 10:49:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3DBE140DC6; Wed, 27 Jan 2021 10:49:44 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 2A873140D9C; Wed, 27 Jan 2021 10:49:42 +0100 (CET) IronPort-SDR: d/MocGLqDR894ESk4V+Fq5EHcoLl5UvOgk6DfmOwvW51LkVpMuxsumomtntCEKv60p8ibQjHFt pVmLD33+VXGg== X-IronPort-AV: E=McAfee;i="6000,8403,9876"; a="180189028" X-IronPort-AV: E=Sophos;i="5.79,378,1602572400"; d="scan'208";a="180189028" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2021 01:49:41 -0800 IronPort-SDR: 3tkJZj0XJiRY08n/3+gNWm9sGolZLz/EQ2GGhEt5DxG3WZDc5mo+ZFLhBo2Q0JitQqCteq2D9q PHLttcgeMgow== X-IronPort-AV: E=Sophos;i="5.79,378,1602572400"; d="scan'208";a="388247613" Received: from unknown (HELO localhost.localdomain) ([10.240.183.50]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2021 01:49:39 -0800 From: "yuanx.wang" To: qiming.yang@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, "yuanx.wang" , stable@dpdk.org Date: Wed, 27 Jan 2021 09:42:36 +0000 Message-Id: <20210127094236.44186-1-yuanx.wang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [DPDK] net/ice: fix flow rule checking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Currently, when the RSS rule set to l4-src-only and l4-dst-only, the hash value is different while the ingress packets have same L4 parameters. This patch keeps the hash value consistent in above situation. Fixes: 38d632cbdc88 ("net/ice: refactor PF RSS") Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow") Cc: stable@dpdk.org Signed-off-by: yuanx.wang --- drivers/net/ice/ice_hash.c | 66 +++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index 2d23c8dd5..8092c1acc 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -712,14 +712,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg, if (rss_type & (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP)) { - if (rss_type & ETH_RSS_L4_SRC_ONLY) - *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT)); - else if (rss_type & ETH_RSS_L4_DST_ONLY) - *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT)); - else if (rss_type & - (ETH_RSS_L3_SRC_ONLY | - ETH_RSS_L3_DST_ONLY)) - *hash_flds &= ~ICE_FLOW_HASH_UDP_PORT; + if ((rss_type & + (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) != + (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) { + if (rss_type & ETH_RSS_L4_SRC_ONLY) + *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT)); + else if (rss_type & ETH_RSS_L4_DST_ONLY) + *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT)); + else if (rss_type & + (ETH_RSS_L3_SRC_ONLY | + ETH_RSS_L3_DST_ONLY)) + *hash_flds &= ~ICE_FLOW_HASH_UDP_PORT; + } } else { *hash_flds &= ~ICE_FLOW_HASH_UDP_PORT; } @@ -729,14 +733,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg, if (rss_type & (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP)) { - if (rss_type & ETH_RSS_L4_SRC_ONLY) - *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT)); - else if (rss_type & ETH_RSS_L4_DST_ONLY) - *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT)); - else if (rss_type & - (ETH_RSS_L3_SRC_ONLY | - ETH_RSS_L3_DST_ONLY)) - *hash_flds &= ~ICE_FLOW_HASH_TCP_PORT; + if ((rss_type & + (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) != + (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) { + if (rss_type & ETH_RSS_L4_SRC_ONLY) + *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT)); + else if (rss_type & ETH_RSS_L4_DST_ONLY) + *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT)); + else if (rss_type & + (ETH_RSS_L3_SRC_ONLY | + ETH_RSS_L3_DST_ONLY)) + *hash_flds &= ~ICE_FLOW_HASH_TCP_PORT; + } } else { *hash_flds &= ~ICE_FLOW_HASH_TCP_PORT; } @@ -746,14 +754,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg, if (rss_type & (ETH_RSS_NONFRAG_IPV4_SCTP | ETH_RSS_NONFRAG_IPV6_SCTP)) { - if (rss_type & ETH_RSS_L4_SRC_ONLY) - *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT)); - else if (rss_type & ETH_RSS_L4_DST_ONLY) - *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT)); - else if (rss_type & - (ETH_RSS_L3_SRC_ONLY | - ETH_RSS_L3_DST_ONLY)) - *hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT; + if ((rss_type & + (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) != + (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) { + if (rss_type & ETH_RSS_L4_SRC_ONLY) + *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT)); + else if (rss_type & ETH_RSS_L4_DST_ONLY) + *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT)); + else if (rss_type & + (ETH_RSS_L3_SRC_ONLY | + ETH_RSS_L3_DST_ONLY)) + *hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT; + } } else { *hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT; } @@ -946,12 +958,6 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item, RTE_FLOW_ERROR_TYPE_ACTION, action, "a non-NULL RSS queue is not supported"); - /** - * Check simultaneous use of SRC_ONLY and DST_ONLY - * of the same level. - */ - rss_type = rte_eth_rss_hf_refine(rss_type); - if (ice_any_invalid_rss_type(rss->func, rss_type, pattern_match_item->input_set_mask)) return rte_flow_error_set(error, ENOTSUP, -- 2.25.1