diff options
author | Carolina Jubran <cjubran@nvidia.com> | 2024-10-08 21:32:21 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-10-10 13:12:00 +0200 |
commit | f91c69f43c545f46f256d907d55d24d06a4ac8f5 (patch) | |
tree | 4b6979dc9ed8fe64b9f242faa5f52411528fbefd /drivers/net/ethernet/mellanox/mlx5/core/qos.c | |
parent | 40efb0b7c755f7803abe59a81c3bdd73edf025d3 (diff) | |
download | linux-f91c69f43c545f46f256d907d55d24d06a4ac8f5.tar.gz linux-f91c69f43c545f46f256d907d55d24d06a4ac8f5.tar.bz2 linux-f91c69f43c545f46f256d907d55d24d06a4ac8f5.zip |
net/mlx5: Unify QoS element type checks across NIC and E-Switch
Refactor the QoS element type support check by introducing a new
function, mlx5_qos_element_type_supported(), which handles element type
validation for both NIC and E-Switch schedulers.
This change removes the redundant esw_qos_element_type_supported()
function and unifies the element type checks into a single
implementation.
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/qos.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/qos.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/qos.c index db2bd3ad63ba..4d353da3eb7b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/qos.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/qos.c @@ -28,7 +28,9 @@ int mlx5_qos_create_leaf_node(struct mlx5_core_dev *mdev, u32 parent_id, { u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0}; - if (!(MLX5_CAP_QOS(mdev, nic_element_type) & ELEMENT_TYPE_CAP_MASK_QUEUE_GROUP)) + if (!mlx5_qos_element_type_supported(mdev, + SCHEDULING_CONTEXT_ELEMENT_TYPE_QUEUE_GROUP, + SCHEDULING_HIERARCHY_NIC)) return -EOPNOTSUPP; MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_id); @@ -47,7 +49,9 @@ int mlx5_qos_create_inner_node(struct mlx5_core_dev *mdev, u32 parent_id, u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0}; void *attr; - if (!(MLX5_CAP_QOS(mdev, nic_element_type) & ELEMENT_TYPE_CAP_MASK_TSAR) || + if (!mlx5_qos_element_type_supported(mdev, + SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR, + SCHEDULING_HIERARCHY_NIC) || !(MLX5_CAP_QOS(mdev, nic_tsar_type) & TSAR_TYPE_CAP_MASK_DWRR)) return -EOPNOTSUPP; |