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 0ABB5428F8 for ; Sun, 9 Apr 2023 17:26:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 043B0410EF; Sun, 9 Apr 2023 17:26:48 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2058.outbound.protection.outlook.com [40.107.220.58]) by mails.dpdk.org (Postfix) with ESMTP id 4DC5640EDE for ; Sun, 9 Apr 2023 17:26:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=buXXrNsz8mg5VDhYa6/UNExwyT7MGorsQTm95Jd+68wJ6eIiW051NtuZdPtiTCUHWHuk4p5AU0Ou+vhRAHt5hwpwD4sohu/ho5+xT+VeBRmifwi0DZh6CElW1UFr/LwMJNA9bGdT+Z0gHnQzSf1O5rtYNoxbchgrxSd5Wzq0A35BF8XpHp2beueRLap+sGhplkMCYw+azY8cUA7Rrmo/08rTFYd9cUm7y9Xm/WKyVrR+Ee2OHOEjUPMBXGZ+DovC8S26l2wJ0Mikwqd1hJza86YTZS/t/LKd6MIihEZZtu2Xaqfmq0nwlpGECFL5LuhiVngG53FF22xmDdARkUvfqA== 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=HGKFH7eDOUS9TDcjWGow1uZbuqhHnGPzwbFHgZYZCGk=; b=Ko3NysgHYhTc7yXBQubghR2o6Ml1LNBTUWwCqxldfWCQ2fPXvzPmU63OgUlwSce4NKEAika28TtH2aMnhKM+v+22QJo6MwYhnvo0oY+Pd3OYdKYMmET8k1pOwe6PTTEXTEEgrlMp5GLF+aSfnv3cObwDyWQqbUWPZhZCRIal7BOLKq74YQm6DUgsGLU6Zf0HbmN9BDwgNbeDbs5BWcIJlGTkqLu7dxtjHsfjqONQGmWgM0SlcmDTvKog+qqP1YhWNDZ0pC53W+4UcWCaP72em7G8fzWxyWLbWkWqnVlU3pwiyGAqcWlQ12d7WPmPuIWUELYRkzTkCyiHpUcIPJ6nRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.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 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=HGKFH7eDOUS9TDcjWGow1uZbuqhHnGPzwbFHgZYZCGk=; b=caOxEM+B4rtPcyHaUjjwwGR8T/m6j1aq8cHZ7jnu/Vx7CqGg121WWlFYnoQfw//eo0g6j8zJXz4XqBP0W3PKZdbm7DMOAsDFUFNJG01HDR0D7cBDg3hBZIUuqxw+CKsMoyiMdEd9Lgh/YQj9HXrmPNkYxx3jFmihaYxuc7y5h4ffX7LHeih3j40gD4F9w6qhm7J6oQqyVgqXcL+gJoRJ9IefE1TWhSLZhO0H7x9TNvwwL7aC0xQn7HCjxNhODYGfFzap2Rp93cjA7FdlSpJJpbtUHwEcs7cCvxRZqa7T1xAmeyOpe64cA2x14zOHVQDmOVpvjaUrSg9OV8ncKZuOJg== Received: from DS7P222CA0002.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::30) by PH0PR12MB5498.namprd12.prod.outlook.com (2603:10b6:510:d6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.31; Sun, 9 Apr 2023 15:26:43 +0000 Received: from DM6NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::c4) by DS7P222CA0002.outlook.office365.com (2603:10b6:8:2e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.39 via Frontend Transport; Sun, 9 Apr 2023 15:26:42 +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 DM6NAM11FT097.mail.protection.outlook.com (10.13.172.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.20 via Frontend Transport; Sun, 9 Apr 2023 15:26:42 +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.5; Sun, 9 Apr 2023 08:26:37 -0700 Received: from nvidia.com (10.126.230.37) 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.986.37; Sun, 9 Apr 2023 08:26:36 -0700 From: Xueming Li To: Nicolas Chautru CC: Maxime Coquelin , dpdk stable Subject: patch 'baseband/acc: prevent to dequeue more than requested' has been queued to stable release 22.11.2 Date: Sun, 9 Apr 2023 23:23:18 +0800 Message-ID: <20230409152529.5308-11-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230409152529.5308-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230409152529.5308-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT097:EE_|PH0PR12MB5498:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bf5b0ae-e6ac-4d91-95ff-08db390ed270 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: StLsWq1+OoRu9PEOeXzzE0fCoRFR9oeRcZ5Qv24s7INxjK5uvv6PJ8whhg+rYwOINnzS+tKvXg4kht79HMtv9/3GdVbZUfj/vgV/XzCrFqWW0MSpexRwrQomZCFo3NPirJ75UwMmXnyvwHoWBSOLDdlfEWG7hrOmKDOX+/VG0IxVZL1xJIJO00349UaoieDRLxJcnMpdC/UhqCQLvq/c+YaW+80C4zA+eHdIlgGxsp/6ZX6B927YiyasbI+LMxKOSsFQXPnQJ5E8fAK9FIdm0RhX/HmaSiNRHShtso1DsMsvOWvkQJhCUe3jo4mZ2QPYjq2P38WqbVhQNJ63cxFNHzJjLQHb1G0apfx4YWkrLEo4eHivlJXrPD77y2Bn7MtKE9tEk8oF0gZNRzqOg/lR2ndNl3DHwkYmf6E9WIuA1m3C1We6EuZdIS/UZDq3AygkbQfNh6N1VIxLXGc3bDedvRhY9nmp0S3/CYgQwy/52NiLL7Hpkayh8Xs/Puf1x5fgD0kI8AFjFkzDwlzcSl3XD+o1bYTExoMO0N9kHajlx5hBIXNR06glWVUFCqQ2USbdtSvay4akoJz2/VJk9xy3SX+WzOXM5Tos/ICfAp7uyP31CDQLlRO6GM9CLDOvN4eoFwrV5sEWRDKBe8ttYvev8cgckZ33L0lcO4H8A6zxERdt5abbrmRo4OXto5QxzcXx4jbL9Fb2FrGrajiTL3s5LlHGAGZadr6QOmgoYWLgdAT/6siZNE6R8aCmlgIbUarH1Q32x3PzPETkZ9GSyA8ep8zz9pjnEHC11bN4/qa1d/so7IyX7sMhJtJn4TxJMzSK6e/EGQeg56pRuePKLHIHxw== 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:(13230028)(4636009)(39860400002)(376002)(346002)(396003)(136003)(451199021)(46966006)(36840700001)(40470700004)(40480700001)(36756003)(2906002)(40460700003)(4326008)(5660300002)(6916009)(55016003)(82310400005)(8936002)(41300700001)(356005)(70586007)(70206006)(7636003)(86362001)(8676002)(2616005)(966005)(336012)(83380400001)(82740400003)(426003)(47076005)(36860700001)(53546011)(1076003)(26005)(186003)(6666004)(54906003)(6286002)(7696005)(478600001)(316002)(16526019); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2023 15:26:42.4570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bf5b0ae-e6ac-4d91-95ff-08db390ed270 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: DM6NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5498 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.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/11/23. 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=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/ff4d7c9a71b3359135179e8f4a477c2a8b669478 Thanks. Xueming Li --- >From ff4d7c9a71b3359135179e8f4a477c2a8b669478 Mon Sep 17 00:00:00 2001 From: Nicolas Chautru Date: Fri, 10 Feb 2023 17:58:36 +0000 Subject: [PATCH] baseband/acc: prevent to dequeue more than requested Cc: Xueming Li [ upstream commit e76efc7303cd0d16e873533ffca2914f405b2651 ] Add support for corner-case when more operations are requested than expected, in the case of encoder muxing operations. Fixes: e640f6cdfa84 ("baseband/acc200: add LDPC processing") Signed-off-by: Nicolas Chautru Reviewed-by: Maxime Coquelin --- drivers/baseband/acc/rte_acc200_pmd.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c index 0bec218ca4..ee9a050d24 100644 --- a/drivers/baseband/acc/rte_acc200_pmd.c +++ b/drivers/baseband/acc/rte_acc200_pmd.c @@ -2660,7 +2660,8 @@ acc200_enqueue_ldpc_dec(struct rte_bbdev_queue_data *q_data, /* Dequeue one encode operations from ACC200 device in CB mode. */ static inline int dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, - uint16_t *dequeued_ops, uint32_t *aq_dequeued, uint16_t *dequeued_descs) + uint16_t *dequeued_ops, uint32_t *aq_dequeued, uint16_t *dequeued_descs, + uint16_t max_requested_ops) { union acc_dma_desc *desc, atom_desc; union acc_dma_rsp_desc rsp; @@ -2673,6 +2674,9 @@ dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, desc = q->ring_addr + desc_idx; atom_desc.atom_hdr = __atomic_load_n((uint64_t *)desc, __ATOMIC_RELAXED); + if (*dequeued_ops + desc->req.numCBs > max_requested_ops) + return -1; + /* Check fdone bit. */ if (!(atom_desc.rsp.val & ACC_FDONE)) return -1; @@ -2714,7 +2718,7 @@ dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, static inline int dequeue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, uint16_t *dequeued_ops, uint32_t *aq_dequeued, - uint16_t *dequeued_descs) + uint16_t *dequeued_descs, uint16_t max_requested_ops) { union acc_dma_desc *desc, *last_desc, atom_desc; union acc_dma_rsp_desc rsp; @@ -2725,6 +2729,9 @@ dequeue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, desc = acc_desc_tail(q, *dequeued_descs); atom_desc.atom_hdr = __atomic_load_n((uint64_t *)desc, __ATOMIC_RELAXED); + if (*dequeued_ops + 1 > max_requested_ops) + return -1; + /* Check fdone bit. */ if (!(atom_desc.rsp.val & ACC_FDONE)) return -1; @@ -2985,25 +2992,23 @@ acc200_dequeue_enc(struct rte_bbdev_queue_data *q_data, cbm = op->turbo_enc.code_block_mode; - for (i = 0; i < num; i++) { + for (i = 0; i < avail; i++) { if (cbm == RTE_BBDEV_TRANSPORT_BLOCK) ret = dequeue_enc_one_op_tb(q, &ops[dequeued_ops], &dequeued_ops, &aq_dequeued, - &dequeued_descs); + &dequeued_descs, num); else ret = dequeue_enc_one_op_cb(q, &ops[dequeued_ops], &dequeued_ops, &aq_dequeued, - &dequeued_descs); + &dequeued_descs, num); if (ret < 0) break; - if (dequeued_ops >= num) - break; } q->aq_dequeued += aq_dequeued; q->sw_ring_tail += dequeued_descs; - /* Update enqueue stats */ + /* Update enqueue stats. */ q_data->queue_stats.dequeued_count += dequeued_ops; return dequeued_ops; @@ -3029,15 +3034,13 @@ acc200_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, if (cbm == RTE_BBDEV_TRANSPORT_BLOCK) ret = dequeue_enc_one_op_tb(q, &ops[dequeued_ops], &dequeued_ops, &aq_dequeued, - &dequeued_descs); + &dequeued_descs, num); else ret = dequeue_enc_one_op_cb(q, &ops[dequeued_ops], &dequeued_ops, &aq_dequeued, - &dequeued_descs); + &dequeued_descs, num); if (ret < 0) break; - if (dequeued_ops >= num) - break; } q->aq_dequeued += aq_dequeued; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-04-09 21:45:39.091780900 +0800 +++ 0010-baseband-acc-prevent-to-dequeue-more-than-requested.patch 2023-04-09 21:45:38.579042200 +0800 @@ -1 +1 @@ -From e76efc7303cd0d16e873533ffca2914f405b2651 Mon Sep 17 00:00:00 2001 +From ff4d7c9a71b3359135179e8f4a477c2a8b669478 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit e76efc7303cd0d16e873533ffca2914f405b2651 ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -16 +18 @@ - drivers/baseband/acc/rte_vrb_pmd.c | 27 +++++++++++++++------------ + drivers/baseband/acc/rte_acc200_pmd.c | 27 +++++++++++++++------------ @@ -19,6 +21,6 @@ -diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c -index b1134f244d..a7d0b1e33c 100644 ---- a/drivers/baseband/acc/rte_vrb_pmd.c -+++ b/drivers/baseband/acc/rte_vrb_pmd.c -@@ -2640,7 +2640,8 @@ vrb_enqueue_ldpc_dec(struct rte_bbdev_queue_data *q_data, - /* Dequeue one encode operations from device in CB mode. */ +diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c +index 0bec218ca4..ee9a050d24 100644 +--- a/drivers/baseband/acc/rte_acc200_pmd.c ++++ b/drivers/baseband/acc/rte_acc200_pmd.c +@@ -2660,7 +2660,8 @@ acc200_enqueue_ldpc_dec(struct rte_bbdev_queue_data *q_data, + /* Dequeue one encode operations from ACC200 device in CB mode. */ @@ -26 +28 @@ - vrb_dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, + dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, @@ -33 +35 @@ -@@ -2653,6 +2654,9 @@ vrb_dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, +@@ -2673,6 +2674,9 @@ dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, @@ -43 +45 @@ -@@ -2694,7 +2698,7 @@ vrb_dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, +@@ -2714,7 +2718,7 @@ dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, @@ -45 +47 @@ - vrb_dequeue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, + dequeue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, @@ -52 +54 @@ -@@ -2705,6 +2709,9 @@ vrb_dequeue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, +@@ -2725,6 +2729,9 @@ dequeue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, @@ -62 +64 @@ -@@ -2965,25 +2972,23 @@ vrb_dequeue_enc(struct rte_bbdev_queue_data *q_data, +@@ -2985,25 +2992,23 @@ acc200_dequeue_enc(struct rte_bbdev_queue_data *q_data, @@ -69 +71 @@ - ret = vrb_dequeue_enc_one_op_tb(q, &ops[dequeued_ops], + ret = dequeue_enc_one_op_tb(q, &ops[dequeued_ops], @@ -74 +76 @@ - ret = vrb_dequeue_enc_one_op_cb(q, &ops[dequeued_ops], + ret = dequeue_enc_one_op_cb(q, &ops[dequeued_ops], @@ -92 +94 @@ -@@ -3009,15 +3014,13 @@ vrb_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, +@@ -3029,15 +3034,13 @@ acc200_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, @@ -94 +96 @@ - ret = vrb_dequeue_enc_one_op_tb(q, &ops[dequeued_ops], + ret = dequeue_enc_one_op_tb(q, &ops[dequeued_ops], @@ -99 +101 @@ - ret = vrb_dequeue_enc_one_op_cb(q, &ops[dequeued_ops], + ret = dequeue_enc_one_op_cb(q, &ops[dequeued_ops],