mlx5: Add a no-append flow insertion mode

(cherry picked from commit 6a6af22b6ec42eb0436381fae8dd1b86bc4c6327)
This commit is contained in:
Mark Bloch 2023-02-20 15:46:42 +00:00 committed by Konstantin Belousov
parent 67a9c8868a
commit 5a2ff1f03a
2 changed files with 9 additions and 0 deletions

View file

@ -96,8 +96,13 @@ enum mlx5_flow_act_actions {
MLX5_FLOW_ACT_ACTIONS_PACKET_REFORMAT = 1 << 2,
};
enum MLX5_FLOW_ACT_FLAGS {
MLX5_FLOW_ACT_NO_APPEND = 1 << 0,
};
struct mlx5_flow_act {
u32 actions; /* See enum mlx5_flow_act_actions */
u32 flags;
u32 flow_tag;
struct mlx5_modify_hdr *modify_hdr;
struct mlx5_pkt_reformat *pkt_reformat;

View file

@ -1806,6 +1806,9 @@ static struct mlx5_flow_rule *fs_add_dst_fg(struct mlx5_flow_group *fg,
char fte_name[20];
mutex_lock(&fg->base.lock);
if (flow_act->flags & MLX5_FLOW_ACT_NO_APPEND)
goto insert_fte;
fs_for_each_fte(fte, fg) {
/* TODO: Check of size against PRM max size */
mutex_lock(&fte->base.lock);
@ -1821,6 +1824,7 @@ static struct mlx5_flow_rule *fs_add_dst_fg(struct mlx5_flow_group *fg,
mutex_unlock(&fte->base.lock);
}
insert_fte:
fs_get_parent(ft, fg);
if (fg->num_ftes == fg->max_ftes) {
dst = ERR_PTR(-ENOSPC);