Skip to content

Commit bbe8345

Browse files
bruce-richardsonferruhy
authored andcommitted
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 <[email protected]> Reviewed-by: Rosen Xu <[email protected]> Acked-by: Ferruh Yigit <[email protected]> Acked-by: Stephen Hemminger <[email protected]>
1 parent e739f1a commit bbe8345

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

drivers/net/ipn3ke/ipn3ke_tm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ ipn3ke_tm_shaper_profile_delete(struct rte_eth_dev *dev,
848848

849849
static int
850850
ipn3ke_tm_tdrop_profile_check(__rte_unused struct rte_eth_dev *dev,
851-
uint32_t tdrop_profile_id, struct rte_tm_wred_params *profile,
851+
uint32_t tdrop_profile_id, const struct rte_tm_wred_params *profile,
852852
struct rte_tm_error *error)
853853
{
854854
enum rte_color color;
@@ -931,7 +931,7 @@ ipn3ke_hw_tm_tdrop_wr(struct ipn3ke_hw *hw,
931931
/* Traffic manager TDROP profile add */
932932
static int
933933
ipn3ke_tm_tdrop_profile_add(struct rte_eth_dev *dev,
934-
uint32_t tdrop_profile_id, struct rte_tm_wred_params *profile,
934+
uint32_t tdrop_profile_id, const struct rte_tm_wred_params *profile,
935935
struct rte_tm_error *error)
936936
{
937937
struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);

lib/ethdev/rte_tm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ int rte_tm_node_capabilities_get(uint16_t port_id,
153153
/* Add WRED profile */
154154
int rte_tm_wred_profile_add(uint16_t port_id,
155155
uint32_t wred_profile_id,
156-
struct rte_tm_wred_params *profile,
156+
const struct rte_tm_wred_params *profile,
157157
struct rte_tm_error *error)
158158
{
159159
struct rte_eth_dev *dev = &rte_eth_devices[port_id];

lib/ethdev/rte_tm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ rte_tm_node_capabilities_get(uint16_t port_id,
13471347
int
13481348
rte_tm_wred_profile_add(uint16_t port_id,
13491349
uint32_t wred_profile_id,
1350-
struct rte_tm_wred_params *profile,
1350+
const struct rte_tm_wred_params *profile,
13511351
struct rte_tm_error *error);
13521352

13531353
/**

lib/ethdev/rte_tm_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typedef int (*rte_tm_node_capabilities_get_t)(struct rte_eth_dev *dev,
5151
/** @internal Traffic manager WRED profile add */
5252
typedef int (*rte_tm_wred_profile_add_t)(struct rte_eth_dev *dev,
5353
uint32_t wred_profile_id,
54-
struct rte_tm_wred_params *profile,
54+
const struct rte_tm_wred_params *profile,
5555
struct rte_tm_error *error);
5656

5757
/** @internal Traffic manager WRED profile delete */

0 commit comments

Comments
 (0)