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 DA470A0C45; Thu, 16 Sep 2021 17:21:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 729CC4069E; Thu, 16 Sep 2021 17:21:32 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D63E840151 for ; Thu, 16 Sep 2021 17:21:30 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10109"; a="209678510" X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="209678510" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 08:21:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="509341475" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 16 Sep 2021 08:21:29 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 16 Sep 2021 08:21:29 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 16 Sep 2021 08:21:28 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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 via Frontend Transport; Thu, 16 Sep 2021 08:21:28 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.108) 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; Thu, 16 Sep 2021 08:21:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RI7PPGisLFVp84E8M2uwQoLRD8OivJfBuBx4Q3mXKmRH2QN+9fL7cvYX+M9ln67BrHHNMqayEUgVTHj4wFusyn2lnDdLGLzkNKMhUPhW0Uy1cFqZuFvAgLPBESCIJTP2DZs1MZCEqIuoXQ8ZFveXYkS0GE6F/RG6kGWjJZe4fB2xUOnMV6haIEtPCcHk6IDCaGE+XBPOEPCu2bnWLxa9JmRu5H3ovgjtwHW6kEz4MCVo1IFLFTnWFRSfqEz12PWtDkeHiDP3oaXP7lTxy/s0/B6PXhpQwMCBoKn29Xs1hw3Ok6QAmhPs0efI+2caYNn/OgXaHZB+yLQgOeaKpMqUyg== 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=TlfTRg2SLHSXtljkIY//M2ZoGYIBypYAcEXiE0IMHdw=; b=RWVzHIM9sMByAH7DHn3CadQrrDX4WQS2DIMTABBPVRhuN0KLHrCVQKoFfkzRvSgqJ+cIif7GCJWSygA3kMZlylwoAO/AT3OthhnWPZklRmYA1WnoROKxqM0MuagCPrbOZ/Xndq5DwB1C5QzptMktTVfSKm9xvdFc1+mAvopuWHtl3vLP8eGnYCZNj7lBF6WoQjGnlZ8UsN/F5aoJdMWxa1p1SDVc2oyp9bJ62MdHMQ6sPZU3Ow7QQEU5JqzZ2INPqT65880ERk5s/Is6xwZJ/5oobKJTMYq+zt4mMh9eFPmYgc0UDiWrQwvhxslzg0SwGEkgbJtjetci4nlVgkRqTQ== 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=TlfTRg2SLHSXtljkIY//M2ZoGYIBypYAcEXiE0IMHdw=; b=kJAkrBI+lxn1LVV/illPX/KtpfUywsk4p5xW5A2pnJJ8mgEvctAMojyOwCadnDAOW8y/HK9sB7TNKY0JiA3GZiryCwfPB8tbKk61Z+m6aR61L1Tr4vo57/BEH1r4LV3hpu3sf12Tb13ew8HcaSv6ohFf2JrnbpTpgmfrf9aMyL4= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM5PR11MB1897.namprd11.prod.outlook.com (2603:10b6:3:112::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Thu, 16 Sep 2021 15:21:25 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd%4]) with mapi id 15.20.4523.016; Thu, 16 Sep 2021 15:21:25 +0000 From: "Ananyev, Konstantin" To: Akhil Goyal , "dev@dpdk.org" CC: "anoobj@marvell.com" , "Nicolau, Radu" , "Doherty, Declan" , "hemant.agrawal@nxp.com" , "matan@nvidia.com" , "thomas@monjalon.net" , "Zhang, Roy Fan" , "asomalap@amd.com" , "ruifeng.wang@arm.com" , "ajit.khaparde@broadcom.com" , "De Lara Guarch, Pablo" , "Trahe, Fiona" , "adwivedi@marvell.com" , "michaelsh@marvell.com" , "rnagadheeraj@marvell.com" , "jianjay.zhou@huawei.com" , "jerinj@marvell.com" Thread-Topic: [PATCH 2/8] cryptodev: move inline APIs into separate structure Thread-Index: AQHXnNS1dcXJ73OS60SXMgcsaqLXpqum3rWg Date: Thu, 16 Sep 2021 15:21:24 +0000 Message-ID: References: <20210829125139.2173235-1-gakhil@marvell.com> <20210829125139.2173235-3-gakhil@marvell.com> In-Reply-To: <20210829125139.2173235-3-gakhil@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: 1ba759db-2aa9-4d2d-5136-08d97925a5d0 x-ms-traffictypediagnostic: DM5PR11MB1897: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:398; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IiBg5k3GLkJM9+vo5rTu3NCIJDJCI/cIt3niWwywEDndc15tRIXFhXY50cE6GeqYXOWYeZwY6Z1r9aC+PAhRaQbqtCNg0fXYh3VNPLHmWtpgdPY6g1C9wtqqKQrQJ4txf2Otpk/awhL/YZDqRz134AHa2irlbLcGEyndvXdZrA4WsiEZdlbDNHjMVI2Fbcxmq7uprn+5MQWiVRpYxLi9mJ1bz6wLU4UW2YV8fdXuzUfGn+N0sUyqh2gX3o4ojgyCU1j1X3akfD1PYhqBBXl9zxsyvRhmN7NH/nZqnAOa2YzeQeagqskXUYKL/S+ziEwYbZ94ZCCreAdr7RSBjNgDDzj3DFlSjfMcuHYi5u/+w3WvxQaCrixw0yD5JFdlhaNxBaLrr/o8GHJ/uDueeX/ttG9A3yMvHRmz0Wdn7iw1kxFjSi62ncRE1cSPpYVVAlgdWDH1ijhiWYEiqRm4C722otCufV1Qz8g5nQjAhqcLQ49scbZaczWIg2kxdoxfP0KFUE+cGswOk+MG15R1X3lAM7xiOQbl+FmEObUEs0ECzGJ5kdM851tgy35T5rJMFfCsjJoUBSJ/WUjrRY9vb2CrSSUeIFZ52gV/m5pByB6v1x1isb6DTFEYPjAc0Ur9tZyri9D0Ih/OWIgnoLVQo8AJzDAOKxjRkVsM6m7JA7cESnofiei7A+rK4Bx1S8xNPGKmoIwqvlCurc6aii+pQUTSYg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(346002)(39860400002)(136003)(366004)(6506007)(4326008)(83380400001)(2906002)(55016002)(9686003)(7696005)(55236004)(52536014)(478600001)(7416002)(66946007)(316002)(71200400001)(76116006)(86362001)(66556008)(110136005)(66476007)(66446008)(8676002)(64756008)(26005)(186003)(38070700005)(38100700002)(122000001)(5660300002)(54906003)(33656002)(8936002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?lw2sCBmiLaOoUybA748pZqyRIY2i0mJ5RA7qSVJsmU1vkSBNZi1CzbXFygLi?= =?us-ascii?Q?7d0h/0AEpRBfHjBRdivKC8yYXRKjkx0ClgH10U7FaCJDZQYdpTFACNhaU08g?= =?us-ascii?Q?B1o39juYssgR1Y6KIkZAyLgMjqVJ4Y3J3X9cs7b6A8jw4mACcNejm4ZS66Or?= =?us-ascii?Q?u+6HJ2tet1N0egiSkEEPk1FY8S409JPCqKAp51qpaREEry86XZ6THhme4OVY?= =?us-ascii?Q?uuXSV77fPVWOGM8tCHzwP+naQopm71n6SxJD75y0QKHNqjARq8ai2myOyDFO?= =?us-ascii?Q?0u+NN/l7O5+vAVe66v/IipxW64+VcJL8fCwMqIxkCqgY+3rhHzMI9LoguPss?= =?us-ascii?Q?CLOnndVYMURMiiwK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Nd/1ft17my1h+?= =?us-ascii?Q?Ym+P+fsw5p2Deu0QgkYkihgsZauTZkbj4ryp1GaveTIttAO5RJ1kpOKTsxA5?= =?us-ascii?Q?M0inTeGNeJc0ODg+Gb6Dn8GS?= 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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ba759db-2aa9-4d2d-5136-08d97925a5d0 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Sep 2021 15:21:25.0420 (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: HEJSrRe0V30Z+2K5UJS4h2fZ5OGGg3MnlQ9V232M/H+9zohf8jMx0um6UjpR6/FGpigAjEhLxwqEzkY3XSThASa/6Tno6zxIDHiAgA/G7oQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1897 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 2/8] cryptodev: move inline APIs into separate structure 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" Hi Akhil, Overall, looks good to me. Few comments below. Konstantin > Move fastpath inline function pointers from rte_cryptodev into a > separate structure accessed via a flat array. > The intension is to make rte_cryptodev and related structures private > to avoid future API/ABI breakages. >=20 > Signed-off-by: Akhil Goyal > --- > lib/cryptodev/cryptodev_pmd.c | 33 ++++++++++++++++++++++++++++++ > lib/cryptodev/cryptodev_pmd.h | 9 ++++++++ > lib/cryptodev/rte_cryptodev.c | 3 +++ > lib/cryptodev/rte_cryptodev_core.h | 19 +++++++++++++++++ > lib/cryptodev/version.map | 4 ++++ > 5 files changed, 68 insertions(+) >=20 > diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.= c > index 71e34140cd..46772dc355 100644 > --- a/lib/cryptodev/cryptodev_pmd.c > +++ b/lib/cryptodev/cryptodev_pmd.c > @@ -158,3 +158,36 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryp= todev) >=20 > return 0; > } > + > +static uint16_t > +dummy_crypto_enqueue_burst(__rte_unused uint8_t dev_id, > + __rte_unused uint8_t qp_id, > + __rte_unused struct rte_crypto_op **ops, > + __rte_unused uint16_t nb_ops) > +{ > + CDEV_LOG_ERR( > + "crypto enqueue burst requested for unconfigured crypto device"); > + return 0; > +} > + > +static uint16_t > +dummy_crypto_dequeue_burst(__rte_unused uint8_t dev_id, > + __rte_unused uint8_t qp_id, > + __rte_unused struct rte_crypto_op **ops, > + __rte_unused uint16_t nb_ops) > +{ > + CDEV_LOG_ERR( > + "crypto enqueue burst requested for unconfigured crypto device"); > + return 0; > +} > + > +void > +rte_cryptodev_api_reset(struct rte_cryptodev_api *api) > +{ > + static const struct rte_cryptodev_api dummy =3D { > + .enqueue_burst =3D dummy_crypto_enqueue_burst, > + .dequeue_burst =3D dummy_crypto_dequeue_burst, > + }; > + > + *api =3D dummy; > +} > diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.= h > index f775ba6beb..eeaea13a23 100644 > --- a/lib/cryptodev/cryptodev_pmd.h > +++ b/lib/cryptodev/cryptodev_pmd.h > @@ -520,6 +520,15 @@ RTE_INIT(init_ ##driver_id)\ > driver_id =3D rte_cryptodev_allocate_driver(&crypto_drv, &(drv));\ > } >=20 > +/** > + * Reset crypto device fastpath APIs to dummy values. > + * > + * @param The *api* pointer to reset. > + */ > +__rte_internal > +void > +rte_cryptodev_api_reset(struct rte_cryptodev_api *api); > + > static inline void * > get_sym_session_private_data(const struct rte_cryptodev_sym_session *ses= s, > uint8_t driver_id) { > diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.= c > index 9fa3aff1d3..26f8390668 100644 > --- a/lib/cryptodev/rte_cryptodev.c > +++ b/lib/cryptodev/rte_cryptodev.c > @@ -54,6 +54,9 @@ static struct rte_cryptodev_global cryptodev_globals = =3D { > .nb_devs =3D 0 > }; >=20 > +/* Public fastpath APIs. */ > +struct rte_cryptodev_api *rte_cryptodev_api; I think it has to be an statically allocated array: struct rte_cryptodev_api rte_cryptodev_api[RTE_CRYPTO_MAX_DEVS]; Other alternative would be to allocate space for it at some RTE_INIT() func= tion, but not sure is it really worth it. Another thing - to make things a bit more error prone - probably need to fill it with dummy pointers at RTE_INIT timeframe. Also, I think we need to call rte_cryptodev_api_reset() at=20 rte_cryptodev_pmd_destroy() or so. > + > /* spinlock for crypto device callbacks */ > static rte_spinlock_t rte_cryptodev_cb_lock =3D RTE_SPINLOCK_INITIALIZER= ; >=20 > diff --git a/lib/cryptodev/rte_cryptodev_core.h b/lib/cryptodev/rte_crypt= odev_core.h > index 1633e55889..ec38f70e0c 100644 > --- a/lib/cryptodev/rte_cryptodev_core.h > +++ b/lib/cryptodev/rte_cryptodev_core.h > @@ -25,6 +25,25 @@ typedef uint16_t (*enqueue_pkt_burst_t)(void *qp, > struct rte_crypto_op **ops, uint16_t nb_ops); > /**< Enqueue packets for processing on queue pair of a device. */ >=20 > +typedef uint16_t (*rte_crypto_dequeue_burst_t)(uint8_t dev_id, uint8_t q= p_id, > + struct rte_crypto_op **ops, > + uint16_t nb_ops); > +/**< @internal Dequeue processed packets from queue pair of a device. */ > +typedef uint16_t (*rte_crypto_enqueue_burst_t)(uint8_t dev_id, uint8_t q= p_id, > + struct rte_crypto_op **ops, > + uint16_t nb_ops); > +/**< @internal Enqueue packets for processing on queue pair of a device.= */ > + > +struct rte_cryptodev_api { > + rte_crypto_enqueue_burst_t enqueue_burst; > + /**< PMD enqueue burst function. */ > + rte_crypto_dequeue_burst_t dequeue_burst; > + /**< PMD dequeue burst function. */ > + uintptr_t reserved[6]; > +} __rte_cache_aligned; > + > +extern struct rte_cryptodev_api *rte_cryptodev_api; > + > /** > * @internal > * The data part, with no function pointers, associated with each device= . > diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map > index 2fdf70002d..050089ae55 100644 > --- a/lib/cryptodev/version.map > +++ b/lib/cryptodev/version.map > @@ -57,6 +57,9 @@ DPDK_22 { > rte_cryptodev_sym_session_init; > rte_cryptodevs; >=20 > + #added in 21.11 > + rte_cryptodev_api; > + > local: *; > }; >=20 > @@ -114,6 +117,7 @@ INTERNAL { > global: >=20 > rte_cryptodev_allocate_driver; > + rte_cryptodev_api_reset; > rte_cryptodev_pmd_allocate; > rte_cryptodev_pmd_callback_process; > rte_cryptodev_pmd_create; > -- > 2.25.1