net/mlx5: support Rx queue delay drop
[dpdk.git] / drivers / common / mlx5 / windows / mlx5_glue.c
index 7f8a00a..535487a 100644 (file)
@@ -12,7 +12,7 @@
 #include <rte_malloc.h>
 
 #include "mlx5_glue.h"
-#include "mlx5_common_utils.h"
+#include "../mlx5_common_log.h"
 #include "mlx5_win_ext.h"
 
 /*
@@ -256,6 +256,9 @@ mlx5_glue_devx_free_uar(void *uar)
        devx_free_uar((devx_uar_handle *)uar);
 }
 
+static_assert(MLX5_ST_SZ_BYTES(fte_match_param) == 0x200,
+       "PRM size of fte_match_param is broken! cannot compile Windows!");
+
 static void*
 mlx5_glue_devx_fs_rule_add(void *ctx, void *in, uint32_t inlen)
 
@@ -280,6 +283,51 @@ mlx5_glue_devx_fs_rule_del(void *flow)
        return devx_fs_rule_del(flow);
 }
 
+static int
+mlx5_glue_query_rt_values(void *ctx, void *devx_clock)
+{
+       struct mlx5_context *mlx5_ctx;
+       struct mlx5_devx_clock *clock;
+       int err;
+
+       if (!ctx) {
+               errno = EINVAL;
+               return errno;
+       }
+       mlx5_ctx = (struct mlx5_context *)ctx;
+       clock = (struct mlx5_devx_clock *)devx_clock;
+       err = devx_hca_clock_query(
+                       mlx5_ctx->devx_ctx,
+                       &clock->p_iseg_internal_timer,
+                       &clock->clock_frequency_hz,
+                       &clock->is_stable_clock_frequency);
+       if (err) {
+               errno = err;
+               return errno;
+       }
+       return 0;
+}
+
+static int
+mlx5_glue_devx_init_showdown_event(void *ctx)
+{
+       struct mlx5_context *mlx5_ctx;
+       int err;
+
+       if (!ctx) {
+               errno = EINVAL;
+               return errno;
+       }
+       mlx5_ctx = (struct mlx5_context *)ctx;
+       err = devx_query_shutdown_event(mlx5_ctx->devx_ctx,
+                       &mlx5_ctx->shutdown_event_obj);
+       if (err) {
+               errno = err;
+               return errno;
+       }
+       return 0;
+}
+
 alignas(RTE_CACHE_LINE_SIZE)
 const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
        .version = MLX5_GLUE_VERSION,
@@ -301,4 +349,6 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
        .devx_fs_rule_add = mlx5_glue_devx_fs_rule_add,
        .devx_fs_rule_del = mlx5_glue_devx_fs_rule_del,
        .devx_query_eqn = mlx5_glue_devx_query_eqn,
+       .query_rt_values = mlx5_glue_query_rt_values,
+       .devx_init_showdown_event = mlx5_glue_devx_init_showdown_event,
 };