net/mlx5: fix layer validation with decapsulation
Currently, the flow validate function only validate the outermost layer with the header modify actions. If there is decapsulation action before the header modify action, the validation should choose the inner layer for validation. Add decapsulation check when validate with the header modify actions. Choose the inner layer once there is decapsulation action. Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs") Cc: stable@dpdk.org Signed-off-by: Suanming Mou <suanmingm@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com>
This commit is contained in:
parent
bdcfb8a10b
commit
e505ac7f91
@ -3096,10 +3096,14 @@ flow_dv_validate_action_modify_ipv4(const uint64_t action_flags,
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t layer;
|
||||
|
||||
ret = flow_dv_validate_action_modify_hdr(action_flags, action, error);
|
||||
if (!ret) {
|
||||
if (!(item_flags & MLX5_FLOW_LAYER_L3_IPV4))
|
||||
layer = (action_flags & MLX5_FLOW_ACTION_DECAP) ?
|
||||
MLX5_FLOW_LAYER_INNER_L3_IPV4 :
|
||||
MLX5_FLOW_LAYER_OUTER_L3_IPV4;
|
||||
if (!(item_flags & layer))
|
||||
return rte_flow_error_set(error, EINVAL,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION,
|
||||
NULL,
|
||||
@ -3130,10 +3134,14 @@ flow_dv_validate_action_modify_ipv6(const uint64_t action_flags,
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t layer;
|
||||
|
||||
ret = flow_dv_validate_action_modify_hdr(action_flags, action, error);
|
||||
if (!ret) {
|
||||
if (!(item_flags & MLX5_FLOW_LAYER_L3_IPV6))
|
||||
layer = (action_flags & MLX5_FLOW_ACTION_DECAP) ?
|
||||
MLX5_FLOW_LAYER_INNER_L3_IPV6 :
|
||||
MLX5_FLOW_LAYER_OUTER_L3_IPV6;
|
||||
if (!(item_flags & layer))
|
||||
return rte_flow_error_set(error, EINVAL,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION,
|
||||
NULL,
|
||||
@ -3164,10 +3172,14 @@ flow_dv_validate_action_modify_tp(const uint64_t action_flags,
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t layer;
|
||||
|
||||
ret = flow_dv_validate_action_modify_hdr(action_flags, action, error);
|
||||
if (!ret) {
|
||||
if (!(item_flags & MLX5_FLOW_LAYER_L4))
|
||||
layer = (action_flags & MLX5_FLOW_ACTION_DECAP) ?
|
||||
MLX5_FLOW_LAYER_INNER_L4 :
|
||||
MLX5_FLOW_LAYER_OUTER_L4;
|
||||
if (!(item_flags & layer))
|
||||
return rte_flow_error_set(error, EINVAL,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION,
|
||||
NULL, "no transport layer "
|
||||
@ -3199,10 +3211,14 @@ flow_dv_validate_action_modify_tcp_seq(const uint64_t action_flags,
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t layer;
|
||||
|
||||
ret = flow_dv_validate_action_modify_hdr(action_flags, action, error);
|
||||
if (!ret) {
|
||||
if (!(item_flags & MLX5_FLOW_LAYER_OUTER_L4_TCP))
|
||||
layer = (action_flags & MLX5_FLOW_ACTION_DECAP) ?
|
||||
MLX5_FLOW_LAYER_INNER_L4_TCP :
|
||||
MLX5_FLOW_LAYER_OUTER_L4_TCP;
|
||||
if (!(item_flags & layer))
|
||||
return rte_flow_error_set(error, EINVAL,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION,
|
||||
NULL, "no TCP item in"
|
||||
@ -3244,10 +3260,14 @@ flow_dv_validate_action_modify_tcp_ack(const uint64_t action_flags,
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t layer;
|
||||
|
||||
ret = flow_dv_validate_action_modify_hdr(action_flags, action, error);
|
||||
if (!ret) {
|
||||
if (!(item_flags & MLX5_FLOW_LAYER_OUTER_L4_TCP))
|
||||
layer = (action_flags & MLX5_FLOW_ACTION_DECAP) ?
|
||||
MLX5_FLOW_LAYER_INNER_L4_TCP :
|
||||
MLX5_FLOW_LAYER_OUTER_L4_TCP;
|
||||
if (!(item_flags & layer))
|
||||
return rte_flow_error_set(error, EINVAL,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION,
|
||||
NULL, "no TCP item in"
|
||||
@ -3288,10 +3308,14 @@ flow_dv_validate_action_modify_ttl(const uint64_t action_flags,
|
||||
struct rte_flow_error *error)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t layer;
|
||||
|
||||
ret = flow_dv_validate_action_modify_hdr(action_flags, action, error);
|
||||
if (!ret) {
|
||||
if (!(item_flags & MLX5_FLOW_LAYER_L3))
|
||||
layer = (action_flags & MLX5_FLOW_ACTION_DECAP) ?
|
||||
MLX5_FLOW_LAYER_INNER_L3 :
|
||||
MLX5_FLOW_LAYER_OUTER_L3;
|
||||
if (!(item_flags & layer))
|
||||
return rte_flow_error_set(error, EINVAL,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION,
|
||||
NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user