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 99123437FC; Tue, 2 Jan 2024 12:22:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0946940A87; Tue, 2 Jan 2024 12:21:43 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 9820B40A75 for ; Tue, 2 Jan 2024 12:21:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704194500; x=1735730500; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1S1OXgVbxUMMAlXZUdjD5wX0ENsyKyq8GrGN4OjlU84=; b=k2j66nynjD7YIVmTL6bFeQSP1xZtLoKUot+daMN07udzlqqWJ02a6GPC x/7XH6J2krWC99f58NEX/tN7LBj8Q47V43mxkhGtkBgm+XsNhdHpRo9ng dcNUoLBsAmk3WbpzZ2ePcs0UWskQYbTTM30+ABnYf6V6mImDG6qWeklIx 7CwGEHeFMY3S8iIsRnEJxpFWZEW8T0kYwjekCq4AyxYZ3cgdqUJXs8Nlf YmSiveiRmZAsLBDdID9/UA4/DtBS2vAb3vDY62a67jYXYI02a2YdJxE9w WFqzUegzR04vMvVz/WoutomN9qU4Ltc3eJTIYxDHtsc21VvAJhV5DbprI A==; X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="10256801" X-IronPort-AV: E=Sophos;i="6.04,324,1695711600"; d="scan'208";a="10256801" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 03:21:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="952895257" X-IronPort-AV: E=Sophos;i="6.04,324,1695711600"; d="scan'208";a="952895257" Received: from dpdk-qzhan15-test02.sh.intel.com ([10.67.115.37]) by orsmga005.jf.intel.com with ESMTP; 02 Jan 2024 03:21:38 -0800 From: Qi Zhang To: qiming.yang@intel.com, wenjun1.wu@intel.com Cc: dev@dpdk.org, Qi Zhang Subject: [PATCH 6/6] net/ice: support Tx sched commit before device start Date: Tue, 2 Jan 2024 14:42:32 -0500 Message-Id: <20240102194232.3614305-7-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240102194232.3614305-1-qi.z.zhang@intel.com> References: <20240102194232.3614305-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 original 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 | 4 ++++ drivers/net/ice/ice_tm.c | 25 ++++++++++++++++++++++--- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 3c3bc49dc2..72e13f95f8 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, pf->tm_conf.clear_on_fail, &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..fa4981ed14 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -504,6 +504,7 @@ struct ice_tm_conf { uint32_t nb_qgroup_node; uint32_t nb_queue_node; bool committed; + bool clear_on_fail; }; struct ice_pf { @@ -686,6 +687,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 4d8dbff2dc..aa012897ed 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -52,6 +52,7 @@ ice_tm_conf_init(struct rte_eth_dev *dev) pf->tm_conf.nb_qgroup_node = 0; pf->tm_conf.nb_queue_node = 0; pf->tm_conf.committed = false; + pf->tm_conf.clear_on_fail = false; } void @@ -832,9 +833,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); @@ -959,6 +960,8 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev, } } + pf->tm_conf.committed = true; + return ret_val; reset_leaf: @@ -974,3 +977,19 @@ 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; + pf->tm_conf.clear_on_fail = clear_on_fail; + return 0; + } + + return ice_do_hierarchy_commit(dev, clear_on_fail, error); +} -- 2.31.1