DPDK patches and discussions
 help / color / mirror / Atom feed
From: peng1x.zhang@intel.com
To: qiming.yang@intel.com, qi.z.zhang@intel.com, dev@dpdk.org
Cc: Peng Zhang <peng1x.zhang@intel.com>, stable@dpdk.org
Subject: [PATCH v2] net/ice: fix DCF state checking mechanism
Date: Wed, 11 May 2022 15:49:30 +0000	[thread overview]
Message-ID: <20220511154930.509436-1-peng1x.zhang@intel.com> (raw)

From: Peng Zhang <peng1x.zhang@intel.com>

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 <peng1x.zhang@intel.com>
---
 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


             reply	other threads:[~2022-05-11  7:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11 15:49 peng1x.zhang [this message]
2022-05-13  9:56 ` Connolly, Padraig J
2022-05-17  7:35 ` Zhang, Qi Z
2022-05-18  6:36   ` Zhang, Peng1X
2022-05-18  6:45     ` Zhang, Qi Z
2022-05-19  6:05       ` Zhang, Peng1X
2022-05-20 18:31 ` [PATCH v3] " peng1x.zhang
2022-05-21  2:17   ` Zhang, Qi Z
2022-05-31 17:48   ` [PATCH v4] net/ice: retry sending adminQ command after failure peng1x.zhang
2022-05-31 11:51     ` Zhang, Qi Z
2022-06-01  1:48       ` Zhang, Peng1X
2022-06-01  1:53         ` Zhang, Qi Z
2022-06-01  2:46           ` Zhang, Peng1X
2022-06-01  3:22             ` Zhang, Qi Z
2022-06-01  5:35               ` Zhang, Peng1X
2022-06-08 10:21     ` [PATCH v5] net/ice: add retry mechanism for DCF " peng1x.zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220511154930.509436-1-peng1x.zhang@intel.com \
    --to=peng1x.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).