Skip to content

Commit c88146a

Browse files
cjubranSaeed Mahameed
authored andcommitted
net/mlx5: Explicitly set scheduling element and TSAR type
Ensure the scheduling element type and TSAR type are explicitly initialized in the QoS rate group creation. This prevents potential issues due to default values. Fixes: 1ae258f ("net/mlx5: E-switch, Introduce rate limiting groups API") Signed-off-by: Carolina Jubran <[email protected]> Reviewed-by: Cosmin Ratiu <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 80bf474 commit c88146a

File tree

1 file changed

+7
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/esw

1 file changed

+7
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,20 @@ __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *ex
421421
{
422422
u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
423423
struct mlx5_esw_rate_group *group;
424+
__be32 *attr;
424425
u32 divider;
425426
int err;
426427

427428
group = kzalloc(sizeof(*group), GFP_KERNEL);
428429
if (!group)
429430
return ERR_PTR(-ENOMEM);
430431

432+
MLX5_SET(scheduling_context, tsar_ctx, element_type,
433+
SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR);
434+
435+
attr = MLX5_ADDR_OF(scheduling_context, tsar_ctx, element_attributes);
436+
*attr = cpu_to_be32(TSAR_ELEMENT_TSAR_TYPE_DWRR << 16);
437+
431438
MLX5_SET(scheduling_context, tsar_ctx, parent_element_id,
432439
esw->qos.root_tsar_ix);
433440
err = mlx5_create_scheduling_element_cmd(esw->dev,

0 commit comments

Comments
 (0)