DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH V2, 1/2] eventdev: add caps API and PMD callback for crypto adapter
@ 2018-01-15 10:52 Abhinandan Gujjar
  2018-02-15 13:09 ` Jerin Jacob
  0 siblings, 1 reply; 3+ messages in thread
From: Abhinandan Gujjar @ 2018-01-15 10:52 UTC (permalink / raw)
  To: jerin.jacob; +Cc: dev, Abhinandan Gujjar, Nikhil Rao

Application gets required information to configure crypto
adapter for cryptodev and eventdev using caps API.

Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---

Notes:
        V2:
	        1. Removed _MULTI_EVENTQ & _MULTI_EVENTQ capabilities

 lib/librte_eventdev/rte_eventdev.c     | 25 +++++++++++++++++++++++++
 lib/librte_eventdev/rte_eventdev.h     | 33 +++++++++++++++++++++++++++++++++
 lib/librte_eventdev/rte_eventdev_pmd.h | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index f32c53f..e453667 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_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 f1949ff..b442fa2 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1048,6 +1048,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_CYRPTO_ADAPTER_CAP_INTERNAL_PORT	0x1
+/**< Flag indicates HW is capable of generating events.
+ * Cryptodev can send packets to the event device using 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_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 c2fd09c..0c10d99 100644
--- a/lib/librte_eventdev/rte_eventdev_pmd.h
+++ b/lib/librte_eventdev/rte_eventdev_pmd.h
@@ -569,6 +569,35 @@ typedef int (*eventdev_eth_rx_adapter_stats_reset)
 			(const struct rte_eventdev *dev,
 			const struct rte_eth_dev *eth_dev);
 
+
+struct rte_cryptodev;
+/**
+ * @warning
+ * @b EXPERIMENTAL: 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);
+
 /** Event device operations function pointer table */
 struct rte_eventdev_ops {
 	eventdev_info_get_t dev_infos_get;	/**< Get device info. */
@@ -623,6 +652,9 @@ struct rte_eventdev_ops {
 	/**< Get ethernet Rx stats */
 	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 */
 };
 
 /**
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH V2, 1/2] eventdev: add caps API and PMD callback for crypto adapter
  2018-01-15 10:52 [dpdk-dev] [PATCH V2, 1/2] eventdev: add caps API and PMD callback for crypto adapter Abhinandan Gujjar
@ 2018-02-15 13:09 ` Jerin Jacob
  2018-02-16  5:51   ` Gujjar, Abhinandan S
  0 siblings, 1 reply; 3+ messages in thread
From: Jerin Jacob @ 2018-02-15 13:09 UTC (permalink / raw)
  To: Abhinandan Gujjar; +Cc: dev, Nikhil Rao

-----Original Message-----
> Date: Mon, 15 Jan 2018 16:22:50 +0530
> From: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> To: jerin.jacob@caviumnetworks.com
> CC: dev@dpdk.org, Abhinandan Gujjar <abhinandan.gujjar@intel.com>, Nikhil
>  Rao <nikhil.rao@intel.com>
> Subject: [PATCH V2, 1/2] eventdev: add caps API and PMD callback for crypto
>  adapter
> X-Mailer: git-send-email 1.9.1
> 
> Application gets required information to configure crypto
> adapter for cryptodev and eventdev using caps API.
> 
> Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
> 
> Notes:
>         V2:
> 	        1. Removed _MULTI_EVENTQ & _MULTI_EVENTQ capabilities


Please fix the shared build issue
target: x86_64-native-linuxapp-gcc+shared

<log>

rte_eventdev.o: In function `rte_event_crypto_adapter_caps_get':
rte_eventdev.c:(.text+0x4e4): undefined reference to
`rte_cryptodev_pmd_is_valid_dev'
rte_eventdev.c:(.text+0x4f7): undefined reference to
`rte_cryptodev_pmd_get_dev'
collect2: error: ld returned 1 exit status

</log>

> 
>  lib/librte_eventdev/rte_eventdev.c     | 25 +++++++++++++++++++++++++
>  lib/librte_eventdev/rte_eventdev.h     | 33 +++++++++++++++++++++++++++++++++
>  lib/librte_eventdev/rte_eventdev_pmd.h | 32 ++++++++++++++++++++++++++++++++
>  3 files changed, 90 insertions(+)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index f32c53f..e453667 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_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;

Could move the caps check to beginning.


> +	*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 f1949ff..b442fa2 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -1048,6 +1048,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_CYRPTO_ADAPTER_CAP_INTERNAL_PORT	0x1

s/CYRPTO/CRYPTO

> +/**< Flag indicates HW is capable of generating events.

How about, generating "crypto completion" events or something similar,

> + * Cryptodev can send packets to the event device using internal event port.
> + */
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice

Use the new __experimental tag

> + *
> + * 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_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 c2fd09c..0c10d99 100644
> --- a/lib/librte_eventdev/rte_eventdev_pmd.h
> +++ b/lib/librte_eventdev/rte_eventdev_pmd.h
> @@ -569,6 +569,35 @@ typedef int (*eventdev_eth_rx_adapter_stats_reset)
>  			(const struct rte_eventdev *dev,
>  			const struct rte_eth_dev *eth_dev);
>  
> +
> +struct rte_cryptodev;
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice


This is a internal PMD API. So, I think, it does not come in EXPERIMENTAL tag

> + *
> + * 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);
> +
>  /** Event device operations function pointer table */
>  struct rte_eventdev_ops {
>  	eventdev_info_get_t dev_infos_get;	/**< Get device info. */
> @@ -623,6 +652,9 @@ struct rte_eventdev_ops {
>  	/**< Get ethernet Rx stats */
>  	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 */

Please rebase to latest dpdk-event-next tree.

>  };
>  
>  /**
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH V2, 1/2] eventdev: add caps API and PMD callback for crypto adapter
  2018-02-15 13:09 ` Jerin Jacob
@ 2018-02-16  5:51   ` Gujjar, Abhinandan S
  0 siblings, 0 replies; 3+ messages in thread
From: Gujjar, Abhinandan S @ 2018-02-16  5:51 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, Rao, Nikhil

Hi Jerin,

Thanks for the review. Few comments inline.

> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Thursday, February 15, 2018 6:40 PM
> To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> Cc: dev@dpdk.org; Rao, Nikhil <nikhil.rao@intel.com>
> Subject: Re: [PATCH V2, 1/2] eventdev: add caps API and PMD callback for
> crypto adapter
> 
> -----Original Message-----
> > Date: Mon, 15 Jan 2018 16:22:50 +0530
> > From: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> > To: jerin.jacob@caviumnetworks.com
> > CC: dev@dpdk.org, Abhinandan Gujjar <abhinandan.gujjar@intel.com>,
> > Nikhil  Rao <nikhil.rao@intel.com>
> > Subject: [PATCH V2, 1/2] eventdev: add caps API and PMD callback for
> > crypto  adapter
> > X-Mailer: git-send-email 1.9.1
> >
> > Application gets required information to configure crypto adapter for
> > cryptodev and eventdev using caps API.
> >
> > Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> > Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> > ---
> >
> > Notes:
> >         V2:
> > 	        1. Removed _MULTI_EVENTQ & _MULTI_EVENTQ capabilities
> 
> 
> Please fix the shared build issue
> target: x86_64-native-linuxapp-gcc+shared
> 
> <log>
> 
> rte_eventdev.o: In function `rte_event_crypto_adapter_caps_get':
> rte_eventdev.c:(.text+0x4e4): undefined reference to
> `rte_cryptodev_pmd_is_valid_dev'
> rte_eventdev.c:(.text+0x4f7): undefined reference to
> `rte_cryptodev_pmd_get_dev'
> collect2: error: ld returned 1 exit status
> 
> </log>
Ok. I will recheck.
> 
> >
> >  lib/librte_eventdev/rte_eventdev.c     | 25 +++++++++++++++++++++++++
> >  lib/librte_eventdev/rte_eventdev.h     | 33
> +++++++++++++++++++++++++++++++++
> >  lib/librte_eventdev/rte_eventdev_pmd.h | 32
> > ++++++++++++++++++++++++++++++++
> >  3 files changed, 90 insertions(+)
> >
> > diff --git a/lib/librte_eventdev/rte_eventdev.c
> > b/lib/librte_eventdev/rte_eventdev.c
> > index f32c53f..e453667 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_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;
> 
> Could move the caps check to beginning.
Sure
> 
> 
> > +	*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 f1949ff..b442fa2 100644
> > --- a/lib/librte_eventdev/rte_eventdev.h
> > +++ b/lib/librte_eventdev/rte_eventdev.h
> > @@ -1048,6 +1048,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_CYRPTO_ADAPTER_CAP_INTERNAL_PORT	0x1
> 
> s/CYRPTO/CRYPTO
Ok
> 
> > +/**< Flag indicates HW is capable of generating events.
> 
> How about, generating "crypto completion" events or something similar,
Sure. I will update it.
> 
> > + * Cryptodev can send packets to the event device using internal event port.
> > + */
> > +
> > +/**
> > + * @warning
> > + * @b EXPERIMENTAL: this API may change without prior notice
> 
> Use the new __experimental tag
Ok
> 
> > + *
> > + * 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_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 c2fd09c..0c10d99 100644
> > --- a/lib/librte_eventdev/rte_eventdev_pmd.h
> > +++ b/lib/librte_eventdev/rte_eventdev_pmd.h
> > @@ -569,6 +569,35 @@ typedef int (*eventdev_eth_rx_adapter_stats_reset)
> >  			(const struct rte_eventdev *dev,
> >  			const struct rte_eth_dev *eth_dev);
> >
> > +
> > +struct rte_cryptodev;
> > +/**
> > + * @warning
> > + * @b EXPERIMENTAL: this API may change without prior notice
> 
> 
> This is a internal PMD API. So, I think, it does not come in EXPERIMENTAL tag
Ok
> 
> > + *
> > + * 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);
> > +
> >  /** Event device operations function pointer table */  struct
> > rte_eventdev_ops {
> >  	eventdev_info_get_t dev_infos_get;	/**< Get device info. */
> > @@ -623,6 +652,9 @@ struct rte_eventdev_ops {
> >  	/**< Get ethernet Rx stats */
> >  	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 */
> 
> Please rebase to latest dpdk-event-next tree.
Sure
> 
> >  };
> >
> >  /**
> > --
> > 1.9.1
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-16  5:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-15 10:52 [dpdk-dev] [PATCH V2, 1/2] eventdev: add caps API and PMD callback for crypto adapter Abhinandan Gujjar
2018-02-15 13:09 ` Jerin Jacob
2018-02-16  5:51   ` 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).