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 BA3DA41D8C for ; Mon, 27 Feb 2023 08:02:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6CA341140; Mon, 27 Feb 2023 08:02:50 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2054.outbound.protection.outlook.com [40.107.95.54]) by mails.dpdk.org (Postfix) with ESMTP id 9F2E840ED6 for ; Mon, 27 Feb 2023 08:02:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aMF3enJcy86FyAU7SHSy/vjyFRCpMWURvZMNh66kWsQsTvpYmnnl6SiCs0ic7fh7B4yBJWzOM32Ol5t8yq7SwSf6IUnswt7eD48zVgDFI+EUTmLsIc92iDOQ7tERX73LohaFAcxXOhePXpMQEbHTOLPNT3tIHArP7zne2ea6M8CRwNes/tehi94WZHLYXrrCPVfYlyOPdC+RKei7PkKOfBHCqwAmrzxS4EVGnwslIXs1dyx4/I2X/EyO1mva0SRHPuUZXagi3kvX3g5p4xZxTGs//l8QJ/3NJLEX9/K0tkzERehx/pQmsUCT9725W+FRYoVEDUBglQVUKj897/dhmA== 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=YwZvxn3qu4gi270UUQDy/EB8yBTXGlbOeKHEOU2v8UU=; b=Y6MLjaUo/65wBAnFXRwsMD/n2akw+ReGsFu8za00ORN0IRL2UtBib9pIG2R1JbKTc35ftL8Dl8PTQaVOmm83+KSDa/qjuEc6JLdyphsfjjYPi68zLpxTwWglTJrcAqx4XFtaCyGMlXfnrzWNB8VOmxZokbN9EUKpncmr/eGkC3hcSomZUsdScK0Bxox/nWXZKZG+hx5VVk0nVaZ19ruL8XCCjp8GSt4XF+Jpkiz7UAUyvqhU76MSHnJOlE+UbCVRGakZ20MN/McavfbXR/4BikhIs1pTaXhb3BAgxHkYJpbsov9NlpFoAjcwgir6SqcD0PxFL/ndFKirtuXdv8bQRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=marvell.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=YwZvxn3qu4gi270UUQDy/EB8yBTXGlbOeKHEOU2v8UU=; b=mjY38LbuDEmr18+YapbtGuR/RHSEvKtnlqWKroUJTGUj0lFwGrF5AHcdS0mjFdPjQ4JKDMjfQHwcsUvY/pcB7pVCeNr0gM3ArNHzNaf1YcDHy+qZJ0e1YlqNfJLVpVHxQJFyRwTe9q0jhVDwhb23UKkP7EFBhgt7wQRyvf+Q+0Msw5lf3QsC/Fa3pbkfWHJ5k7AiDHJsh486MYmU+uXdDt0tbIMF5F7GFPF6MLURs6KlglFf/Nir+3LNG8yr6HZQAAgb5N1wFLKICJqwyo7I0vfNV7C4vgGtJ+ywaS4Jo/vhIgcPjgnzzG45GOeMxGB4L5Y2qDtab9YeZymAoJtNKw== Received: from MN2PR06CA0005.namprd06.prod.outlook.com (2603:10b6:208:23d::10) by PH8PR12MB7279.namprd12.prod.outlook.com (2603:10b6:510:221::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.28; Mon, 27 Feb 2023 07:02:47 +0000 Received: from BL02EPF000108EB.namprd05.prod.outlook.com (2603:10b6:208:23d:cafe::54) by MN2PR06CA0005.outlook.office365.com (2603:10b6:208:23d::10) 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:02:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF000108EB.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.12 via Frontend Transport; Mon, 27 Feb 2023 07:02:46 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) 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:02:31 -0800 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, 26 Feb 2023 23:02:28 -0800 From: Xueming Li To: Anoob Joseph CC: Akhil Goyal , dpdk stable Subject: patch 'app/crypto-perf: fix IPsec direction' has been queued to stable release 22.11.2 Date: Mon, 27 Feb 2023 14:58:39 +0800 Message-ID: <20230227070107.15664-11-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.230.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: BL02EPF000108EB:EE_|PH8PR12MB7279:EE_ X-MS-Office365-Filtering-Correlation-Id: b22d69ee-8b4d-4319-4c7d-08db1890a1b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K/LhJ/jp3VMaVcZRk/MekIM9694dRwAsg0fojhvTwubr98Yx0nMoeJkS1mwOfbgJK8CYFrciRcw9lYMakKLr/IBXoNq1VIVYKX4hmpPYD9V9FKbJ+CEYcXTR0jd7UF+br3GqJrJGvsnEtkIOqOWHIYG/1M9xLDZS0JPhiuGqvD8lriaV5poor4hlgZU5R2zDn6Wu2Qr8AjvPNSeo+Q+YgIlTqId51fp7ai6qQoTG40Ty+R0iUF8medFbRvciBgQgjxwOaGCbIjqeFp5NecJGzYEmDUfuT+Z0cyw0KIjZVkuOvvOj+Z2BvGWIpnzsXPHFoBZN6C9DZLNYJgrkxKtHxnQa5dEX0vmu8Nlwg5tCYyBBHOl3W01s/fFLQiwpk9JaEo/Q4zYpwjckMcUJ+3/9K5/pRY9GoRi+rakWAPXkQvXYRuIvmvvnO0XR91yfimtCTnNBOhUJ7G3Qqn1YAoagS9mcff8o5pw9aFSGvLMjevayxP+TKMsptwOuYCMrBuqmlD+Pl8wGSRRoAYlEEJUcO8vm4qxjODM5FumN+MPHPhVr13tGuIIfYPH59lLX0zYg6VNBTkLHogU/Kt/dhMY3FUvLI89YX3Z2bFRu76ERXKmRWdJO4slV4iWNGo4mnAww0opW/F1ejFRbTEb1h4cDeTofCPhzLBJ/brdbF1hf/9N1/mHnnn4zrCAQEFE+BUqFA/R6MQODPJO2H/Bf2KjuL3+FfEe4gknj0gKMwrwAe8SyXOhZWVLzGQvnaafiQ809Xh6wJFRAvWKjRDZsMP+2d7kj3TRMzUlxWyfzsHgLEHA= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(396003)(39860400002)(346002)(376002)(136003)(451199018)(40470700004)(36840700001)(46966006)(40460700003)(36756003)(54906003)(316002)(966005)(478600001)(8936002)(5660300002)(2906002)(7696005)(70206006)(70586007)(8676002)(6916009)(4326008)(41300700001)(7636003)(82740400003)(36860700001)(356005)(55016003)(40480700001)(86362001)(6286002)(186003)(26005)(16526019)(2616005)(53546011)(83380400001)(6666004)(82310400005)(1076003)(336012)(47076005)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 07:02:46.8593 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b22d69ee-8b4d-4319-4c7d-08db1890a1b8 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000108EB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7279 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=b81247d47bcf7493b1b7354f2ccf4997d99e783b Thanks. Xueming Li --- >From b81247d47bcf7493b1b7354f2ccf4997d99e783b Mon Sep 17 00:00:00 2001 From: Anoob Joseph Date: Mon, 2 Jan 2023 17:16:55 +0530 Subject: [PATCH] app/crypto-perf: fix IPsec direction Cc: Xueming Li [ upstream commit 212304008255fa3aa9d380d912488e4552ea7c68 ] The default value of options->auth_op & options->cipher_op are such that an unconditional check for the same would always return true. Hence, the direction is always determined to be outbound/egress. The field options->aead_algo should be checked prior to checking above fields. Since the same check would be required in datapath, introduce a new flag in options for the same. Fixes: 28dde5da503e ("app/crypto-perf: support lookaside IPsec") Signed-off-by: Anoob Joseph Acked-by: Akhil Goyal --- app/test-crypto-perf/cperf_ops.c | 35 +++++++++++--------- app/test-crypto-perf/cperf_options.h | 1 + app/test-crypto-perf/cperf_options_parsing.c | 15 +++++++++ 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c index 4a1c9feb1c..93b9bfb240 100644 --- a/app/test-crypto-perf/cperf_ops.c +++ b/app/test-crypto-perf/cperf_ops.c @@ -42,8 +42,7 @@ test_ipsec_vec_populate(struct rte_mbuf *m, const struct cperf_options *options, { struct rte_ipv4_hdr *ip = rte_pktmbuf_mtod(m, struct rte_ipv4_hdr *); - if ((options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) || - (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT)) { + if (options->is_outbound) { memcpy(ip, test_vector->plaintext.data, sizeof(struct rte_ipv4_hdr)); @@ -645,8 +644,9 @@ create_ipsec_session(struct rte_mempool *sess_mp, const struct cperf_test_vector *test_vector, uint16_t iv_offset) { - struct rte_crypto_sym_xform xform = {0}; struct rte_crypto_sym_xform auth_xform = {0}; + struct rte_crypto_sym_xform *crypto_xform; + struct rte_crypto_sym_xform xform = {0}; if (options->aead_algo != 0) { /* Setup AEAD Parameters */ @@ -660,10 +660,10 @@ create_ipsec_session(struct rte_mempool *sess_mp, xform.aead.iv.length = test_vector->aead_iv.length; xform.aead.digest_length = options->digest_sz; xform.aead.aad_length = options->aead_aad_sz; + crypto_xform = &xform; } else if (options->cipher_algo != 0 && options->auth_algo != 0) { /* Setup Cipher Parameters */ xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - xform.next = NULL; xform.cipher.algo = options->cipher_algo; xform.cipher.op = options->cipher_op; xform.cipher.iv.offset = iv_offset; @@ -680,7 +680,6 @@ create_ipsec_session(struct rte_mempool *sess_mp, /* Setup Auth Parameters */ auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - auth_xform.next = NULL; auth_xform.auth.algo = options->auth_algo; auth_xform.auth.op = options->auth_op; auth_xform.auth.iv.offset = iv_offset + @@ -699,7 +698,15 @@ create_ipsec_session(struct rte_mempool *sess_mp, auth_xform.auth.iv.length = 0; } - xform.next = &auth_xform; + if (options->is_outbound) { + crypto_xform = &xform; + xform.next = &auth_xform; + auth_xform.next = NULL; + } else { + crypto_xform = &auth_xform; + auth_xform.next = &xform; + xform.next = NULL; + } } else { return NULL; } @@ -729,23 +736,19 @@ create_ipsec_session(struct rte_mempool *sess_mp, .salt = CPERF_IPSEC_SALT, .options = { 0 }, .replay_win_sz = 0, - .direction = - ((options->cipher_op == - RTE_CRYPTO_CIPHER_OP_ENCRYPT) && - (options->auth_op == - RTE_CRYPTO_AUTH_OP_GENERATE)) || - (options->aead_op == - RTE_CRYPTO_AEAD_OP_ENCRYPT) ? - RTE_SECURITY_IPSEC_SA_DIR_EGRESS : - RTE_SECURITY_IPSEC_SA_DIR_INGRESS, .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP, .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL, .tunnel = tunnel, } }, .userdata = NULL, - .crypto_xform = &xform + .crypto_xform = crypto_xform, }; + if (options->is_outbound) + sess_conf.ipsec.direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS; + else + sess_conf.ipsec.direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS; + struct rte_security_ctx *ctx = (struct rte_security_ctx *) rte_cryptodev_get_sec_ctx(dev_id); diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-perf/cperf_options.h index 613d6d31e2..6966e0b286 100644 --- a/app/test-crypto-perf/cperf_options.h +++ b/app/test-crypto-perf/cperf_options.h @@ -105,6 +105,7 @@ struct cperf_options { uint32_t out_of_place:1; uint32_t silent:1; uint32_t csv:1; + uint32_t is_outbound:1; enum rte_crypto_cipher_algorithm cipher_algo; enum rte_crypto_cipher_operation cipher_op; diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index bc5e312c81..cb91bcc3c5 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -1318,6 +1318,21 @@ cperf_options_check(struct cperf_options *options) if (check_docsis_buffer_length(options) < 0) return -EINVAL; } + + if (options->op_type == CPERF_IPSEC) { + if (options->aead_algo) { + if (options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) + options->is_outbound = 1; + else + options->is_outbound = 0; + } else { + if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT && + options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) + options->is_outbound = 1; + else + options->is_outbound = 0; + } + } #endif return 0; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-27 14:08:41.379350300 +0800 +++ 0012-app-crypto-perf-fix-IPsec-direction.patch 2023-02-27 14:08:40.729237000 +0800 @@ -1 +1 @@ -From 212304008255fa3aa9d380d912488e4552ea7c68 Mon Sep 17 00:00:00 2001 +From b81247d47bcf7493b1b7354f2ccf4997d99e783b Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 212304008255fa3aa9d380d912488e4552ea7c68 ] @@ -15 +17,0 @@ -Cc: stable@dpdk.org