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 419D8A034E for ; Mon, 21 Feb 2022 16:38:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3CC144013F; Mon, 21 Feb 2022 16:38:06 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 075CA4013F for ; Mon, 21 Feb 2022 16:38:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645457884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MKDL2jZSIIFlSjPmwsdSXu6zDMClsq+izEYfhqdiWPo=; b=htOi3G3enWno5Bog6phpIOS71sWvPP4mX0S0VvHPoj6vOKAEQTVS9rmT2yhtpOHWhzLxHw 340BRY6BpHjAubaSgEgY1IygaOHCJSFiwHfXNIxSv7cy0Y3Fd8xJkq1RMZVEoSCav1qoOm oaA6yuGEXKRHDmNrGxPukivSaCERBwU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-2-5SJK8RPzPvO0m7dc4Dq3Dw-1; Mon, 21 Feb 2022 10:38:01 -0500 X-MC-Unique: 5SJK8RPzPvO0m7dc4Dq3Dw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6692A100C662; Mon, 21 Feb 2022 15:38:00 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5965E7E131; Mon, 21 Feb 2022 15:37:59 +0000 (UTC) From: Kevin Traynor To: Dapeng Yu Cc: Haiyue Wang , dpdk stable Subject: patch 'net/ice: track DCF state of PF' has been queued to stable release 21.11.1 Date: Mon, 21 Feb 2022 15:33:47 +0000 Message-Id: <20220221153625.152324-38-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/26/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/76a729e7ed5e95e12f479a0b09c97783b9974a31 Thanks. Kevin --- >From 76a729e7ed5e95e12f479a0b09c97783b9974a31 Mon Sep 17 00:00:00 2001 From: Dapeng Yu Date: Wed, 24 Nov 2021 16:12:20 +0800 Subject: [PATCH] net/ice: track DCF state of PF [ upstream commit 285f63fc6bb72a07594af9a7652f5bae3a95eb52 ] When VF is reset, PF will change DCF state from ON to other state, if flow creation, destroy, or redirect command is sent to DCF at this time, it will fail. This patch tracks DCF state and returns try-again error to caller when DCF state is not ON. Signed-off-by: Dapeng Yu Acked-by: Haiyue Wang --- drivers/net/ice/ice_dcf_ethdev.c | 12 ++++++++ drivers/net/ice/ice_dcf_ethdev.h | 1 + drivers/net/ice/ice_dcf_parent.c | 16 +++++++--- drivers/net/ice/ice_ethdev.h | 2 ++ drivers/net/ice/ice_generic_flow.c | 4 ++- drivers/net/ice/ice_switch_filter.c | 45 +++++++++++++++++++++++++++-- 6 files changed, 73 insertions(+), 7 deletions(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index a1f11c01d9..59610e058f 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -958,4 +958,11 @@ ice_dcf_link_update(struct rte_eth_dev *dev, } +bool +ice_dcf_adminq_need_retry(struct ice_adapter *ad) +{ + return ad->hw.dcf_enabled && + !__atomic_load_n(&ad->dcf_state_on, __ATOMIC_RELAXED); +} + /* Add UDP tunneling port */ static int @@ -1107,4 +1114,5 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev) { struct ice_dcf_adapter *adapter = eth_dev->data->dev_private; + struct ice_adapter *parent_adapter = &adapter->parent; eth_dev->dev_ops = &ice_dcf_eth_dev_ops; @@ -1118,7 +1126,11 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev) if (ice_dcf_init_hw(eth_dev, &adapter->real_hw) != 0) { PMD_INIT_LOG(ERR, "Failed to init DCF hardware"); + __atomic_store_n(&parent_adapter->dcf_state_on, false, + __ATOMIC_RELAXED); return -1; } + __atomic_store_n(&parent_adapter->dcf_state_on, true, __ATOMIC_RELAXED); + if (ice_dcf_init_parent_adapter(eth_dev) != 0) { PMD_INIT_LOG(ERR, "Failed to init DCF parent adapter"); diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_ethdev.h index 8510e37119..11a1305038 100644 --- a/drivers/net/ice/ice_dcf_ethdev.h +++ b/drivers/net/ice/ice_dcf_ethdev.h @@ -65,4 +65,5 @@ int ice_dcf_vf_repr_uninit(struct rte_eth_dev *vf_rep_eth_dev); int ice_dcf_vf_repr_init_vlan(struct rte_eth_dev *vf_rep_eth_dev); void ice_dcf_vf_repr_stop_all(struct ice_dcf_adapter *dcf_adapter); +bool ice_dcf_adminq_need_retry(struct ice_adapter *ad); #endif /* _ICE_DCF_ETHDEV_H_ */ diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index 1ff2c47172..0c8c2ed6c7 100644 --- a/drivers/net/ice/ice_dcf_parent.c +++ b/drivers/net/ice/ice_dcf_parent.c @@ -120,5 +120,7 @@ ice_dcf_vsi_update_service_handler(void *param) struct ice_dcf_reset_event_param *reset_param = param; struct ice_dcf_hw *hw = reset_param->dcf_hw; - struct ice_dcf_adapter *adapter; + 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()); @@ -128,9 +130,10 @@ ice_dcf_vsi_update_service_handler(void *param) rte_spinlock_lock(&vsi_update_lock); - adapter = container_of(hw, struct ice_dcf_adapter, real_hw); - - if (!ice_dcf_handle_vsi_update_event(hw)) + 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); + } if (reset_param->vfr && adapter->repr_infos) { @@ -225,4 +228,7 @@ ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw, { struct virtchnl_pf_event *pf_msg = (struct virtchnl_pf_event *)msg; + struct ice_dcf_adapter *adapter = + container_of(dcf_hw, struct ice_dcf_adapter, real_hw); + struct ice_adapter *parent_adapter = &adapter->parent; if (msglen < sizeof(struct virtchnl_pf_event)) { @@ -259,4 +265,6 @@ ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw, pf_msg->event_data.vf_vsi_map.vf_id, pf_msg->event_data.vf_vsi_map.vsi_id); + __atomic_store_n(&parent_adapter->dcf_state_on, false, + __ATOMIC_RELAXED); start_vsi_reset_thread(dcf_hw, true, pf_msg->event_data.vf_vsi_map.vf_id); diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 2e3e45f3d7..1242177b42 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -532,4 +532,6 @@ struct ice_adapter { struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS]; struct ice_rss_prof_info rss_prof_info[ICE_MAX_PTGS]; + /* True if DCF state of the associated PF is on */ + bool dcf_state_on; #ifdef RTE_ARCH_X86 bool rx_use_avx2; diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index c673feb7a6..406a0a953f 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -2516,5 +2516,7 @@ ice_flow_flush(struct rte_eth_dev *dev, if (ret) { PMD_DRV_LOG(ERR, "Failed to flush flows"); - return -EINVAL; + if (ret != -EAGAIN) + ret = -EINVAL; + return ret; } } diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index ed29c00d77..bd805d9606 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -401,4 +401,12 @@ 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) { @@ -424,5 +432,10 @@ ice_switch_create(struct ice_adapter *ad, flow->rule = filter_conf_ptr; } else { - rte_flow_error_set(error, EINVAL, + if (ice_dcf_adminq_need_retry(ad)) + ret = -EAGAIN; + else + ret = -EINVAL; + + rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "switch filter create flow fail"); @@ -476,7 +489,19 @@ ice_switch_destroy(struct ice_adapter *ad, } + 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) { - rte_flow_error_set(error, EINVAL, + if (ice_dcf_adminq_need_retry(ad)) + ret = -EAGAIN; + else + ret = -EINVAL; + + rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "fail to destroy switch filter rule"); @@ -2017,4 +2042,10 @@ ice_switch_redirect(struct ice_adapter *ad, rmv_rule: + if (ice_dcf_adminq_need_retry(ad)) { + PMD_DRV_LOG(WARNING, "DCF is not on"); + ret = -EAGAIN; + goto out; + } + /* Remove the old rule */ ret = ice_rem_adv_rule(hw, lkups_ref, lkups_cnt, &rinfo); @@ -2029,4 +2060,10 @@ rmv_rule: add_rule: + if (ice_dcf_adminq_need_retry(ad)) { + PMD_DRV_LOG(WARNING, "DCF is not on"); + ret = -EAGAIN; + goto out; + } + /* Update VSI context */ hw->vsi_ctx[rd->vsi_handle]->vsi_num = rd->new_vsi_num; @@ -2048,4 +2085,8 @@ add_rule: out: + if (ret == -EINVAL) + if (ice_dcf_adminq_need_retry(ad)) + ret = -EAGAIN; + ice_free(hw, lkups_dp); return ret; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:45.477849821 +0000 +++ 0038-net-ice-track-DCF-state-of-PF.patch 2022-02-21 15:22:44.083704107 +0000 @@ -1 +1 @@ -From 285f63fc6bb72a07594af9a7652f5bae3a95eb52 Mon Sep 17 00:00:00 2001 +From 76a729e7ed5e95e12f479a0b09c97783b9974a31 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 285f63fc6bb72a07594af9a7652f5bae3a95eb52 ] + @@ -12,2 +13,0 @@ - -Cc: stable@dpdk.org