From patchwork Wed Sep 6 07:49:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaiwen Deng X-Patchwork-Id: 131184 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6FAA142526; Wed, 6 Sep 2023 10:11:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 444914029E; Wed, 6 Sep 2023 10:11:11 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 7869C4029D; Wed, 6 Sep 2023 10:11:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693987869; x=1725523869; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ULHCMpwkJ20UXfm5UQ+LteSSmg/uPGWCVMSkoSeZHGs=; b=nGHCzs+uQVll6XhzQewAiFEHXmmkxY9I/sg3wxrDDNkEHYKEwVGEPS5y ermRStvmAaNXFhu2bAa0pF8A2QbrqFD8+C7d00WYBJRY7lDT9BQTJIST9 Duw4cfWRLh+foTMjOmBAtkVZEQPa77+utQY9x/Z5G50R76XNXAWvB5BGb mE19gMZxyE3CKzXMnnMjrbV8Jj8Yzf/07nWP/qYH8+giDp+ccMvSQPTvM 4Gt8DL0lRlyfCUhhX9FRYbEB5eRUzvtEkXmklranOILSzgGggmAoh9EIw 9cWWho4jpyzVFWPtaMeJsMkZUY/9s7pXaOPaMZ62DxCZKvRf2Hr+Aha2A Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="379717223" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="379717223" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2023 01:11:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="806920105" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="806920105" Received: from unknown (HELO localhost.localdomain) ([10.239.252.104]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2023 01:11:05 -0700 From: Kaiwen Deng To: dev@dpdk.org Cc: stable@dpdk.org, qiming.yang@intel.com, yidingx.zhou@intel.com, Kaiwen Deng , Qi Zhang , Ting Xu Subject: [PATCH v3] net/ice: fix tm configuration cannot be cleared Date: Wed, 6 Sep 2023 15:49:30 +0800 Message-Id: <20230906074930.746005-1-kaiwenx.deng@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230905073444.708799-1-kaiwenx.deng@intel.com> References: <20230905073444.708799-1-kaiwenx.deng@intel.com> MIME-Version: 1.0 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 When the device is stopped, the PMD resets the commit flag so that we can update the hierarchy configuration. The commit flag is also used to determine if the hierarchy configuration needs to be cleared. When the PMD exits, it always stops the device first and also resets the commit flag result in the hierarchy configuration is not cleared. This commit changes the PMD to not reset the commit flag when the device is stopped. And we prevent additional commit when device is running by only checking the stop flag. Fixes: f5ec6a3a1987 ("net/ice: fix TM hierarchy commit flag reset") Cc: stable@dpdk.org Signed-off-by: Kaiwen Deng Acked-by: Wenjun Wu --- Changes since v2: - Replace DPDK with the PMD in commit log. Changes since v1: - Prevent additional commit when device is running. --- --- drivers/net/ice/ice_dcf_ethdev.c | 2 -- drivers/net/ice/ice_dcf_sched.c | 14 ++++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 30ad18d8fc..065ec728c2 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -670,7 +670,6 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev) struct ice_dcf_adapter *dcf_ad = dev->data->dev_private; struct rte_intr_handle *intr_handle = dev->intr_handle; struct ice_adapter *ad = &dcf_ad->parent; - struct ice_dcf_hw *hw = &dcf_ad->real_hw; if (ad->pf.adapter_stopped == 1) { PMD_DRV_LOG(DEBUG, "Port is already stopped"); @@ -697,7 +696,6 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev) dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; ad->pf.adapter_stopped = 1; - hw->tm_conf.committed = false; return 0; } diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c index a231c1e60b..b08bc5f1de 100644 --- a/drivers/net/ice/ice_dcf_sched.c +++ b/drivers/net/ice/ice_dcf_sched.c @@ -237,6 +237,7 @@ ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id, enum ice_dcf_tm_node_type node_type = ICE_DCF_TM_NODE_TYPE_MAX; struct ice_dcf_tm_shaper_profile *shaper_profile = NULL; struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_adapter *ad = &adapter->parent; struct ice_dcf_hw *hw = &adapter->real_hw; struct ice_dcf_tm_node *parent_node; struct ice_dcf_tm_node *tm_node; @@ -246,10 +247,10 @@ ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id, if (!params || !error) return -EINVAL; - /* if already committed */ - if (hw->tm_conf.committed) { + /* if port is running */ + if (!ad->pf.adapter_stopped) { error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; - error->message = "already committed"; + error->message = "port is running"; return -EINVAL; } @@ -400,16 +401,17 @@ ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id, { enum ice_dcf_tm_node_type node_type = ICE_DCF_TM_NODE_TYPE_MAX; struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_adapter *ad = &adapter->parent; struct ice_dcf_hw *hw = &adapter->real_hw; struct ice_dcf_tm_node *tm_node; if (!error) return -EINVAL; - /* if already committed */ - if (hw->tm_conf.committed) { + /* if port is running */ + if (!ad->pf.adapter_stopped) { error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; - error->message = "already committed"; + error->message = "port is running"; return -EINVAL; }