net/mlx5_core: Flow counters infrastructure
[cascardo/linux.git] / include / linux / mlx5 / fs.h
index 8230caa..4b7a107 100644 (file)
 
 #define MLX5_FS_DEFAULT_FLOW_TAG 0x0
 
+enum {
+       MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO  = 1 << 16,
+};
+
 #define LEFTOVERS_RULE_NUM      2
 static inline void build_leftovers_ft_param(int *priority,
                                            int *n_ent,
@@ -52,7 +56,10 @@ enum mlx5_flow_namespace_type {
        MLX5_FLOW_NAMESPACE_BYPASS,
        MLX5_FLOW_NAMESPACE_KERNEL,
        MLX5_FLOW_NAMESPACE_LEFTOVERS,
+       MLX5_FLOW_NAMESPACE_ANCHOR,
        MLX5_FLOW_NAMESPACE_FDB,
+       MLX5_FLOW_NAMESPACE_ESW_EGRESS,
+       MLX5_FLOW_NAMESPACE_ESW_INGRESS,
 };
 
 struct mlx5_flow_table;
@@ -66,6 +73,7 @@ struct mlx5_flow_destination {
                u32                     tir_num;
                struct mlx5_flow_table  *ft;
                u32                     vport_num;
+               struct mlx5_fc          *counter;
        };
 };
 
@@ -77,12 +85,19 @@ struct mlx5_flow_table *
 mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
                                    int prio,
                                    int num_flow_table_entries,
-                                   int max_num_groups);
+                                   int max_num_groups,
+                                   u32 level);
 
 struct mlx5_flow_table *
 mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
                       int prio,
-                      int num_flow_table_entries);
+                      int num_flow_table_entries,
+                      u32 level);
+struct mlx5_flow_table *
+mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
+                            int prio,
+                            int num_flow_table_entries,
+                            u32 level, u16 vport);
 int mlx5_destroy_flow_table(struct mlx5_flow_table *ft);
 
 /* inbox should be set with the following values:
@@ -108,4 +123,13 @@ mlx5_add_flow_rule(struct mlx5_flow_table *ft,
                   struct mlx5_flow_destination *dest);
 void mlx5_del_flow_rule(struct mlx5_flow_rule *fr);
 
+int mlx5_modify_rule_destination(struct mlx5_flow_rule *rule,
+                                struct mlx5_flow_destination *dest);
+
+struct mlx5_fc *mlx5_flow_rule_counter(struct mlx5_flow_rule *rule);
+struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
+void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
+void mlx5_fc_query_cached(struct mlx5_fc *counter,
+                         u64 *bytes, u64 *packets, u64 *lastuse);
+
 #endif