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 11E3E45BB4; Wed, 23 Oct 2024 18:28:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75A1242EB5; Wed, 23 Oct 2024 18:28:07 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mails.dpdk.org (Postfix) with ESMTP id 9B75C42E8C for ; Wed, 23 Oct 2024 18:28:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729700881; x=1761236881; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=smXF4eD3W/OhNGat0Dj/1yjW2WT4jRP2sKEue/GD7VU=; b=KyEqKpnMun+82quUeQy48aDiZgl+aXa+fdBEWgPHRLuTSBmqefDRUzgz Ikh9vDVuQDdT0VCfPN0W2bHiANX7Z7zDCB7gqNhoFyHn8egADNa6AnEh1 Y+PajqaHeZuPtAumjfVrJyaHyCuWxd3GUymmdX4G8jyoB7OsZYo0tJZx6 VoE8x1FmF9GNCDu6zuqUniB6dvgVyfyEdZ9EOipmEOjykXgUdER/WGz2s UEs2C1xgNoLeL8kUdEP5BE2fqTMZJcY/kezIwq8h67Xjx9guwEd7TeBg6 ms9IKSAOSeAUyrByS/fkXAWDNc9lKAJVirzxjB5TbWM5t9LZMZN9LHgMJ w==; X-CSE-ConnectionGUID: BhEBPykyS/iz732C2MWbOw== X-CSE-MsgGUID: AsnFvWDySXG8a0Uz+3S4Cw== X-IronPort-AV: E=McAfee;i="6700,10204,11234"; a="29521282" X-IronPort-AV: E=Sophos;i="6.11,226,1725346800"; d="scan'208";a="29521282" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2024 09:28:00 -0700 X-CSE-ConnectionGUID: yaw4K8SdSF+zgJKKu3ultA== X-CSE-MsgGUID: xSRk90oETRCW4ap8x2oCZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,226,1725346800"; d="scan'208";a="103583950" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by fmviesa002.fm.intel.com with ESMTP; 23 Oct 2024 09:28:00 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH v4 4/5] net/ice: allowing stopping port to apply TM topology Date: Wed, 23 Oct 2024 17:27:35 +0100 Message-ID: <20241023162747.453267-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023162747.453267-1-bruce.richardson@intel.com> References: <20240807093407.452784-1-bruce.richardson@intel.com> <20241023162747.453267-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