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 C250CA0C52; Wed, 24 Nov 2021 10:36:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5818141163; Wed, 24 Nov 2021 10:36:24 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2052.outbound.protection.outlook.com [40.107.237.52]) by mails.dpdk.org (Postfix) with ESMTP id 5250D4114B for ; Wed, 24 Nov 2021 10:36:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=deuXtGss/xe4j0yYBr5e0vhYZo5g0IWpwhkaAjQXgCh02099558fDB8WhM57XeV3d/Tud0A9lroKY2bJvjgb/XuE1tNKHI9zPrd+yu8bVU49wz31La3ajCa+0FUGsxLwxyKdKbRg2x2ep028HtLNHKKEh0OOcrq2FUFx3T7Xh4LMikURQGZYQv2e/hV4AFl4ziHgyDqlCxttnalUiFyAaPgfkgblpFjhdeUkJ3AigXrCVe6i56ZJB/sDG/qcu0vgiCzOwjl+1Kkt/iRf1NDFOVS3bKScQA7JC0aZET6zl0UAW2+ytPMCY7aPjM1k5zIalEDWPkDqiQDTlOPC9AR94Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CFRYjF8f8yOEMLARjKK5vQ1Bxgzctnr6vpKtTBIGxDc=; b=e/KBmlC+NJI2YEWw+s3tlsSXTsz7NnqMeK0hAqZ2FfAz9Yek/KW+PgW4WgmyI1Z8neP4Bk9LHxkO1fNzkhs4gjsHVZU+ZmCjgaIg9F0IbczYZ2Ps3MAGqHOvr0JQWlfMO1LYjb2DOgc490ihSDY1QMK3ll/DP64CourjDSWH6PlA51uZO/7Vkrw9Uy4vNwCTzLQ1iUmsUiTyZKEIgkTSg8GyLXyGkRyJDf0ZWcCUz0OWuQzdUKSDGRvaEMEfEucd9k40h9Ivdo8IRhThxlfvmnieJdN/CepIfgeGwIaggCZrgRUL6f87BROyRY2xpyrbIf4XM+uTT/nFZag9+uKD3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CFRYjF8f8yOEMLARjKK5vQ1Bxgzctnr6vpKtTBIGxDc=; b=Hph5pUOcpBBouG/nFxq347ah1LotmGLZYyLuyluVwlo/r8G0pXeLzkGNkYuFXV0BLbP/9w+pJVWk5XSoY6JiBRY51o9TgWumrc3oe+FF59kaxUjdPodxZp3SRUyT3t7EqNWvhm+ek0DpnBWihKSm5Fyyw1M3pi+6KaI0dD9m9WxsaMkKticvHVjnjDVYehYYzShhD2CS4jQaZP3xNUvljP8FF4MlkVaUR/tal/YkbUV6BxAtHLt0g/l/MV1QCAvs6nAUB44TfLp8FKbJJXWCeaEKdTrvwkUkvfSMsU8S3TOnOomxnqsR7lgnwDnHRfNcVMnTslUK49FkNmwNDDk+hg== Received: from DM6PR03CA0070.namprd03.prod.outlook.com (2603:10b6:5:100::47) by BYAPR12MB2838.namprd12.prod.outlook.com (2603:10b6:a03:6f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Wed, 24 Nov 2021 09:36:19 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:5:100:cafe::4f) by DM6PR03CA0070.outlook.office365.com (2603:10b6:5:100::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.21 via Frontend Transport; Wed, 24 Nov 2021 09:36:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Wed, 24 Nov 2021 09:36:18 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 24 Nov 2021 09:36:16 +0000 From: Dmitry Kozlyuk To: CC: Raslan Darawsheh , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH v2 1/2] net/mlx5: fix indirect RSS creation when port is stopped Date: Wed, 24 Nov 2021 11:35:55 +0200 Message-ID: <20211124093556.3358394-5-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211124093556.3358394-1-dkozlyuk@nvidia.com> References: <20211123223159.3324247-1-dkozlyuk@nvidia.com> <20211124093556.3358394-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff02739e-4bdc-4923-c278-08d9af2dde3c X-MS-TrafficTypeDiagnostic: BYAPR12MB2838: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NjpFA4ydwylEJWCo+r3hx+QDYbpmUVDAsGclpjCR5BPi+KurYfmsGoRidfqEX2fP3QtJSwxC5k5W4inMM1+WieZZSQImaWrxx7T7dOPokeD4K0IhEzjrSKvYh4v3G8dpE4VAj18DDZagVYrm/JEGwZ31pySx7OXGQt+s5pnTCPzLnRqsdbo4fV8N9/Vu0mPmbfS4y1HHnyTetEQ/gd3yIIVSJSm5oKF8OHh+FkB8hzYjCNBSmbx+57RzWXP5vHof1rnKpDmVO14qQwtOsTkxNdISHJwns1CVw8FRbppCRWpCfPp/tqP7T3J+Ldp50qzhviKIKeCa0rkYGMzjqxodTUVsvk2bK1maL9AtUneZbeBrbyhV7v+er77XpAg2kUeJvXfy3YMfMUZHFMIx+d0V54Aa8katAtl7N9q/M1yuRY2GvK7qx0iOYOw42YBEmr6x1/PhJHu0EHp2keoTD4pJA9kU1MRRgN9OpLC4orba7i3oYhVr4bWUs/PTEdCmVpsWGK2XMLl8dvlVaVB055dNctLYXSu+hIhcDYipYQu0V551TFZ7fEck3zEkodKnNO+QVGC/cuzWbZSD7CuTT1l71oZr2HW3Sl7CE8Lm8ZfEt6PHEyTMcSEUPkETQ6ZX0O/2oebWnHlbubfo3B/KBJXLUonVIc+8iiYz+T3j9Rb4TUeOnKN18n4mmBPwMX8W+XnA9lq7eZCne/ARl2eWjddnKSQJhFQwODT+W3m5SywzIBw= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(26005)(8936002)(8676002)(426003)(186003)(508600001)(356005)(7636003)(316002)(1076003)(36860700001)(86362001)(6916009)(83380400001)(16526019)(4326008)(6666004)(54906003)(47076005)(5660300002)(2616005)(107886003)(6286002)(70206006)(55016003)(82310400004)(2906002)(336012)(7696005)(36756003)(70586007)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2021 09:36:18.5349 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff02739e-4bdc-4923-c278-08d9af2dde3c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2838 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org mlx5_ind_table_obj_setup() was incrementing RxQ reference counters even when the port was stopped, which prevented RxQ release and triggered an internal assertion. Only increment reference counter when the port is started. Fixes: ec4e11d41d12 ("net/mlx5: preserve indirect actions on restart") Signed-off-by: Dmitry Kozlyuk Reviewed-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 3 ++- drivers/net/mlx5/mlx5_rx.h | 3 ++- drivers/net/mlx5/mlx5_rxq.c | 41 +++++++++++++++++++++------------ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 9d4bd0560c..a8f63e22c4 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -14700,7 +14700,8 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev, size_t i; int err; - if (mlx5_ind_table_obj_setup(dev, shared_rss->ind_tbl)) { + if (mlx5_ind_table_obj_setup(dev, shared_rss->ind_tbl, + !!dev->data->dev_started)) { return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "cannot setup indirection table"); diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index b19464bb37..283242f530 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -228,7 +228,8 @@ int mlx5_ind_table_obj_release(struct rte_eth_dev *dev, bool standalone, bool deref_rxqs); int mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, - struct mlx5_ind_table_obj *ind_tbl); + struct mlx5_ind_table_obj *ind_tbl, + bool ref_qs); int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 191f1e483f..2dd9490c36 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2263,39 +2263,45 @@ mlx5_ind_table_obj_verify(struct rte_eth_dev *dev) * Pointer to Ethernet device. * @param ind_table * Indirection table to modify. + * @param ref_qs + * Whether to increment RxQ reference counters. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ int mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, - struct mlx5_ind_table_obj *ind_tbl) + struct mlx5_ind_table_obj *ind_tbl, + bool ref_qs) { struct mlx5_priv *priv = dev->data->dev_private; uint32_t queues_n = ind_tbl->queues_n; uint16_t *queues = ind_tbl->queues; - unsigned int i, j; + unsigned int i = 0, j; int ret = 0, err; const unsigned int n = rte_is_power_of_2(queues_n) ? log2above(queues_n) : log2above(priv->config.ind_table_max_size); - for (i = 0; i != queues_n; ++i) { - if (mlx5_rxq_ref(dev, queues[i]) == NULL) { - ret = -rte_errno; - goto error; + if (ref_qs) + for (i = 0; i != queues_n; ++i) { + if (mlx5_rxq_ref(dev, queues[i]) == NULL) { + ret = -rte_errno; + goto error; + } } - } ret = priv->obj_ops.ind_table_new(dev, n, ind_tbl); if (ret) goto error; __atomic_fetch_add(&ind_tbl->refcnt, 1, __ATOMIC_RELAXED); return 0; error: - err = rte_errno; - for (j = 0; j < i; j++) - mlx5_rxq_deref(dev, ind_tbl->queues[j]); - rte_errno = err; + if (ref_qs) { + err = rte_errno; + for (j = 0; j < i; j++) + mlx5_rxq_deref(dev, queues[j]); + rte_errno = err; + } DRV_LOG(DEBUG, "Port %u cannot setup indirection table.", dev->data->port_id); return ret; @@ -2312,13 +2318,15 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, * Number of queues in the array. * @param standalone * Indirection table for Standalone queue. + * @param ref_qs + * Whether to increment RxQ reference counters. * * @return * The Verbs/DevX object initialized, NULL otherwise and rte_errno is set. */ static struct mlx5_ind_table_obj * mlx5_ind_table_obj_new(struct rte_eth_dev *dev, const uint16_t *queues, - uint32_t queues_n, bool standalone) + uint32_t queues_n, bool standalone, bool ref_qs) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_ind_table_obj *ind_tbl; @@ -2333,7 +2341,7 @@ mlx5_ind_table_obj_new(struct rte_eth_dev *dev, const uint16_t *queues, ind_tbl->queues_n = queues_n; ind_tbl->queues = (uint16_t *)(ind_tbl + 1); memcpy(ind_tbl->queues, queues, queues_n * sizeof(*queues)); - ret = mlx5_ind_table_obj_setup(dev, ind_tbl); + ret = mlx5_ind_table_obj_setup(dev, ind_tbl, ref_qs); if (ret < 0) { mlx5_free(ind_tbl); return NULL; @@ -2537,6 +2545,7 @@ mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx, struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_hrxq *hrxq = mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_HRXQ], hrxq_idx); + bool dev_started = !!dev->data->dev_started; int ret; if (!hrxq) { @@ -2565,7 +2574,8 @@ mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx, ind_tbl = mlx5_ind_table_obj_get(dev, queues, queues_n); if (!ind_tbl) ind_tbl = mlx5_ind_table_obj_new(dev, queues, queues_n, - hrxq->standalone); + hrxq->standalone, + dev_started); } if (!ind_tbl) { rte_errno = ENOMEM; @@ -2657,7 +2667,8 @@ __mlx5_hrxq_create(struct rte_eth_dev *dev, ind_tbl = mlx5_ind_table_obj_get(dev, queues, queues_n); if (!ind_tbl) ind_tbl = mlx5_ind_table_obj_new(dev, queues, queues_n, - standalone); + standalone, + !!dev->data->dev_started); if (!ind_tbl) return NULL; hrxq = mlx5_ipool_zmalloc(priv->sh->ipool[MLX5_IPOOL_HRXQ], &hrxq_idx); -- 2.25.1