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 DC40845BB4; Wed, 23 Oct 2024 18:56:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 063FF42EE0; Wed, 23 Oct 2024 18:56:20 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by mails.dpdk.org (Postfix) with ESMTP id 1779D42ED7 for ; Wed, 23 Oct 2024 18:56:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729702578; x=1761238578; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=smXF4eD3W/OhNGat0Dj/1yjW2WT4jRP2sKEue/GD7VU=; b=WX+dBT5bep6JAALaR9xOtnVudBawRl6GQaL5K0WzD9/3KWT2Hwagyp71 MGZioQIjoFB/iYyUlyTTjVvqyMUmhf3lCva6oBFJmIaqqNP5d4Gi1aruE x4Q9ZpIBFVo3tKAa+Jy9vL7WYFuFtZ+gc8T83qSfN5SKwsV0P+DdiwZWZ qWZh58amf/fROQLsLot3eLC/QxLRdWaRN6RrsXd9ncmcD2hu91mTsgCyv 1R86xyA1/B2l5qFwlGtSabN8MWQs8ZTxTcyzowGyYTsc2NjU9R4mWVw46 Ohiu7pqCxc1sPTN5gaomKxxbNxLkIQ9YxR/LTOMw3GsXfhA2I4OYf9kHW Q==; X-CSE-ConnectionGUID: VzwNbi5uSLK3GNBJr34gvA== X-CSE-MsgGUID: ZMh5AUzYR4WzlR/gIOHWlw== X-IronPort-AV: E=McAfee;i="6700,10204,11234"; a="32159403" X-IronPort-AV: E=Sophos;i="6.11,226,1725346800"; d="scan'208";a="32159403" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2024 09:56:09 -0700 X-CSE-ConnectionGUID: 0RgvXkVpS0mlXlSDP711Pg== X-CSE-MsgGUID: r3dEp/+pT1C4DoxnpoL7RA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,226,1725346800"; d="scan'208";a="85073324" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by orviesa005.jf.intel.com with ESMTP; 23 Oct 2024 09:56:08 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH v5 4/5] net/ice: allowing stopping port to apply TM topology Date: Wed, 23 Oct 2024 17:55:39 +0100 Message-ID: <20241023165540.893269-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023165540.893269-1-bruce.richardson@intel.com> References: <20240807093407.452784-1-bruce.richardson@intel.com> <20241023165540.893269-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 --- 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 4809bdde40..09e947a3b1 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -844,15 +844,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