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 7C3E941D8D for ; Mon, 27 Feb 2023 08:07:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 746EE40A84; Mon, 27 Feb 2023 08:07:51 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12hn2215.outbound.protection.outlook.com [52.100.166.215]) by mails.dpdk.org (Postfix) with ESMTP id 8CF5440A7D for ; Mon, 27 Feb 2023 08:07:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DlyoV4rF5lfEP3U5Wa4R0DWCCWCVYkkw/TNA7AbeYg05ZkzjcEF6CIOWfRSujmRCM477iS5syy1jWyT3wQbaKh7GQ1v8smfZCmP5Yl53kElbVktG68X4gYwixbHCc9qQZQgD4V509ipEg8yReK+42LZhdG6HWP4ywaYprm0M5vwxILk/Bi/rW/3g4uEhe8+sl7bd3Or4y8TKDLf78WZ0bcV2+9rK+eMzH9unImcMofe4Q6IS10P3qG3INFWN0xZnocP00XBpJIhbpdwruhZxyqSGlbF0t/GW147QURRAPCen69GUZ/2WbZi29txbx1VDoyZpmMMJ7pxFUk7cyK0g3Q== 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=lrGvpzuWmTQO1aKQ5yur/HiUl0wIkp0qySB0lx0vJBg=; b=f08/gl/dOWPbWHviLr+RfFGiR3++LaeuiDqufQCAi9EojVwbUAv/8tWrzml+X31Xa5xQGTA1/stL0GiWg4JO3hqqAPOlLeNd/YOmXhxaaCXiuhMRQAOD9QmQFjxKYI78EtJkEfwjZ4tuLXsj4BUY7qt6+ivFE7ix/75lP9MiPNdjsMrCOsbBKfo8byQbzkel7x+4s5ZqEEo9h2zP0wx50ZqnGhKGSD9T68cWrSPaTKlrLCPjUJXz2mWN1HuOs+3xaFR2e7AQFH83OZV9oSE4EGvCJeetPsdhIkaTgXonUtT265EdclB+wPNfHcUKOhMkH1vV5pXwYRUL3GJFZv4khw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.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=lrGvpzuWmTQO1aKQ5yur/HiUl0wIkp0qySB0lx0vJBg=; b=QSoI6CCETZlD3xK/4MSLh3LceqYECQHoReEPQDbMSWtmH6nqGBc8u3F22hBfu8hXwnq9YOT3bzhJMsj5NRFOP9cKFZ9hxGJbFm61k/f78F7/0QoAp6lZrZf25Xw3mNFgIs2z5NVTkTSJrnKTS9R2KLSwZL1musyw6p6C19qJLetFUvoAV2cv4G+Fm4zHSE3alo6CTnyHBWNIWKOFA160VMa1MA/OcoGLiR4QxAk49CvYEDmhSw/C4PhGkCKO2rjcc8homPsAlmJil3QdAZm8Ezda/xU9Mtd0veMfkJq3yPcKGVG99fukGgt6+cMM2BU5esdVku92bdoxF6wswUeBQA== Received: from MW4PR03CA0009.namprd03.prod.outlook.com (2603:10b6:303:8f::14) by IA1PR12MB6556.namprd12.prod.outlook.com (2603:10b6:208:3a0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.25; Mon, 27 Feb 2023 07:07:47 +0000 Received: from CO1NAM11FT112.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::bd) by MW4PR03CA0009.outlook.office365.com (2603:10b6:303:8f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29 via Frontend Transport; Mon, 27 Feb 2023 07:07:46 +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 CO1NAM11FT112.mail.protection.outlook.com (10.13.174.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.16 via Frontend Transport; Mon, 27 Feb 2023 07:07:46 +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.36; Sun, 26 Feb 2023 23:07:25 -0800 Received: from nvidia.com (10.126.231.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, 26 Feb 2023 23:07:22 -0800 From: Xueming Li To: Fan Zhang CC: Akhil Goyal , dpdk stable Subject: patch 'cryptodev: fix sym session mempool creation description' has been queued to stable release 22.11.2 Date: Mon, 27 Feb 2023 14:59:25 +0800 Message-ID: <20230227070107.15664-57-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227070107.15664-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230227070107.15664-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.37] 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: CO1NAM11FT112:EE_|IA1PR12MB6556:EE_ X-MS-Office365-Filtering-Correlation-Id: 11f2d695-888a-4601-9f44-08db18915411 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g3q/UHjl3bMu2ydqJ71qk2a6GWXGyplPyjUUYYii/b/Ucvc7JHIaD3wGqAjKiiUSgOhLzvCkn4e9DAofM2QikKSSAfBkCWrjOHBvRmohPxYntSGu9LJ809uB99WReopTqr7D3e/3slH8V+Gkx5jdAtraViY2/vlrZCz53POuVAO1dHnzzQTNLX54cqHgK9PgPUJazWDy+namsdMDrSjTrHS9ShCVFaW5qfcvg/dIdUHCZV+zMaFeKRVk3OsFggP+viDahnU6/RHc4lkKFg1Y8FsWfYHhffzNVSFNMhGrC3opfrkP1Ny5QTo2Gq0PSVe5iSbuVKf46ZEpaW2qQvfMXUaF7NoF7ljY3Ydd4uTqBIvxatGsu9GxUnsRi0/4Sb7llRhg7pr/pOkM1GYhnoOnH499IE9KgqQ5wYmeDOrujZwoTtfVt6hi22cj8S27NGEFJKl0lmGhGbJqgz6hE0np3cRAlR704gl8TjaO09JtvY/5PtrrksxLL+F2BBQG7KryT9k7bt7NumnHhbkLUH0yu7aaAaVmAwQM8XAxfFMotIAxL/VDbH0qz6GJ0qF7ZjJouLA2Cv1/aqjGCs6jqK1+Sjy9AbjwjVOXpZNecSNfJCpvhskeq0SjXzko6yRkOWyCBk4HOJvzUvg/88dSXHoKY3gbVroHi80/F3AqENoEVa3nqfi2yqi4wcqnNQlDSTUcD+LVXDSmSOdvZYjBF7kDrQJR3wm9dVOGjLw0nP35/6rIl1gOgYmLaPQBYFf2it4QnsNH/dGBvSyC/WiHKP5KgRx2+jwLcpH5aA3MLLoqP4pTJtSlb4fBqZGGy/Xe2n5RUsQ/omIB2WXg4WpUyc6EZCI3PAoxLiYf4eOOorJKf3cgLIbWH47/enBFZticuh/F 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:(13230025)(4636009)(346002)(39860400002)(396003)(376002)(136003)(451199018)(5400799012)(36840700001)(40470700004)(46966006)(55016003)(36756003)(40480700001)(19273905006)(40460700003)(86362001)(478600001)(41300700001)(6916009)(356005)(8936002)(4326008)(2616005)(70206006)(7696005)(82310400005)(8676002)(45080400002)(70586007)(966005)(316002)(54906003)(5660300002)(6286002)(186003)(2906002)(36860700001)(34020700004)(83380400001)(7636003)(82740400003)(30864003)(47076005)(16526019)(26005)(53546011)(1076003)(426003)(336012)(12100799018)(563064011); DIR:OUT; SFP:1501; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 07:07:46.0947 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11f2d695-888a-4601-9f44-08db18915411 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: CO1NAM11FT112.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6556 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 03/01/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/commit/?h=22.11-staging&id=ce54658be7c99586d9430c420a6475bd79b3d608 Thanks. Xueming Li --- >From ce54658be7c99586d9430c420a6475bd79b3d608 Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Fri, 6 Jan 2023 13:05:00 +0000 Subject: [PATCH] cryptodev: fix sym session mempool creation description Cc: Xueming Li [ upstream commit 9a8569ac0f9ee929d78f4353946fc6bdece21082 ] After the session mempool creation API is changed, some description is no longer valid. This patch fixes the descriptions in both API comment and the programmer's guide. Fixes: bdce2564dbf7 ("cryptodev: rework session framework") Signed-off-by: Fan Zhang Acked-by: Akhil Goyal --- doc/guides/prog_guide/cryptodev_lib.rst | 42 +- .../prog_guide/img/cryptodev_sym_sess.svg | 417 ------------------ lib/cryptodev/rte_cryptodev.h | 17 +- 3 files changed, 27 insertions(+), 449 deletions(-) delete mode 100644 doc/guides/prog_guide/img/cryptodev_sym_sess.svg diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 01aad842a9..0d9f7059ea 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -499,37 +499,29 @@ a flow. Crypto sessions cache this immutable data in a optimal way for the underlying PMD and this allows further acceleration of the offload of Crypto workloads. -.. figure:: img/cryptodev_sym_sess.* - The Crypto device framework provides APIs to create session mempool and allocate and initialize sessions for crypto devices, where sessions are mempool objects. The application has to use ``rte_cryptodev_sym_session_pool_create()`` to -create the session header mempool that creates a mempool with proper element -size automatically and stores necessary information for safely accessing the -session in the mempool's private data field. - -To create a mempool for storing session private data, the application has two -options. The first is to create another mempool with elt size equal to or -bigger than the maximum session private data size of all crypto devices that -will share the same session header. The creation of the mempool shall use the -traditional ``rte_mempool_create()`` with the correct ``elt_size``. The other -option is to change the ``elt_size`` parameter in -``rte_cryptodev_sym_session_pool_create()`` to the correct value. The first -option is more complex to implement but may result in better memory usage as -a session header normally takes smaller memory footprint as the session private -data. +create the session mempool header and the private data with the size specified +by the user through the ``elt_size`` parameter in the function. +The session private data is for the driver to initialize and access +during crypto operations, hence the ``elt_size`` should be big enough +for all drivers that will share this mempool. +To obtain the proper session private data size of a crypto device, +the user can call ``rte_cryptodev_sym_get_private_session_size()`` function. +In case of heterogeneous crypto devices which will share the same session mempool, +the maximum session private data size of them should be passed. Once the session mempools have been created, ``rte_cryptodev_sym_session_create()`` -is used to allocate an uninitialized session from the given mempool. -The session then must be initialized using ``rte_cryptodev_sym_session_init()`` -for each of the required crypto devices. A symmetric transform chain -is used to specify the operation and its parameters. See the section below for -details on transforms. +is used to allocate and initialize the session from the given mempool. +The created session can ONLY be used by the crypto devices sharing the same driver ID +as the device ID passed into the function as the parameter. +In addition, a symmetric transform chain is used to specify the operation and its parameters. +See the section below for details on transforms. -When a session is no longer used, user must call ``rte_cryptodev_sym_session_clear()`` -for each of the crypto devices that are using the session, to free all driver -private session data. Once this is done, session should be freed using -``rte_cryptodev_sym_session_free`` which returns them to their mempool. +When a session is no longer used, user must call ``rte_cryptodev_sym_session_free()`` +to uninitialize the session data and return the session +back to the mempool it belongs. Transforms and Transform Chaining diff --git a/doc/guides/prog_guide/img/cryptodev_sym_sess.svg b/doc/guides/prog_guide/img/cryptodev_sym_sess.svg deleted file mode 100644 index 9b522458c8..0000000000 --- a/doc/guides/prog_guide/img/cryptodev_sym_sess.svg +++ /dev/null @@ -1,417 +0,0 @@ - - - -image/svg+xmlRounded Rectangle.12Crypto Symmetric SessionRounded Rectangle.13Private Session Data - - -Rounded Rectangle.12Crypto Symmetric SessionCrypto Driver Private Session -Crypto Symmetric Session -uint16_t nb_drivers; -struct { -void *data; -} session_data[]; -uint16_t user_data_sz; -user_data -uint16_t refcnt; -uint64_t opaque_data; -Rounded Rectangle.13Private Session DataPrivate Session Data -Rounded Rectangle.12Crypto Symmetric SessionCrypto Driver Private Session -Rounded Rectangle.13Private Session DataPrivate Session Data - -... - \ No newline at end of file diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h index 86d792e2e7..ed4112c625 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -911,11 +911,14 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id); * @param nb_elts * The number of elements in the mempool. * @param elt_size - * The size of the element. This value will be ignored if it is smaller than - * the minimum session header size required for the system. For the user who - * want to use the same mempool for sym session and session private data it - * can be the maximum value of all existing devices' private data and session - * header sizes. + * The size of the element. This should be the size of the cryptodev PMD + * session private data obtained through + * rte_cryptodev_sym_get_private_session_size() function call. + * For the user who wants to use the same mempool for heterogeneous PMDs + * this value should be the maximum value of their private session sizes. + * Please note the created mempool will have bigger elt size than this + * value as necessary session header and the possible padding are filled + * into each elt. * @param cache_size * The number of per-lcore cache elements * @param priv_size @@ -926,8 +929,8 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id); * constraint for the reserved zone. * * @return - * - On success return size of the session - * - On failure returns 0 + * - On success returns the created session mempool pointer + * - On failure returns NULL */ __rte_experimental struct rte_mempool * -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-27 14:08:42.777531500 +0800 +++ 0058-cryptodev-fix-sym-session-mempool-creation-descripti.patch 2023-02-27 14:08:40.789237000 +0800 @@ -1 +1 @@ -From 9a8569ac0f9ee929d78f4353946fc6bdece21082 Mon Sep 17 00:00:00 2001 +From ce54658be7c99586d9430c420a6475bd79b3d608 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9a8569ac0f9ee929d78f4353946fc6bdece21082 ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -506 +508 @@ -index bbb854ccb9..27cdec8495 100644 +index 86d792e2e7..ed4112c625 100644 @@ -509 +511 @@ -@@ -982,11 +982,14 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id); +@@ -911,11 +911,14 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id); @@ -529 +531 @@ -@@ -997,8 +1000,8 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id); +@@ -926,8 +929,8 @@ rte_cryptodev_get_sec_ctx(uint8_t dev_id);