Hi, > -----Original Message----- > From: Richardson, Bruce <bruce.richard...@intel.com> > Sent: Tuesday, August 6, 2024 11:24 PM > To: dev@dpdk.org > Cc: Richardson, Bruce <bruce.richard...@intel.com>; Xu, Rosen > <rosen...@intel.com>; Dumitrescu, Cristian > <cristian.dumitre...@intel.com>; Thomas Monjalon > <tho...@monjalon.net>; Ferruh Yigit <ferruh.yi...@amd.com>; Andrew > Rybchenko <andrew.rybche...@oktetlabs.ru> > Subject: [PATCH 2/4] ethdev: make parameters to TM profile add fn constant > > The function to add a new profile in rte_tm should not (and does not) modify > the profile parameters passed in via struct pointer. We should guarantee this > by marking the parameter pointer as const. This allows SW to create multiple > profiles using the same parameter struct without having to reset it each time. > > Signed-off-by: Bruce Richardson <bruce.richard...@intel.com> > --- > drivers/net/ipn3ke/ipn3ke_tm.c | 4 ++-- > lib/ethdev/rte_tm.c | 2 +- > lib/ethdev/rte_tm.h | 2 +- > lib/ethdev/rte_tm_driver.h | 2 +- > 4 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c > b/drivers/net/ipn3ke/ipn3ke_tm.c index cffe1fdaa4..20a0ed0467 100644 > --- a/drivers/net/ipn3ke/ipn3ke_tm.c > +++ b/drivers/net/ipn3ke/ipn3ke_tm.c > @@ -848,7 +848,7 @@ ipn3ke_tm_shaper_profile_delete(struct > rte_eth_dev *dev, > > static int > ipn3ke_tm_tdrop_profile_check(__rte_unused struct rte_eth_dev *dev, > - uint32_t tdrop_profile_id, struct rte_tm_wred_params *profile, > + uint32_t tdrop_profile_id, const struct rte_tm_wred_params > *profile, > struct rte_tm_error *error) > { > enum rte_color color; > @@ -931,7 +931,7 @@ ipn3ke_hw_tm_tdrop_wr(struct ipn3ke_hw *hw, > /* Traffic manager TDROP profile add */ static int > ipn3ke_tm_tdrop_profile_add(struct rte_eth_dev *dev, > - uint32_t tdrop_profile_id, struct rte_tm_wred_params *profile, > + uint32_t tdrop_profile_id, const struct rte_tm_wred_params > *profile, > struct rte_tm_error *error) > { > struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev); diff -- > git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c index > 74e6f4d610..d221b1e553 100644 > --- a/lib/ethdev/rte_tm.c > +++ b/lib/ethdev/rte_tm.c > @@ -153,7 +153,7 @@ int rte_tm_node_capabilities_get(uint16_t port_id, > /* Add WRED profile */ > int rte_tm_wred_profile_add(uint16_t port_id, > uint32_t wred_profile_id, > - struct rte_tm_wred_params *profile, > + const struct rte_tm_wred_params *profile, > 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 c52acd1b4f..f6f3f6a8d4 > 100644 > --- a/lib/ethdev/rte_tm.h > +++ b/lib/ethdev/rte_tm.h > @@ -1347,7 +1347,7 @@ rte_tm_node_capabilities_get(uint16_t port_id, > int rte_tm_wred_profile_add(uint16_t port_id, > uint32_t wred_profile_id, > - struct rte_tm_wred_params *profile, > + const struct rte_tm_wred_params *profile, > struct rte_tm_error *error); > > /** > diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h index > 25d688516b..b6ecf1bd4d 100644 > --- a/lib/ethdev/rte_tm_driver.h > +++ b/lib/ethdev/rte_tm_driver.h > @@ -51,7 +51,7 @@ typedef int (*rte_tm_node_capabilities_get_t)(struct > rte_eth_dev *dev, > /** @internal Traffic manager WRED profile add */ typedef int > (*rte_tm_wred_profile_add_t)(struct rte_eth_dev *dev, > uint32_t wred_profile_id, > - struct rte_tm_wred_params *profile, > + const struct rte_tm_wred_params *profile, > struct rte_tm_error *error); > > /** @internal Traffic manager WRED profile delete */ > -- > 2.43.0
Reviewed-by: Rosen Xu <rosen...@intel.com>