From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6742945D5D for ; Thu, 21 Nov 2024 00:43:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B47E40296; Thu, 21 Nov 2024 00:43:46 +0100 (CET) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mails.dpdk.org (Postfix) with ESMTP id CB40A40296 for ; Thu, 21 Nov 2024 00:43:45 +0100 (CET) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4319399a411so2274635e9.2 for ; Wed, 20 Nov 2024 15:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732146225; x=1732751025; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7LPtbQwdMR7LdRnmycbk72oKQtQY8kfQHW6tDu9oh+U=; b=gCjln6dFDrTpmn79ODDBt4+3WuJYL++KkznCUwG5gfuMLcRWA4EVOVFJIcArMyqo2N pBXfGJm1m0YZV1v9qCLtb6M/fyNBv+nQTaDi+Kyw3QX8tL3soBe3Nr5W+tQZl4NQZEoX ArikfDzhODhZ6PbPRbOOkmJXivI9NdBGGXZDXqvEYOSITvS9meWzKZsy64RNqhKGi2p4 tBk6y395p+boSxy2w3JYQMfcC+WIL67PjkBOAQijAC4eaUvDAxTDIylu0UMM6rJH1S5b FP6zbtMPPn6xzUd+YmwbsXiusrMGOcpbSkpI6XH8i1hk2TZuzRhn+zUQEbGBoNCzXm7G Jvjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732146225; x=1732751025; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7LPtbQwdMR7LdRnmycbk72oKQtQY8kfQHW6tDu9oh+U=; b=xPdp4VWfwHxXRlFrOwsQtDsV1dtZ3AKhARFWFI3PXsynIEeM1ENHD+Ny9GMC4wc64K XmWBJDDGjbGAM+w1kMYwxhrvdmqxc35W7iVZmuzD5KvAJtaWDeVmLNuSCxx3ytJbdEXZ x+x03nN4Z139DRJJ0zimpJ3R2MClmOUnubF+kO2r6tb1m0ajMzh1JA9Uy5fVYnj+9sUr s6vaUwJ7scWt6q9qm8PMe2qSRFHBx497tPn34RBGZ3ojLYKigVCutGiaNbKXHwyh9f5E 3pYco+fG0t/X8VrJkT5J+oJdigmcdW2TsE/XLZnmTw3dRNxUq3SZQLIkQXXiH3P8KTQD tm1g== X-Forwarded-Encrypted: i=1; AJvYcCWAJpiJ5AW3PpCuBnhfAkcO49QRT44erx/6X6xI3Ka3/ItNBjZVPjNOoeiimvOU+eUJ7Q0Uxa8=@dpdk.org X-Gm-Message-State: AOJu0Yyez5rrh6CGcY0zKSBP+j5uPid/b+V0Mk4QVgZ7IcidlP1fA/nt gYtMMWnxX26mP3yyZ2fWOi94KOZMHB2QvmQKrtCt8kZGjGIeQu87W8+oKHTq X-Gm-Gg: ASbGncvcdid8KUWk3WpBp1QKdVBT1CSlF6FMZTV+RMaNrSF+hcJAJIn0CEA9YtXItT9 y16oEX4TZ2obuLJ0Rib9L+QWlh8haLo12PX+nP8ul8qy1QyUHZvGljXmSFNbT/wRHLxru+ZakgV 0Ejnl3RGaaeH/Xz6eR5t/1raUPI4MVsKq8ez+qCe14tiNx7VFIHxSdIt2fBe+MNF5XBP8+DYl4D VK9Olk7cFBf9ng+HaDuJle/ksROmxjyq8SBgsK2mj1w411jxZFoBPz9 X-Google-Smtp-Source: AGHT+IGsuTVPZ7ZGVKSvHmdkDKmUgR4yIjmiFf0LjxCoMHJuDChZ2O4Jr/55/EmPohMHl10IoB3zdQ== X-Received: by 2002:a05:6000:18a3:b0:382:534b:18b4 with SMTP id ffacd0b85a97d-38254ae56e1mr3747762f8f.18.1732146225382; Wed, 20 Nov 2024 15:43:45 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:21cd:def0:a01d:d2aa]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-382549055f2sm3289275f8f.16.2024.11.20.15.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 15:43:44 -0800 (PST) From: luca.boccassi@gmail.com To: Bing Zhao Cc: Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5: fix Rx queue reference count in flushing flows' has been queued to stable release 22.11.7 Date: Wed, 20 Nov 2024 23:41:46 +0000 Message-ID: <20241120234215.233355-21-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241120234215.233355-1-luca.boccassi@gmail.com> References: <20241112220754.666489-40-luca.boccassi@gmail.com> <20241120234215.233355-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/22/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/d3789f7b2e6a381166cc5865346230ea172b7d9e Thanks. Luca Boccassi --- >From d3789f7b2e6a381166cc5865346230ea172b7d9e Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Wed, 13 Nov 2024 09:22:44 +0200 Subject: [PATCH] net/mlx5: fix Rx queue reference count in flushing flows [ upstream commit 1ea333d2de220d5bad600ed50b43f91f7703c123 ] Some indirect table and hrxq is created in the rule creation with QUEUE or RSS action. When stopping a port, the 'dev_started' is set to 0 in the beginning. The mlx5_ind_table_obj_release() should still do the dereference of the queue(s) when it is called in the polling of flow rule deletion, due to the fact that a flow with Q/RSS action is always referring to the active Rx queues. The callback now can only pass one input parameter. Using a global flag per device to indicate that the user flows flushing is in progress. Then the reference count of the queue(s) should be decreased. Fixes: 3a2f674b6aa8 ("net/mlx5: add queue and RSS HW steering action") Signed-off-by: Bing Zhao Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.c | 2 ++ drivers/net/mlx5/mlx5_rxq.c | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 56b482a16e..7053db5fa7 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1804,6 +1804,7 @@ struct mlx5_priv { uint32_t nb_queue; /* HW steering queue number. */ struct mlx5_hws_cnt_pool *hws_cpool; /* HW steering's counter pool. */ uint32_t hws_mark_refcnt; /* HWS mark action reference counter. */ + bool hws_rule_flushing; /**< Whether this port is in rules flushing stage. */ #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) /* Item template list. */ LIST_HEAD(flow_hw_itt, rte_flow_pattern_template) flow_hw_itt; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a44ccea436..f66edf1c64 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -7474,7 +7474,9 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type, #ifdef HAVE_IBV_FLOW_DV_SUPPORT if (priv->sh->config.dv_flow_en == 2 && type == MLX5_FLOW_TYPE_GEN) { + priv->hws_rule_flushing = true; flow_hw_q_flow_flush(dev, NULL); + priv->hws_rule_flushing = false; return; } #endif diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 98a670fae8..fcf6ab54b6 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2891,6 +2891,7 @@ static void __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) { struct mlx5_priv *priv = dev->data->dev_private; + bool deref_rxqs = true; #ifdef HAVE_IBV_FLOW_DV_SUPPORT if (hrxq->hws_flags) @@ -2900,9 +2901,10 @@ __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) #endif priv->obj_ops.hrxq_destroy(hrxq); if (!hrxq->standalone) { - mlx5_ind_table_obj_release(dev, hrxq->ind_table, - hrxq->hws_flags ? - (!!dev->data->dev_started) : true); + if (!dev->data->dev_started && hrxq->hws_flags && + !priv->hws_rule_flushing) + deref_rxqs = false; + mlx5_ind_table_obj_release(dev, hrxq->ind_table, deref_rxqs); } mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_HRXQ], hrxq->idx); } -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-20 23:41:23.455249222 +0000 +++ 0021-net-mlx5-fix-Rx-queue-reference-count-in-flushing-fl.patch 2024-11-20 23:41:22.748195468 +0000 @@ -1 +1 @@ -From 1ea333d2de220d5bad600ed50b43f91f7703c123 Mon Sep 17 00:00:00 2001 +From d3789f7b2e6a381166cc5865346230ea172b7d9e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 1ea333d2de220d5bad600ed50b43f91f7703c123 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ - drivers/net/mlx5/mlx5_flow.c | 3 +++ + drivers/net/mlx5/mlx5_flow.c | 2 ++ @@ -27 +28 @@ - 3 files changed, 9 insertions(+), 3 deletions(-) + 3 files changed, 8 insertions(+), 3 deletions(-) @@ -30 +31 @@ -index 6e8295110e..89d277b523 100644 +index 56b482a16e..7053db5fa7 100644 @@ -33,4 +34,4 @@ -@@ -2060,6 +2060,7 @@ struct mlx5_priv { - RTE_ATOMIC(uint32_t) hws_mark_refcnt; /* HWS mark action reference counter. */ - struct rte_pmd_mlx5_flow_engine_mode_info mode_info; /* Process set flow engine info. */ - struct mlx5_flow_hw_attr *hw_attr; /* HW Steering port configuration. */ +@@ -1804,6 +1804,7 @@ struct mlx5_priv { + uint32_t nb_queue; /* HW steering queue number. */ + struct mlx5_hws_cnt_pool *hws_cpool; /* HW steering's counter pool. */ + uint32_t hws_mark_refcnt; /* HWS mark action reference counter. */ @@ -42 +43 @@ -index d631ed150c..16ddd05448 100644 +index a44ccea436..f66edf1c64 100644 @@ -45 +46 @@ -@@ -8118,7 +8118,10 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type, +@@ -7474,7 +7474,9 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type, @@ -52 +53 @@ -+ return; + return; @@ -55 +55,0 @@ - MLX5_IPOOL_FOREACH(priv->flows[type], fidx, flow) { @@ -57 +57 @@ -index d437835b73..0737f60272 100644 +index 98a670fae8..fcf6ab54b6 100644 @@ -60 +60 @@ -@@ -2894,6 +2894,7 @@ static void +@@ -2891,6 +2891,7 @@ static void @@ -68 +68 @@ -@@ -2903,9 +2904,10 @@ __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) +@@ -2900,9 +2901,10 @@ __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq)