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 1860CA00C5; Thu, 15 Sep 2022 13:47:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E7AC34021D; Thu, 15 Sep 2022 13:47:24 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 169C940156 for ; Thu, 15 Sep 2022 13:47:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663242443; x=1694778443; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=LylHN5KQlHJtXXJPknI3QNxa1khxbVGBaj24geqfg2E=; b=CQHt9SnWBEejAbjE/OQ9krZIvkp5c/KHqHDHQVNwkx4NtVlV/2ihOGwD WIY6n2/sRQrgasU5u6OnUPDzqO/8+5NmZXwJ2K8WkgdCMlD8qGEqQgCzQ GJ5rpNQx08kOs9bogFuXLfKhz0Pk3V8Ky02D2LYJnyU1fUPuytacnK3bk D6baFb0FoDLciGxbH9+FkGA0pkUFOO5L3ZPupaq0hPgnGAO0xxGs0z7lq 5aBkJqE6Dkv/Grd9vp2ko/QTucyvmZxJSQ/Sp553CG3VFUI96uUr84ofj DH5yu3GoH2nMscsVYFCUYTyYM457HRvi4wdiVjrmolJ0iR/dyKqOQ3mHE w==; X-IronPort-AV: E=McAfee;i="6500,9779,10470"; a="298684500" X-IronPort-AV: E=Sophos;i="5.93,317,1654585200"; d="scan'208";a="298684500" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 04:47:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,317,1654585200"; d="scan'208";a="759608987" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga001.fm.intel.com with ESMTP; 15 Sep 2022 04:47:22 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 15 Sep 2022 04:47:21 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 15 Sep 2022 04:47:21 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Thu, 15 Sep 2022 04:47:21 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.109) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Thu, 15 Sep 2022 04:47:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MG9SP6tFE4ViwSC0ZfgM8k/blVJoo21XVJYF5tlWxNyOxym6HdifpFDdbB5+UAkULgctcjEU7UCk38QcC5Bej6kNjWBT+ScuHDXODbRzTTUpIQmiPAygOJmXtUacyQWcKgjo8TmZQzIvBaUX5yyBubr5t2P0dFlFkIlGuKf8RgE7AWhsgsXUOjZHfpE0LoOf/BBc3qEA3JPip3FRIfwJ3Q7jC5ah/7fiYGRGooiawsxxcILdOYVM0liTdhe1sNPHpZHYviFY1TnCG625r94j8PjORwquJH3KeWE0E1u85X/0BlX2Y+329oh/VvFb34KOgE6971Dc+RHXTP3youlFSg== 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=8I13xxpu53ofmjfm3sWqLBWfNU2QmgQDXX9iesdxDXU=; b=FKsvCojepQDCzwkPixVKLp9S0vaGzFJ2ajBAEcB9vYfujCXRpaKc8+77Imgsf3KfH5cNns/U4mdg3NNiIXXL0yoej5fAtgTCLjRA5Dz9L3fsEqr25ubveoasFY8m2X+gurPkrrrOlm0FpQuFZf3vUn+Q/YlVN1euivmTMysV70hbi9CWoYqLzbIN7LXow/wHVVDTpYPK+mHdH7Xjn/eHU5A6WAjYN6AswiO92g8HKFKn6aIt5yhhDl2H2n6aWt/oKv/KFDo4InhcH++8P0IE3wLzimYb5hvIcY7Ko0LdKZHcF5lDes2CUeRwW2FGSZ02wQLubMdS+mGH2RQrEUTA2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM8PR11MB5591.namprd11.prod.outlook.com (2603:10b6:8:38::23) by SN7PR11MB6947.namprd11.prod.outlook.com (2603:10b6:806:2aa::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Thu, 15 Sep 2022 11:47:19 +0000 Received: from DM8PR11MB5591.namprd11.prod.outlook.com ([fe80::1400:7e7f:fc3b:98fe]) by DM8PR11MB5591.namprd11.prod.outlook.com ([fe80::1400:7e7f:fc3b:98fe%3]) with mapi id 15.20.5632.015; Thu, 15 Sep 2022 11:47:19 +0000 From: "De Lara Guarch, Pablo" To: "Power, Ciara" , "Zhang, Roy Fan" CC: "dev@dpdk.org" , "Ji, Kai" Subject: RE: [PATCH v2 3/5] crypto/ipsec_mb: add remaining SGL support Thread-Topic: [PATCH v2 3/5] crypto/ipsec_mb: add remaining SGL support Thread-Index: AQHYuI8Qz/dtICCj3UiYzwkBieDQv63gf5vg Date: Thu, 15 Sep 2022 11:47:19 +0000 Message-ID: References: <20220812132334.75707-1-ciara.power@intel.com> <20220825142901.898007-1-ciara.power@intel.com> <20220825142901.898007-4-ciara.power@intel.com> In-Reply-To: <20220825142901.898007-4-ciara.power@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM8PR11MB5591:EE_|SN7PR11MB6947:EE_ x-ms-office365-filtering-correlation-id: 259b49b3-ea7e-4614-3bdd-08da97100ba5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZHAXre60vrY9+/pbkLLTMeZbErZ++XrFKdvWxduBiOZr5gdZtxIFX/nuTZu1y+rmb8NY7zDggoQkDHy61VsZsduF4QUldwQ8qWvfcdWCi01/1wxJAjqKlHT8XqZpVOYjQ+T4kmYYIiM7H2HgZik7IUOpe91yFU22yo8ZBgQzZ+jXrL1Hgnyp8aYYqim9RIJABmJfEbc0h0HPYifjA5QXJyhgYtXT/mhTF0vt2+UV9ctKSIdVDcMBCOa6TFWXoZVQvDIa+yPxzg5eJCZ9ancrir0brc0+nTtPnUT8MIG5piruphrBv2mS3Owe9AfvxwvaPkJU04dJAvTx2Wk/uQGe1pKsgNAP5AWFzc4miAjSaslLTbDiLi89hfNlu5CXyE/NgPjI13b8fOgdPEjJGz6Puc5qx1ZI/BQ1kqDy5Is8jkEWzb0TeHCtwT8PqaACPpsfcmluwC8IJ4Gh6sJrF9Fy2YDlTc7rfductuRFNq4m1ne45b9ymMe20s5Ny6w1VZxWux6p2dhB5YlGh0C95wQDyfhrMOnoAdP8FgLZ+ZrXTKCEBCx0IgBZ+vv+/beAvlKCa/uqJqyu74eEloR2Js5GhI0mU7NxKtnMMq2xduTD92JUruJGZivf9x4oVzscNXxFaXZ2CamD5QfyfLlR3zq7Q4pGRq0EL2Ncbzd2KjOvKZ6F8sol1yiFAgKcCgnPRXZmMF1Y+goNzQEXJwm+CLrw0Quy1yU5F5Da9AhKt8iTFgfo6Cvkp4NrrdnBvYN8f1HFXNrV2I4Y8426rVo6kF+ymQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR11MB5591.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39860400002)(451199015)(66946007)(41300700001)(53546011)(52536014)(110136005)(83380400001)(9686003)(26005)(38100700002)(478600001)(55016003)(6506007)(316002)(7696005)(82960400001)(6636002)(8936002)(4326008)(54906003)(8676002)(107886003)(66556008)(76116006)(5660300002)(64756008)(66476007)(66446008)(122000001)(186003)(71200400001)(2906002)(33656002)(38070700005)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?gFYGXMPeWOdn32oJziaolK/vMOTKPVOG+mZLbNiRpnOlEEZPMXNS3jCsLZDC?= =?us-ascii?Q?LV90Z8CSyDpi31O6kkzwxUmzxO5x37MPAD3HdAHLa9trepqwz3rblZJOq19R?= =?us-ascii?Q?N6p3FdLTCo4TIH9eD1BOppVT8VoPHZFhSF4p6VWzEqDeMJGdP+9QnXlJMqT0?= =?us-ascii?Q?3FUnvJGW7cERjJrWrrxADjAmZs3FB0laOIjUmOlYIkbC7BkvWfcRjcQHVYuS?= =?us-ascii?Q?CZEt2TDZ8w9iLYl/UZxFM5T4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ascii?Q?YAJLtaqSPwr4B/th41gJp7UF2fR2qi4hw+8MhS+TFPda/KLMpG5A434ID+h9?= =?us-ascii?Q?JddLqQjof+ovt1mdeevcAKGlu8lt0YBMrazYvUXSMp3bncoN/hnw1xOqemKe?= =?us-ascii?Q?ze6gxeem0I/dibRYZl6vXpXwgrN9wIQgwDYn6yvlayGV2y8bbPYdJNTzsAAq?= =?us-ascii?Q?lwnXyk18uhhmViIzEv+B1a5Y2K5bNtR85zbHZCXi9GRtAwhZz4J6kVXixHg+?= =?us-ascii?Q?hpejE703pEX0xWFCaZTZZCfweVybtKkmqrZnJ94Aa9vh+eYvC8DV4Xdx5r7y?= =?us-ascii?Q?9qT1FBrq3isVrE8SzIboiOLWETXv6U16CHS6iuy9FzDzo+nrsfoFH3UMHBZa?= =?us-ascii?Q?jua6CUnqUafu2pdlmbIsyUC9zk65TBuBSa9bxSIlr3MRkitfg6hl53oYfr8I?= =?us-ascii?Q?six/FrCqKuaM5mD6hLBTpqbwO804C74SYU7vOv4BvfD/lMp0mIrHR2c6ABOg?= =?us-ascii?Q?ow=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5591.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 259b49b3-ea7e-4614-3bdd-08da97100ba5 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2022 11:47:19.6669 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TuWvrvMHL654N6j4S261gMckpqbk8KmL8jacO++GwTHECb/F57CB9WfIWE9X/skWPEN8CEXLlWvi1EvD2lmcvhlnkTBL4QJ/gSW3BvHGjL4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6947 X-OriginatorOrg: intel.com 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 Hi Ciara, > -----Original Message----- > From: Power, Ciara > Sent: Thursday, August 25, 2022 3:29 PM > To: Zhang, Roy Fan ; De Lara Guarch, Pablo > > Cc: dev@dpdk.org; Ji, Kai ; Power, Ciara > > Subject: [PATCH v2 3/5] crypto/ipsec_mb: add remaining SGL support >=20 > The intel-ipsec-mb library supports SGL for GCM and ChaChaPoly algorithms > using the JOB API. > This support was added to AESNI_MB PMD previously, but the SGL feature > flags could not be added due to no SGL support for other algorithms. >=20 > This patch adds a workaround SGL approach for other algorithms using the > JOB API. The segmented input buffers are copied into a linear buffer, whi= ch is > passed as a single job to intel-ipsec-mb. > The job is processed, and on return, the linear buffer is split into the = original > destination segments. >=20 > Existing AESNI_MB testcases are passing with these feature flags added. >=20 > Signed-off-by: Ciara Power >=20 > --- > v2: > - Small improvements when copying segments to linear buffer. > - Added documentation changes. > --- > doc/guides/cryptodevs/aesni_mb.rst | 1 - > doc/guides/cryptodevs/features/aesni_mb.ini | 4 + > doc/guides/rel_notes/release_22_11.rst | 4 + > drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 191 ++++++++++++++++---- > 4 files changed, 166 insertions(+), 34 deletions(-) >=20 ... > +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c ... >=20 > +static int > +handle_sgl_linear(IMB_JOB *job, struct rte_crypto_op *op, uint32_t > dst_offset, > + struct aesni_mb_session *session) > +{ > + uint64_t cipher_len, auth_len; > + uint8_t *src, *linear_buf =3D NULL; > + int total_len; > + int lb_offset =3D 0; Suggest using unsigned here (probably uint64_t for total_len, as it gets th= e value from max between cipher_len and auth_len). > + struct rte_mbuf *src_seg; > + uint16_t src_len; > + > + if (job->cipher_mode =3D=3D IMB_CIPHER_SNOW3G_UEA2_BITLEN || > + job->cipher_mode =3D=3D > IMB_CIPHER_KASUMI_UEA1_BITLEN) > + cipher_len =3D (job->msg_len_to_cipher_in_bits >> 3) + > + (job->cipher_start_src_offset_in_bits >> 3); > + else > + cipher_len =3D job->msg_len_to_cipher_in_bytes + > + job->cipher_start_src_offset_in_bytes; > + > + if (job->hash_alg =3D=3D IMB_AUTH_SNOW3G_UIA2_BITLEN || > + job->hash_alg =3D=3D IMB_AUTH_ZUC_EIA3_BITLEN) > + auth_len =3D (job->msg_len_to_hash_in_bits >> 3) + > + job->hash_start_src_offset_in_bytes; > + else if (job->hash_alg =3D=3D IMB_AUTH_AES_GMAC) > + auth_len =3D job->u.GCM.aad_len_in_bytes; > + else > + auth_len =3D job->msg_len_to_hash_in_bytes + > + job->hash_start_src_offset_in_bytes; > + > + total_len =3D RTE_MAX(auth_len, cipher_len); > + linear_buf =3D rte_zmalloc(NULL, total_len + job- > >auth_tag_output_len_in_bytes, 0); > + if (linear_buf =3D=3D NULL) { > + IPSEC_MB_LOG(ERR, "Error allocating memory for SGL Linear > Buffer\n"); > + return -1; > + } > + .. > +static void > +post_process_sgl_linear(struct rte_crypto_op *op, IMB_JOB *job, > + struct aesni_mb_session *sess, uint8_t *linear_buf) { > + > + int lb_offset =3D 0; > + struct rte_mbuf *m_dst =3D op->sym->m_dst =3D=3D NULL ? > + op->sym->m_src : op->sym->m_dst; > + uint16_t total_len, dst_len; > + uint64_t cipher_len, auth_len; > + uint8_t *dst; > + > + if (job->cipher_mode =3D=3D IMB_CIPHER_SNOW3G_UEA2_BITLEN || > + job->cipher_mode =3D=3D > IMB_CIPHER_KASUMI_UEA1_BITLEN) > + cipher_len =3D (job->msg_len_to_cipher_in_bits >> 3) + > + (job->cipher_start_src_offset_in_bits >> 3); > + else > + cipher_len =3D job->msg_len_to_cipher_in_bytes + > + job->cipher_start_src_offset_in_bytes; > + > + if (job->hash_alg =3D=3D IMB_AUTH_SNOW3G_UIA2_BITLEN || > + job->hash_alg =3D=3D IMB_AUTH_ZUC_EIA3_BITLEN) > + auth_len =3D (job->msg_len_to_hash_in_bits >> 3) + > + job->hash_start_src_offset_in_bytes; > + else if (job->hash_alg =3D=3D IMB_AUTH_AES_GMAC) > + auth_len =3D job->u.GCM.aad_len_in_bytes; > + else > + auth_len =3D job->msg_len_to_hash_in_bytes + > + job->hash_start_src_offset_in_bytes; > + This code above is the same as the code in handle_sgl_linear. Maybe you can have a separate function and remove duplication.