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 A1B4DA0C41; Thu, 18 Nov 2021 08:00:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42A2840687; Thu, 18 Nov 2021 08:00:41 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150051.outbound.protection.outlook.com [40.107.15.51]) by mails.dpdk.org (Postfix) with ESMTP id 0FA7040395; Thu, 18 Nov 2021 08:00:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OD1wMcA850V+EsBrxqDxsjghp8zQ4TUvhYGfe9RdO1Ho75nxl8Gi2HQFm1qfcEFnMGqzcQdzMmrcx4/JVY4P/Mi7bkU9GzgJvbVWhyJ9kUsSWYvfZP9duif1agtcyXulWg6MLpNy1v1uaDWFvvdT7K92VLKpd3B8/IVTc+6qCpJYmYPtQCJGWU4zF7tQv0cJDLrqH4Lli0J1tVNYofv1DWQRJ87HhgUDyrUXa8Tr2aarZpbqx3visvBmMhIMbsVq7DEgo3cyBwhBsugV2fsdFHdLYvsbxl0YjKZu4175uiDPczw1JfSUdj2oDLRRNNusTFzSCjKyHT03McoblPBxjg== 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=a/kxN+1LM1AVn6OaunL6L4Q6zW6W6xz3ybVfyss0SP4=; b=hJMI2ysfW9un3qDLGEbkSVJ51l3EP94INu40qoqm5jLuypiEWEkwsP66HkC84uInIwxLy27HA4mT5CHWRFTA1c6VTLD2mmOW9fXkdG/6QR4O1tVY/aG+m49kBniOdlnOkwLxylN/qcLYFkcOG5mYC3aSYnsnBqey/0LWj3kyariWRf4Mba+v3z7anfpbFzQ6Zle4IvdpjzkAVAqqRse6uP4e168HA6LsycP+/VH7emskXrIHfxuM/WONaepyJHBnVHnwlOrbalKWimnQIpQlPH3q9tIv5Wx7SQq20OtgS2DTVDpXJ1JY8zn3LuNvK3FQ/y/kzOwZQ/pgp5A5gV8t/A== 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=a/kxN+1LM1AVn6OaunL6L4Q6zW6W6xz3ybVfyss0SP4=; b=hh/kk7XbFUViMm160RK5sfI/NQtonFGyeWQ8ICxxYVWPwJh4hAgTbvOEdu7tqA4cp9w+8nuE8YF3YlWBt9VT+vsUNVNAcXzk0+PBchhWGhC57b6nqA3c5jCBvQD93QIRhl7EClX/wI5088naWIg7zcYs3iC+OwATiCEFoxJFhUE= 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 AM6PR04MB6246.eurprd04.prod.outlook.com (2603:10a6:20b:bc::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26; Thu, 18 Nov 2021 07:00:36 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::9895:b941:f782:6999]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::9895:b941:f782:6999%9]) with mapi id 15.20.4649.026; Thu, 18 Nov 2021 07:00:36 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH] drivers/crypto: fix ipsec inner ip header ttl decrement option Date: Thu, 18 Nov 2021 12:30:18 +0530 Message-Id: <20211118070018.2650965-1-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR06CA0006.apcprd06.prod.outlook.com (2603:1096:4:186::19) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 Received: from lsv03457.swis.in-blr01.nxp.com (14.142.151.118) by SI2PR06CA0006.apcprd06.prod.outlook.com (2603:1096:4:186::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Thu, 18 Nov 2021 07:00:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7d4e2dc-94f5-49bb-733d-08d9aa611f19 X-MS-TrafficTypeDiagnostic: AM6PR04MB6246: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +t4X56qrzHQ36GbBTJu8gCkgi3XqKms2v1BGCG2P4Ouy54+UyThl1kKmvx9D1CnsrfQJFMB8yUoBYdD4C3IZZ0mS4Zvjh6Oq00N6vvNdHeIh0L2lEFozZtt/+kKUBXfBBp0Ci3GXVHEsqEXLvUeQEEVuDGFikF4mVhijOJaLmHq2o1Bdu4ybEUe/GDVrflpN4FXLGXazU/MWSeoKL8yYBoSWlYou0Lrnx56UN70+RiYwEgukXFS42N+lCpf/q6HcXaxbIOvOHfbW5OeMcH2fdX6o5Uf7hivlYkUzxcPpvn3vJ/jj1spThnAF0hQaQFJ9bkOUT7s9gqZWkyTM9ZmTDBSTZR/+n631Vq9FZaBg61VdKABTpM3DPdDrqtXm+XDjtTaUPbzEqlDzzmIxvrycTl2bFMXS2ww/lfTv8QbKEoDtBOwQeDCilkwARi6DDVcbvKetoOkDDuhOz+CpMvig6nQpxCfLzxhSlw4TWTY0dn5H65uCgt5g/AArC8D3iEoXMet8UNaYzjV/zB+JSHgHRemdM37y1MUSmKJssGLqxjjf679m6nBzxB+a+pbn74Fo9HYtqvODpquLwheWR93dOcKkaBiBXZ5cZtE5chYwuYpBMmlMu1nSQ3wdZooj/mDhDXRXvMWzJOTTeqUDWi91KphuAhPrOBLQoDQzQIhIRa//GVt0SbjIHX0gC3iOOVyExmlN/L/ikGJLtBZCfk6YS8jgMHaoavo2cb6lUbHLFgo= 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:(4636009)(366004)(956004)(83380400001)(38350700002)(2616005)(1076003)(36756003)(2906002)(38100700002)(26005)(186003)(508600001)(8936002)(4326008)(86362001)(52116002)(1006002)(7696005)(6486002)(66946007)(316002)(55236004)(8676002)(6666004)(5660300002)(66556008)(66476007)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SSlEqMm6ahKex5MV+DLLq5Ii7myHXRiVUej21hRY3QzvyxVkE1NzvoF93lC4?= =?us-ascii?Q?7XBEzZNbKD8snjXH43F6aaVy8Nkg1CsR7VRiMgzoTGbsJifLrW+/lJSD9nJP?= =?us-ascii?Q?ip4xDDwugfqRhq7wrI32ZuyM8/m9qems2FyTK1JRCGXD3wLo39IGa6VQ9Z6m?= =?us-ascii?Q?NQYZAPlvfWceTzu5S8qmptunaTZr8Qc02GYbm3g+EyiokcapGH3vL2s0abmg?= =?us-ascii?Q?Pv5lKAOtBXunyB0pPE7KaDFVnN//IROoOGX38zEhj5UlAeG8Qw7U3Y72hvT+?= =?us-ascii?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7pGn/pTHVWiIh7Y9/lesbdHn1ICaM7?= =?us-ascii?Q?F+zHNWa9n2IVYW6zAj8Pfd7Us1PTAwREzZXXK64iQbqn6cA9dE/N2psFJh5v?= =?us-ascii?Q?GvYUO4kAbGh1wxL1T//vOXBs8hGIhtriVwlZAA4vcJDdoJtJRTAy4dDBorpP?= =?us-ascii?Q?F23Qf/pG6HgBK41I7uHwChi5MN5LLNYfsMldBPRO85+dqDjG6RRxH1p5myVX?= =?us-ascii?Q?AsUSO6k1iZT6dbS5UVlDXRelnf/ptdpX4H16aYuPmO/JplGkQu9p+VD4Q0eW?= =?us-ascii?Q?Cw3U/Qy/Z75tWZOD0j5zKKt/p7+NyOnk8vK/nEGtWZgOjPHcE6GFHTADv+ok?= =?us-ascii?Q?fzhGi0Eg63NYspTAkPlXgwgjMKkjG/dUT3BWyXM/Vp4Qz/4hwpS3/bIIhrBT?= =?us-ascii?Q?taSFTEZXhWGdj1qBqyI=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7d4e2dc-94f5-49bb-733d-08d9aa611f19 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 07:00:36.5233 (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: SJf63SVuhiOSZV8ktwsnGnM1T5D0gQbLWq7uY0ui5Mqx6HMaYZ/xC0Z0x4tvCUlh X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6246 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, dpaa2 and caam_jr drivers decrement the inner IP header TTL for all packets and ignoring the dec_ttl option of SA. In this patch, using the dec_ttl to decide to decrement the packets inner IP header TTL or not. Fixes: 0a23d4b6f4c2 ("crypto/dpaa2_sec: support protocol offload IPsec") Fixes: 3e33486f80a5 ("crypto/caam_jr: add security offload") Fixes: 1f14d500bce1 ("crypto/dpaa_sec: support IPsec protocol offload") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/crypto/caam_jr/caam_jr.c | 5 +++-- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 3 ++- drivers/crypto/dpaa_sec/dpaa_sec.c | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index 8c56610ac8..5909eca6e4 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -1881,8 +1881,9 @@ caam_jr_set_ipsec_session(__rte_unused struct rte_cryptodev *dev, session->encap_pdb.options = (IPVERSION << PDBNH_ESP_ENCAP_SHIFT) | PDBOPTS_ESP_OIHI_PDB_INL | - PDBOPTS_ESP_IVSRC | - PDBHMO_ESP_ENCAP_DTTL; + PDBOPTS_ESP_IVSRC; + if (ipsec_xform->options.dec_ttl) + session->encap_pdb.options |= PDBHMO_ESP_ENCAP_DTTL; if (ipsec_xform->options.esn) session->encap_pdb.options |= PDBOPTS_ESP_ESN; session->encap_pdb.spi = ipsec_xform->spi; diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index cb2ad435bf..2e8e4c6adf 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -2935,8 +2935,9 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev, encap_pdb.options = (IPVERSION << PDBNH_ESP_ENCAP_SHIFT) | PDBOPTS_ESP_OIHI_PDB_INL | PDBOPTS_ESP_IVSRC | - PDBHMO_ESP_ENCAP_DTTL | PDBHMO_ESP_SNR; + if (ipsec_xform->options.dec_ttl) + encap_pdb.options |= PDBHMO_ESP_ENCAP_DTTL; if (ipsec_xform->options.esn) encap_pdb.options |= PDBOPTS_ESP_ESN; encap_pdb.spi = ipsec_xform->spi; diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 454b9c4785..9a7d5eb8b7 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -2898,12 +2898,14 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev, session->encap_pdb.ip_hdr_len = sizeof(struct rte_ipv6_hdr); } + session->encap_pdb.options = (IPVERSION << PDBNH_ESP_ENCAP_SHIFT) | PDBOPTS_ESP_OIHI_PDB_INL | PDBOPTS_ESP_IVSRC | - PDBHMO_ESP_ENCAP_DTTL | PDBHMO_ESP_SNR; + if (ipsec_xform->options.dec_ttl) + session->encap_pdb.options |= PDBHMO_ESP_ENCAP_DTTL; if (ipsec_xform->options.esn) session->encap_pdb.options |= PDBOPTS_ESP_ESN; session->encap_pdb.spi = ipsec_xform->spi; -- 2.25.1