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 B9E5CA0032; Wed, 11 May 2022 09:55:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65586410F2; Wed, 11 May 2022 09:55:52 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 016B140042; Wed, 11 May 2022 09:55:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652255751; x=1683791751; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xIFPwSa2johpL/dwI6P0peqmrJu5x4DhCSFpZpbm0+Q=; b=Vsprco0W3vn8k2kHVqY4ppMgO4eny6B07GPIpOpFzuIuIGYQAtELk3O9 sxc7ZnOhJRBiCcE5x5BUIQpthFuT02x7DmpJOfYaPYnobF1nj0o3lpfzK /1/LhqSMmz5HqNY9v7fw8JLT7Kbub/TPS+b9tJ8gWlGf+jboyxDz4ot8v g39BuJacb3KAKtAfuLEoEijH4pEfb55tMg12TLQWt9hcFzVjzAVY5OJoQ FCRkvuBGBUC/Iv5AOo8sd5gpWBFCB5KT9gFvC5aPAxtXd8UtbNmVj1znL dEpjNfLm21gVHJT8zmdlHZgHa+77ahS3c2ITrl+Xruj38pvh+JqQ3A/uX A==; X-IronPort-AV: E=McAfee;i="6400,9594,10343"; a="267210602" X-IronPort-AV: E=Sophos;i="5.91,216,1647327600"; d="scan'208";a="267210602" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 00:55:49 -0700 X-IronPort-AV: E=Sophos;i="5.91,216,1647327600"; d="scan'208";a="566061127" Received: from unknown (HELO localhost.localdomain) ([10.239.251.253]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 00:55:47 -0700 From: peng1x.zhang@intel.com To: qiming.yang@intel.com, qi.z.zhang@intel.com, dev@dpdk.org Cc: Peng Zhang , stable@dpdk.org Subject: [PATCH v2] net/ice: fix DCF state checking mechanism Date: Wed, 11 May 2022 15:49:30 +0000 Message-Id: <20220511154930.509436-1-peng1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Peng Zhang DCF state previous checking mechanism can not fully detect DCF state whether is on or not,so PMD will report uncorrect error code in some cases and mislead user.Fix DCF state checking mechanism which will mention user resource temporarily unavailable when DCF state is not on. Fixes: 285f63fc6bb7 ("net/ice: track DCF state of PF") Cc: stable@dpdk.org Signed-off-by: Peng Zhang --- drivers/net/ice/ice_dcf_parent.c | 3 --- drivers/net/ice/ice_switch_filter.c | 20 ++++++-------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index 2f96dedcce..5b02e0197f 100644 --- a/drivers/net/ice/ice_dcf_parent.c +++ b/drivers/net/ice/ice_dcf_parent.c @@ -121,7 +121,6 @@ ice_dcf_vsi_update_service_handler(void *param) struct ice_dcf_hw *hw = reset_param->dcf_hw; struct ice_dcf_adapter *adapter = container_of(hw, struct ice_dcf_adapter, real_hw); - struct ice_adapter *parent_adapter = &adapter->parent; pthread_detach(pthread_self()); @@ -130,8 +129,6 @@ ice_dcf_vsi_update_service_handler(void *param) rte_spinlock_lock(&vsi_update_lock); if (!ice_dcf_handle_vsi_update_event(hw)) { - __atomic_store_n(&parent_adapter->dcf_state_on, true, - __ATOMIC_RELAXED); ice_dcf_update_vf_vsi_map(&adapter->parent.hw, hw->num_vfs, hw->vf_vsi_map); } diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 36c9bffb73..3d36c63e97 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -403,13 +403,6 @@ ice_switch_create(struct ice_adapter *ad, goto error; } - if (ice_dcf_adminq_need_retry(ad)) { - rte_flow_error_set(error, EAGAIN, - RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "DCF is not on"); - goto error; - } - ret = ice_add_adv_rule(hw, list, lkups_cnt, rule_info, &rule_added); if (!ret) { filter_conf_ptr = rte_zmalloc("ice_switch_filter", @@ -432,6 +425,9 @@ ice_switch_create(struct ice_adapter *ad, filter_conf_ptr->fltr_status = ICE_SW_FLTR_ADDED; flow->rule = filter_conf_ptr; + + if (ad->hw.dcf_enabled) + __atomic_store_n(&ad->dcf_state_on, true, __ATOMIC_RELAXED); } else { if (ice_dcf_adminq_need_retry(ad)) ret = -EAGAIN; @@ -490,13 +486,6 @@ ice_switch_destroy(struct ice_adapter *ad, return -rte_errno; } - if (ice_dcf_adminq_need_retry(ad)) { - rte_flow_error_set(error, EAGAIN, - RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "DCF is not on"); - return -rte_errno; - } - ret = ice_rem_adv_rule_by_id(hw, &filter_conf_ptr->sw_query_data); if (ret) { if (ice_dcf_adminq_need_retry(ad)) @@ -508,6 +497,9 @@ ice_switch_destroy(struct ice_adapter *ad, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "fail to destroy switch filter rule"); return -rte_errno; + } else { + if (ad->hw.dcf_enabled) + __atomic_store_n(&ad->dcf_state_on, true, __ATOMIC_RELAXED); } ice_switch_filter_rule_free(flow); -- 2.25.1