net/mlx5: prepare sub-policy for flow with meter
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_os.c
index ad43141..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) {
@@ -1290,6 +1292,23 @@ err_secondary:
                                        priv->mtr_color_reg);
                        }
                }
+               if (config->hca_attr.qos.sup &&
+                       config->hca_attr.qos.flow_meter_aso_sup) {
+                       uint32_t log_obj_size =
+                               rte_log2_u32(MLX5_ASO_MTRS_PER_POOL >> 1);
+                       if (log_obj_size >=
+                       config->hca_attr.qos.log_meter_aso_granularity &&
+                       log_obj_size <=
+                       config->hca_attr.qos.log_meter_aso_max_alloc)
+                               sh->meter_aso_en = 1;
+               }
+               if (priv->mtr_en) {
+                       err = mlx5_aso_flow_mtrs_mng_init(priv->sh);
+                       if (err) {
+                               err = -err;
+                               goto error;
+                       }
+               }
 #endif
 #ifdef HAVE_MLX5_DR_CREATE_ACTION_ASO
                if (config->hca_attr.flow_hit_aso &&