common/mlx5: share device context object
[dpdk.git] / drivers / common / mlx5 / linux / mlx5_glue.h
index 734ace2..f39ef2d 100644 (file)
@@ -77,16 +77,60 @@ struct mlx5dv_devx_async_cmd_hdr;
 #ifndef HAVE_MLX5DV_DR
 enum  mlx5dv_dr_domain_type { unused, };
 struct mlx5dv_dr_domain;
+struct mlx5dv_dr_action;
+#define MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL 1
 #endif
 
 #ifndef HAVE_MLX5DV_DR_DEVX_PORT
 struct mlx5dv_devx_port;
 #endif
 
+#ifndef HAVE_MLX5DV_DR_DEVX_PORT_V35
+struct mlx5dv_port;
+#endif
+
+#define MLX5_PORT_QUERY_VPORT (1u << 0)
+#define MLX5_PORT_QUERY_REG_C0 (1u << 1)
+
+struct mlx5_port_info {
+       uint16_t query_flags;
+       uint16_t vport_id; /* Associated VF vport index (if any). */
+       uint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. */
+       uint32_t vport_meta_mask; /* Used for vport index field match mask. */
+};
+
 #ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER
 struct mlx5dv_dr_flow_meter_attr;
 #endif
 
+#ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE
+struct mlx5dv_dr_flow_sampler_attr {
+       uint32_t sample_ratio;
+       void *default_next_table;
+       size_t num_sample_actions;
+       struct mlx5dv_dr_action **sample_actions;
+       uint64_t action;
+};
+#endif
+
+#ifndef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY
+enum mlx5dv_dr_action_dest_type {
+       MLX5DV_DR_ACTION_DEST,
+       MLX5DV_DR_ACTION_DEST_REFORMAT,
+};
+struct mlx5dv_dr_action_dest_reformat {
+       struct mlx5dv_dr_action *reformat;
+       struct mlx5dv_dr_action *dest;
+};
+struct mlx5dv_dr_action_dest_attr {
+       enum mlx5dv_dr_action_dest_type type;
+       union {
+               struct mlx5dv_dr_action *dest;
+               struct mlx5dv_dr_action_dest_reformat *dest_reformat;
+       };
+};
+#endif
+
 #ifndef HAVE_IBV_DEVX_EVENT
 struct mlx5dv_devx_event_channel { int fd; };
 struct mlx5dv_devx_async_event_hdr;
@@ -102,7 +146,6 @@ struct mlx5dv_var { uint32_t page_id; uint32_t length; off_t mmap_off;
 #define IBV_ACCESS_RELAXED_ORDERING 0
 #endif
 
-/* LIB_GLUE_VERSION must be updated every time this structure is modified. */
 struct mlx5_glue {
        const char *version;
        int (*fork_init)(void);
@@ -195,6 +238,7 @@ struct mlx5_glue {
        void *(*dr_create_domain)(struct ibv_context *ctx,
                                  enum mlx5dv_dr_domain_type domain);
        int (*dr_destroy_domain)(void *domain);
+       int (*dr_sync_domain)(void *domain, uint32_t flags);
        struct ibv_cq_ex *(*dv_create_cq)
                (struct ibv_context *context,
                 struct ibv_cq_init_attr_ex *cq_attr,
@@ -278,10 +322,13 @@ struct mlx5_glue {
        int (*devx_qp_query)(struct ibv_qp *qp,
                             const void *in, size_t inlen,
                             void *out, size_t outlen);
+       int (*devx_wq_query)(struct ibv_wq *wq, const void *in, size_t inlen,
+                            void *out, size_t outlen);
        int (*devx_port_query)(struct ibv_context *ctx,
                               uint32_t port_num,
-                              struct mlx5dv_devx_port *mlx5_devx_port);
+                              struct mlx5_port_info *info);
        int (*dr_dump_domain)(FILE *file, void *domain);
+       int (*dr_dump_rule)(FILE *file, void *rule);
        int (*devx_query_eqn)(struct ibv_context *context, uint32_t cpus,
                              uint32_t *eqn);
        struct mlx5dv_devx_event_channel *(*devx_create_event_channel)
@@ -304,11 +351,21 @@ struct mlx5_glue {
                         struct mlx5dv_devx_async_event_hdr *event_data,
                         size_t event_resp_len);
        void (*dr_reclaim_domain_memory)(void *domain, uint32_t enable);
+       void (*dr_allow_duplicate_rules)(void *domain, uint32_t allow);
        struct mlx5dv_pp *(*dv_alloc_pp)(struct ibv_context *context,
                                         size_t pp_context_sz,
                                         const void *pp_context,
                                         uint32_t flags);
        void (*dv_free_pp)(struct mlx5dv_pp *pp);
+       void *(*dr_create_flow_action_sampler)
+                       (struct mlx5dv_dr_flow_sampler_attr *attr);
+       void *(*dr_create_flow_action_dest_array)
+                       (void *domain,
+                        size_t num_dest,
+                        struct mlx5dv_dr_action_dest_attr *dests[]);
+       void *(*dv_create_flow_action_aso)
+                       (struct mlx5dv_dr_domain *domain, void *aso_obj,
+                        uint32_t offset, uint32_t flags, uint8_t return_reg_c);
 };
 
 extern const struct mlx5_glue *mlx5_glue;