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 573CBA0093; Fri, 22 Apr 2022 05:51:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 68E69427FB; Fri, 22 Apr 2022 05:51:40 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20062.outbound.protection.outlook.com [40.107.2.62]) by mails.dpdk.org (Postfix) with ESMTP id B6370427EC; Fri, 22 Apr 2022 05:51:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lkFZPo7SAVHuNC/CYtnVopJm6cshgltz3Ey6s2345L9SWARtFqQmA+6yHL3qEOAHGxoYAmZmdOdt8yor1ffw39c5LyQVhSjsHvG5zvPc1gvW/n/e+pmQqYAgm6Jkj6nrL0jG/2cNKR0fbLbhFdbx1dh5F28R44rJKQMKDE+PneUMjGOAjPpNNxVcOdc2sDfz1rTBnJnl677xcKIBf5lWxBMBs9unm1EPln3Ym3JJHoNUV5HtrF1vAUMcJTGXpnZBHCgUiHhNSIUYJFw08w/vnaXX0Acee36CKUs4xoi37JZDW6FNinkN9H14/ezUDER5R3X+nzLMdfSpZAwon2r6oA== 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=/jWTJ+8y7eqN4JZqhHKI/bOc45P/Isbhn7aUgvrHXpk=; b=HL4dPhpgVZGBRS1bRy18IWbSwFOuipGDWrm9j3EQO4exY/n+Pbyr9gTZsYs/ryf2BlA5gHcyZBHOn8ldBD2bccNJ7XmGJ9whSSWg1KZ9hKr9LBmx5KiALlrZCXBsXBxrWBnmBmxFSjn9L/s7F+R9H7Ju6p3ZRy+VFZ985gp0LPNs/1/7gfTfy9wDgFM6XNseXssdgsidvYTkEBO2OKgLV5gYy/bTaHgp5IGcO7Oso+Zp+P0s7G8IEnh+++dpVbVXTbraMsKaEyuRuoxx+QEA4MJVfzYURuKnv9+6cf25xfJf9XA2ljoZoQDrIyzjKR2gpZv67vX3qZ9a95ShyfuNwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/jWTJ+8y7eqN4JZqhHKI/bOc45P/Isbhn7aUgvrHXpk=; b=Iyy+7Xj8uEYCJD7QQVlyKatO1G0YgDV9ZeX2dwYpk/JFetLGDvJxvGHGf6RAOa9ARNN5ILVLqAmOdxRQceahNkGJUWKFhcWr6vEQuiytboG8eYh0XWwLp7zf79GeJJGs5gRLplURZHiZMrHu+Lax0186L53OrSzK/Zr4b5Oirwc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by DB7PR04MB4393.eurprd04.prod.outlook.com (2603:10a6:5:32::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Fri, 22 Apr 2022 03:51:38 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2%7]) with mapi id 15.20.5186.015; Fri, 22 Apr 2022 03:51:38 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH 03/14] crypto/dpaa_sec: fix length for chain fd in raw sec driver Date: Fri, 22 Apr 2022 09:20:49 +0530 Message-Id: <20220422035100.3180870-3-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422035100.3180870-1-g.singh@nxp.com> References: <20220422035100.3180870-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0127.apcprd03.prod.outlook.com (2603:1096:4:91::31) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e063c0d-431b-4a51-1af9-08da2413674d X-MS-TrafficTypeDiagnostic: DB7PR04MB4393:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n55wwVtRpVflHY4i/rvDq8KcFzLVdVKZ56XITFXwj4a+zKnxSSFBrvikTLzZ7yD9xkF/YnlcLCvE1YpTyVoz/ki6TibW/54q9vW06Ps3wP1f5vdMhDGmqv7u5jJGB2+GLnDRT0jHjSwF9mjsXBTS5jeRP3XtH2hVaieHbGVq+wmXClK7YYNpmu0xYWqJrY3Mbr8JXKyxS/1eMZiT/iYWMz+9MBO0gMLzuoD3/eE10lJWt1x1npMuHP3XvdsRp0lCFrhW4xh/sH6/Sv1mpYYOLMMJdcbXtz1ZlzEcHKFfnPiYGDcrYmBP/p40HBGV69N5TMI62LxXPv67sKC+KrnNrj8gV7aYMUQJI06QiYDyeepcXvEvseY7zheBJHMhXhXUX9Js6NrcfP4otog31GQLfFCHoQAvU8cg3fdK8pXNa5WMhE2UySw2zutuL4rT8mRZX8IoB1+6w6zK6Q3io7+Tp783ZcEjOgepvNeOT5smKo8E83ARoeCKexYF/OsCzt3qU9ZyDsz37HDHVxnfkEpevdp7nynsC7uEqfNKvbhxLL1J+BJ8L6p/SRQZsUVkk7PNBjY+gyOjVlDc23NZiZkoBgiJjxRGblfu0z+xTzOPTRcOi4vvNaLCo5d0jpj/fFWfA/uR6uXApavSoyrvc2j2/84xWHk3IKhOz8S1X59r2Ih5DQf9VEin0XaZmlTWRWlN7zEnKF6UX6YmygDvj3lrmw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(5660300002)(36756003)(2616005)(6486002)(1076003)(8936002)(86362001)(316002)(52116002)(66946007)(26005)(6506007)(6512007)(186003)(66556008)(6666004)(66476007)(83380400001)(38350700002)(38100700002)(508600001)(4326008)(55236004)(2906002)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?TD2yrqOUpxfr3Gtdddgx2iTZPSnMUZQSse2vnZ9La3U7jWzotT+SY+BFrGG7?= =?us-ascii?Q?hak5BmscSdhGFV6wzvfH5ksispEblpp1YwFFJ0HQE8cuURbdBP99yObMWYmF?= =?us-ascii?Q?7Jmvb99HsYFZZuhoLnygLxhPqowLooEOZYKcR98Wbdj/qpFfI3lQ53c4L7Jx?= =?us-ascii?Q?4SvQs/f3lmDtxFuKKgpSWnsSLyu+Mqg4aKDtmLRekmSLHQzOAX+p+znAweuu?= =?us-ascii?Q?tt88F19EwEHENwDZLynOrWni78pM3rdMO4b3N0O+KNu7Ni7IFwbOqe3EQjXj?= =?us-ascii?Q?DjDsF3dJ0jBuRVdv7sqC1ONX91Ykh5JrPtGbL02GL5fO/2fk40ouk6gbomtw?= =?us-ascii?Q?4yfSbWoc9wwDBu8qiHslEcMm6H9POISKPQ2Xz6h3IjfXwc8ockXsLnozGagp?= =?us-ascii?Q?6+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j2x+q9hrXlMt84eIkh9Whba?= =?us-ascii?Q?dydglfD9m+pjkrwogLPb0RxKmNS8g3ZS2JrjbmA/8e+pFV4F46qBmTV+As+i?= =?us-ascii?Q?qU5fJ/uTjx8Z3VOXl/bSrPGBBB0aeoafkMRcsUDOBRZZdbnceXRCHgJ4qLAb?= =?us-ascii?Q?u/c+4eXZDukvCU0R9HgRPp6fr9rAaKuyq+zlR7jqdCT7ZvHWYPBGx0cYFr/p?= =?us-ascii?Q?Z2TCKBHMxFdi2uXbXbgLAcZzmhopEMTgSx4uc3mLcx+XaSI3qQhh6vYQnUf9?= =?us-ascii?Q?4MDgE6yj/a/KJJ9KTLuydpaVfD5y+pcdUtGtU0dUnfAy+QMEVxIXcijWgp5F?= =?us-ascii?Q?+cd83N1EtXCXcSr5qZnQxhn/u4FaMqYB31UXKS6mTyh5zOmtau/CVXAfdZxq?= =?us-ascii?Q?f9VGd26LM94wzQkXWwuZc5CWj7QllmrFnD+Tm/DOblcGyq+vMcooKD8saoe7?= =?us-ascii?Q?AW7HUu6LBg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e063c0d-431b-4a51-1af9-08da2413674d X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2022 03:51:38.4931 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EdRb1Lh008LgzV4zBxHdq7Q+GMzS9ECOu5jR0a6IhK6NmgBGya2h5xByCSgDA7+B X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4393 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 DPAA sec raw driver is calculating the wrong lengths while creating the FD for chain. This patch fixes lengths for chain FD. Fixes: 78156d38e112 ("crypto/dpaa_sec: support authonly and chain with raw API") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c index 522685f8cf..29f4e6d40b 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021 NXP + * Copyright 2021-2022 NXP */ #include @@ -397,8 +397,8 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, unsigned int i; uint16_t auth_hdr_len = ofs.ofs.cipher.head - ofs.ofs.auth.head; - uint16_t auth_tail_len = ofs.ofs.auth.tail; - uint32_t auth_only_len = (auth_tail_len << 16) | auth_hdr_len; + uint16_t auth_tail_len; + uint32_t auth_only_len; int data_len = 0, auth_len = 0, cipher_len = 0; for (i = 0; i < sgl->num; i++) @@ -406,6 +406,8 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, cipher_len = data_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; auth_len = data_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; + auth_tail_len = auth_len - cipher_len - auth_hdr_len; + auth_only_len = (auth_tail_len << 16) | auth_hdr_len; if (sgl->num > MAX_SG_ENTRIES) { DPAA_SEC_DP_ERR("Cipher-Auth: Max sec segs supported is %d", @@ -448,6 +450,7 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, qm_sg_entry_set64(sg, dest_sgl->vec[i].iova); sg->length = dest_sgl->vec[i].len; } + sg->length -= ofs.ofs.cipher.tail; } else { qm_sg_entry_set64(sg, sgl->vec[0].iova); sg->length = sgl->vec[0].len - ofs.ofs.cipher.head; @@ -460,6 +463,7 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, qm_sg_entry_set64(sg, sgl->vec[i].iova); sg->length = sgl->vec[i].len; } + sg->length -= ofs.ofs.cipher.tail; } if (is_encode(ses)) { -- 2.25.1