net/mlx5: support meter creation with policy
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_os.c
index 336cdbe..17d0533 100644 (file)
@@ -1255,7 +1255,9 @@ err_secondary:
                                "required for coalescing is %d bytes",
                                config->hca_attr.lro_min_mss_size);
                }
-#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER)
+#if defined(HAVE_MLX5DV_DR) && \
+       (defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER) || \
+        defined(HAVE_MLX5_DR_CREATE_ACTION_ASO))
                if (config->hca_attr.qos.sup &&
                    config->hca_attr.qos.flow_meter_old &&
                    config->dv_flow_en) {
@@ -1297,13 +1299,14 @@ err_secondary:
                        if (log_obj_size >=
                        config->hca_attr.qos.log_meter_aso_granularity &&
                        log_obj_size <=
-                       config->hca_attr.qos.log_meter_aso_max_alloc) {
+                       config->hca_attr.qos.log_meter_aso_max_alloc)
                                sh->meter_aso_en = 1;
-                               err = mlx5_aso_flow_mtrs_mng_init(priv);
-                               if (err) {
-                                       err = -err;
-                                       goto error;
-                               }
+               }
+               if (priv->mtr_en) {
+                       err = mlx5_aso_flow_mtrs_mng_init(priv->sh);
+                       if (err) {
+                               err = -err;
+                               goto error;
                        }
                }
 #endif