[v2,15/15] net/ice: add minimal capability reporting API

Message ID 20240807094706.459822-16-bruce.richardson@intel.com (mailing list archive)
State Superseded
Delegated to: Bruce Richardson
Headers
Series Improve rte_tm support in ICE driver |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation warning apply issues

Commit Message

Bruce Richardson Aug. 7, 2024, 9:47 a.m. UTC
Incomplete but reports number of available layers

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/ice/ice_ethdev.h |  1 +
 drivers/net/ice/ice_tm.c     | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
  

Patch

diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index cb1a7e8e0d..6bebc511e4 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -682,6 +682,7 @@  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);
+
 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 a86943a5b2..d7def61756 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -33,8 +33,12 @@  static int ice_shaper_profile_add(struct rte_eth_dev *dev,
 static int ice_shaper_profile_del(struct rte_eth_dev *dev,
 				   uint32_t shaper_profile_id,
 				   struct rte_tm_error *error);
+static int ice_tm_capabilities_get(struct rte_eth_dev *dev,
+	struct rte_tm_capabilities *cap,
+	struct rte_tm_error *error);
 
 const struct rte_tm_ops ice_tm_ops = {
+	.capabilities_get = ice_tm_capabilities_get,
 	.shaper_profile_add = ice_shaper_profile_add,
 	.shaper_profile_delete = ice_shaper_profile_del,
 	.node_add = ice_tm_node_add,
@@ -861,3 +865,16 @@  ice_hierarchy_commit(struct rte_eth_dev *dev,
 	PMD_DRV_LOG(DEBUG, "Time to apply hierarchy = %.1f\n", (float)time / rte_get_timer_hz());
 	return ret;
 }
+
+static int
+ice_tm_capabilities_get(struct rte_eth_dev *dev, struct rte_tm_capabilities *cap,
+	struct rte_tm_error *error)
+{
+	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	*cap = (struct rte_tm_capabilities){
+		.n_levels_max = hw->num_tx_sched_layers - hw->port_info->has_tc,
+	};
+	if (error)
+		error->type = RTE_TM_ERROR_TYPE_NONE;
+	return 0;
+}