* [dpdk-dev] [RFC] eventdev: add caps API and PMD callback for crypto adapter
@ 2017-11-09 6:52 Abhinandan Gujjar
2017-11-29 3:50 ` Jerin Jacob
0 siblings, 1 reply; 2+ messages in thread
From: Abhinandan Gujjar @ 2017-11-09 6:52 UTC (permalink / raw)
To: jerin.jacob; +Cc: dev, Abhinandan Gujjar, Nikhil Rao
Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
lib/librte_eventdev/rte_eventdev.c | 25 +++++++++++++++++++
lib/librte_eventdev/rte_eventdev.h | 44 ++++++++++++++++++++++++++++++++++
lib/librte_eventdev/rte_eventdev_pmd.h | 32 +++++++++++++++++++++++++
3 files changed, 101 insertions(+)
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index ce6a5dc..3f9475e 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -57,6 +57,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"
@@ -151,6 +153,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..65a9edd 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1048,6 +1048,50 @@ struct rte_event {
rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id,
uint32_t *caps);
+
+/* Crypto Rx adapter capability bitmap flags */
+#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.
+ */
+#define RTE_EVENT_CRYPTO_ADAPTER_CAP_MULTI_EVENTQ 0x2
+/**< Flag indicates adapter supports multiple event queues per cryptodev.
+ * Each cryptodev queue pair can be connected to a unique event queue.
+ */
+#define RTE_EVENT_CRYPTO_ADAPTER_CAP_MBUF_MULTI_EVENTQ 0x3
+/**< Flag indicates adapter supports event queue enqueue based on mbuf metadata.
+ * Mbuf metadata will be used enqueue to unique event queue.
+ * Event information will be stored in metadata of each mbuf
+ * @see struct rte_event_crypto_adapter_mbuf_metadata
+ */
+
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Retrieve the event device's crypto Rx adapter capabilities for the
+ * specified cryptodev device
+ *
+ * @param dev_id
+ * The identifier of the device.
+ *
+ * @param qp_id
+ * The queue pair id of the cryptodev device.
+ *
+ * @param[out] caps
+ * A pointer to memory filled with Rx event adapter capabilities.
+ *
+ * @return
+ * - 0: Success, driver provides Rx 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 eth_port_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 7a206c5..77886e0 100644
--- a/lib/librte_eventdev/rte_eventdev_pmd.h
+++ b/lib/librte_eventdev/rte_eventdev_pmd.h
@@ -596,6 +596,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 Rx adapter capabilities for the
+ * specified cryptodev
+ *
+ * @param dev
+ * Event device pointer
+ *
+ * @param crypto_dev
+ * cryptodev pointer
+ *
+ * @param[out] caps
+ * A pointer to memory filled with Rx event adapter capabilities.
+ *
+ * @return
+ * - 0: Success, driver provides Rx 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. */
@@ -650,6 +679,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 Rx adapter capabilities */
};
/**
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [RFC] eventdev: add caps API and PMD callback for crypto adapter
2017-11-09 6:52 [dpdk-dev] [RFC] eventdev: add caps API and PMD callback for crypto adapter Abhinandan Gujjar
@ 2017-11-29 3:50 ` Jerin Jacob
0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2017-11-29 3:50 UTC (permalink / raw)
To: Abhinandan Gujjar; +Cc: dev, Nikhil Rao, hemant.agrawal, nipun.gupta
-----Original Message-----
> Date: Thu, 9 Nov 2017 12:22:37 +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: [RFC] eventdev: add caps API and PMD callback for crypto adapter
> X-Mailer: git-send-email 1.9.1
>
> Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Hi Abhinandan,
Thanks for the contribution. Some comments below,
> ---
> lib/librte_eventdev/rte_eventdev.c | 25 +++++++++++++++++++
> lib/librte_eventdev/rte_eventdev.h | 44 ++++++++++++++++++++++++++++++++++
> lib/librte_eventdev/rte_eventdev_pmd.h | 32 +++++++++++++++++++++++++
> 3 files changed, 101 insertions(+)
> +
> +/* Crypto Rx adapter capability bitmap flags */
> +#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.
> + */
> +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_MULTI_EVENTQ 0x2
> +/**< Flag indicates adapter supports multiple event queues per cryptodev.
> + * Each cryptodev queue pair can be connected to a unique event queue.
> + */
> +#define RTE_EVENT_CRYPTO_ADAPTER_CAP_MBUF_MULTI_EVENTQ 0x3
The value should be 4 as it is a flag.
> +/**< Flag indicates adapter supports event queue enqueue based on mbuf metadata.
> + * Mbuf metadata will be used enqueue to unique event queue.
> + * Event information will be stored in metadata of each mbuf
> + * @see struct rte_event_crypto_adapter_mbuf_metadata
Since CPU is enqueuing the crypto ops to HW(Unlike ethdev Rx adapter,
Which is hardwired to Ingress packet Input hardware), I think, we may
NOT need RTE_EVENT_CRYPTO_ADAPTER_CAP_MULTI_EVENTQ and
RTE_EVENT_CRYPTO_ADAPTER_CAP_MBUF_MULTI_EVENTQ capabilities.
Adding NXP folks to get the comment on capabilities requirement for
their HW. If no one needs RTE_EVENT_CRYPTO_ADAPTER_CAP_MULTI_EVENTQ and
RTE_EVENT_CRYPTO_ADAPTER_CAP_MBUF_MULTI_EVENTQ then we can remove it.
Jerin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-29 3:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09 6:52 [dpdk-dev] [RFC] eventdev: add caps API and PMD callback for crypto adapter Abhinandan Gujjar
2017-11-29 3:50 ` Jerin Jacob
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).