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 F0AD4A0C41; Wed, 15 Sep 2021 16:33:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA5CC41123; Wed, 15 Sep 2021 16:33:09 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id EC9714014F for ; Wed, 15 Sep 2021 16:33:07 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="222377265" X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208";a="222377265" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2021 07:33:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208";a="508800544" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga008.fm.intel.com with ESMTP; 15 Sep 2021 07:33:06 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 15 Sep 2021 07:33:06 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 15 Sep 2021 07:33:06 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.48) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 15 Sep 2021 07:33:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O1DiHZK6xJ3TDj80PnGZRdi3zkDzrMMpJudpj7D6GZ/Ka18xHVceXy+VXNE9EGgV7pe/R2AsSWNeL9hy8AXN6MaMcEhNCTXfU3UhX022abCkOVbPrD87UPx3YZaNPgBFVlUv6wUwvJ7QIe4mIofChndXefludxuSwDk5yNTBbUVkS2F8NvkBT2gD3smIm8QOhHNc5/tNNbE2d5+vxAUwBZGgSME7rZHDa3wGNGK7iy+DJQfY/5uWdOOROkRPt8Mny4DfFkdl9IPinuleEMsjPtQkFr5jzsAyACwlriCQJ3hI8hcsedtgTmquk8Hx/aMPTxHlg70N/NB4aMIojQ+vZg== 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=M91+AxQ2BPGvMzWM0cjE1GgBrEQMMxbdoKRoixa3TpM=; b=e83ZKLFnvY4s2JFZ3Feu/OxReMVe2QpzUFJK8U45ANtY93o6bdd3/psIJxkQSNJ/T8TB4pyIIwBwXp7WUlS2WGj2mwJ9Mr5R0mi+RrbwYUoAjKABK/3tSsmH+K30+9BxyMzRAG6W5Jz05scGGeXO/s0+Zeos6U9/pBS9vlmD5NIB8RHVMT95VI39q6lRi62sdyFG1EXpX9+Qnfgcvm20Zrugp3WtrIxIjb55XxXDbczsH1U5GGfk5qtyuWptyyBDkwwm91vzMFd3p1GOs3WGrTWWFYJcWaEMZPn9Y8hDrspp4TyUFc5iZLlBfsId8vQ0rM7ulYUFIItn7uy6zE963w== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M91+AxQ2BPGvMzWM0cjE1GgBrEQMMxbdoKRoixa3TpM=; b=BrpVpb+lCNrGbUKuxuXSdhTszsIpA0XXuAVvhlcwaww9ttX3OHpONbF89fHnXD1aeAVDqSf8WgnPwlDx+K2YX2OcQibZ5YPzH5c9EsDqrsZ0IrT2FXJ2aegwFBDS2g6Nh0cp4Sz8adFt/7LiDebQFhth2GPQnrWD2n4rLTF6RXg= Received: from BY5PR11MB4482.namprd11.prod.outlook.com (2603:10b6:a03:1ca::33) by BYAPR11MB3335.namprd11.prod.outlook.com (2603:10b6:a03:1d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 14:33:04 +0000 Received: from BY5PR11MB4482.namprd11.prod.outlook.com ([fe80::a850:4ae9:9444:7334]) by BY5PR11MB4482.namprd11.prod.outlook.com ([fe80::a850:4ae9:9444:7334%5]) with mapi id 15.20.4500.019; Wed, 15 Sep 2021 14:33:04 +0000 From: "Ananyev, Konstantin" To: Nithin Dabilpuram , "jerinj@marvell.com" , "gakhil@marvell.com" , "Zhang, Roy Fan" , "hemant.agrawal@nxp.com" , "matan@nvidia.com" CC: "dev@dpdk.org" , "Yigit, Ferruh" , "Nicolau, Radu" , "olivier.matz@6wind.com" , "g.singh@nxp.com" , "Doherty, Declan" , "jiawenwu@trustnetic.com" Thread-Topic: [PATCH v5 2/3] security: add option for faster udata or mdata access Thread-Index: AQHXqXvtJu9+zzZ8xUKadLwx9qkvgaulKBCw Date: Wed, 15 Sep 2021 14:33:04 +0000 Message-ID: References: <20210624102848.3878788-1-gakhil@marvell.com> <20210914151434.29922-1-ndabilpuram@marvell.com> <20210914151434.29922-3-ndabilpuram@marvell.com> In-Reply-To: <20210914151434.29922-3-ndabilpuram@marvell.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.200.16 authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a4d3e1a9-274b-479f-8859-08d97855ba98 x-ms-traffictypediagnostic: BYAPR11MB3335: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: j/YtTg+rT9UNr4sYWq+Mpo7ZufsPDu5jrofVZMlB4lQLUWlGTKdiKsG6U60F6Doy2UP/9Uj4hXrQgG6w6Fx8OdUzATV/qhB6W3wLII5AajCd9M7+pnoXam9nYmTZovb5Cl7AYLARBgqSehE5M6vrXB88SPPPL77BqhByqxzOUYDyPetjZFyUHcbUP8VJj5zeMi2iIWEr0zn7H0pOTTfImAdxfV7j+XArZ91W7d3ycuOQqRdJDmvbZZ6xAVF214ejG/0j7ESspiueze/X6OyqX/0l6Miw0x1ZmKjoxRUMthY6vpPUoNMe2wguxEHiBBWGoYtY1EruUNL2am64oCgOoHm3bZKB5l3zRctdXb0Rv838YvyRlLguEF+ldEN+V0pmvPyYn7gMm2xhhH7yqpBcNy7lJTr9BAVRSwlCEuGl+W5rEax1a+4SK06XeizFpHreEzi3WE+uInHhXZSow89WbOciCKlFu/jZPA4xVEEj++JnFJndPG1wcFHT8wcdgWkPpRm7xhY7YnqljYn7TEdfc0rMLrj2TSOYrbWkDSxiytGmi/8s6C+wYBXHWisQyGOHaehOGfqOrp8/li8sQzrcDACZf8t7u8oRvoro84XAOLflc+B0AFNIeuIr8GwHYlFaWHkaE7UY11Pf2Bm76xjlk/NgqeYmk6CeT30Uu6tWILVybI2TgszYR0cC4xDDWu5YGMdfG6qwu9teSTB8GTPzSw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR11MB4482.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(396003)(376002)(366004)(346002)(66446008)(6506007)(52536014)(478600001)(86362001)(186003)(55236004)(5660300002)(83380400001)(9686003)(38100700002)(26005)(66946007)(33656002)(66476007)(76116006)(8676002)(66556008)(2906002)(54906003)(110136005)(122000001)(316002)(4326008)(8936002)(38070700005)(15650500001)(55016002)(64756008)(71200400001)(7696005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DSeyT/3soVPhgZ1J8oJwnp57QyMQ1etyQPlIuDQrWORGRbz48CS/CVzpEQ37?= =?us-ascii?Q?K6b1ppwzDnipAbIBKOvsgt4rijtpOH+hW2rBjJgygHU8hfqiP5O2pH5YdulU?= =?us-ascii?Q?4nRNLJR1hMv5wkGQwF+sLCSDVwy03niLLhqp/T5klMtz6P4alSOGqI0CJdBR?= =?us-ascii?Q?NwTCXUmP9mzu9Cvhs+9sIrpIYlrDlYaWfDOZMPnkJDsCtDNpPE7vyztS4xqJ?= =?us-ascii?Q?S2eFoPbllvSw4zXZm8M32ZllNOUF+BAnHoRNkJ3i4j5JRmuNf/cCl5EOznwM?= =?us-ascii?Q?30o+vfdZnPfBOPrRqCB7eo3FTNT0GNPS0ZqfHt4udBUh03RGMiQe0AGV86Mi?= =?us-ascii?Q?mlZrw8qgNO8wQNI1WJdCvcekSh3Uh+BVQUl6GbXWWYAId+2BxbZWy/cyPu5b?= =?us-ascii?Q?CZFzYeWiX/7FSxFJTCFPPsd6EAJc98wg95MieAjvy5d6CQsyseC3rhnH3f3K?= =?us-ascii?Q?Q5YBjF5VmabHOb3ue5pAydZArUzLk0NsP5mdInWLxjh4C1/QDkLw+F4EU2y7?= =?us-ascii?Q?IHD4gAh9YvMF1ud95xTefw2swbXdXPcAlyXmV2h1HeH8ZheBp4j/CMkGM0n2?= =?us-ascii?Q?vYplHdMGWTXGST45z9FC81S9qwYFPDMn8dpvkm6vIvz4ovAHxe8PYgvGdnGZ?= =?us-ascii?Q?rELnfDUqgccL7tqBp13rth60SKjY0QSnyb2geUpohjrbfS+bYjyglM5HDxzi?= =?us-ascii?Q?HU7JtYgHawKFCbSwmIoOBUcnUqnueUAwXq0uJLCKCYJBz6YMC7WJ4j+9D8i8?= =?us-ascii?Q?RFp6VOqTHUO9NCvHU+c0wSOxcuHTO/RK92fJew0PghTsrrBHd49wHV/hatsI?= =?us-ascii?Q?JtnzZgBJp/hJZixK5hkVOcNzSXXwKjnJNqKg23aHAwnYCWt7yqICboTvH5wx?= =?us-ascii?Q?0aoZycPXbssATUC0bgi4buPUVrgrlFYU9t82+MZ7khZFwcvcAjohz4oCUEw7?= =?us-ascii?Q?WYUpRoomZ8QACAOORY+W51PfOaXLjcerwtuAhr6zTXNXs8mWEHUVZdn+jIyA?= =?us-ascii?Q?BpjR8/eP/WHmSl+26zbwUVzmafWxvBQbfEZnUfinRu4TsxgFo/DnxnvYvILx?= =?us-ascii?Q?BPOzjg0eCioV+Yo26jI91pOPUa73c2NbFqSClrZ7okTbgWd/FA+U79vvExyL?= =?us-ascii?Q?h3eGekr0SX/blquz5ea5OuJOP1qyobeB0ZH2LUjfqx7lLB/knNMyEpkhM/K2?= =?us-ascii?Q?qCM7ByzOOob9KUYxwK41hcwFDvnG1VQ+3kFTDC6iWqiZ6OjWcALsOCAHq8vr?= =?us-ascii?Q?6ge4q7R8b/KF1MA8qgfxs5p3T/K8Y6hJCIR1WpcEPgl2Fs9IYYWyLDsP6L6E?= =?us-ascii?Q?avuddc4Mv61K6oXZton82/CJ?= 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: BY5PR11MB4482.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4d3e1a9-274b-479f-8859-08d97855ba98 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2021 14:33:04.5848 (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: lmyFEBV1hIY2VMZsi3L6o4D8+8jaEsbOaJlOg0Sxki3iqYyyTByZbYwn6YwFFsdL3bpfp6Y8BphYNgZ0sncQN/bHSb1JyDn74CCGmzxTtW4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3335 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v5 2/3] 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" >=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 > Acked-by: Akhil Goyal > --- > doc/guides/rel_notes/deprecation.rst | 4 --- > doc/guides/rel_notes/release_21_08.rst | 6 +++++ > lib/security/rte_security.c | 8 +++--- > lib/security/rte_security.h | 48 ++++++++++++++++++++++++++++= +++--- > lib/security/version.map | 2 ++ > 5 files changed, 56 insertions(+), 12 deletions(-) >=20 > diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/= deprecation.rst > index 59445a6..70ef45e 100644 > --- a/doc/guides/rel_notes/deprecation.rst > +++ b/doc/guides/rel_notes/deprecation.rst > @@ -276,10 +276,6 @@ Deprecation Notices > content. On Linux and FreeBSD, supported prior to DPDK 20.11, > original structure will be kept until DPDK 21.11. >=20 > -* security: The functions ``rte_security_set_pkt_metadata`` and > - ``rte_security_get_userdata`` will be made inline functions and additi= onal > - flags will be added in structure ``rte_security_ctx`` in DPDK 21.11. > - > * cryptodev: The structure ``rte_crypto_op`` would be updated to reduce > reserved bytes to 2 (from 3), and use 1 byte to indicate warnings and = other > information from the crypto/security operation. This field will be use= d to > diff --git a/doc/guides/rel_notes/release_21_08.rst b/doc/guides/rel_note= s/release_21_08.rst > index b4cbf2d..59ff15a 100644 > --- a/doc/guides/rel_notes/release_21_08.rst > +++ b/doc/guides/rel_notes/release_21_08.rst > @@ -223,6 +223,12 @@ ABI Changes >=20 > * No ABI change that would break compatibility with 20.11. >=20 > +* security: ``rte_security_set_pkt_metadata`` and ``rte_security_get_use= rdata`` > + routines used by Inline outbound and Inline inbound security processin= g are > + made inline and enhanced to do simple 64-bit set/get for PMD's that do= not > + have much processing in PMD specific callbacks but just 64-bit set/get= . > + This avoids a per-pkt function pointer jump overhead for such PMD's. > + >=20 > Known Issues > ------------ > 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 2e136d7..3124134 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 */ Probably worth to mention somewhere that it is driver responsibility to cal= l=20 rte_security_dynfield_register() to expose that flag. > + > +#define RTE_SEC_CTX_F_FAST_GET_UDATA 0x00000002 > +/**< Driver provides udata using fast method without using driver specif= ic > + * callback. > + */ > + > /** > * IPSEC tunnel parameters > * > @@ -494,6 +504,12 @@ static inline bool rte_security_dynfield_is_register= ed(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 *inst= ance, > + struct rte_security_session *sess, > + struct rte_mbuf *m, void *params); > + > /** > * Updates the buffer with device-specific defined metadata > * > @@ -507,10 +523,26 @@ static inline bool rte_security_dynfield_is_registe= red(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 me= tadata > @@ -530,8 +562,16 @@ rte_security_set_pkt_metadata(struct rte_security_ct= x *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 c44c7f5..45ace9c 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 Acked-by: Konstantin Ananyev