[PATCH v3 02/9] common/mlx5: query packet pacing rate table capabilities

Vincent Jardin
2026-03-12T22:02:10Z

Query additional QoS packet pacing capabilities from HCA attributes:
- packet_pacing_burst_bound: HW supports burst_upper_bound parameter
- packet_pacing_typical_size: HW supports typical_packet_size parameter
- packet_pacing_max_rate / packet_pacing_min_rate: rate range in kbps
- packet_pacing_rate_table_size: number of HW rate table entries

These capabilities are needed by the upcoming per-queue rate limiting
feature to validate devarg values and report HW limits.

Supported hardware:
- ConnectX-6 Dx and later (different boards expose different subsets)
- ConnectX-5 reports packet_pacing but not all extended fields
- ConnectX-7/8 report the full capability set
- BlueField-2 and later DPUs also report these capabilities

Not supported:
- ConnectX-4 Lx and earlier (no packet_pacing capability at all)
- ConnectX-5 Ex may not report burst_bound or typical_size

Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
drivers/common/mlx5/mlx5_devx_cmds.c | 15 +++++++++++++++
drivers/common/mlx5/mlx5_devx_cmds.h | 11 ++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index d12ebf8487..8f53303fa7 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -1244,6 +1244,21 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
MLX5_GET(qos_cap, hcattr, packet_pacing);
attr->qos.wqe_rate_pp =
MLX5_GET(qos_cap, hcattr, wqe_rate_pp);
+ attr->qos.packet_pacing_burst_bound =
+ MLX5_GET(qos_cap, hcattr,
+ packet_pacing_burst_bound);
+ attr->qos.packet_pacing_typical_size =
+ MLX5_GET(qos_cap, hcattr,
+ packet_pacing_typical_size);
+ attr->qos.packet_pacing_max_rate =
+ MLX5_GET(qos_cap, hcattr,
+ packet_pacing_max_rate);
+ attr->qos.packet_pacing_min_rate =
+ MLX5_GET(qos_cap, hcattr,
+ packet_pacing_min_rate);
+ attr->qos.packet_pacing_rate_table_size =
+ MLX5_GET(qos_cap, hcattr,
+ packet_pacing_rate_table_size);
if (attr->qos.flow_meter_aso_sup) {
attr->qos.log_meter_aso_granularity =
MLX5_GET(qos_cap, hcattr,
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index da50fc686c..930ae2c072 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -67,7 +67,16 @@ struct mlx5_hca_qos_attr {
/* Power of the maximum allocation granularity Object. */
uint32_t log_max_num_meter_aso:5;
/* Power of the maximum number of supported objects. */
-
+ uint32_t packet_pacing_burst_bound:1;
+ /* HW supports burst_upper_bound PP parameter. */
+ uint32_t packet_pacing_typical_size:1;
+ /* HW supports typical_packet_size PP parameter. */
+ uint32_t packet_pacing_max_rate;
+ /* Maximum supported pacing rate in kbps. */
+ uint32_t packet_pacing_min_rate;
+ /* Minimum supported pacing rate in kbps. */
+ uint16_t packet_pacing_rate_table_size;
+ /* Number of entries in the HW rate table. */
};

struct mlx5_hca_vdpa_attr {
--
2.43.0