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 E481245BC0; Tue, 29 Oct 2024 18:02:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9956E42F1B; Tue, 29 Oct 2024 18:02:17 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by mails.dpdk.org (Postfix) with ESMTP id C2A0442EEE for ; Tue, 29 Oct 2024 18:02:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730221332; x=1761757332; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=POGyRvvj72NqS+boLmT/mNnqO6wTJb6mSopjWe+DsQ0=; b=lhZtrQhNxQsicX+s/weuheQcnQx2iLMbyn7mFu1UNJOwNKhR9V1N33Ln Svs5VA2JAkpHXCv369NzRh8TOt2baXzrmcU5kovu1D2KRhNBqPrbpg302 MHj4iKagRx3I5kuWZjcFs23fDdQZvLKJmZs0qzN9+Hv0PXTJ5D4LYTKlS UxyTStWASn8M0CF+HbfVPEEGMGZW0AXXXuzNKqO++k9GGvPM8JOxVnR2f pi1Uo/SWTty4TUA8YxZU9aZCjonEYOrO2Uhj6yqEEo1aHalyFnaPH75PV rLEkbRc1MVgWZ3VkB6yOltoQiFM/uuBnKex6BxW5TPLgAuOEwx3B3BrXb Q==; X-CSE-ConnectionGUID: iSpCLQSETQWF0rFKrC4u+A== X-CSE-MsgGUID: GtdfIw72TrOmOaMzQ4VH6g== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="40977544" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="40977544" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 10:02:11 -0700 X-CSE-ConnectionGUID: vkFZ3OCiTxGCDNPQ5eD5eQ== X-CSE-MsgGUID: JyXnaFmBQrOaiGTKLYK70g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,241,1725346800"; d="scan'208";a="119494680" Received: from silpixa00400496-oob.ir.intel.com (HELO silpixa00401385.ir.intel.com) ([10.237.214.43]) by orviesa001.jf.intel.com with ESMTP; 29 Oct 2024 10:02:11 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: vladimir.medvedkin@intel.com, Bruce Richardson Subject: [PATCH v6 4/5] net/ice: allowing stopping port to apply TM topology Date: Tue, 29 Oct 2024 17:01:56 +0000 Message-ID: <20241029170157.1390724-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241029170157.1390724-1-bruce.richardson@intel.com> References: <20240807093407.452784-1-bruce.richardson@intel.com> <20241029170157.1390724-1-bruce.richardson@intel.com> 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 The rte_tm topology commit requires the port to be stopped on apply. Rather than just returning an error when the port is already started, we can stop the port, apply the topology to it and then restart it. Signed-off-by: Bruce Richardson Acked-by: Vladimir Medvedkin --- drivers/net/ice/ice_tm.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index a135e9db30..235eda24e5 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -836,15 +836,30 @@ ice_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, struct rte_tm_error *error) { - RTE_SET_USED(error); - /* commit should only be done to topology before start! */ - if (dev->data->dev_started) - return -1; + bool restart = false; + + /* commit should only be done to topology before start + * If port is already started, stop it and then restart when done. + */ + if (dev->data->dev_started) { + if (rte_eth_dev_stop(dev->data->port_id) != 0) { + error->message = "Device failed to Stop"; + return -1; + } + restart = true; + } int ret = commit_new_hierarchy(dev); if (ret < 0 && clear_on_fail) { ice_tm_conf_uninit(dev); ice_tm_conf_init(dev); } + + if (restart) { + if (rte_eth_dev_start(dev->data->port_id) != 0) { + error->message = "Device failed to Start"; + return -1; + } + } return ret; } -- 2.43.0