]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net/mlx5: Explicitly set scheduling element and TSAR type
authorCarolina Jubran <cjubran@nvidia.com>
Mon, 2 Sep 2024 08:46:14 +0000 (11:46 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Mon, 9 Sep 2024 19:39:57 +0000 (12:39 -0700)
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: 1ae258f8b343 ("net/mlx5: E-switch, Introduce rate limiting groups API")
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c

index 20146a2dc7f42baffbb3807b0017b445e7e5a1f0..997c412a81afe816645af69f5f95a1e1f60de517 100644 (file)
@@ -421,6 +421,7 @@ __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *ex
 {
        u32 tsar_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
        struct mlx5_esw_rate_group *group;
+       __be32 *attr;
        u32 divider;
        int err;
 
@@ -428,6 +429,12 @@ __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *ex
        if (!group)
                return ERR_PTR(-ENOMEM);
 
+       MLX5_SET(scheduling_context, tsar_ctx, element_type,
+                SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR);
+
+       attr = MLX5_ADDR_OF(scheduling_context, tsar_ctx, element_attributes);
+       *attr = cpu_to_be32(TSAR_ELEMENT_TSAR_TYPE_DWRR << 16);
+
        MLX5_SET(scheduling_context, tsar_ctx, parent_element_id,
                 esw->qos.root_tsar_ix);
        err = mlx5_create_scheduling_element_cmd(esw->dev,