common/mlx5: add read ASO flow meter HCA capability
authorLi Zhang <lizh@nvidia.com>
Tue, 20 Apr 2021 10:55:14 +0000 (13:55 +0300)
committerRaslan Darawsheh <rasland@nvidia.com>
Wed, 21 Apr 2021 06:27:56 +0000 (08:27 +0200)
Read and store the device capability of FLOW_METER_ASO general object,
using the DevX API.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/common/mlx5/mlx5_devx_cmds.c
drivers/common/mlx5/mlx5_devx_cmds.h

index ec6069b..88be7de 100644 (file)
@@ -696,6 +696,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
        attr->max_geneve_tlv_option_data_len = MLX5_GET(cmd_hca_cap, hcattr,
                        max_geneve_tlv_option_data_len);
        attr->qos.sup = MLX5_GET(cmd_hca_cap, hcattr, qos);
+       attr->qos.flow_meter_aso_sup = !!(MLX5_GET64(cmd_hca_cap, hcattr,
+                                        general_obj_types) &
+                             MLX5_GENERAL_OBJ_TYPES_CAP_FLOW_METER_ASO);
        attr->vdpa.valid = !!(MLX5_GET64(cmd_hca_cap, hcattr,
                                         general_obj_types) &
                              MLX5_GENERAL_OBJ_TYPES_CAP_VIRTQ_NET_Q);
@@ -783,6 +786,17 @@ 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);
+               if (attr->qos.flow_meter_aso_sup) {
+                       attr->qos.log_meter_aso_granularity =
+                               MLX5_GET(qos_cap, hcattr,
+                                       log_meter_aso_granularity);
+                       attr->qos.log_meter_aso_max_alloc =
+                               MLX5_GET(qos_cap, hcattr,
+                                       log_meter_aso_max_alloc);
+                       attr->qos.log_max_num_meter_aso =
+                               MLX5_GET(qos_cap, hcattr,
+                                       log_max_num_meter_aso);
+               }
        }
        if (attr->vdpa.valid)
                mlx5_devx_cmd_query_hca_vdpa_attr(ctx, &attr->vdpa);
index 209e7da..fa8dd38 100644 (file)
@@ -50,10 +50,18 @@ struct mlx5_hca_qos_attr {
         * Using older driver versions, flow_meter_old can be 1
         * while flow_meter is 0.
         */
+       uint32_t flow_meter_aso_sup:1;
+       /* Whether FLOW_METER_ASO Object is supported. */
        uint8_t log_max_flow_meter;
        /* Power of the maximum supported meters. */
        uint8_t flow_meter_reg_c_ids;
        /* Bitmap of the reg_Cs available for flow meter to use. */
+       uint32_t log_meter_aso_granularity:5;
+       /* Power of the minimum allocation granularity Object. */
+       uint32_t log_meter_aso_max_alloc:5;
+       /* Power of the maximum allocation granularity Object. */
+       uint32_t log_max_num_meter_aso:5;
+       /* Power of the maximum number of supported objects. */
 
 };