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 23B7F43B7D for ; Tue, 5 Mar 2024 10:58:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EBC74026B; Tue, 5 Mar 2024 10:58:49 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 8B6C54014F for ; Tue, 5 Mar 2024 10:58:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fY9RGdLPkp6c5v54j/Wynr+pmorwaac11Lg8IdIQeE1OVr1iE1UGPE+B65jKhKKpVC7aLSrdbDLoj7T9hss4bvVBjaLbnDazi+wsruO/BhPfsICn/VIHVFKF93PPbIwREZ3IVt9h6McbTVBTeIgCIt6yc5jW5CQXoPU7vdKDVibY09T7owaESyv249Sx36pRWOziqmR5lBEAFCDaRqiaWYzgv6PcivTnvpnpO9aprO9/Yqxa+oFLUXZywA6UdOfXD1iGysyclywsMBku+QzldvdxsWmKSf5tMANZCrOb4ymnXlCJXifnqM8X6P4fwVZWdVyQSPK17vsEND836d6Ulg== 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=BvcChb5eWwJiLl3PNKTWmWn5Zbh3tu5M7XPoH4AH9kU=; b=TSx80TfntLIyw6OrYgC2gaheUQaLlc5DWAj7qJS75BPm9vx6GklMSQdbax/zy4ofUOzx5ogrOSOcafbSTvRx4JE3WLjZ3S1Mu/dvHgRz7xTOmzFv3/8k2GKnd4o162VLlE9s8PWk9kf8C5iDKm4NV1NzdrVkkccOXGbEZLQK0zv/LUrCjSR8n42SK5glX8ota4kFWSKKDiEzMw19AMkGAfEa4ZJMT7UkwW1sYN/aB5tCjR+jjMBN3IrOcPOHYaq4s+O6hyovz0Pbf+WAge6Uyv3AL50DGcn1/+SZ77vf1OrTWww5BdCwywtjhindnZ/b6rniB9/g5863oDRf39piDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=broadcom.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=BvcChb5eWwJiLl3PNKTWmWn5Zbh3tu5M7XPoH4AH9kU=; b=nj6Ym1Bqb65LJLFWVMMc8aRa1lQxxgLQpXqpqHXwnhlzwLoFNG826hVUgOMQfm7++R88S0OHoCDjOOomxmC4lq1J6olEqY1gfu2/Auoz5SVCsVh8J971hHiXv4G6wuDmsGildyWeJToh/ZxXt7XbBUaQjz+U6ODEiP1Gs4llu2aeTVshkb1RMFodMHw5F7dRVxM6+ygSFfcKiYFmgANMZJzz+uuzcJ7hbK12q8rWZaSGtwvilPTOvLb172n7F1f+hcGNlnNYl74IECRyp9nl1AwnG+VsaTKF1qsyzbdzEZ73JphJddn8cP+Vw2XjqpflIh12nytsBnMoXMeDhqzSBw== Received: from DM6PR08CA0047.namprd08.prod.outlook.com (2603:10b6:5:1e0::21) by IA0PR12MB8908.namprd12.prod.outlook.com (2603:10b6:208:48a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 09:58:45 +0000 Received: from CY4PEPF0000EDD6.namprd03.prod.outlook.com (2603:10b6:5:1e0:cafe::39) by DM6PR08CA0047.outlook.office365.com (2603:10b6:5:1e0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Tue, 5 Mar 2024 09:58:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000EDD6.mail.protection.outlook.com (10.167.241.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:58:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 5 Mar 2024 01:58:29 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 5 Mar 2024 01:58:27 -0800 From: Xueming Li To: Ajit Khaparde CC: Peter Spreadborough , dpdk stable Subject: patch 'net/bnxt: modify locking for representor Tx' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:47:38 +0800 Message-ID: <20240305094757.439387-118-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD6:EE_|IA0PR12MB8908:EE_ X-MS-Office365-Filtering-Correlation-Id: bec2ffa5-f0ee-49e3-b36e-08dc3cfad823 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n4iqtO+olUckBeVXtkMeBkRczd4CjzSOjsT/gZHvkXhNVUJ2N4GHXTj+FM9kr83Fh7TZXDDqdu3rRIQI6cr4WgefZr5eOAudQARs6ebQaDj0kI4HwuaBBpua5AJUVp64SRa3NfpSA8gzXdW20Ti8slaCnp0DOQwoTzTu7zFxhpEwINX8noWLNxHxTWRnlNkQkXHmp0mPnYtu5qN97U6ZXExw26QAqPCVnZU+q3P3UkiGiC+/ZFF5+rRc4dd1kGSh/g2AkrJVYPxk6BprGhpuWpvt2jSQfjJIw6T/8sgHDQtUGvQDpW8OXxeXS1auY05oi8ep/ebzgqzBsN0zp018qEsAxboSMhC+65Vwbu/KX6QmII1Ej6v1Rrfbo9FsUiBeZmXOSfLKLjcQQSoLfB9EWwajWLsSVEn98b/iI/YkQ6XfdbSmA2mMsOD/FNueU7SeCCcIQECZZp8J7yty+PVz4NSIgLgui7potWEJXbYrY1RDjw06bo+9XaGh2pBofLT1Spu+Y0hX8vuLH7XWu3QEK+iXzmfv9TLrXAjFLujEO2XMhMvsNpieJ/e9GInPWlK1iRhqr2y6ozlQxG2Q9CI/YQ/ukJwzUgC98HiEfMpcAvMWuI0Aw0SACErJ4nmVtvJ7mZDfFgw441ovXJm1PAmhFRTKj3Hbj7MCV7vX+A9iXloeHDeH50iFDu+Emqxuu49hSSWOyPj8rjBUUKH866m+9uCI4FXgXkKrcuphLjIbLhaF1dMa6gbg0P8nuEIUMMhP X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(82310400014)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:58:44.4382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bec2ffa5-f0ee-49e3-b36e-08dc3cfad823 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8908 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 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/31/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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=d9e1762f076530d7ffa47e0649fe4a2b4c53d609 Thanks. Xueming Li --- >From d9e1762f076530d7ffa47e0649fe4a2b4c53d609 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Thu, 8 Feb 2024 09:13:25 -0800 Subject: [PATCH] net/bnxt: modify locking for representor Tx Cc: Xueming Li [ upstream commit d46406c7070724c8cfd04b805849339d1178f528 ] Currently the representor Tx function is synchronized using a per device lock. But that is not sufficient when there is simultaneous traffic on the parent Tx ring and the representor rings. Moreover the representor Tx is not protected from incursions by the parent transmits. This can cause parent Tx threads to crossover into the representor Tx contexts. Prevent this by using per TxQ locking and protect not just representor Tx, but also the parent Tx using the lock. Fixes: 6dc83230b43b ("net/bnxt: support port representor data path") Signed-off-by: Ajit Khaparde Reviewed-by: Peter Spreadborough --- drivers/net/bnxt/bnxt.h | 1 - drivers/net/bnxt/bnxt_ethdev.c | 11 +---------- drivers/net/bnxt/bnxt_reps.c | 6 +++--- drivers/net/bnxt/bnxt_txq.c | 6 ++++++ drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 13 +++++++++++++ drivers/net/bnxt/bnxt_txr.h | 4 +++- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 7908efba78..be2fd689bb 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -550,7 +550,6 @@ struct bnxt_mark_info { struct bnxt_rep_info { struct rte_eth_dev *vfr_eth_dev; - pthread_mutex_t vfr_lock; pthread_mutex_t vfr_start_lock; bool conduit_valid; }; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 9e63942a0f..0fc561d258 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1673,10 +1673,8 @@ bnxt_uninit_locks(struct bnxt *bp) pthread_mutex_destroy(&bp->def_cp_lock); pthread_mutex_destroy(&bp->health_check_lock); pthread_mutex_destroy(&bp->err_recovery_lock); - if (bp->rep_info) { - pthread_mutex_destroy(&bp->rep_info->vfr_lock); + if (bp->rep_info) pthread_mutex_destroy(&bp->rep_info->vfr_start_lock); - } } static void bnxt_drv_uninit(struct bnxt *bp) @@ -6199,13 +6197,6 @@ static int bnxt_init_rep_info(struct bnxt *bp) for (i = 0; i < BNXT_MAX_CFA_CODE; i++) bp->cfa_code_map[i] = BNXT_VF_IDX_INVALID; - rc = pthread_mutex_init(&bp->rep_info->vfr_lock, NULL); - if (rc) { - PMD_DRV_LOG(ERR, "Unable to initialize vfr_lock\n"); - bnxt_free_rep_info(bp); - return rc; - } - rc = pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL); if (rc) { PMD_DRV_LOG(ERR, "Unable to initialize vfr_start_lock\n"); diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 78337431af..a15f993328 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -124,8 +124,8 @@ bnxt_rep_tx_burst(void *tx_queue, qid = vfr_txq->txq->queue_id; vf_rep_bp = vfr_txq->bp; parent = vf_rep_bp->parent_dev->data->dev_private; - pthread_mutex_lock(&parent->rep_info->vfr_lock); ptxq = parent->tx_queues[qid]; + pthread_mutex_lock(&ptxq->txq_lock); ptxq->vfr_tx_cfa_action = vf_rep_bp->vfr_tx_cfa_action; @@ -134,9 +134,9 @@ bnxt_rep_tx_burst(void *tx_queue, vf_rep_bp->tx_pkts[qid]++; } - rc = bnxt_xmit_pkts(ptxq, tx_pkts, nb_pkts); + rc = _bnxt_xmit_pkts(ptxq, tx_pkts, nb_pkts); ptxq->vfr_tx_cfa_action = 0; - pthread_mutex_unlock(&parent->rep_info->vfr_lock); + pthread_mutex_unlock(&ptxq->txq_lock); return rc; } diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index 4df4604975..696603757b 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -112,6 +112,7 @@ void bnxt_tx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx) txq->mz = NULL; rte_free(txq->free); + pthread_mutex_destroy(&txq->txq_lock); rte_free(txq); dev->data->tx_queues[queue_idx] = NULL; } @@ -195,6 +196,11 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, goto err; } + rc = pthread_mutex_init(&txq->txq_lock, NULL); + if (rc != 0) { + PMD_DRV_LOG(ERR, "TxQ mutex init failed!"); + goto err; + } return 0; err: bnxt_tx_queue_release_op(eth_dev, queue_idx); diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h index 3a483ad5c3..9e54985c4c 100644 --- a/drivers/net/bnxt/bnxt_txq.h +++ b/drivers/net/bnxt/bnxt_txq.h @@ -26,6 +26,7 @@ struct bnxt_tx_queue { int index; int tx_wake_thresh; uint32_t vfr_tx_cfa_action; + pthread_mutex_t txq_lock; struct bnxt_tx_ring_info *tx_ring; unsigned int cp_nr_rings; diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c index 899986764f..cef14427a8 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -562,6 +562,19 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq) uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) +{ + struct bnxt_tx_queue *txq = tx_queue; + uint16_t rc; + + pthread_mutex_lock(&txq->txq_lock); + rc = _bnxt_xmit_pkts(tx_queue, tx_pkts, nb_pkts); + pthread_mutex_unlock(&txq->txq_lock); + + return rc; +} + +uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) { int rc; uint16_t nb_tx_pkts = 0; diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h index e64ea2c7d1..09078d545d 100644 --- a/drivers/net/bnxt/bnxt_txr.h +++ b/drivers/net/bnxt/bnxt_txr.h @@ -47,7 +47,9 @@ void bnxt_free_tx_rings(struct bnxt *bp); int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq); int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id); uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts); + uint16_t nb_pkts); +uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64) uint16_t bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:34.477923716 +0800 +++ 0117-net-bnxt-modify-locking-for-representor-Tx.patch 2024-03-05 17:39:30.953566499 +0800 @@ -1 +1 @@ -From d46406c7070724c8cfd04b805849339d1178f528 Mon Sep 17 00:00:00 2001 +From d9e1762f076530d7ffa47e0649fe4a2b4c53d609 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit d46406c7070724c8cfd04b805849339d1178f528 ] @@ -15 +17,0 @@ -Cc: stable@dpdk.org @@ -30 +32 @@ -index b604284256..23b0829e9e 100644 +index 7908efba78..be2fd689bb 100644 @@ -33 +35 @@ -@@ -623,7 +623,6 @@ struct bnxt_mark_info { +@@ -550,7 +550,6 @@ struct bnxt_mark_info { @@ -42 +44 @@ -index 74064e8971..72debaca64 100644 +index 9e63942a0f..0fc561d258 100644 @@ -45 +47 @@ -@@ -1802,10 +1802,8 @@ bnxt_uninit_locks(struct bnxt *bp) +@@ -1673,10 +1673,8 @@ bnxt_uninit_locks(struct bnxt *bp) @@ -57 +59 @@ -@@ -6523,13 +6521,6 @@ static int bnxt_init_rep_info(struct bnxt *bp) +@@ -6199,13 +6197,6 @@ static int bnxt_init_rep_info(struct bnxt *bp) @@ -72 +74 @@ -index d96d972904..3a4720bc3c 100644 +index 78337431af..a15f993328 100644 @@ -98 +100 @@ -index 7d91e88c9d..05032f7807 100644 +index 4df4604975..696603757b 100644 @@ -101 +103 @@ -@@ -114,6 +114,7 @@ void bnxt_tx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx) +@@ -112,6 +112,7 @@ void bnxt_tx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx) @@ -109 +111 @@ -@@ -197,6 +198,11 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, +@@ -195,6 +196,11 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, @@ -134 +136 @@ -index d74d271d91..7fc44e989d 100644 +index 899986764f..cef14427a8 100644 @@ -137 +139 @@ -@@ -567,6 +567,19 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq) +@@ -562,6 +562,19 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)