* [dpdk-dev] [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for crypto adapter @ 2018-04-04 6:56 Abhinandan Gujjar 2018-04-10 6:07 ` Jerin Jacob 2018-04-10 10:37 ` Akhil Goyal 0 siblings, 2 replies; 5+ messages in thread From: Abhinandan Gujjar @ 2018-04-04 6:56 UTC (permalink / raw) To: jerin.jacob, hemant.agrawal, akhil.goyal, dev Cc: pablo.de.lara.guarch, declan.doherty, narender.vangati, abhinandan.gujjar, nikhil.rao Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com> --- lib/librte_eventdev/rte_eventdev.c | 25 +++++ lib/librte_eventdev/rte_eventdev.h | 35 +++++++ lib/librte_eventdev/rte_eventdev_pmd.h | 176 +++++++++++++++++++++++++++++++++ 3 files changed, 236 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 2de8d9a..3d24e8f 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -29,6 +29,8 @@ #include <rte_malloc.h> #include <rte_errno.h> #include <rte_ethdev.h> +#include <rte_cryptodev.h> +#include <rte_cryptodev_pmd.h> #include "rte_eventdev.h" #include "rte_eventdev_pmd.h" @@ -123,6 +125,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 = &rte_eventdevs[dev_id]; + cdev = rte_cryptodev_pmd_get_dev(cdev_id); + + if (caps == NULL) + return -EINVAL; + *caps = 0; + + return dev->dev_ops->crypto_adapter_caps_get ? + (*dev->dev_ops->crypto_adapter_caps_get) + (dev, cdev, caps) : 0; +} + 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 a20077c..49a71d1 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -35,6 +35,8 @@ #ifndef _RTE_EVENTDEV_H_ #define _RTE_EVENTDEV_H_ +#include <rte_compat.h> + /** * @file * @@ -1142,6 +1144,39 @@ struct rte_event { rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id, uint32_t *caps); + +/* Crypto adapter capability bitmap flag */ +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT 0x1 +/**< Flag indicates HW is capable of generating events. + * Cryptodev can send packets to the event device using an internal event port. + */ + +/** + * @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. + * + * @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_driver; 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 3a8ddd7..656d160 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -585,6 +585,167 @@ typedef int (*eventdev_eth_rx_adapter_stats_reset) */ typedef int (*eventdev_selftest)(void); + +struct rte_cryptodev; +/** + * 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. + * + * @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[out] queue_pair_id + * cryptodev queue pair indentifier. + * + * @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); + + +/** + * 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[out] queue_pair_id + * cryptodev queue pair indentifier. + * + * @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. */ @@ -640,6 +801,21 @@ struct rte_eventdev_ops { eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset; /**< Reset ethernet Rx stats */ + 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for crypto adapter 2018-04-04 6:56 [dpdk-dev] [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for crypto adapter Abhinandan Gujjar @ 2018-04-10 6:07 ` Jerin Jacob 2018-04-12 6:28 ` Gujjar, Abhinandan S 2018-04-10 10:37 ` Akhil Goyal 1 sibling, 1 reply; 5+ messages in thread From: Jerin Jacob @ 2018-04-10 6:07 UTC (permalink / raw) To: Abhinandan Gujjar Cc: hemant.agrawal, akhil.goyal, dev, pablo.de.lara.guarch, declan.doherty, narender.vangati, nikhil.rao, Nidadavolu.Murthy, NarayanaPrasad.Athreya -----Original Message----- > Date: Wed, 4 Apr 2018 12:26:18 +0530 > From: Abhinandan Gujjar <abhinandan.gujjar@intel.com> > To: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, > akhil.goyal@nxp.com, dev@dpdk.org > CC: pablo.de.lara.guarch@intel.com, declan.doherty@intel.com, > narender.vangati@intel.com, abhinandan.gujjar@intel.com, > nikhil.rao@intel.com > Subject: [dpdk-dev,v1,1/5] eventdev: add caps API and PMD callbacks for > crypto adapter > X-Mailer: git-send-email 1.9.1 > > Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com> > --- > lib/librte_eventdev/rte_eventdev.c | 25 +++++ > lib/librte_eventdev/rte_eventdev.h | 35 +++++++ > lib/librte_eventdev/rte_eventdev_pmd.h | 176 +++++++++++++++++++++++++++++++++ > 3 files changed, 236 insertions(+) > > diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c > index 2de8d9a..3d24e8f 100644 > --- a/lib/librte_eventdev/rte_eventdev.c > +++ b/lib/librte_eventdev/rte_eventdev.c > @@ -29,6 +29,8 @@ > #include <rte_malloc.h> > #include <rte_errno.h> > #include <rte_ethdev.h> > +#include <rte_cryptodev.h> > +#include <rte_cryptodev_pmd.h> > > #include "rte_eventdev.h" > #include "rte_eventdev_pmd.h" > @@ -123,6 +125,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 = &rte_eventdevs[dev_id]; > + cdev = rte_cryptodev_pmd_get_dev(cdev_id); > + > + if (caps == NULL) > + return -EINVAL; > + *caps = 0; > + > + return dev->dev_ops->crypto_adapter_caps_get ? > + (*dev->dev_ops->crypto_adapter_caps_get) > + (dev, cdev, caps) : 0; > +} > + > 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 a20077c..49a71d1 100644 > --- a/lib/librte_eventdev/rte_eventdev.h > +++ b/lib/librte_eventdev/rte_eventdev.h > @@ -35,6 +35,8 @@ > #ifndef _RTE_EVENTDEV_H_ > #define _RTE_EVENTDEV_H_ > > +#include <rte_compat.h> > + > /** > * @file > * > @@ -1142,6 +1144,39 @@ struct rte_event { > rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id, > uint32_t *caps); > > + > +/* Crypto adapter capability bitmap flag */ > +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT 0x1 > +/**< Flag indicates HW is capable of generating events. > + * Cryptodev can send packets to the event device using an internal event port. > + */ Some top level comments, 1) Since we are not planning to abstract RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ mode inside the adapter, I think, it make sense to introduce new capability. ie. In some of the HW implementation, We could maintain the packet order even if source queue/scheded_type is ORDERED. ie. if the capability is set then application can use RTE_EVENT_CRYPTO_ADAPTER_DEQ_ONLY to maintain the ingress order even if it is been called from multiple CPU in ORDERED/ATOMIC context instead of using RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ mode. 2) Please split the 2/5 to patch specification and implementation 3) I think, we need to give a example code snippet in the programmer guide on how to use RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ mode in conjunction with rte_event_crypto_adapter_event_port_get(). Let me know your views? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for crypto adapter 2018-04-10 6:07 ` Jerin Jacob @ 2018-04-12 6:28 ` Gujjar, Abhinandan S 0 siblings, 0 replies; 5+ messages in thread From: Gujjar, Abhinandan S @ 2018-04-12 6:28 UTC (permalink / raw) To: Jerin Jacob Cc: hemant.agrawal, akhil.goyal, dev, De Lara Guarch, Pablo, Doherty, Declan, Vangati, Narender, Rao, Nikhil, Nidadavolu.Murthy, NarayanaPrasad.Athreya Hi Jerin, Please find some comments inline > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Tuesday, April 10, 2018 11:38 AM > To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com> > Cc: hemant.agrawal@nxp.com; akhil.goyal@nxp.com; dev@dpdk.org; De Lara > Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty, Declan > <declan.doherty@intel.com>; Vangati, Narender > <narender.vangati@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>; > Nidadavolu.Murthy@cavium.com; NarayanaPrasad.Athreya@cavium.com > Subject: Re: [dpdk-dev,v1,1/5] eventdev: add caps API and PMD callbacks for > crypto adapter > > -----Original Message----- > > Date: Wed, 4 Apr 2018 12:26:18 +0530 > > From: Abhinandan Gujjar <abhinandan.gujjar@intel.com> > > To: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, > > akhil.goyal@nxp.com, dev@dpdk.org > > CC: pablo.de.lara.guarch@intel.com, declan.doherty@intel.com, > > narender.vangati@intel.com, abhinandan.gujjar@intel.com, > > nikhil.rao@intel.com > > Subject: [dpdk-dev,v1,1/5] eventdev: add caps API and PMD callbacks > > for crypto adapter > > X-Mailer: git-send-email 1.9.1 > > > > Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com> > > --- > > lib/librte_eventdev/rte_eventdev.c | 25 +++++ > > lib/librte_eventdev/rte_eventdev.h | 35 +++++++ > > lib/librte_eventdev/rte_eventdev_pmd.h | 176 > > +++++++++++++++++++++++++++++++++ > > 3 files changed, 236 insertions(+) > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c > > b/lib/librte_eventdev/rte_eventdev.c > > index 2de8d9a..3d24e8f 100644 > > --- a/lib/librte_eventdev/rte_eventdev.c > > +++ b/lib/librte_eventdev/rte_eventdev.c > > @@ -29,6 +29,8 @@ > > #include <rte_malloc.h> > > #include <rte_errno.h> > > #include <rte_ethdev.h> > > +#include <rte_cryptodev.h> > > +#include <rte_cryptodev_pmd.h> > > > > #include "rte_eventdev.h" > > #include "rte_eventdev_pmd.h" > > @@ -123,6 +125,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 = &rte_eventdevs[dev_id]; > > + cdev = rte_cryptodev_pmd_get_dev(cdev_id); > > + > > + if (caps == NULL) > > + return -EINVAL; > > + *caps = 0; > > + > > + return dev->dev_ops->crypto_adapter_caps_get ? > > + (*dev->dev_ops->crypto_adapter_caps_get) > > + (dev, cdev, caps) : 0; > > +} > > + > > 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 a20077c..49a71d1 100644 > > --- a/lib/librte_eventdev/rte_eventdev.h > > +++ b/lib/librte_eventdev/rte_eventdev.h > > @@ -35,6 +35,8 @@ > > #ifndef _RTE_EVENTDEV_H_ > > #define _RTE_EVENTDEV_H_ > > > > +#include <rte_compat.h> > > + > > /** > > * @file > > * > > @@ -1142,6 +1144,39 @@ struct rte_event { > > rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id, > > uint32_t *caps); > > > > + > > +/* Crypto adapter capability bitmap flag */ > > +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT 0x1 > > +/**< Flag indicates HW is capable of generating events. > > + * Cryptodev can send packets to the event device using an internal event > port. > > + */ > > Some top level comments, > > 1) Since we are not planning to abstract > RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ mode inside the adapter, I think, it > make sense to introduce new capability. ie. In some of the HW implementation, > We could maintain the packet order even if source queue/scheded_type is > ORDERED. ie. if the capability is set then application can use > RTE_EVENT_CRYPTO_ADAPTER_DEQ_ONLY to maintain the ingress order even > if it is been called from multiple CPU in ORDERED/ATOMIC context instead of > using RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ mode. Sure. I will add ENQ-DEQ into caps. > > 2) Please split the 2/5 to patch specification and implementation Ok > > 3) I think, we need to give a example code snippet in the programmer guide on > how to use RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ mode in conjunction with > rte_event_crypto_adapter_event_port_get(). I have added a test case in the test app to show usage of rte_event_crypto_adapter_event_port_get(). I will update the programmer guide too. Regards Abhinandan > > Let me know your views? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for crypto adapter 2018-04-04 6:56 [dpdk-dev] [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for crypto adapter Abhinandan Gujjar 2018-04-10 6:07 ` Jerin Jacob @ 2018-04-10 10:37 ` Akhil Goyal 2018-04-12 6:47 ` Gujjar, Abhinandan S 1 sibling, 1 reply; 5+ messages in thread From: Akhil Goyal @ 2018-04-10 10:37 UTC (permalink / raw) To: Abhinandan Gujjar, jerin.jacob, hemant.agrawal, dev Cc: pablo.de.lara.guarch, declan.doherty, narender.vangati, nikhil.rao It would be good if we have a cover letter and description in the commit message. The patchset does not apply on eventdev subtree. Could you please rebase. I think there is a need to add struct rte_crypto_op in the rte_event word 1 union as you are adding crypto event. All crypto drivers would process crypto op and not mbuf. Also, I guess the patchset is dependent on another patchset. Please mention that also in the cover letter. On 4/4/2018 12:26 PM, Abhinandan Gujjar wrote: > Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com> > --- > lib/librte_eventdev/rte_eventdev.c | 25 +++++ > lib/librte_eventdev/rte_eventdev.h | 35 +++++++ > lib/librte_eventdev/rte_eventdev_pmd.h | 176 +++++++++++++++++++++++++++++++++ > 3 files changed, 236 insertions(+) > > diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c > index 2de8d9a..3d24e8f 100644 > --- a/lib/librte_eventdev/rte_eventdev.c > +++ b/lib/librte_eventdev/rte_eventdev.c > @@ -29,6 +29,8 @@ > #include <rte_malloc.h> > #include <rte_errno.h> > #include <rte_ethdev.h> > +#include <rte_cryptodev.h> > +#include <rte_cryptodev_pmd.h> > > #include "rte_eventdev.h" > #include "rte_eventdev_pmd.h" > @@ -123,6 +125,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 = &rte_eventdevs[dev_id]; > + cdev = rte_cryptodev_pmd_get_dev(cdev_id); > + > + if (caps == NULL) > + return -EINVAL; It is expected that caps memory is initialized by the caller. This should be mentioned in the description of the API. > + *caps = 0; > + > + return dev->dev_ops->crypto_adapter_caps_get ? > + (*dev->dev_ops->crypto_adapter_caps_get) > + (dev, cdev, caps) : 0; It should be -ENOTSUP instead of 0. I think same needs to be corrected for eth rx adapter. > +} > + > 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 a20077c..49a71d1 100644 > --- a/lib/librte_eventdev/rte_eventdev.h > +++ b/lib/librte_eventdev/rte_eventdev.h > @@ -35,6 +35,8 @@ > #ifndef _RTE_EVENTDEV_H_ > #define _RTE_EVENTDEV_H_ > > +#include <rte_compat.h> > + > /** > * @file > * > @@ -1142,6 +1144,39 @@ struct rte_event { > rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id, > uint32_t *caps); > > + > +/* Crypto adapter capability bitmap flag */ > +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT 0x1 > +/**< Flag indicates HW is capable of generating events. > + * Cryptodev can send packets to the event device using an internal event port. > + */ > + > +/** > + * @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. > + * > + * @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_driver; > 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 3a8ddd7..656d160 100644 > --- a/lib/librte_eventdev/rte_eventdev_pmd.h > +++ b/lib/librte_eventdev/rte_eventdev_pmd.h > @@ -585,6 +585,167 @@ typedef int (*eventdev_eth_rx_adapter_stats_reset) > */ > typedef int (*eventdev_selftest)(void); > > + > +struct rte_cryptodev; > +/** > + * 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. > + * > + * @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[out] queue_pair_id > + * cryptodev queue pair indentifier. spell check. > + * > + * @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); > + > + > +/** > + * 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[out] queue_pair_id > + * cryptodev queue pair indentifier. spell check > + * > + * @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. */ > @@ -640,6 +801,21 @@ struct rte_eventdev_ops { > eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset; > /**< Reset ethernet Rx stats */ > > + 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 */ > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for crypto adapter 2018-04-10 10:37 ` Akhil Goyal @ 2018-04-12 6:47 ` Gujjar, Abhinandan S 0 siblings, 0 replies; 5+ messages in thread From: Gujjar, Abhinandan S @ 2018-04-12 6:47 UTC (permalink / raw) To: Akhil Goyal, jerin.jacob, hemant.agrawal, dev Cc: De Lara Guarch, Pablo, Doherty, Declan, Vangati, Narender, Rao, Nikhil > -----Original Message----- > From: Akhil Goyal [mailto:akhil.goyal@nxp.com] > Sent: Tuesday, April 10, 2018 4:07 PM > To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; > jerin.jacob@caviumnetworks.com; hemant.agrawal@nxp.com; dev@dpdk.org > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty, Declan > <declan.doherty@intel.com>; Vangati, Narender > <narender.vangati@intel.com>; Rao, Nikhil <nikhil.rao@intel.com> > Subject: Re: [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for > crypto adapter > > It would be good if we have a cover letter and description in the commit > message. Sure.. > > The patchset does not apply on eventdev subtree. Could you please rebase. All the patches were based on " dpdk-next-eventdev ". > > I think there is a need to add struct rte_crypto_op in the rte_event word 1 union > as you are adding crypto event. All crypto drivers would process crypto op and > not mbuf. The " event_ptr" of *rte_event* will point to *rte_crypto_op* from application side. From adapter side, the same is extracted using "crypto_op = ev[i].event_ptr". Please refer adapter implementation and test/test/.c files & review them too. > > Also, I guess the patchset is dependent on another patchset. Please mention > that also in the cover letter. You mean cryptodev? If yes, sure.. > > On 4/4/2018 12:26 PM, Abhinandan Gujjar wrote: > > Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com> > > --- > > lib/librte_eventdev/rte_eventdev.c | 25 +++++ > > lib/librte_eventdev/rte_eventdev.h | 35 +++++++ > > lib/librte_eventdev/rte_eventdev_pmd.h | 176 > +++++++++++++++++++++++++++++++++ > > 3 files changed, 236 insertions(+) > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c > > b/lib/librte_eventdev/rte_eventdev.c > > index 2de8d9a..3d24e8f 100644 > > --- a/lib/librte_eventdev/rte_eventdev.c > > +++ b/lib/librte_eventdev/rte_eventdev.c > > @@ -29,6 +29,8 @@ > > #include <rte_malloc.h> > > #include <rte_errno.h> > > #include <rte_ethdev.h> > > +#include <rte_cryptodev.h> > > +#include <rte_cryptodev_pmd.h> > > > > #include "rte_eventdev.h" > > #include "rte_eventdev_pmd.h" > > @@ -123,6 +125,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 = &rte_eventdevs[dev_id]; > > + cdev = rte_cryptodev_pmd_get_dev(cdev_id); > > + > > + if (caps == NULL) > > + return -EINVAL; > It is expected that caps memory is initialized by the caller. This should be > mentioned in the description of the API. Ok > > + *caps = 0; > > + > > + return dev->dev_ops->crypto_adapter_caps_get ? > > + (*dev->dev_ops->crypto_adapter_caps_get) > > + (dev, cdev, caps) : 0; > > It should be -ENOTSUP instead of 0. I think same needs to be corrected for eth > rx adapter. Ok. I will update this in the crypto caps API. > > > +} > > + > > 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 a20077c..49a71d1 100644 > > --- a/lib/librte_eventdev/rte_eventdev.h > > +++ b/lib/librte_eventdev/rte_eventdev.h > > @@ -35,6 +35,8 @@ > > #ifndef _RTE_EVENTDEV_H_ > > #define _RTE_EVENTDEV_H_ > > > > +#include <rte_compat.h> > > + > > /** > > * @file > > * > > @@ -1142,6 +1144,39 @@ struct rte_event { > > rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id, > > uint32_t *caps); > > > > + > > +/* Crypto adapter capability bitmap flag */ > > +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT 0x1 > > +/**< Flag indicates HW is capable of generating events. > > + * Cryptodev can send packets to the event device using an internal event > port. > > + */ > > + > > +/** > > + * @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. > > + * > > + * @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_driver; > > 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 3a8ddd7..656d160 100644 > > --- a/lib/librte_eventdev/rte_eventdev_pmd.h > > +++ b/lib/librte_eventdev/rte_eventdev_pmd.h > > @@ -585,6 +585,167 @@ typedef int > (*eventdev_eth_rx_adapter_stats_reset) > > */ > > typedef int (*eventdev_selftest)(void); > > > > + > > +struct rte_cryptodev; > > +/** > > + * 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. > > + * > > + * @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[out] queue_pair_id > > + * cryptodev queue pair indentifier. > spell check. 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); > > + > > + > > +/** > > + * 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[out] queue_pair_id > > + * cryptodev queue pair indentifier. > spell check Ok > > + * > > + * @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. */ > > @@ -640,6 +801,21 @@ struct rte_eventdev_ops { > > eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset; > > /**< Reset ethernet Rx stats */ > > > > + 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 */ > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-12 6:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-04-04 6:56 [dpdk-dev] [dpdk-dev, v1, 1/5] eventdev: add caps API and PMD callbacks for crypto adapter Abhinandan Gujjar 2018-04-10 6:07 ` Jerin Jacob 2018-04-12 6:28 ` Gujjar, Abhinandan S 2018-04-10 10:37 ` Akhil Goyal 2018-04-12 6:47 ` Gujjar, Abhinandan S
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).