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 793F0437F7; Tue, 2 Jan 2024 03:08:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA40E40633; Tue, 2 Jan 2024 03:08:08 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 1B1AE402BD for ; Tue, 2 Jan 2024 03:08:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704161286; x=1735697286; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UnvqRHv/oJ9XnzETyAtvHDF0beIPjFHQe0kAI/uFdgI=; b=HJ3qLtUxuIA7rCLlT0/ORq965LUdB+MEsXSyVzmebQ6ZL6G0tFRJURbZ 4FD0apSYP20HbZiZkzLNiwHZksQ8IOn2ubQeg8/jUv5SPTYL50GpNzxdN r7ckIfkcjWwp331xx8W1mlBodm0EqCbuVCkmvoUy2FjZ13enhtEoYeCgG 9ooJWhoJT4leNqifGFkVQX7cIHZ0h5hSRVA3ArAgcmp/98CNKBXeoD8B+ f76KlpMByuua4ezA5PrpakTLflY+rzoOMYr6y5rQCZi30hoHVdshQRFzb aTBfsgt36vO+fzjmpJW40iUSeAquR0ZPXF1z3jtacm2+LHI1mf3YwLSjB g==; X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="427991436" X-IronPort-AV: E=Sophos;i="6.04,324,1695711600"; d="scan'208";a="427991436" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jan 2024 18:08:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="870108609" X-IronPort-AV: E=Sophos;i="6.04,324,1695711600"; d="scan'208";a="870108609" Received: from dpdk-qzhan15-test02.sh.intel.com ([10.67.115.37]) by FMSMGA003.fm.intel.com with ESMTP; 01 Jan 2024 18:07:59 -0800 From: Qi Zhang To: qiming.yang@intel.com, wenjun1.wu@intel.com Cc: dev@dpdk.org, Qi Zhang Subject: [PATCH v4 2/2] net/ice: support Tx sched commit before dev_start Date: Tue, 2 Jan 2024 05:29:00 -0500 Message-Id: <20240102102900.3435496-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240102102900.3435496-1-qi.z.zhang@intel.com> References: <20231226185428.3158880-1-qi.z.zhang@intel.com> <20240102102900.3435496-1-qi.z.zhang@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 Currently Tx hierarchy commit only take effect if device already be started, as after a dev start / stop cycle, queues has been removed and added back which cause the Tx scheduler tree return to orignal topo. In this patch, the hierarchy commit function will simply return if device has not be started yet and all the commit actions will be deferred to dev_start. Signed-off-by: Qi Zhang --- drivers/net/ice/ice_ethdev.c | 9 +++++++++ drivers/net/ice/ice_ethdev.h | 3 +++ drivers/net/ice/ice_tm.c | 23 ++++++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 3c3bc49dc2..d425a8f98b 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3717,6 +3717,7 @@ ice_dev_start(struct rte_eth_dev *dev) int mask, ret; uint8_t timer = hw->func_caps.ts_func_info.tmr_index_owned; uint32_t pin_idx = ad->devargs.pin_idx; + struct rte_tm_error tm_err; /* program Tx queues' context in hardware */ for (nb_txq = 0; nb_txq < data->nb_tx_queues; nb_txq++) { @@ -3746,6 +3747,14 @@ ice_dev_start(struct rte_eth_dev *dev) } } + if (pf->tm_conf.committed) { + ret = ice_do_hierarchy_commit(dev, true, &tm_err); + if (ret) { + PMD_DRV_LOG(ERR, "fail to commit Tx scheduler"); + goto rx_err; + } + } + ice_set_rx_function(dev); ice_set_tx_function(dev); diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 3b2db6aaa6..5448dff48d 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -686,6 +686,9 @@ int ice_rem_rss_cfg_wrap(struct ice_pf *pf, uint16_t vsi_id, struct ice_rss_hash_cfg *cfg); void ice_tm_conf_init(struct rte_eth_dev *dev); void ice_tm_conf_uninit(struct rte_eth_dev *dev); +int ice_do_hierarchy_commit(struct rte_eth_dev *dev, + int clear_on_fail, + struct rte_tm_error *error); extern const struct rte_tm_ops ice_tm_ops; static inline int diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index 2ae55418b0..26a440124a 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -843,9 +843,9 @@ static int ice_add_leaf_nodes(struct rte_eth_dev *dev) return ret; } -static int ice_hierarchy_commit(struct rte_eth_dev *dev, - int clear_on_fail, - struct rte_tm_error *error) +int ice_do_hierarchy_commit(struct rte_eth_dev *dev, + int clear_on_fail, + struct rte_tm_error *error) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -977,6 +977,8 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev, } } + pf->tm_conf.committed = true; + return ret_val; reset_leaf: @@ -992,3 +994,18 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev, } return ret_val; } + +static int ice_hierarchy_commit(struct rte_eth_dev *dev, + int clear_on_fail, + struct rte_tm_error *error) +{ + struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + + /* if device not started, simply set committed flag and return. */ + if (!dev->data->dev_started) { + pf->tm_conf.committed = true; + return 0; + } + + return ice_do_hierarchy_commit(dev, clear_on_fail, error); +} -- 2.31.1