From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 65121DD2 for ; Mon, 30 Apr 2018 13:15:11 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2018 04:15:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,346,1520924400"; d="scan'208";a="224482906" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by fmsmga005.fm.intel.com with ESMTP; 30 Apr 2018 04:15:07 -0700 Received: from pgsmsx102.gar.corp.intel.com ([169.254.6.245]) by KMSMSX151.gar.corp.intel.com ([169.254.10.3]) with mapi id 14.03.0319.002; Mon, 30 Apr 2018 19:15:06 +0800 From: "Gujjar, Abhinandan S" To: Jerin Jacob CC: "hemant.agrawal@nxp.com" , "akhil.goyal@nxp.com" , "dev@dpdk.org" , "Vangati, Narender" , "Rao, Nikhil" , "Eads, Gage" Thread-Topic: [v2,2/6] eventdev: add APIs and PMD callbacks for crypto adapter Thread-Index: AQHT28ndBpk3/sZ8YE+RCPEMIk01eqQXbI8AgAHESlA= Date: Mon, 30 Apr 2018 11:15:06 +0000 Message-ID: <5612CB344B05EE4F95FC5B729939F78070700DC9@PGSMSX102.gar.corp.intel.com> References: <1524573807-168522-1-git-send-email-abhinandan.gujjar@intel.com> <1524573807-168522-3-git-send-email-abhinandan.gujjar@intel.com> <20180429161417.GB11546@jerin> In-Reply-To: <20180429161417.GB11546@jerin> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjJmMmYzZjctNDRmNy00NjFkLWFlNzktODk4Yzk5NjU2MjlkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ikx6KzBOcHpPeW5TTnQrektPQzJtWm85TlFYVmpPS2E5b1JMWWduUWJuTkE9In0= dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [172.30.20.205] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [v2, 2/6] eventdev: add APIs and PMD callbacks for crypto adapter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 11:15:13 -0000 > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Sunday, April 29, 2018 9:44 PM > To: Gujjar, Abhinandan S > Cc: hemant.agrawal@nxp.com; akhil.goyal@nxp.com; dev@dpdk.org; Vangati, > Narender ; Rao, Nikhil = ; > Eads, Gage > Subject: Re: [v2,2/6] eventdev: add APIs and PMD callbacks for crypto ada= pter >=20 > -----Original Message----- > > Date: Tue, 24 Apr 2018 18:13:23 +0530 > > From: Abhinandan Gujjar > > To: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, > > akhil.goyal@nxp.com, dev@dpdk.org > > CC: narender.vangati@intel.com, abhinandan.gujjar@intel.com, > > nikhil.rao@intel.com, gage.eads@intel.com > > Subject: [v2,2/6] eventdev: add APIs and PMD callbacks for crypto > > adapter > > X-Mailer: git-send-email 1.9.1 > > > > Signed-off-by: Abhinandan Gujjar > > --- > > drivers/event/sw/sw_evdev.c | 13 +++ > > lib/librte_eventdev/rte_eventdev.c | 25 +++++ > > lib/librte_eventdev/rte_eventdev.h | 52 +++++++++ > > lib/librte_eventdev/rte_eventdev_pmd.h | 189 > > +++++++++++++++++++++++++++++++++ > > 4 files changed, 279 insertions(+) > > > > diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c > > index dcb6551..10f0e1a 100644 > > --- a/drivers/event/sw/sw_evdev.c > > +++ b/drivers/event/sw/sw_evdev.c > > @@ -480,6 +480,17 @@ > > return 0; > > } > > > > +static int > > +sw_crypto_adapter_caps_get(const struct rte_eventdev *dev, > > + const struct rte_cryptodev *cdev, > > + uint32_t *caps) > > +{ > > + RTE_SET_USED(dev); > > + RTE_SET_USED(cdev); > > + *caps =3D RTE_EVENT_CRYPTO_ADAPTER_SW_CAP; > > + return 0; > > +} > > + > > static void > > sw_info_get(struct rte_eventdev *dev, struct rte_event_dev_info > > *info) { @@ -809,6 +820,8 @@ static int32_t > > sw_sched_service_func(void *args) > > > > .timer_adapter_caps_get =3D > sw_timer_adapter_caps_get, > > > > + .crypto_adapter_caps_get =3D > sw_crypto_adapter_caps_get, > > + > > .xstats_get =3D sw_xstats_get, > > .xstats_get_names =3D sw_xstats_get_names, > > .xstats_get_by_name =3D sw_xstats_get_by_name, diff -- > git > > a/lib/librte_eventdev/rte_eventdev.c > > b/lib/librte_eventdev/rte_eventdev.c > > index 3f016f4..7ca9fd1 100644 > > --- a/lib/librte_eventdev/rte_eventdev.c > > +++ b/lib/librte_eventdev/rte_eventdev.c > > @@ -29,6 +29,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > > > #include "rte_eventdev.h" > > #include "rte_eventdev_pmd.h" > > @@ -145,6 +147,29 @@ > > : 0; > > } > > > > +int __rte_experimental > > +rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id, > > + uint32_t *caps) > > +{ > > + struct rte_eventdev *dev; > > + struct rte_cryptodev *cdev; > > + > > + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); > > + if (!rte_cryptodev_pmd_is_valid_dev(cdev_id)) > > + return -EINVAL; > > + > > + dev =3D &rte_eventdevs[dev_id]; > > + cdev =3D rte_cryptodev_pmd_get_dev(cdev_id); > > + > > + if (caps =3D=3D NULL) > > + return -EINVAL; > > + *caps =3D 0; > > + > > + return dev->dev_ops->crypto_adapter_caps_get ? > > + (*dev->dev_ops->crypto_adapter_caps_get) > > + (dev, cdev, caps) : -ENOTSUP; > > +} > > + > > static inline int > > rte_event_dev_queue_config(struct rte_eventdev *dev, uint8_t > > nb_queues) { diff --git a/lib/librte_eventdev/rte_eventdev.h > > b/lib/librte_eventdev/rte_eventdev.h > > index 8297f24..9822747 100644 > > --- a/lib/librte_eventdev/rte_eventdev.h > > +++ b/lib/librte_eventdev/rte_eventdev.h > > @@ -8,6 +8,8 @@ > > #ifndef _RTE_EVENTDEV_H_ > > #define _RTE_EVENTDEV_H_ > > > > +#include > > + > > /** > > * @file > > * > > @@ -1135,6 +1137,56 @@ struct rte_event { int __rte_experimental > > rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps); > > > > +/* Crypto adapter capability bitmap flag */ > > +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW > 0x1 > > +/**< Flag indicates HW is capable of generating events. >=20 > events in RTE_EVENT_OP_NEW enqueue operation Ok >=20 > > + * Cryptodev will send packets to the event device as new events > > + * using an internal event port. > > + */ > > + > > +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD > 0x2 > > +/**< Flag indicates HW is capable of generating events. >=20 > events in RTE_EVENT_OP_FWD enqueue operation Ok >=20 > > + * Cryptodev will send packets to the event device as forwarded event > > + * using an internal event port. > > + */ > > + > > +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND > 0x4 > > +/**< Flag indicates HW is capable of mapping crypto queue pair to > > + * event queue. > > + */ > > + > > +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA 0x8 > > +/**< Flag indicates HW/SW suports a mechanism to store and retrieve > > + * the private data information along with the crypto session. > > + */ > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice > > + * > > + * Retrieve the event device's crypto adapter capabilities for the > > + * specified cryptodev device > > + * > > + * @param dev_id > > + * The identifier of the device. > > + * > > + * @param cdev_id > > + * The identifier of the cryptodev device. > > + * > > + * @param[out] caps > > + * A pointer to memory filled with event adapter capabilities. > > + * It is expected to be pre-allocated & initialized by caller. > > + * > > + * @return > > + * - 0: Success, driver provides event adapter capabilities for the > > + * cryptodev device. > > + * - <0: Error code returned by the driver function. > > + * > > + */ > > +int __rte_experimental > > +rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id, > > + uint32_t *caps); > > + > > struct rte_eventdev_ops; > > struct rte_eventdev; > > > > diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h > > b/lib/librte_eventdev/rte_eventdev_pmd.h > > index 2dcb528..739b984 100644 > > --- a/lib/librte_eventdev/rte_eventdev_pmd.h > > +++ b/lib/librte_eventdev/rte_eventdev_pmd.h > > @@ -70,6 +70,9 @@ > > ((RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) | \ > > > (RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ)) > > > > +#define RTE_EVENT_CRYPTO_ADAPTER_SW_CAP \ > > + RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA > > + > > /**< Ethernet Rx adapter cap to return If the packet transfers from > > * the ethdev to eventdev use a SW service function > > */ > > @@ -617,6 +620,177 @@ typedef int > (*eventdev_eth_rx_adapter_stats_reset) > > */ > > typedef int (*eventdev_selftest)(void); > > > > + > > +struct rte_cryptodev; > > +struct rte_event_crypto_queue_pair_conf *conf; >=20 > Can we get rid of this conf global variable? Sure, I will replace the conf with rte_event to configure qps. >=20 > > + > > +/** > > + * This API may change without prior notice > > + * > > + * Retrieve the event device's crypto adapter capabilities for the > > + * specified cryptodev > > + * > > + * @param dev > > + * Event device pointer > > + * > > + * @param cdev > > + * cryptodev pointer > > + * > > + * @param[out] caps > > + * A pointer to memory filled with event adapter capabilities. > > + * It is expected to be pre-allocated & initialized by caller. > > + * > > + * @return > > + * - 0: Success, driver provides event adapter capabilities for the > > + * cryptodev. > > + * - <0: Error code returned by the driver function. > > + * > > + */ > > +typedef int (*eventdev_crypto_adapter_caps_get_t) > > + (const struct rte_eventdev *dev, > > + const struct rte_cryptodev *cdev, > > + uint32_t *caps); > > + > > +/** > > + * This API may change without prior notice > > + * > > + * Add crypto queue pair to event device. This callback is invoked if > > + * the caps returned from rte_event_crypto_adapter_caps_get(, > > +cdev_id) > > + * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set. > > + * > > + * @param dev > > + * Event device pointer > > + * > > + * @param cdev > > + * cryptodev pointer > > + * > > + * @param queue_pair_id > > + * cryptodev queue pair identifier. > > + * > > + * @param conf > > + * Additional configuration structure of type > > + * *rte_event_crypto_queue_pair_conf*. > > + * This structure will have a valid value for only those HW PMDs > > +supporting > > + * @see > RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND capability. Ok > > + * > > + * @return > > + * - 0: Success, cryptodev queue pair added successfully. > > + * - <0: Error code returned by the driver function. > > + * > > + */ > > +typedef int (*eventdev_crypto_adapter_queue_pair_add_t) > > + (const struct rte_eventdev *dev, > > + const struct rte_cryptodev *cdev, > > + int32_t queue_pair_id, > > + const struct rte_event_crypto_queue_pair_conf > *conf); > > + > > + > > +/** > > + * This API may change without prior notice > > + * > > + * Delete crypto queue pair to event device. This callback is invoked > > +if > > + * the caps returned from rte_event_crypto_adapter_caps_get(, > > +cdev_id) > > + * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set. > > + * > > + * @param dev > > + * Event device pointer > > + * > > + * @param cdev > > + * cryptodev pointer > > + * > > + * @param queue_pair_id > > + * cryptodev queue pair identifier. > > + * > > + * @return > > + * - 0: Success, cryptodev queue pair deleted successfully. > > + * - <0: Error code returned by the driver function. > > + * > > + */ > > +typedef int (*eventdev_crypto_adapter_queue_pair_del_t) > > + (const struct rte_eventdev *dev, > > + const struct rte_cryptodev *cdev, > > + int32_t queue_pair_id); > > + > > +/** > > + * Start crypto adapter. This callback is invoked if > > + * the caps returned from rte_event_crypto_adapter_caps_get(.., > > +cdev_id) > > + * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set and > queue > > +pairs > > + * from cdev_id have been added to the event device. > > + * > > + * @param dev > > + * Event device pointer > > + * > > + * @param cdev > > + * Crypto device pointer > > + * > > + * @return > > + * - 0: Success, crypto adapter started successfully. > > + * - <0: Error code returned by the driver function. > > + */ > > +typedef int (*eventdev_crypto_adapter_start_t) > > + (const struct rte_eventdev *dev, > > + const struct rte_cryptodev *cdev); > > + > > +/** > > + * Stop crypto adapter. This callback is invoked if > > + * the caps returned from rte_event_crypto_adapter_caps_get(.., > > +cdev_id) > > + * has RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_* set and > queue > > +pairs > > + * from cdev_id have been added to the event device. > > + * > > + * @param dev > > + * Event device pointer > > + * > > + * @param cdev > > + * Crypto device pointer > > + * > > + * @return > > + * - 0: Success, crypto adapter stopped successfully. > > + * - <0: Error code returned by the driver function. > > + */ > > +typedef int (*eventdev_crypto_adapter_stop_t) > > + (const struct rte_eventdev *dev, > > + const struct rte_cryptodev *cdev); > > + > > +struct rte_event_crypto_adapter_stats; > > + > > +/** > > + * Retrieve crypto adapter statistics. > > + * > > + * @param dev > > + * Event device pointer > > + * > > + * @param cdev > > + * Crypto device pointer > > + * > > + * @param[out] stats > > + * Pointer to stats structure > > + * > > + * @return > > + * Return 0 on success. > > + */ > > + > > +typedef int (*eventdev_crypto_adapter_stats_get) > > + (const struct rte_eventdev *dev, > > + const struct rte_cryptodev *cdev, > > + struct rte_event_crypto_adapter_stats *stats); > > + > > +/** > > + * Reset crypto adapter statistics. > > + * > > + * @param dev > > + * Event device pointer > > + * > > + * @param cdev > > + * Crypto device pointer > > + * > > + * @return > > + * Return 0 on success. > > + */ > > + > > +typedef int (*eventdev_crypto_adapter_stats_reset) > > + (const struct rte_eventdev *dev, > > + const struct rte_cryptodev *cdev); > > + > > /** Event device operations function pointer table */ struct > > rte_eventdev_ops { > > eventdev_info_get_t dev_infos_get; /**< Get device info. */ > > @@ -675,6 +849,21 @@ struct rte_eventdev_ops { > > eventdev_timer_adapter_caps_get_t timer_adapter_caps_get; > > /**< Get timer adapter capabilities */ > > > > + eventdev_crypto_adapter_caps_get_t crypto_adapter_caps_get; > > + /**< Get crypto adapter capabilities */ > > + eventdev_crypto_adapter_queue_pair_add_t > crypto_adapter_queue_pair_add; > > + /**< Add queue pair to crypto adapter */ > > + eventdev_crypto_adapter_queue_pair_del_t > crypto_adapter_queue_pair_del; > > + /**< Delete queue pair from crypto adapter */ > > + eventdev_crypto_adapter_start_t crypto_adapter_start; > > + /**< Start crypto adapter */ > > + eventdev_crypto_adapter_stop_t crypto_adapter_stop; > > + /**< Stop crypto adapter */ > > + eventdev_crypto_adapter_stats_get crypto_adapter_stats_get; > > + /**< Get crypto stats */ > > + eventdev_crypto_adapter_stats_reset crypto_adapter_stats_reset; > > + /**< Reset crypto stats */ > > + > > eventdev_selftest dev_selftest; > > /**< Start eventdev Selftest */ > > > > -- > > 1.9.1 > >