Skip to content

Commit e739f1a

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

File tree

13 files changed

+34
-34
lines changed

13 files changed

+34
-34
lines changed

drivers/net/cnxk/cnxk_tm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static int
336336
cnxk_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
337337
uint32_t parent_node_id, uint32_t priority,
338338
uint32_t weight, uint32_t lvl,
339-
struct rte_tm_node_params *params,
339+
const struct rte_tm_node_params *params,
340340
struct rte_tm_error *error)
341341
{
342342
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);

drivers/net/dpaa2/dpaa2_tm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static int
359359
dpaa2_node_check_params(struct rte_eth_dev *dev, uint32_t node_id,
360360
__rte_unused uint32_t priority, uint32_t weight,
361361
uint32_t level_id,
362-
struct rte_tm_node_params *params,
362+
const struct rte_tm_node_params *params,
363363
struct rte_tm_error *error)
364364
{
365365
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,
431431
static int
432432
dpaa2_node_add(struct rte_eth_dev *dev, uint32_t node_id,
433433
uint32_t parent_node_id, uint32_t priority, uint32_t weight,
434-
uint32_t level_id, struct rte_tm_node_params *params,
434+
uint32_t level_id, const struct rte_tm_node_params *params,
435435
struct rte_tm_error *error)
436436
{
437437
struct dpaa2_dev_priv *priv = dev->data->dev_private;

drivers/net/hns3/hns3_tm.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ hns3_tm_node_search(struct rte_eth_dev *dev,
329329

330330
static int
331331
hns3_tm_nonleaf_node_param_check(struct rte_eth_dev *dev,
332-
struct rte_tm_node_params *params,
332+
const struct rte_tm_node_params *params,
333333
struct rte_tm_error *error)
334334
{
335335
struct hns3_tm_shaper_profile *shaper_profile;
@@ -364,7 +364,7 @@ hns3_tm_nonleaf_node_param_check(struct rte_eth_dev *dev,
364364

365365
static int
366366
hns3_tm_leaf_node_param_check(struct rte_eth_dev *dev __rte_unused,
367-
struct rte_tm_node_params *params,
367+
const struct rte_tm_node_params *params,
368368
struct rte_tm_error *error)
369369

370370
{
@@ -408,7 +408,7 @@ hns3_tm_leaf_node_param_check(struct rte_eth_dev *dev __rte_unused,
408408
static int
409409
hns3_tm_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
410410
uint32_t priority, uint32_t weight,
411-
struct rte_tm_node_params *params,
411+
const struct rte_tm_node_params *params,
412412
struct rte_tm_error *error)
413413
{
414414
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,
457457

458458
static int
459459
hns3_tm_port_node_add(struct rte_eth_dev *dev, uint32_t node_id,
460-
uint32_t level_id, struct rte_tm_node_params *params,
460+
uint32_t level_id, const struct rte_tm_node_params *params,
461461
struct rte_tm_error *error)
462462
{
463463
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,
503503
static int
504504
hns3_tm_tc_node_add(struct rte_eth_dev *dev, uint32_t node_id,
505505
uint32_t level_id, struct hns3_tm_node *parent_node,
506-
struct rte_tm_node_params *params,
506+
const struct rte_tm_node_params *params,
507507
struct rte_tm_error *error)
508508
{
509509
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,
554554
static int
555555
hns3_tm_queue_node_add(struct rte_eth_dev *dev, uint32_t node_id,
556556
uint32_t level_id, struct hns3_tm_node *parent_node,
557-
struct rte_tm_node_params *params,
557+
const struct rte_tm_node_params *params,
558558
struct rte_tm_error *error)
559559
{
560560
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -601,7 +601,7 @@ static int
601601
hns3_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
602602
uint32_t parent_node_id, uint32_t priority,
603603
uint32_t weight, uint32_t level_id,
604-
struct rte_tm_node_params *params,
604+
const struct rte_tm_node_params *params,
605605
struct rte_tm_error *error)
606606
{
607607
struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -1230,7 +1230,7 @@ static int
12301230
hns3_tm_node_add_wrap(struct rte_eth_dev *dev, uint32_t node_id,
12311231
uint32_t parent_node_id, uint32_t priority,
12321232
uint32_t weight, uint32_t level_id,
1233-
struct rte_tm_node_params *params,
1233+
const struct rte_tm_node_params *params,
12341234
struct rte_tm_error *error)
12351235
{
12361236
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);

drivers/net/i40e/i40e_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int i40e_shaper_profile_del(struct rte_eth_dev *dev,
2020
static int i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id,
2121
uint32_t parent_node_id, uint32_t priority,
2222
uint32_t weight, uint32_t level_id,
23-
struct rte_tm_node_params *params,
23+
const struct rte_tm_node_params *params,
2424
struct rte_tm_error *error);
2525
static int i40e_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
2626
struct rte_tm_error *error);
@@ -353,7 +353,7 @@ i40e_tm_node_search(struct rte_eth_dev *dev,
353353
static int
354354
i40e_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
355355
uint32_t priority, uint32_t weight,
356-
struct rte_tm_node_params *params,
356+
const struct rte_tm_node_params *params,
357357
struct rte_tm_error *error)
358358
{
359359
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -450,7 +450,7 @@ static int
450450
i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id,
451451
uint32_t parent_node_id, uint32_t priority,
452452
uint32_t weight, uint32_t level_id,
453-
struct rte_tm_node_params *params,
453+
const struct rte_tm_node_params *params,
454454
struct rte_tm_error *error)
455455
{
456456
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);

drivers/net/iavf/iavf_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static int iavf_shaper_profile_del(struct rte_eth_dev *dev,
1818
static int iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
1919
uint32_t parent_node_id, uint32_t priority,
2020
uint32_t weight, uint32_t level_id,
21-
struct rte_tm_node_params *params,
21+
const struct rte_tm_node_params *params,
2222
struct rte_tm_error *error);
2323
static int iavf_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
2424
struct rte_tm_error *error);
@@ -131,7 +131,7 @@ iavf_tm_node_search(struct rte_eth_dev *dev,
131131
static int
132132
iavf_node_param_check(struct iavf_info *vf, uint32_t node_id,
133133
uint32_t priority, uint32_t weight,
134-
struct rte_tm_node_params *params,
134+
const struct rte_tm_node_params *params,
135135
struct rte_tm_error *error)
136136
{
137137
/* checked all the unsupported parameter */
@@ -271,7 +271,7 @@ static int
271271
iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
272272
uint32_t parent_node_id, uint32_t priority,
273273
uint32_t weight, uint32_t level_id,
274-
struct rte_tm_node_params *params,
274+
const struct rte_tm_node_params *params,
275275
struct rte_tm_error *error)
276276
{
277277
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);

drivers/net/ice/ice_dcf_sched.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
1212
static int ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id,
1313
uint32_t parent_node_id, uint32_t priority,
1414
uint32_t weight, uint32_t level_id,
15-
struct rte_tm_node_params *params,
15+
const struct rte_tm_node_params *params,
1616
struct rte_tm_error *error);
1717
static int ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
1818
struct rte_tm_error *error);
@@ -139,7 +139,7 @@ ice_dcf_shaper_profile_search(struct rte_eth_dev *dev,
139139
static int
140140
ice_dcf_node_param_check(struct ice_dcf_hw *hw, uint32_t node_id,
141141
uint32_t priority, uint32_t weight,
142-
struct rte_tm_node_params *params,
142+
const struct rte_tm_node_params *params,
143143
struct rte_tm_error *error)
144144
{
145145
/* checked all the unsupported parameter */
@@ -230,7 +230,7 @@ static int
230230
ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id,
231231
uint32_t parent_node_id, uint32_t priority,
232232
uint32_t weight, uint32_t level_id,
233-
struct rte_tm_node_params *params,
233+
const struct rte_tm_node_params *params,
234234
struct rte_tm_error *error)
235235
{
236236
enum ice_dcf_tm_node_type parent_node_type = ICE_DCF_TM_NODE_TYPE_MAX;

drivers/net/ice/ice_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
1515
static int ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
1616
uint32_t parent_node_id, uint32_t priority,
1717
uint32_t weight, uint32_t level_id,
18-
struct rte_tm_node_params *params,
18+
const struct rte_tm_node_params *params,
1919
struct rte_tm_error *error);
2020
static int ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
2121
struct rte_tm_error *error);
@@ -82,7 +82,7 @@ ice_tm_conf_uninit(struct rte_eth_dev *dev)
8282
static int
8383
ice_node_param_check(struct ice_pf *pf, uint32_t node_id,
8484
uint32_t priority, uint32_t weight,
85-
struct rte_tm_node_params *params,
85+
const struct rte_tm_node_params *params,
8686
struct rte_tm_error *error)
8787
{
8888
/* checked all the unsupported parameter */
@@ -337,7 +337,7 @@ static int
337337
ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
338338
uint32_t parent_node_id, uint32_t priority,
339339
uint32_t weight, uint32_t level_id,
340-
struct rte_tm_node_params *params,
340+
const struct rte_tm_node_params *params,
341341
struct rte_tm_error *error)
342342
{
343343
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);

drivers/net/ipn3ke/ipn3ke_tm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ ipn3ke_tm_tdrop_profile_delete(struct rte_eth_dev *dev,
10101010
static int
10111011
ipn3ke_tm_node_add_check_parameter(uint32_t tm_id,
10121012
uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
1013-
uint32_t weight, uint32_t level_id, struct rte_tm_node_params *params,
1013+
uint32_t weight, uint32_t level_id, const struct rte_tm_node_params *params,
10141014
struct rte_tm_error *error)
10151015
{
10161016
uint32_t level_of_node_id;
@@ -1168,7 +1168,7 @@ ipn3ke_tm_node_add_check_mount(uint32_t tm_id,
11681168
static int
11691169
ipn3ke_tm_node_add(struct rte_eth_dev *dev,
11701170
uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
1171-
uint32_t weight, uint32_t level_id, struct rte_tm_node_params *params,
1171+
uint32_t weight, uint32_t level_id, const struct rte_tm_node_params *params,
11721172
struct rte_tm_error *error)
11731173
{
11741174
struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);

drivers/net/ixgbe/ixgbe_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static int ixgbe_shaper_profile_del(struct rte_eth_dev *dev,
1919
static int ixgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id,
2020
uint32_t parent_node_id, uint32_t priority,
2121
uint32_t weight, uint32_t level_id,
22-
struct rte_tm_node_params *params,
22+
const struct rte_tm_node_params *params,
2323
struct rte_tm_error *error);
2424
static int ixgbe_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
2525
struct rte_tm_error *error);
@@ -461,7 +461,7 @@ ixgbe_queue_base_nb_get(struct rte_eth_dev *dev, uint16_t tc_node_no,
461461
static int
462462
ixgbe_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
463463
uint32_t priority, uint32_t weight,
464-
struct rte_tm_node_params *params,
464+
const struct rte_tm_node_params *params,
465465
struct rte_tm_error *error)
466466
{
467467
if (node_id == RTE_TM_NODE_ID_NULL) {
@@ -558,7 +558,7 @@ static int
558558
ixgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id,
559559
uint32_t parent_node_id, uint32_t priority,
560560
uint32_t weight, uint32_t level_id,
561-
struct rte_tm_node_params *params,
561+
const struct rte_tm_node_params *params,
562562
struct rte_tm_error *error)
563563
{
564564
struct ixgbe_tm_conf *tm_conf =

drivers/net/txgbe/txgbe_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int txgbe_shaper_profile_del(struct rte_eth_dev *dev,
2020
static int txgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id,
2121
uint32_t parent_node_id, uint32_t priority,
2222
uint32_t weight, uint32_t level_id,
23-
struct rte_tm_node_params *params,
23+
const struct rte_tm_node_params *params,
2424
struct rte_tm_error *error);
2525
static int txgbe_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
2626
struct rte_tm_error *error);
@@ -450,7 +450,7 @@ txgbe_queue_base_nb_get(struct rte_eth_dev *dev, uint16_t tc_node_no,
450450
static int
451451
txgbe_node_param_check(struct rte_eth_dev *dev, uint32_t node_id,
452452
uint32_t priority, uint32_t weight,
453-
struct rte_tm_node_params *params,
453+
const struct rte_tm_node_params *params,
454454
struct rte_tm_error *error)
455455
{
456456
if (node_id == RTE_TM_NODE_ID_NULL) {
@@ -547,7 +547,7 @@ static int
547547
txgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id,
548548
uint32_t parent_node_id, uint32_t priority,
549549
uint32_t weight, uint32_t level_id,
550-
struct rte_tm_node_params *params,
550+
const struct rte_tm_node_params *params,
551551
struct rte_tm_error *error)
552552
{
553553
struct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);

0 commit comments

Comments
 (0)