[1/4] ethdev: make parameters to TM node add fn constant

Message ID 20240806152417.3649745-2-bruce.richardson@intel.com (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers
Series improve rte_tm APIs |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Aug. 6, 2024, 3:24 p.m. UTC
The function to add a new scheduling node in rte_tm should not (and
does not) modify the actual node parameters passed in via struct
pointer. We should guarantee this by marking the parameter pointer as
const. This allows SW to create multiple scheduling nodes using the same
parameter struct without having to reset it each time.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/cnxk/cnxk_tm.c      |  2 +-
 drivers/net/dpaa2/dpaa2_tm.c    |  4 ++--
 drivers/net/hns3/hns3_tm.c      | 16 ++++++++--------
 drivers/net/i40e/i40e_tm.c      |  6 +++---
 drivers/net/iavf/iavf_tm.c      |  6 +++---
 drivers/net/ice/ice_dcf_sched.c |  6 +++---
 drivers/net/ice/ice_tm.c        |  6 +++---
 drivers/net/ipn3ke/ipn3ke_tm.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_tm.c    |  6 +++---
 drivers/net/txgbe/txgbe_tm.c    |  6 +++---
 lib/ethdev/rte_tm.c             |  2 +-
 lib/ethdev/rte_tm.h             |  2 +-
 lib/ethdev/rte_tm_driver.h      |  2 +-
 13 files changed, 34 insertions(+), 34 deletions(-)
  

Comments

Xu, Rosen Aug. 7, 2024, 7:27 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Tuesday, August 6, 2024 11:24 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Nithin Dabilpuram
> <ndabilpuram@marvell.com>; Kiran Kumar K <kirankumark@marvell.com>;
> Sunil Kumar Kori <skori@marvell.com>; Satha Rao
> <skoteshwar@marvell.com>; Harman Kalra <hkalra@marvell.com>; Hemant
> Agrawal <hemant.agrawal@nxp.com>; Sachin Saxena
> <sachin.saxena@nxp.com>; Jie Hai <haijie1@huawei.com>; Yisen Zhuang
> <yisen.zhuang@huawei.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xu,
> Rosen <rosen.xu@intel.com>; Jiawen Wu <jiawenwu@trustnetic.com>; Jian
> Wang <jianwang@trustnetic.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@amd.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Subject: [PATCH 1/4] ethdev: make parameters to TM node add fn constant
> 
> The function to add a new scheduling node in rte_tm should not (and does
> not) modify the actual node parameters passed in via struct pointer. We
> should guarantee this by marking the parameter pointer as const. This allows
> SW to create multiple scheduling nodes using the same parameter struct
> without having to reset it each time.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  drivers/net/ipn3ke/ipn3ke_tm.c  |  4 ++--
> diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c
> b/drivers/net/ipn3ke/ipn3ke_tm.c index 0260227900..cffe1fdaa4 100644
> --- a/drivers/net/ipn3ke/ipn3ke_tm.c
> +++ b/drivers/net/ipn3ke/ipn3ke_tm.c
> @@ -1010,7 +1010,7 @@ ipn3ke_tm_tdrop_profile_delete(struct
> rte_eth_dev *dev,  static int
> ipn3ke_tm_node_add_check_parameter(uint32_t tm_id,
>  	uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
> -	uint32_t weight, uint32_t level_id, struct rte_tm_node_params
> *params,
> +	uint32_t weight, uint32_t level_id, const struct rte_tm_node_params
> +*params,
>  	struct rte_tm_error *error)
>  {
>  	uint32_t level_of_node_id;
> @@ -1168,7 +1168,7 @@ ipn3ke_tm_node_add_check_mount(uint32_t
> tm_id,  static int  ipn3ke_tm_node_add(struct rte_eth_dev *dev,
>  	uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
> -	uint32_t weight, uint32_t level_id, struct rte_tm_node_params
> *params,
> +	uint32_t weight, uint32_t level_id, const struct rte_tm_node_params
> +*params,
>  	struct rte_tm_error *error)
>  {
>  	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev); diff --
>  /** @internal Traffic manager node delete */
> --
> 2.43.0

Reviewed-by: Rosen Xu <rosen.xu@intel.com>
  
Ferruh Yigit Sept. 22, 2024, 4:10 p.m. UTC | #2
On 8/7/2024 8:27 AM, Xu, Rosen wrote:
> Hi,
> 
>> -----Original Message-----
<...>
>> Subject: [PATCH 1/4] ethdev: make parameters to TM node add fn constant
>>
>> The function to add a new scheduling node in rte_tm should not (and does
>> not) modify the actual node parameters passed in via struct pointer. We
>> should guarantee this by marking the parameter pointer as const. This allows
>> SW to create multiple scheduling nodes using the same parameter struct
>> without having to reset it each time.
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> ---
>>  drivers/net/ipn3ke/ipn3ke_tm.c  |  4 ++--
>> diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c
>> b/drivers/net/ipn3ke/ipn3ke_tm.c index 0260227900..cffe1fdaa4 100644
>> --- a/drivers/net/ipn3ke/ipn3ke_tm.c
>> +++ b/drivers/net/ipn3ke/ipn3ke_tm.c
>> @@ -1010,7 +1010,7 @@ ipn3ke_tm_tdrop_profile_delete(struct
>> rte_eth_dev *dev,  static int
>> ipn3ke_tm_node_add_check_parameter(uint32_t tm_id,
>>  	uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
>> -	uint32_t weight, uint32_t level_id, struct rte_tm_node_params
>> *params,
>> +	uint32_t weight, uint32_t level_id, const struct rte_tm_node_params
>> +*params,
>>  	struct rte_tm_error *error)
>>  {
>>  	uint32_t level_of_node_id;
>> @@ -1168,7 +1168,7 @@ ipn3ke_tm_node_add_check_mount(uint32_t
>> tm_id,  static int  ipn3ke_tm_node_add(struct rte_eth_dev *dev,
>>  	uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
>> -	uint32_t weight, uint32_t level_id, struct rte_tm_node_params
>> *params,
>> +	uint32_t weight, uint32_t level_id, const struct rte_tm_node_params
>> +*params,
>>  	struct rte_tm_error *error)
>>  {
>>  	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev); diff --
>>  /** @internal Traffic manager node delete */
>> --
>> 2.43.0
> 
> Reviewed-by: Rosen Xu <rosen.xu@intel.com>
>

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
  

Patch

diff --git a/drivers/net/cnxk/cnxk_tm.c b/drivers/net/cnxk/cnxk_tm.c
index c799193cb8..9293b3e8f2 100644
--- a/drivers/net/cnxk/cnxk_tm.c
+++ b/drivers/net/cnxk/cnxk_tm.c
@@ -336,7 +336,7 @@  static int
 cnxk_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		     uint32_t parent_node_id, uint32_t priority,
 		     uint32_t weight, uint32_t lvl,
-		     struct rte_tm_node_params *params,
+		     const struct rte_tm_node_params *params,
 		     struct rte_tm_error *error)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c
index cb854964b4..22337097e5 100644
--- a/drivers/net/dpaa2/dpaa2_tm.c
+++ b/drivers/net/dpaa2/dpaa2_tm.c
@@ -359,7 +359,7 @@  static int
 dpaa2_node_check_params(struct rte_eth_dev *dev, uint32_t node_id,
 		__rte_unused uint32_t priority, uint32_t weight,
 		       uint32_t level_id,
-		       struct rte_tm_node_params *params,
+		       const struct rte_tm_node_params *params,
 		       struct rte_tm_error *error)
 {
 	if (node_id == RTE_TM_NODE_ID_NULL)
@@ -431,7 +431,7 @@  dpaa2_node_check_params(struct rte_eth_dev *dev, uint32_t node_id,
 static int
 dpaa2_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t parent_node_id, uint32_t priority, uint32_t weight,
-	      uint32_t level_id, struct rte_tm_node_params *params,
+	      uint32_t level_id, const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error)
 {
 	struct dpaa2_dev_priv *priv = dev->data->dev_private;
diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c
index 92a668538f..06df32bbcd 100644
--- a/drivers/net/hns3/hns3_tm.c
+++ b/drivers/net/hns3/hns3_tm.c
@@ -329,7 +329,7 @@  hns3_tm_node_search(struct rte_eth_dev *dev,
 
 static int
 hns3_tm_nonleaf_node_param_check(struct rte_eth_dev *dev,
-				 struct rte_tm_node_params *params,
+				 const struct rte_tm_node_params *params,
 				 struct rte_tm_error *error)
 {
 	struct hns3_tm_shaper_profile *shaper_profile;
@@ -364,7 +364,7 @@  hns3_tm_nonleaf_node_param_check(struct rte_eth_dev *dev,
 
 static int
 hns3_tm_leaf_node_param_check(struct rte_eth_dev *dev __rte_unused,
-			      struct rte_tm_node_params *params,
+			      const struct rte_tm_node_params *params,
 			      struct rte_tm_error *error)
 
 {
@@ -408,7 +408,7 @@  hns3_tm_leaf_node_param_check(struct rte_eth_dev *dev __rte_unused,
 static int
 hns3_tm_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
 			 uint32_t priority, uint32_t weight,
-			 struct rte_tm_node_params *params,
+			 const struct rte_tm_node_params *params,
 			 struct rte_tm_error *error)
 {
 	struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -457,7 +457,7 @@  hns3_tm_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
 
 static int
 hns3_tm_port_node_add(struct rte_eth_dev *dev, uint32_t node_id,
-		      uint32_t level_id, struct rte_tm_node_params *params,
+		      uint32_t level_id, const struct rte_tm_node_params *params,
 		      struct rte_tm_error *error)
 {
 	struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -503,7 +503,7 @@  hns3_tm_port_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 static int
 hns3_tm_tc_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 		    uint32_t level_id, struct hns3_tm_node *parent_node,
-		    struct rte_tm_node_params *params,
+		    const struct rte_tm_node_params *params,
 		    struct rte_tm_error *error)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -554,7 +554,7 @@  hns3_tm_tc_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 static int
 hns3_tm_queue_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 		       uint32_t level_id, struct hns3_tm_node *parent_node,
-		       struct rte_tm_node_params *params,
+		       const struct rte_tm_node_params *params,
 		       struct rte_tm_error *error)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -601,7 +601,7 @@  static int
 hns3_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 		 uint32_t parent_node_id, uint32_t priority,
 		 uint32_t weight, uint32_t level_id,
-		 struct rte_tm_node_params *params,
+		 const struct rte_tm_node_params *params,
 		 struct rte_tm_error *error)
 {
 	struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -1230,7 +1230,7 @@  static int
 hns3_tm_node_add_wrap(struct rte_eth_dev *dev, uint32_t node_id,
 		      uint32_t parent_node_id, uint32_t priority,
 		      uint32_t weight, uint32_t level_id,
-		      struct rte_tm_node_params *params,
+		      const struct rte_tm_node_params *params,
 		      struct rte_tm_error *error)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c
index cab296e1a4..c7d4680fb4 100644
--- a/drivers/net/i40e/i40e_tm.c
+++ b/drivers/net/i40e/i40e_tm.c
@@ -20,7 +20,7 @@  static int i40e_shaper_profile_del(struct rte_eth_dev *dev,
 static int i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 			 uint32_t parent_node_id, uint32_t priority,
 			 uint32_t weight, uint32_t level_id,
-			 struct rte_tm_node_params *params,
+			 const struct rte_tm_node_params *params,
 			 struct rte_tm_error *error);
 static int i40e_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			    struct rte_tm_error *error);
@@ -353,7 +353,7 @@  i40e_tm_node_search(struct rte_eth_dev *dev,
 static int
 i40e_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
 		      uint32_t priority, uint32_t weight,
-		      struct rte_tm_node_params *params,
+		      const struct rte_tm_node_params *params,
 		      struct rte_tm_error *error)
 {
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -450,7 +450,7 @@  static int
 i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t parent_node_id, uint32_t priority,
 	      uint32_t weight, uint32_t level_id,
-	      struct rte_tm_node_params *params,
+	      const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error)
 {
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
diff --git a/drivers/net/iavf/iavf_tm.c b/drivers/net/iavf/iavf_tm.c
index 32bb3be45e..f9883927be 100644
--- a/drivers/net/iavf/iavf_tm.c
+++ b/drivers/net/iavf/iavf_tm.c
@@ -18,7 +18,7 @@  static int iavf_shaper_profile_del(struct rte_eth_dev *dev,
 static int iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t parent_node_id, uint32_t priority,
 	      uint32_t weight, uint32_t level_id,
-	      struct rte_tm_node_params *params,
+	      const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error);
 static int iavf_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			    struct rte_tm_error *error);
@@ -131,7 +131,7 @@  iavf_tm_node_search(struct rte_eth_dev *dev,
 static int
 iavf_node_param_check(struct iavf_info *vf, uint32_t node_id,
 		      uint32_t priority, uint32_t weight,
-		      struct rte_tm_node_params *params,
+		      const struct rte_tm_node_params *params,
 		      struct rte_tm_error *error)
 {
 	/* checked all the unsupported parameter */
@@ -271,7 +271,7 @@  static int
 iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t parent_node_id, uint32_t priority,
 	      uint32_t weight, uint32_t level_id,
-	      struct rte_tm_node_params *params,
+	      const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error)
 {
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c
index b08bc5f1de..b93e001806 100644
--- a/drivers/net/ice/ice_dcf_sched.c
+++ b/drivers/net/ice/ice_dcf_sched.c
@@ -12,7 +12,7 @@  static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
 static int ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t parent_node_id, uint32_t priority,
 	      uint32_t weight, uint32_t level_id,
-	      struct rte_tm_node_params *params,
+	      const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error);
 static int ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			    struct rte_tm_error *error);
@@ -139,7 +139,7 @@  ice_dcf_shaper_profile_search(struct rte_eth_dev *dev,
 static int
 ice_dcf_node_param_check(struct ice_dcf_hw *hw, uint32_t node_id,
 		      uint32_t priority, uint32_t weight,
-		      struct rte_tm_node_params *params,
+		      const struct rte_tm_node_params *params,
 		      struct rte_tm_error *error)
 {
 	/* checked all the unsupported parameter */
@@ -230,7 +230,7 @@  static int
 ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t parent_node_id, uint32_t priority,
 	      uint32_t weight, uint32_t level_id,
-	      struct rte_tm_node_params *params,
+	      const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error)
 {
 	enum ice_dcf_tm_node_type parent_node_type = ICE_DCF_TM_NODE_TYPE_MAX;
diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 7239ab53f1..c977e6b177 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -15,7 +15,7 @@  static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 static int ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t parent_node_id, uint32_t priority,
 	      uint32_t weight, uint32_t level_id,
-	      struct rte_tm_node_params *params,
+	      const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error);
 static int ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			    struct rte_tm_error *error);
@@ -82,7 +82,7 @@  ice_tm_conf_uninit(struct rte_eth_dev *dev)
 static int
 ice_node_param_check(struct ice_pf *pf, uint32_t node_id,
 		      uint32_t priority, uint32_t weight,
-		      struct rte_tm_node_params *params,
+		      const struct rte_tm_node_params *params,
 		      struct rte_tm_error *error)
 {
 	/* checked all the unsupported parameter */
@@ -337,7 +337,7 @@  static int
 ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t parent_node_id, uint32_t priority,
 	      uint32_t weight, uint32_t level_id,
-	      struct rte_tm_node_params *params,
+	      const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 0260227900..cffe1fdaa4 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -1010,7 +1010,7 @@  ipn3ke_tm_tdrop_profile_delete(struct rte_eth_dev *dev,
 static int
 ipn3ke_tm_node_add_check_parameter(uint32_t tm_id,
 	uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
-	uint32_t weight, uint32_t level_id, struct rte_tm_node_params *params,
+	uint32_t weight, uint32_t level_id, const struct rte_tm_node_params *params,
 	struct rte_tm_error *error)
 {
 	uint32_t level_of_node_id;
@@ -1168,7 +1168,7 @@  ipn3ke_tm_node_add_check_mount(uint32_t tm_id,
 static int
 ipn3ke_tm_node_add(struct rte_eth_dev *dev,
 	uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
-	uint32_t weight, uint32_t level_id, struct rte_tm_node_params *params,
+	uint32_t weight, uint32_t level_id, const struct rte_tm_node_params *params,
 	struct rte_tm_error *error)
 {
 	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c
index ac8976062f..75cd707109 100644
--- a/drivers/net/ixgbe/ixgbe_tm.c
+++ b/drivers/net/ixgbe/ixgbe_tm.c
@@ -19,7 +19,7 @@  static int ixgbe_shaper_profile_del(struct rte_eth_dev *dev,
 static int ixgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 			  uint32_t parent_node_id, uint32_t priority,
 			  uint32_t weight, uint32_t level_id,
-			  struct rte_tm_node_params *params,
+			  const struct rte_tm_node_params *params,
 			  struct rte_tm_error *error);
 static int ixgbe_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			     struct rte_tm_error *error);
@@ -461,7 +461,7 @@  ixgbe_queue_base_nb_get(struct rte_eth_dev *dev, uint16_t tc_node_no,
 static int
 ixgbe_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
 		       uint32_t priority, uint32_t weight,
-		       struct rte_tm_node_params *params,
+		       const struct rte_tm_node_params *params,
 		       struct rte_tm_error *error)
 {
 	if (node_id == RTE_TM_NODE_ID_NULL) {
@@ -558,7 +558,7 @@  static int
 ixgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	       uint32_t parent_node_id, uint32_t priority,
 	       uint32_t weight, uint32_t level_id,
-	       struct rte_tm_node_params *params,
+	       const struct rte_tm_node_params *params,
 	       struct rte_tm_error *error)
 {
 	struct ixgbe_tm_conf *tm_conf =
diff --git a/drivers/net/txgbe/txgbe_tm.c b/drivers/net/txgbe/txgbe_tm.c
index 3171be73d0..8ed4d24459 100644
--- a/drivers/net/txgbe/txgbe_tm.c
+++ b/drivers/net/txgbe/txgbe_tm.c
@@ -20,7 +20,7 @@  static int txgbe_shaper_profile_del(struct rte_eth_dev *dev,
 static int txgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 			  uint32_t parent_node_id, uint32_t priority,
 			  uint32_t weight, uint32_t level_id,
-			  struct rte_tm_node_params *params,
+			  const struct rte_tm_node_params *params,
 			  struct rte_tm_error *error);
 static int txgbe_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			     struct rte_tm_error *error);
@@ -450,7 +450,7 @@  txgbe_queue_base_nb_get(struct rte_eth_dev *dev, uint16_t tc_node_no,
 static int
 txgbe_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
 		       uint32_t priority, uint32_t weight,
-		       struct rte_tm_node_params *params,
+		       const struct rte_tm_node_params *params,
 		       struct rte_tm_error *error)
 {
 	if (node_id == RTE_TM_NODE_ID_NULL) {
@@ -547,7 +547,7 @@  static int
 txgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	       uint32_t parent_node_id, uint32_t priority,
 	       uint32_t weight, uint32_t level_id,
-	       struct rte_tm_node_params *params,
+	       const struct rte_tm_node_params *params,
 	       struct rte_tm_error *error)
 {
 	struct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);
diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c
index d594fe0049..74e6f4d610 100644
--- a/lib/ethdev/rte_tm.c
+++ b/lib/ethdev/rte_tm.c
@@ -286,7 +286,7 @@  int rte_tm_node_add(uint16_t port_id,
 	uint32_t priority,
 	uint32_t weight,
 	uint32_t level_id,
-	struct rte_tm_node_params *params,
+	const struct rte_tm_node_params *params,
 	struct rte_tm_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h
index 07028c9b36..c52acd1b4f 100644
--- a/lib/ethdev/rte_tm.h
+++ b/lib/ethdev/rte_tm.h
@@ -1596,7 +1596,7 @@  rte_tm_node_add(uint16_t port_id,
 	uint32_t priority,
 	uint32_t weight,
 	uint32_t level_id,
-	struct rte_tm_node_params *params,
+	const struct rte_tm_node_params *params,
 	struct rte_tm_error *error);
 
 /**
diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h
index 45290fb3fd..25d688516b 100644
--- a/lib/ethdev/rte_tm_driver.h
+++ b/lib/ethdev/rte_tm_driver.h
@@ -101,7 +101,7 @@  typedef int (*rte_tm_node_add_t)(struct rte_eth_dev *dev,
 	uint32_t priority,
 	uint32_t weight,
 	uint32_t level_id,
-	struct rte_tm_node_params *params,
+	const struct rte_tm_node_params *params,
 	struct rte_tm_error *error);
 
 /** @internal Traffic manager node delete */