Commit 0c56b975 authored by Maor Gottlieb's avatar Maor Gottlieb Committed by David S. Miller

net/mlx5_core: Introduce flow steering API

Introducing the following objects:

mlx5_flow_root_namespace: represent the root of specific flow table
type tree(e.g NIC receive, FDB, etc..)

mlx5_flow_group: define the mask of the flow specification.

fs_fte(flow steering flow table entry): defines the value of the
flow specification.

The following describes the relationships between the tree objects:
root_namespace --> priorities -->namespaces -->
priorities -->flow-tables --> flow-groups -->
flow-entries --> destinations

When we create new object(flow table/flow group/flow table entry), we
call to the FW command and then we add the related sw object to the tree.

When we destroy object, e.g. call to mlx5_destroy_flow_table, we use
the tree node destructor for destroying the FW object and remove the
node from the tree.
Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
Signed-off-by: default avatarMatan Barak <matanb@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5e1626c0
...@@ -69,13 +69,16 @@ struct mlx5_flow_rule { ...@@ -69,13 +69,16 @@ struct mlx5_flow_rule {
struct mlx5_flow_destination dest_attr; struct mlx5_flow_destination dest_attr;
}; };
/* Type of children is mlx5_flow_group */
struct mlx5_flow_table { struct mlx5_flow_table {
struct fs_node node; struct fs_node node;
u32 id; u32 id;
unsigned int max_fte;
unsigned int level; unsigned int level;
enum fs_flow_table_type type; enum fs_flow_table_type type;
}; };
/* Type of children is mlx5_flow_rule */
struct fs_fte { struct fs_fte {
struct fs_node node; struct fs_node node;
u32 val[MLX5_ST_SZ_DW(fte_match_param)]; u32 val[MLX5_ST_SZ_DW(fte_match_param)];
...@@ -83,15 +86,19 @@ struct fs_fte { ...@@ -83,15 +86,19 @@ struct fs_fte {
u32 flow_tag; u32 flow_tag;
u32 index; u32 index;
u32 action; u32 action;
enum fs_fte_status status;
}; };
/* Type of children is mlx5_flow_table/namespace */
struct fs_prio { struct fs_prio {
struct fs_node node; struct fs_node node;
unsigned int max_ft; unsigned int max_ft;
unsigned int start_level; unsigned int start_level;
unsigned int prio; unsigned int prio;
unsigned int num_ft;
}; };
/* Type of children is fs_prio */
struct mlx5_flow_namespace { struct mlx5_flow_namespace {
/* parent == NULL => root ns */ /* parent == NULL => root ns */
struct fs_node node; struct fs_node node;
...@@ -102,6 +109,22 @@ struct mlx5_flow_group_mask { ...@@ -102,6 +109,22 @@ struct mlx5_flow_group_mask {
u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)];
}; };
/* Type of children is fs_fte */
struct mlx5_flow_group {
struct fs_node node;
struct mlx5_flow_group_mask mask;
u32 start_index;
u32 max_ftes;
u32 num_ftes;
u32 id;
};
struct mlx5_flow_root_namespace {
struct mlx5_flow_namespace ns;
enum fs_flow_table_type table_type;
struct mlx5_core_dev *dev;
};
#define fs_get_obj(v, _node) {v = container_of((_node), typeof(*v), node); } #define fs_get_obj(v, _node) {v = container_of((_node), typeof(*v), node); }
#define fs_list_for_each_entry(pos, root) \ #define fs_list_for_each_entry(pos, root) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment