net/mlx5: add pattern template management
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.h
index 7fec79a..49027d6 100644 (file)
@@ -452,6 +452,7 @@ enum mlx5_flow_drv_type {
        MLX5_FLOW_TYPE_MIN,
        MLX5_FLOW_TYPE_DV,
        MLX5_FLOW_TYPE_VERBS,
+       MLX5_FLOW_TYPE_HW,
        MLX5_FLOW_TYPE_MAX,
 };
 
@@ -963,7 +964,7 @@ is_tunnel_offload_active(const struct rte_eth_dev *dev)
 {
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
        const struct mlx5_priv *priv = dev->data->dev_private;
-       return !!priv->config.dv_miss_info;
+       return !!priv->sh->config.dv_miss_info;
 #else
        RTE_SET_USED(dev);
        return false;
@@ -1014,6 +1015,19 @@ struct rte_flow {
        uint32_t geneve_tlv_option; /**< Holds Geneve TLV option id. > */
 } __rte_packed;
 
+#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
+
+/* Flow item template struct. */
+struct rte_flow_pattern_template {
+       LIST_ENTRY(rte_flow_pattern_template) next;
+       /* Template attributes. */
+       struct rte_flow_pattern_template_attr attr;
+       struct mlx5dr_match_template *mt; /* mlx5 match template. */
+       uint32_t refcnt;  /* Reference counter. */
+};
+
+#endif
+
 /*
  * Define list of valid combinations of RX Hash fields
  * (see enum ibv_rx_hash_fields).
@@ -1180,7 +1194,7 @@ typedef void (*mlx5_flow_counter_free_t)(struct rte_eth_dev *dev,
 typedef int (*mlx5_flow_counter_query_t)(struct rte_eth_dev *dev,
                                         uint32_t cnt,
                                         bool clear, uint64_t *pkts,
-                                        uint64_t *bytes);
+                                        uint64_t *bytes, void **action);
 typedef int (*mlx5_flow_get_aged_flows_t)
                                        (struct rte_eth_dev *dev,
                                         void **context,
@@ -1256,6 +1270,26 @@ typedef int (*mlx5_flow_item_update_t)
                         const struct rte_flow_item_flex_handle *handle,
                         const struct rte_flow_item_flex_conf *conf,
                         struct rte_flow_error *error);
+typedef int (*mlx5_flow_info_get_t)
+                       (struct rte_eth_dev *dev,
+                        struct rte_flow_port_info *port_info,
+                        struct rte_flow_queue_info *queue_info,
+                        struct rte_flow_error *error);
+typedef int (*mlx5_flow_port_configure_t)
+                       (struct rte_eth_dev *dev,
+                        const struct rte_flow_port_attr *port_attr,
+                        uint16_t nb_queue,
+                        const struct rte_flow_queue_attr *queue_attr[],
+                        struct rte_flow_error *err);
+typedef struct rte_flow_pattern_template *(*mlx5_flow_pattern_template_create_t)
+                       (struct rte_eth_dev *dev,
+                        const struct rte_flow_pattern_template_attr *attr,
+                        const struct rte_flow_item items[],
+                        struct rte_flow_error *error);
+typedef int (*mlx5_flow_pattern_template_destroy_t)
+                       (struct rte_eth_dev *dev,
+                        struct rte_flow_pattern_template *template,
+                        struct rte_flow_error *error);
 
 struct mlx5_flow_driver_ops {
        mlx5_flow_validate_t validate;
@@ -1294,6 +1328,10 @@ struct mlx5_flow_driver_ops {
        mlx5_flow_item_create_t item_create;
        mlx5_flow_item_release_t item_release;
        mlx5_flow_item_update_t item_update;
+       mlx5_flow_info_get_t info_get;
+       mlx5_flow_port_configure_t configure;
+       mlx5_flow_pattern_template_create_t pattern_template_create;
+       mlx5_flow_pattern_template_destroy_t pattern_template_destroy;
 };
 
 /* mlx5_flow.c */
@@ -1723,11 +1761,6 @@ struct mlx5_list_entry *flow_dv_dest_array_clone_cb(void *tool_ctx,
                                   struct mlx5_list_entry *entry, void *cb_ctx);
 void flow_dv_dest_array_clone_free_cb(void *tool_ctx,
                                      struct mlx5_list_entry *entry);
-int flow_dv_query_count_ptr(struct rte_eth_dev *dev, uint32_t cnt_idx,
-                               void **action, struct rte_flow_error *error);
-int
-flow_dv_query_count(struct rte_eth_dev *dev, uint32_t cnt_idx, void *data,
-                   struct rte_flow_error *error);
 
 struct mlx5_aso_age_action *flow_aso_age_get_by_idx(struct rte_eth_dev *dev,
                                                    uint32_t age_idx);
@@ -1766,4 +1799,6 @@ const struct mlx5_flow_tunnel *
 mlx5_get_tof(const struct rte_flow_item *items,
             const struct rte_flow_action *actions,
             enum mlx5_tof_rule_type *rule_type);
+void
+flow_hw_resource_release(struct rte_eth_dev *dev);
 #endif /* RTE_PMD_MLX5_FLOW_H_ */