net/mlx5: Add flow steering actions to fs_cmd shim layer
Add flow steering actions: modify header and packet reformat to the fs_cmd shim layer. This allows each namespace to define possibly different functionality for alloc/dealloc action commands. Signed-off-by: Maor Gottlieb <maorg@mellanox.com> Reviewed-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:

committed by
Saeed Mahameed

vanhempi
a06ebb8d95
commit
2b688ea5ef
@@ -322,11 +322,11 @@ void mlx5_ib_destroy_flow_action_raw(struct mlx5_ib_flow_action *maction)
|
||||
switch (maction->flow_action_raw.sub_type) {
|
||||
case MLX5_IB_FLOW_ACTION_MODIFY_HEADER:
|
||||
mlx5_modify_header_dealloc(maction->flow_action_raw.dev->mdev,
|
||||
maction->flow_action_raw.action_id);
|
||||
maction->flow_action_raw.modify_hdr);
|
||||
break;
|
||||
case MLX5_IB_FLOW_ACTION_PACKET_REFORMAT:
|
||||
mlx5_packet_reformat_dealloc(maction->flow_action_raw.dev->mdev,
|
||||
maction->flow_action_raw.action_id);
|
||||
maction->flow_action_raw.pkt_reformat);
|
||||
break;
|
||||
case MLX5_IB_FLOW_ACTION_DECAP:
|
||||
break;
|
||||
@@ -352,10 +352,11 @@ mlx5_ib_create_modify_header(struct mlx5_ib_dev *dev,
|
||||
if (!maction)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
ret = mlx5_modify_header_alloc(dev->mdev, namespace, num_actions, in,
|
||||
&maction->flow_action_raw.action_id);
|
||||
maction->flow_action_raw.modify_hdr =
|
||||
mlx5_modify_header_alloc(dev->mdev, namespace, num_actions, in);
|
||||
|
||||
if (ret) {
|
||||
if (IS_ERR(maction->flow_action_raw.modify_hdr)) {
|
||||
ret = PTR_ERR(maction->flow_action_raw.modify_hdr);
|
||||
kfree(maction);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
@@ -479,11 +480,13 @@ static int mlx5_ib_flow_action_create_packet_reformat_ctx(
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = mlx5_packet_reformat_alloc(dev->mdev, prm_prt, len,
|
||||
in, namespace,
|
||||
&maction->flow_action_raw.action_id);
|
||||
if (ret)
|
||||
maction->flow_action_raw.pkt_reformat =
|
||||
mlx5_packet_reformat_alloc(dev->mdev, prm_prt, len,
|
||||
in, namespace);
|
||||
if (IS_ERR(maction->flow_action_raw.pkt_reformat)) {
|
||||
ret = PTR_ERR(maction->flow_action_raw.pkt_reformat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
maction->flow_action_raw.sub_type =
|
||||
MLX5_IB_FLOW_ACTION_PACKET_REFORMAT;
|
||||
|
@@ -2658,7 +2658,8 @@ int parse_flow_flow_action(struct mlx5_ib_flow_action *maction,
|
||||
if (action->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
||||
return -EINVAL;
|
||||
action->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
|
||||
action->modify_id = maction->flow_action_raw.action_id;
|
||||
action->modify_hdr =
|
||||
maction->flow_action_raw.modify_hdr;
|
||||
return 0;
|
||||
}
|
||||
if (maction->flow_action_raw.sub_type ==
|
||||
@@ -2675,8 +2676,8 @@ int parse_flow_flow_action(struct mlx5_ib_flow_action *maction,
|
||||
return -EINVAL;
|
||||
action->action |=
|
||||
MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
|
||||
action->reformat_id =
|
||||
maction->flow_action_raw.action_id;
|
||||
action->pkt_reformat =
|
||||
maction->flow_action_raw.pkt_reformat;
|
||||
return 0;
|
||||
}
|
||||
/* fall through */
|
||||
|
@@ -868,7 +868,10 @@ struct mlx5_ib_flow_action {
|
||||
struct {
|
||||
struct mlx5_ib_dev *dev;
|
||||
u32 sub_type;
|
||||
u32 action_id;
|
||||
union {
|
||||
struct mlx5_modify_hdr *modify_hdr;
|
||||
struct mlx5_pkt_reformat *pkt_reformat;
|
||||
};
|
||||
} flow_action_raw;
|
||||
};
|
||||
};
|
||||
|
Viittaa uudesa ongelmassa
Block a user