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 10CF6A0C55; Mon, 6 Sep 2021 20:58:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFFDE41102; Mon, 6 Sep 2021 20:58:46 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 78FE341100 for ; Mon, 6 Sep 2021 20:58:45 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 186IqwLn025224; Mon, 6 Sep 2021 11:58:43 -0700 Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by mx0a-0016f401.pphosted.com with ESMTP id 3awrfur131-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Sep 2021 11:58:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IkD6D3cdOWw0JK1sihlby8YIZ18fRBMXfDXw6kYgunMK5i4BdDRqft3L+GMdNGG8+/RIPq0pNnQfpvvQkNYzMLWTA0A0R6uxiQZcA6EZf1tz/tHHZb9Dm0wip/L7HRK6dvzwjUs6T5Nd1AxPAOLZmPfFajMUS0TXvkqMMqFpdaCyOpCroUxhWDogzM0d5Wt0akhTpJLoyrV3WK0ELRhJdcynpaTiOMH1n+W8i9tkziRBWGwf2zSbcOm9g7yMcVPdhUOBJh7qxG42WvPJl6bbHB928BbZFFqLl8NSTXaF3ESH5TXXrIIdjeALBasBT7OJdAnZ+OxxM66PqyDzdZqK8g== 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; bh=WRwN0AiZuqTcv3asfsD/qT5u8VkO6b0GY27QxQWJg78=; b=SUzgUmZE7tZf8+pQ7mIUo2NESQu/eJSPCHJNOHw83yRAhlG4OKYbGPT2WDgjx7+sxJlf3Drz5x7vJ4l3MiqrHSZHsZzOdjDAyOjeivIfqN1a+gm5NnZw04+WMaNAHqnNfqdLsV/9BRKNN3kza4FcQbZtsjOptOOB1q3/uDHloyxKzrvO/yvX7ReB2SQE2TIHdalOpftMOEr6r7vC3+BWkKSkrMCkVsjOYIuxY+mMED1e8FcGi3J3+8luYLxiHzoR/LVfFwrDRpfwltIKwpiVbn7nwOUOIlUiNFAvLcLxn4lxqcntnFysBylKOcFV2Z+VlAZO10L1xjE0/ah+f8/gZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WRwN0AiZuqTcv3asfsD/qT5u8VkO6b0GY27QxQWJg78=; b=mrT4bVU+t0h1GGvUoRPTJ0QUIqP3PXCL8lyTzzzSpEOkxZZ9dZTCgpwYJj5FDLxllgnYIQTwe25Vo4rMy1DWj5386B0LOeXEyeUeUP7GE5XSq7GoqDcaMg0RAGOpT8cNX096l7GKs3k8cRNPsYhPJc8npCKSvh6eG49y++0dFiw= Received: from CO6PR18MB4484.namprd18.prod.outlook.com (2603:10b6:5:359::9) by CO1PR18MB4665.namprd18.prod.outlook.com (2603:10b6:303:e4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.22; Mon, 6 Sep 2021 18:58:41 +0000 Received: from CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::411f:5b87:321e:de29]) by CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::411f:5b87:321e:de29%3]) with mapi id 15.20.4478.025; Mon, 6 Sep 2021 18:58:41 +0000 From: Akhil Goyal To: Nithin Kumar Dabilpuram , "dev@dpdk.org" CC: Jerin Jacob Kollanukkaran , "hemant.agrawal@nxp.com" , "thomas@monjalon.net" , "g.singh@nxp.com" , "ferruh.yigit@intel.com" , "roy.fan.zhang@intel.com" , "olivier.matz@6wind.com" , "declan.doherty@intel.com" , "radu.nicolau@intel.com" , "jiawenwu@trustnetic.com" , "konstantin.ananyev@intel.com" , Nithin Kumar Dabilpuram Thread-Topic: [PATCH v4 2/4] security: add option for faster udata or mdata access Thread-Index: AQHXj3Y6X41Ewqj280my9WjkPtqvDKuXg3fw Date: Mon, 6 Sep 2021 18:58:41 +0000 Message-ID: References: <20210624102848.3878788-1-gakhil@marvell.com> <20210812123257.19595-1-ndabilpuram@marvell.com> <20210812123257.19595-3-ndabilpuram@marvell.com> In-Reply-To: <20210812123257.19595-3-ndabilpuram@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0c822121-10f1-497e-c050-08d97168581c x-ms-traffictypediagnostic: CO1PR18MB4665: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CF/gxOMtIh9dJ+DS8ambxT1rfhJf26EVaQhTBwMxK11hK8G//0hEKJaBvnYrXY+t2pt0/bYVnc5EiRx1jTEA3HmJbnsGBdQgMZIGWvZdG/hDsglUcLh4rv6gLHgkf3mPCcYxooLOOR1f4Zyfsjno1ApWF2pJ6f7sGdZlCqwOq336Yt+6xjjFik+ZHbKYnpM437/R0mjuL4eQG6TIoT02hGk570uxkBoSIGFXEJFLaNHtKM5SyyDcN0zV2Ou9aKJQbr9R2LRmfIsJOlhfpZhNpSvlklOQqL4LNM8j9Lu0LmSmcydN4+jaUddPNE45PRqXheWlL31nnyyAMkeXE2q4CMm/Gij/UjlWb2YDO6pH/CHhkWpvsFK0mNRrGxB/UbMUgekUUny5S+m8oTbkyenjmo6rehUg4KBR8e8Q/oXfhXd8bKerIXNn8S6KLhSdWvDTVmMTxnxLIutNt0WLv52Z5H1lq6dIFYusmdLZ5gedwUIGvtHFyD2WGJwjCv3oQmgtfYzb37IgqH7h90AGWYHu11fRj77edR56ZPMo7caz2DiAT2DLB7jfpRSlaOtHjxF8cdGhZ3iMPxA5JMfl1mrWMK03TrX/OuirOoTTqled4TkdoSIuqdpGHixQSDIpoms+KXPbs3+S7fXob3jnSyTq8XsTk6T2Un04c+2mrTRFHBGGO6qEKR5MlyGJCrARqnqLutdIYp3i/SxkDBjMey4TEA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB4484.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(86362001)(26005)(76116006)(66556008)(66446008)(55016002)(4326008)(9686003)(66476007)(66946007)(6506007)(54906003)(110136005)(316002)(15650500001)(83380400001)(7696005)(64756008)(53546011)(107886003)(122000001)(33656002)(71200400001)(2906002)(38100700002)(8936002)(508600001)(52536014)(186003)(38070700005)(5660300002)(8676002)(7416002)(55236004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?osd0qlgBPhcrp+IDS1Nu72u//LOMubqvfbY1UOrr3Z6nYRpZ4irIM8KsWOzT?= =?us-ascii?Q?GrRkpEFNKtZNuNk3XJEM2F9AceTTTBawYRA1M22NYCswpHag0/CqdvkhT07K?= =?us-ascii?Q?9Sux/wJDvCrg7+mZ+B32A+0UXFtgPzPA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YokD0/5DoEJJwHoGgt35NRM5keJOW4fgX3CShrxPN+ER0?= =?us-ascii?Q?06b0oEZ6W7IyqnwXxre06fVTQFxtXjo5HytBWGejvPPbCI6GoyOEvyvPVpB8?= =?us-ascii?Q?UYbh6uAHQB4rUfjTAynE/uMs94G2I/V3Rwmqn6YP2kA4cDqpKIpN47bTZtjL?= =?us-ascii?Q?8LnFmh8uZzWPsG8E+8bM03T7VpsPNR1YoqV9X7ZjQUteATHIA8cFbujstZ3u?= =?us-ascii?Q?HmrGQfnzSKGnfwCnsXRfuMtJBYcNAEMxc0LqimDHDt60Qxs2j2S90x/TFTfR?= =?us-ascii?Q?KrL+hu1aHxfMfNfiQbO4vN8N?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB4484.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c822121-10f1-497e-c050-08d97168581c X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2021 18:58:41.7038 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5OSvlPw+Z4LtHrylIqABJu/MGaCq4JV4KE8WjtSeg34rU4aHnkeBpEn7Zi4fZLZ8X44bhVIVG6M87qh7dnqrug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR18MB4665 X-Proofpoint-GUID: da8ZyPVAW5eFd_J3duBqB4geXEeL_E9m X-Proofpoint-ORIG-GUID: da8ZyPVAW5eFd_J3duBqB4geXEeL_E9m X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-06_08,2021-09-03_01,2020-04-07_01 Subject: Re: [dpdk-dev] [PATCH v4 2/4] security: add option for faster udata or mdata access 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 Sender: "dev" > -----Original Message----- > From: Nithin Dabilpuram > Sent: Thursday, August 12, 2021 6:03 PM > To: dev@dpdk.org > Cc: Jerin Jacob Kollanukkaran ; Akhil Goyal > ; hemant.agrawal@nxp.com; thomas@monjalon.net; > g.singh@nxp.com; ferruh.yigit@intel.com; roy.fan.zhang@intel.com; > olivier.matz@6wind.com; declan.doherty@intel.com; > radu.nicolau@intel.com; jiawenwu@trustnetic.com; > konstantin.ananyev@intel.com; Nithin Kumar Dabilpuram > > Subject: [PATCH v4 2/4] security: add option for faster udata or mdata ac= cess >=20 > Currently rte_security_set_pkt_metadata() and rte_security_get_userdata() > methods to set pkt metadata on Inline outbound and get userdata > after Inline inbound processing is always driver specific callbacks. >=20 > For drivers that do not have much to do in the callbacks but just > to update metadata in rte_security dynamic field and get userdata > from rte_security dynamic field, having to just to PMD specific > callback is costly per packet operation. This patch provides > a mechanism to do the same in inline function and avoid function > pointer jump if a driver supports the same. >=20 > Signed-off-by: Nithin Dabilpuram > --- > lib/security/rte_security.c | 8 ++++---- > lib/security/rte_security.h | 48 > +++++++++++++++++++++++++++++++++++++++++---- > lib/security/version.map | 2 ++ > 3 files changed, 50 insertions(+), 8 deletions(-) >=20 > diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c > index e8116d5..fe81ed3 100644 > --- a/lib/security/rte_security.c > +++ b/lib/security/rte_security.c > @@ -122,9 +122,9 @@ rte_security_session_destroy(struct rte_security_ctx > *instance, > } >=20 > int > -rte_security_set_pkt_metadata(struct rte_security_ctx *instance, > - struct rte_security_session *sess, > - struct rte_mbuf *m, void *params) > +__rte_security_set_pkt_metadata(struct rte_security_ctx *instance, > + struct rte_security_session *sess, > + struct rte_mbuf *m, void *params) > { > #ifdef RTE_DEBUG > RTE_PTR_OR_ERR_RET(sess, -EINVAL); > @@ -137,7 +137,7 @@ rte_security_set_pkt_metadata(struct > rte_security_ctx *instance, > } >=20 > void * > -rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md= ) > +__rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t = md) > { > void *userdata =3D NULL; >=20 > diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h > index 88d31de..1f73dee 100644 > --- a/lib/security/rte_security.h > +++ b/lib/security/rte_security.h > @@ -71,8 +71,18 @@ struct rte_security_ctx { > /**< Pointer to security ops for the device */ > uint16_t sess_cnt; > /**< Number of sessions attached to this context */ > + uint32_t flags; > + /**< Flags for security context */ > }; >=20 > +#define RTE_SEC_CTX_F_FAST_SET_MDATA 0x00000001 > +/**< Driver uses fast metadata update without using driver specific call= back > */ > + > +#define RTE_SEC_CTX_F_FAST_GET_UDATA 0x00000002 > +/**< Driver provides udata using fast method without using driver specif= ic > + * callback. > + */ > + > /** > * IPSEC tunnel parameters > * > @@ -493,6 +503,12 @@ static inline bool > rte_security_dynfield_is_registered(void) > return rte_security_dynfield_offset >=3D 0; > } >=20 > +/** Function to call PMD specific function pointer set_pkt_metadata() */ > +__rte_experimental > +extern int __rte_security_set_pkt_metadata(struct rte_security_ctx > *instance, > + struct rte_security_session *sess, > + struct rte_mbuf *m, void *params); > + > /** > * Updates the buffer with device-specific defined metadata > * > @@ -506,10 +522,26 @@ static inline bool > rte_security_dynfield_is_registered(void) > * - On success, zero. > * - On failure, a negative value. > */ > -int > +static inline int > rte_security_set_pkt_metadata(struct rte_security_ctx *instance, > struct rte_security_session *sess, > - struct rte_mbuf *mb, void *params); > + struct rte_mbuf *mb, void *params) > +{ > + /* Fast Path */ > + if (instance->flags & RTE_SEC_CTX_F_FAST_SET_MDATA) { > + *rte_security_dynfield(mb) =3D > + (rte_security_dynfield_t)(sess->sess_private_data); > + return 0; > + } > + > + /* Jump to PMD specific function pointer */ > + return __rte_security_set_pkt_metadata(instance, sess, mb, > params); > +} > + > +/** Function to call PMD specific function pointer get_userdata() */ > +__rte_experimental > +extern void *__rte_security_get_userdata(struct rte_security_ctx *instan= ce, > + uint64_t md); >=20 > /** > * Get userdata associated with the security session. Device specific > metadata > @@ -529,8 +561,16 @@ rte_security_set_pkt_metadata(struct > rte_security_ctx *instance, > * - On failure, NULL > */ > __rte_experimental > -void * > -rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md= ); > +static inline void * > +rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md= ) > +{ > + /* Fast Path */ > + if (instance->flags & RTE_SEC_CTX_F_FAST_GET_UDATA) > + return (void *)(uintptr_t)md; > + > + /* Jump to PMD specific function pointer */ > + return __rte_security_get_userdata(instance, md); > +} >=20 > /** > * Attach a session to a symmetric crypto operation > diff --git a/lib/security/version.map b/lib/security/version.map > index 2277555..e1c8148 100644 > --- a/lib/security/version.map > +++ b/lib/security/version.map > @@ -20,4 +20,6 @@ EXPERIMENTAL { > rte_security_get_userdata; > rte_security_session_stats_get; > rte_security_session_update; > + __rte_security_set_pkt_metadata; > + __rte_security_get_userdata; > }; > -- > 2.8.4