From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 514B9A0561; Mon, 20 Apr 2020 04:09:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DDC071C2F6; Mon, 20 Apr 2020 04:09:11 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 9E7461C2F5 for ; Mon, 20 Apr 2020 04:09:10 +0200 (CEST) From: Suanming Mou To: viacheslavo@mellanox.com, matan@mellanox.com Cc: rasland@mellanox.com, dev@dpdk.org Date: Mon, 20 Apr 2020 10:09:05 +0800 Message-Id: <1587348545-57200-1-git-send-email-suanmingm@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix RSS description corrupt issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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