> -----Original Message-----
> From: Suanming Mou <suanmi...@mellanox.com>
> Sent: Monday, April 20, 2020 5:09
> To: Slava Ovsiienko <viachesl...@mellanox.com>; Matan Azrad
> <ma...@mellanox.com>
> Cc: Raslan Darawsheh <rasl...@mellanox.com>; dev@dpdk.org
> Subject: [PATCH] net/mlx5: fix RSS description corrupt issue
> 
> Currently, RSS description data is saved in the mlx5 private data. It dose not
> support the nest flow_list_create() routine.
> 
> In the case with mark reg copy, the flow_list_create() function will be called
> nested. The RSS description data will be cleared in the nested case.
> 
> Allocate one more RSS description to avoid the nested case.
> 
> Fixes: bb7e7801704e ("net/mlx5: optimize mlx5 flow RSS struct")
> 
> Signed-off-by: Suanming Mou <suanmi...@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viachesl...@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_flow.c       | 10 ++++++----
>  drivers/net/mlx5/mlx5_flow_dv.c    |  8 +++++---
>  drivers/net/mlx5/mlx5_flow_verbs.c |  8 +++++---
>  3 files changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index c529aa3..109d71e 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -4266,7 +4266,8 @@ uint32_t mlx5_flow_adjust_priority(struct
> rte_eth_dev *dev, int32_t priority,
>               uint8_t buffer[2048];
>       } items_tx;
>       struct rte_flow_expand_rss *buf = &expand_buffer.buf;
> -     struct mlx5_flow_rss_desc *rss_desc = priv->rss_desc;
> +     struct mlx5_flow_rss_desc *rss_desc = &((struct mlx5_flow_rss_desc
> *)
> +                                           priv->rss_desc)[!!priv->flow_idx];
>       const struct rte_flow_action *p_actions_rx = actions;
>       uint32_t i;
>       uint32_t idx = 0;
> @@ -4684,10 +4685,11 @@ struct rte_flow *
>       struct mlx5_priv *priv = dev->data->dev_private;
> 
>       if (!priv->inter_flows) {
> -             priv->inter_flows = rte_calloc(__func__,
> MLX5_NUM_MAX_DEV_FLOWS,
> +             priv->inter_flows = rte_calloc(__func__, 1,
> +                                 MLX5_NUM_MAX_DEV_FLOWS *
>                                   sizeof(struct mlx5_flow) +
> -                                 sizeof(struct mlx5_flow_rss_desc) +
> -                                 sizeof(uint16_t) * UINT16_MAX, 0);
> +                                 (sizeof(struct mlx5_flow_rss_desc) +
> +                                 sizeof(uint16_t) * UINT16_MAX) * 2, 0);
>               if (!priv->inter_flows) {
>                       DRV_LOG(ERR, "can't allocate intermediate
> memory.");
>                       return;
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index cfc911c..fd8f936 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -7377,8 +7377,9 @@ struct field_modify_info modify_tcp[] = {
>       struct mlx5_dev_config *dev_conf = &priv->config;
>       struct rte_flow *flow = dev_flow->flow;
>       struct mlx5_flow_handle *handle = dev_flow->handle;
> -     struct mlx5_flow_rss_desc *rss_desc = (struct mlx5_flow_rss_desc *)
> -                                           priv->rss_desc;
> +     struct mlx5_flow_rss_desc *rss_desc = &((struct mlx5_flow_rss_desc
> *)
> +                                           priv->rss_desc)
> +                                           [!!priv->flow_nested_idx];
>       uint64_t item_flags = 0;
>       uint64_t last_item = 0;
>       uint64_t action_flags = 0;
> @@ -8148,7 +8149,8 @@ struct field_modify_info modify_tcp[] = {
>                       struct mlx5_hrxq *hrxq;
>                       uint32_t hrxq_idx;
>                       struct mlx5_flow_rss_desc *rss_desc =
> -                             (struct mlx5_flow_rss_desc *)priv->rss_desc;
> +                             &((struct mlx5_flow_rss_desc *)priv-
> >rss_desc)
> +                             [!!priv->flow_nested_idx];
> 
>                       MLX5_ASSERT(rss_desc->queue_num);
>                       hrxq_idx = mlx5_hrxq_get(dev, rss_desc->key, diff --
> git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index a246917..722220c 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -1570,8 +1570,9 @@
>       uint64_t priority = attr->priority;
>       uint32_t subpriority = 0;
>       struct mlx5_priv *priv = dev->data->dev_private;
> -     struct mlx5_flow_rss_desc *rss_desc = (struct mlx5_flow_rss_desc *)
> -                                           priv->rss_desc;
> +     struct mlx5_flow_rss_desc *rss_desc = &((struct mlx5_flow_rss_desc
> *)
> +                                           priv->rss_desc)
> +                                           [!!priv->flow_nested_idx];
> 
>       if (priority == MLX5_FLOW_PRIO_RSVD)
>               priority = priv->config.flow_prio - 1; @@ -1844,7 +1845,8
> @@
>               } else {
>                       uint32_t hrxq_idx;
>                       struct mlx5_flow_rss_desc *rss_desc =
> -                             (struct mlx5_flow_rss_desc *)priv->rss_desc;
> +                             &((struct mlx5_flow_rss_desc *)priv-
> >rss_desc)
> +                             [!!priv->flow_nested_idx];
> 
>                       MLX5_ASSERT(rss_desc->queue_num);
>                       hrxq_idx = mlx5_hrxq_get(dev, rss_desc->key,
> --
> 1.8.3.1

Reply via email to