DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com, wenjun1.wu@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [PATCH v4 2/2] net/ice: support Tx sched commit before dev_start
Date: Tue,  2 Jan 2024 05:29:00 -0500	[thread overview]
Message-ID: <20240102102900.3435496-2-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20240102102900.3435496-1-qi.z.zhang@intel.com>

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 <qi.z.zhang@intel.com>
---
 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


  reply	other threads:[~2024-01-02  2:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-26 18:54 [PATCH 1/2] net/ice: add Tx scheduling tree dump support Qi Zhang
2023-12-26 18:54 ` [PATCH 2/2] doc: add document for diagnostic utilities Qi Zhang
2023-12-27 12:31 ` [PATCH v2 1/2] net/ice: add Tx scheduling tree dump support Qi Zhang
2023-12-27 12:31   ` [PATCH v2 2/2] doc: add document for diagnostic utilities Qi Zhang
2023-12-28 10:10 ` [PATCH v3 1/2] net/ice: add Tx scheduling tree dump support Qi Zhang
2023-12-28 10:10   ` [PATCH v3 2/2] doc: add document for diagnostic utilities Qi Zhang
2024-01-02 10:28 ` [PATCH v4 1/2] net/ice: reset Tx sched node during commit Qi Zhang
2024-01-02 10:29   ` Qi Zhang [this message]
2024-01-02 10:32 ` [PATCH 1/2] net/ice: add Tx scheduling tree dump support Qi Zhang
2024-01-02 10:32   ` [PATCH 2/2] doc: add document for diagnostic utilities Qi Zhang
2024-01-02 10:33 ` [PATCH v4 1/2] net/ice: add Tx scheduling tree dump support Qi Zhang
2024-01-02 10:33   ` [PATCH v4 2/2] doc: add document for diagnostic utilities Qi Zhang
2024-01-02 12:24 ` [PATCH v5 1/2] net/ice: add Tx scheduling tree dump support Qi Zhang
2024-01-02 12:24   ` [PATCH v5 2/2] doc: add document for diagnostic utilities Qi Zhang
2024-01-02 23:30   ` [PATCH v5 1/2] net/ice: add Tx scheduling tree dump support Stephen Hemminger
2024-01-02 12:29 ` [PATCH v6 " Qi Zhang
2024-01-02 12:29   ` [PATCH v6 2/2] doc: add document for ice diagnostic utilities Qi Zhang
2024-01-02 17:05     ` Stephen Hemminger
2024-01-02 12:39 ` [PATCH v7 1/2] net/ice: add Tx scheduling tree dump support Qi Zhang
2024-01-02  6:22   ` Wu, Wenjun1
2024-01-02 12:39   ` [PATCH v7 2/2] doc: add document for ice diagnostic utilities Qi Zhang
2024-01-02  7:14     ` Yang, Qiming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240102102900.3435496-2-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=qiming.yang@intel.com \
    --cc=wenjun1.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).