Skip to content

Commit

Permalink
net/mlx5: split sample flow into two sub-flows
Browse files Browse the repository at this point in the history
The flow with sample action will be split into two sub flows:
the prefix sub flow with the all actions preceding the sample
action and sample action itself, and the suffix sub flow with
the actions following the sample action.

The original items remain in the prefix sub flow, add the
implicit tag action with unique id to set in metadata register,
and suffix sub flow uses the tag item to match with that unique id.

The flow split as below:

Original flow: items / actions pre / sample / actions sfx ->
    prefix sub flow -
            items / actions pre / set_tag action / sample
    suffix sub flow -
            tag_item / actions sfx

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
jiaweiwsz authored and Ferruh Yigit committed Oct 16, 2020
1 parent 96b1f02 commit b4c0ddb
Show file tree
Hide file tree
Showing 4 changed files with 394 additions and 17 deletions.
11 changes: 11 additions & 0 deletions drivers/net/mlx5/mlx5.c
Expand Up @@ -241,6 +241,17 @@ static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = {
.free = mlx5_free,
.type = "mlx5_jump_ipool",
},
{
.size = sizeof(struct mlx5_flow_dv_sample_resource),
.trunk_size = 64,
.grow_trunk = 3,
.grow_shift = 2,
.need_lock = 0,
.release_mem_en = 1,
.malloc = mlx5_malloc,
.free = mlx5_free,
.type = "mlx5_sample_ipool",
},
#endif
{
.size = sizeof(struct mlx5_flow_meter),
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/mlx5/mlx5.h
Expand Up @@ -39,6 +39,7 @@ enum mlx5_ipool_index {
MLX5_IPOOL_TAG, /* Pool for tag resource. */
MLX5_IPOOL_PORT_ID, /* Pool for port id resource. */
MLX5_IPOOL_JUMP, /* Pool for jump resource. */
MLX5_IPOOL_SAMPLE, /* Pool for sample resource. */
#endif
MLX5_IPOOL_MTR, /* Pool for meter resource. */
MLX5_IPOOL_MCP, /* Pool for metadata resource. */
Expand Down Expand Up @@ -512,6 +513,7 @@ struct mlx5_flow_tbl_resource {
#define MLX5_FLOW_TABLE_LEVEL_METER (MLX5_MAX_TABLES - 4)
#define MLX5_FLOW_TABLE_LEVEL_SUFFIX (MLX5_MAX_TABLES - 3)
#define MLX5_MAX_TABLES_FDB UINT16_MAX
#define MLX5_FLOW_TABLE_FACTOR 10

/* ID generation structure. */
struct mlx5_flow_id_pool {
Expand Down Expand Up @@ -640,6 +642,7 @@ struct mlx5_dev_ctx_shared {
struct mlx5_hlist *tag_table;
uint32_t port_id_action_list; /* List of port ID actions. */
uint32_t push_vlan_action_list; /* List of push VLAN actions. */
uint32_t sample_action_list; /* List of sample actions. */
struct mlx5_flow_counter_mng cmng; /* Counters management structure. */
struct mlx5_flow_default_miss_resource default_miss;
/* Default miss action resource structure. */
Expand Down

0 comments on commit b4c0ddb

Please sign in to comment.