[v2] net/mlx5: fix modify header action position

Message ID 1555531305-90597-1-git-send-email-orika@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Shahaf Shuler
Headers
Series [v2] net/mlx5: fix modify header action position |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Ori Kam April 17, 2019, 8:01 p.m. UTC
  According to RTE flow the action order should be the order that the
actions were given.
In the case of modify actions the position of the action was always
last.

This commit solves this issue by saving the position of the first modify
action, and then adds to this position the pointer to the modify action.

Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
Cc: dekelp@mellanox.com
Cc: stable@dpdk.org

Signed-off-by: Ori Kam <orika@mellanox.com>
---
v2:
* Move setting the index position outside the case.

---
 drivers/net/mlx5/mlx5_flow_dv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Yongseok Koh April 18, 2019, 1:25 p.m. UTC | #1
> On Apr 17, 2019, at 1:01 PM, Ori Kam <orika@mellanox.com> wrote:
> 
> According to RTE flow the action order should be the order that the
> actions were given.
> In the case of modify actions the position of the action was always
> last.
> 
> This commit solves this issue by saving the position of the first modify
> action, and then adds to this position the pointer to the modify action.
> 
> Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
> Cc: dekelp@mellanox.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>

> v2:
> * Move setting the index position outside the case.
> 
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index 3862b26..c84779d 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -3235,6 +3235,7 @@ struct field_modify_info modify_tcp[] = {
> 	};
> 	union flow_dv_attr flow_attr = { .attr = 0 };
> 	struct mlx5_flow_dv_tag_resource tag_resource;
> +	uint32_t modify_action_position = UINT32_MAX;
> 
> 	if (priority == MLX5_FLOW_PRIO_RSVD)
> 		priority = priv->config.flow_prio - 1;
> @@ -3474,13 +3475,16 @@ struct field_modify_info modify_tcp[] = {
> 								 dev_flow,
> 								 error))
> 					return -rte_errno;
> -				dev_flow->dv.actions[actions_n++] =
> +				dev_flow->dv.actions[modify_action_position] =
> 					dev_flow->dv.modify_hdr->verbs_action;
> 			}
> 			break;
> 		default:
> 			break;
> 		}
> +		if ((action_flags & MLX5_FLOW_MODIFY_HDR_ACTIONS) &&
> +		    modify_action_position == UINT32_MAX)
> +			modify_action_position = actions_n++;
> 	}
> 	dev_flow->dv.actions_n = actions_n;
> 	flow->actions = action_flags;
> -- 
> 1.8.3.1
>
  
Shahaf Shuler April 18, 2019, 6:55 p.m. UTC | #2
Thursday, April 18, 2019 4:26 PM, Yongseok Koh:
> Subject: Re: [PATCH v2] net/mlx5: fix modify header action position
> 
> 
> > On Apr 17, 2019, at 1:01 PM, Ori Kam <orika@mellanox.com> wrote:
> >
> > According to RTE flow the action order should be the order that the
> > actions were given.
> > In the case of modify actions the position of the action was always
> > last.
> >
> > This commit solves this issue by saving the position of the first
> > modify action, and then adds to this position the pointer to the modify
> action.
> >
> > Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct
> > Verbs")
> > Cc: dekelp@mellanox.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ori Kam <orika@mellanox.com>
> > ---
> Acked-by: Yongseok Koh <yskoh@mellanox.com>

Applied to next-net-mlx, thanks.
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3862b26..c84779d 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3235,6 +3235,7 @@  struct field_modify_info modify_tcp[] = {
 	};
 	union flow_dv_attr flow_attr = { .attr = 0 };
 	struct mlx5_flow_dv_tag_resource tag_resource;
+	uint32_t modify_action_position = UINT32_MAX;
 
 	if (priority == MLX5_FLOW_PRIO_RSVD)
 		priority = priv->config.flow_prio - 1;
@@ -3474,13 +3475,16 @@  struct field_modify_info modify_tcp[] = {
 								 dev_flow,
 								 error))
 					return -rte_errno;
-				dev_flow->dv.actions[actions_n++] =
+				dev_flow->dv.actions[modify_action_position] =
 					dev_flow->dv.modify_hdr->verbs_action;
 			}
 			break;
 		default:
 			break;
 		}
+		if ((action_flags & MLX5_FLOW_MODIFY_HDR_ACTIONS) &&
+		    modify_action_position == UINT32_MAX)
+			modify_action_position = actions_n++;
 	}
 	dev_flow->dv.actions_n = actions_n;
 	flow->actions = action_flags;