Skip to content

Commit 4f24ef0

Browse files
bruce-richardsonferruhy
authored andcommitted
ethdev: make TM shaper parameters constant
The function to add a new shaper 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 bbe8345 commit 4f24ef0

File tree

14 files changed

+29
-29
lines changed

14 files changed

+29
-29
lines changed

drivers/net/cnxk/cnxk_tm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ cnxk_nix_tm_node_capa_get(struct rte_eth_dev *eth_dev, uint32_t node_id,
267267

268268
static int
269269
cnxk_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev, uint32_t id,
270-
struct rte_tm_shaper_params *params,
270+
const struct rte_tm_shaper_params *params,
271271
struct rte_tm_error *error)
272272
{
273273
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);

drivers/net/dpaa2/dpaa2_tm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ dpaa2_shaper_profile_from_id(struct dpaa2_dev_priv *priv,
268268

269269
static int
270270
dpaa2_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
271-
struct rte_tm_shaper_params *params,
271+
const struct rte_tm_shaper_params *params,
272272
struct rte_tm_error *error)
273273
{
274274
struct dpaa2_dev_priv *priv = dev->data->dev_private;

drivers/net/hns3/hns3_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ hns3_tm_shaper_profile_search(struct rte_eth_dev *dev,
166166

167167
static int
168168
hns3_tm_shaper_profile_param_check(struct rte_eth_dev *dev,
169-
struct rte_tm_shaper_params *profile,
169+
const struct rte_tm_shaper_params *profile,
170170
struct rte_tm_error *error)
171171
{
172172
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -220,7 +220,7 @@ hns3_tm_shaper_profile_param_check(struct rte_eth_dev *dev,
220220
static int
221221
hns3_tm_shaper_profile_add(struct rte_eth_dev *dev,
222222
uint32_t shaper_profile_id,
223-
struct rte_tm_shaper_params *profile,
223+
const struct rte_tm_shaper_params *profile,
224224
struct rte_tm_error *error)
225225
{
226226
struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -1198,7 +1198,7 @@ hns3_tm_capabilities_get_wrap(struct rte_eth_dev *dev,
11981198
static int
11991199
hns3_tm_shaper_profile_add_wrap(struct rte_eth_dev *dev,
12001200
uint32_t shaper_profile_id,
1201-
struct rte_tm_shaper_params *profile,
1201+
const struct rte_tm_shaper_params *profile,
12021202
struct rte_tm_error *error)
12031203
{
12041204
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
@@ -12,7 +12,7 @@ static int i40e_tm_capabilities_get(struct rte_eth_dev *dev,
1212
struct rte_tm_error *error);
1313
static int i40e_shaper_profile_add(struct rte_eth_dev *dev,
1414
uint32_t shaper_profile_id,
15-
struct rte_tm_shaper_params *profile,
15+
const struct rte_tm_shaper_params *profile,
1616
struct rte_tm_error *error);
1717
static int i40e_shaper_profile_del(struct rte_eth_dev *dev,
1818
uint32_t shaper_profile_id,
@@ -217,7 +217,7 @@ i40e_shaper_profile_search(struct rte_eth_dev *dev,
217217
}
218218

219219
static int
220-
i40e_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
220+
i40e_shaper_profile_param_check(const struct rte_tm_shaper_params *profile,
221221
struct rte_tm_error *error)
222222
{
223223
/* min rate not supported */
@@ -251,7 +251,7 @@ i40e_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
251251
static int
252252
i40e_shaper_profile_add(struct rte_eth_dev *dev,
253253
uint32_t shaper_profile_id,
254-
struct rte_tm_shaper_params *profile,
254+
const struct rte_tm_shaper_params *profile,
255255
struct rte_tm_error *error)
256256
{
257257
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);

drivers/net/iavf/iavf_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static int iavf_hierarchy_commit(struct rte_eth_dev *dev,
1010
__rte_unused struct rte_tm_error *error);
1111
static int iavf_shaper_profile_add(struct rte_eth_dev *dev,
1212
uint32_t shaper_profile_id,
13-
struct rte_tm_shaper_params *profile,
13+
const struct rte_tm_shaper_params *profile,
1414
struct rte_tm_error *error);
1515
static int iavf_shaper_profile_del(struct rte_eth_dev *dev,
1616
uint32_t shaper_profile_id,
@@ -487,7 +487,7 @@ iavf_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
487487
}
488488

489489
static int
490-
iavf_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
490+
iavf_shaper_profile_param_check(const struct rte_tm_shaper_params *profile,
491491
struct rte_tm_error *error)
492492
{
493493
/* min bucket size not supported */
@@ -515,7 +515,7 @@ iavf_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
515515
static int
516516
iavf_shaper_profile_add(struct rte_eth_dev *dev,
517517
uint32_t shaper_profile_id,
518-
struct rte_tm_shaper_params *profile,
518+
const struct rte_tm_shaper_params *profile,
519519
struct rte_tm_error *error)
520520
{
521521
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
@@ -18,7 +18,7 @@ static int ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
1818
struct rte_tm_error *error);
1919
static int ice_dcf_shaper_profile_add(struct rte_eth_dev *dev,
2020
uint32_t shaper_profile_id,
21-
struct rte_tm_shaper_params *profile,
21+
const struct rte_tm_shaper_params *profile,
2222
struct rte_tm_error *error);
2323
static int ice_dcf_shaper_profile_del(struct rte_eth_dev *dev,
2424
uint32_t shaper_profile_id,
@@ -463,7 +463,7 @@ ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
463463
}
464464

465465
static int
466-
ice_dcf_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
466+
ice_dcf_shaper_profile_param_check(const struct rte_tm_shaper_params *profile,
467467
struct rte_tm_error *error)
468468
{
469469
/* min bucket size not supported */
@@ -491,7 +491,7 @@ ice_dcf_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
491491
static int
492492
ice_dcf_shaper_profile_add(struct rte_eth_dev *dev,
493493
uint32_t shaper_profile_id,
494-
struct rte_tm_shaper_params *profile,
494+
const struct rte_tm_shaper_params *profile,
495495
struct rte_tm_error *error)
496496
{
497497
struct ice_dcf_adapter *adapter = dev->data->dev_private;

drivers/net/ice/ice_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static int ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
2323
int *is_leaf, struct rte_tm_error *error);
2424
static int ice_shaper_profile_add(struct rte_eth_dev *dev,
2525
uint32_t shaper_profile_id,
26-
struct rte_tm_shaper_params *profile,
26+
const struct rte_tm_shaper_params *profile,
2727
struct rte_tm_error *error);
2828
static int ice_shaper_profile_del(struct rte_eth_dev *dev,
2929
uint32_t shaper_profile_id,
@@ -237,7 +237,7 @@ ice_shaper_profile_search(struct rte_eth_dev *dev,
237237
}
238238

239239
static int
240-
ice_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
240+
ice_shaper_profile_param_check(const struct rte_tm_shaper_params *profile,
241241
struct rte_tm_error *error)
242242
{
243243
/* min bucket size not supported */
@@ -265,7 +265,7 @@ ice_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
265265
static int
266266
ice_shaper_profile_add(struct rte_eth_dev *dev,
267267
uint32_t shaper_profile_id,
268-
struct rte_tm_shaper_params *profile,
268+
const struct rte_tm_shaper_params *profile,
269269
struct rte_tm_error *error)
270270
{
271271
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
@@ -722,7 +722,7 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
722722
}
723723

724724
static int
725-
ipn3ke_tm_shaper_parame_trans(struct rte_tm_shaper_params *profile,
725+
ipn3ke_tm_shaper_parame_trans(const struct rte_tm_shaper_params *profile,
726726
struct ipn3ke_tm_shaper_profile *local_profile,
727727
const struct ipn3ke_tm_shaper_params_range_type *ref_data)
728728
{
@@ -747,7 +747,7 @@ ipn3ke_tm_shaper_parame_trans(struct rte_tm_shaper_params *profile,
747747

748748
static int
749749
ipn3ke_tm_shaper_profile_add(struct rte_eth_dev *dev,
750-
uint32_t shaper_profile_id, struct rte_tm_shaper_params *profile,
750+
uint32_t shaper_profile_id, const struct rte_tm_shaper_params *profile,
751751
struct rte_tm_error *error)
752752
{
753753
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
@@ -11,7 +11,7 @@ static int ixgbe_tm_capabilities_get(struct rte_eth_dev *dev,
1111
struct rte_tm_error *error);
1212
static int ixgbe_shaper_profile_add(struct rte_eth_dev *dev,
1313
uint32_t shaper_profile_id,
14-
struct rte_tm_shaper_params *profile,
14+
const struct rte_tm_shaper_params *profile,
1515
struct rte_tm_error *error);
1616
static int ixgbe_shaper_profile_del(struct rte_eth_dev *dev,
1717
uint32_t shaper_profile_id,
@@ -226,7 +226,7 @@ ixgbe_shaper_profile_search(struct rte_eth_dev *dev,
226226
}
227227

228228
static int
229-
ixgbe_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
229+
ixgbe_shaper_profile_param_check(const struct rte_tm_shaper_params *profile,
230230
struct rte_tm_error *error)
231231
{
232232
/* min rate not supported */
@@ -260,7 +260,7 @@ ixgbe_shaper_profile_param_check(struct rte_tm_shaper_params *profile,
260260
static int
261261
ixgbe_shaper_profile_add(struct rte_eth_dev *dev,
262262
uint32_t shaper_profile_id,
263-
struct rte_tm_shaper_params *profile,
263+
const struct rte_tm_shaper_params *profile,
264264
struct rte_tm_error *error)
265265
{
266266
struct ixgbe_tm_conf *tm_conf =

drivers/net/mvpp2/mrvl_tm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ mrvl_shaper_profile_from_id(struct mrvl_priv *priv, uint32_t shaper_profile_id)
380380
*/
381381
static int
382382
mrvl_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id,
383-
struct rte_tm_shaper_params *params,
383+
const struct rte_tm_shaper_params *params,
384384
struct rte_tm_error *error)
385385
{
386386
struct mrvl_priv *priv = dev->data->dev_private;

0 commit comments

Comments
 (0)