From patchwork Wed Nov 13 02:03:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simei Su X-Patchwork-Id: 62913 X-Patchwork-Delegate: xiaolong.ye@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 5242FA0353; Wed, 13 Nov 2019 03:03:45 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 78A162BAF; Wed, 13 Nov 2019 03:03:44 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 9FCB2235 for ; Wed, 13 Nov 2019 03:03:42 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 18:03:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,298,1569308400"; d="scan'208";a="198291943" Received: from unknown (HELO npg-dpdk-cvl-simeisu-118d193.sh.intel.com) ([10.67.110.183]) by orsmga008.jf.intel.com with ESMTP; 12 Nov 2019 18:03:38 -0800 From: Simei Su To: qi.z.zhang@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, simei.su@intel.com Date: Wed, 13 Nov 2019 10:03:29 +0800 Message-Id: <1573610609-175412-1-git-send-email-simei.su@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1573546349-341486-1-git-send-email-simei.su@intel.com> References: <1573546349-341486-1-git-send-email-simei.su@intel.com> Subject: [dpdk-dev] [PATCH v2] net/ice: fix flow destroy issue for RSS 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" In ice_hash_create(), whatever the hash_function is, the filter_ptr->symm is always 0 and when we destroy the flow, the ice_rem_rss_cfg() is never carried out. So the destroy function never works well. The patch fixes this issue and at the same time distinguishes semanteme between simple_xor and symmetric_toeplitz. To fix this issue, the patch adds a new structure to include a flag to indicate if it is a simple_xor flow so that it's easier to remove the config when destroying the flow. The patch also simplifies code implementation logic in ice_hash_create(). Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS") Signed-off-by: Simei Su Acked-by: Qi Zhang --- drivers/net/ice/ice_hash.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index 57e7d55..d884343 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -41,6 +41,11 @@ struct rss_meta { uint8_t hash_function; }; +struct ice_hash_flow_cfg { + bool simple_xor; + struct ice_rss_cfg rss_cfg; +}; + static int ice_hash_init(struct ice_adapter *ad); @@ -452,14 +457,14 @@ struct ice_hash_match_type ice_hash_type_list[] = { struct ice_vsi *vsi = pf->main_vsi; int ret; uint32_t reg; - struct ice_rss_cfg *filter_ptr; + struct ice_hash_flow_cfg *filter_ptr; uint32_t headermask = ((struct rss_meta *)meta)->pkt_hdr; uint64_t hash_field = ((struct rss_meta *)meta)->hash_flds; uint8_t hash_function = ((struct rss_meta *)meta)->hash_function; filter_ptr = rte_zmalloc("ice_rss_filter", - sizeof(struct ice_rss_cfg), 0); + sizeof(struct ice_hash_flow_cfg), 0); if (!filter_ptr) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -474,19 +479,20 @@ struct ice_hash_match_type ice_hash_type_list[] = { (2 << VSIQF_HASH_CTL_HASH_SCHEME_S); ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg); - filter_ptr->symm = 0; + filter_ptr->simple_xor = 1; goto out; - } else if (hash_function == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) { - ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 1); - if (ret) { - rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_HANDLE, NULL, - "rss flow create fail"); - goto error; - } } else { - ret = ice_add_rss_cfg(hw, vsi->idx, hash_field, headermask, 0); + filter_ptr->rss_cfg.packet_hdr = headermask; + filter_ptr->rss_cfg.hashed_flds = hash_field; + filter_ptr->rss_cfg.symm = + (hash_function == + RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ); + + ret = ice_add_rss_cfg(hw, vsi->idx, + filter_ptr->rss_cfg.hashed_flds, + filter_ptr->rss_cfg.packet_hdr, + filter_ptr->rss_cfg.symm); if (ret) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -495,9 +501,6 @@ struct ice_hash_match_type ice_hash_type_list[] = { } } - filter_ptr->packet_hdr = headermask; - filter_ptr->hashed_flds = hash_field; - out: flow->rule = filter_ptr; rte_free(meta); @@ -519,11 +522,11 @@ struct ice_hash_match_type ice_hash_type_list[] = { struct ice_vsi *vsi = pf->main_vsi; int ret; uint32_t reg; - struct ice_rss_cfg *filter_ptr; + struct ice_hash_flow_cfg *filter_ptr; - filter_ptr = (struct ice_rss_cfg *)flow->rule; + filter_ptr = (struct ice_hash_flow_cfg *)flow->rule; - if (filter_ptr->symm == 0) { + if (filter_ptr->simple_xor == 1) { /* Return to symmetric_toeplitz state. */ reg = ICE_READ_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id)); reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) | @@ -531,7 +534,8 @@ struct ice_hash_match_type ice_hash_type_list[] = { ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg); } else { ret = ice_rem_rss_cfg(hw, vsi->idx, - filter_ptr->hashed_flds, filter_ptr->packet_hdr); + filter_ptr->rss_cfg.hashed_flds, + filter_ptr->rss_cfg.packet_hdr); if (ret) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,