[dpdk-dev,10/20] event/dpaa2: add initialization of event device
Checks
Commit Message
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
drivers/event/dpaa2/dpaa2_eventdev.c | 153 ++++++++++++++++++++++++++++++++++-
drivers/event/dpaa2/dpaa2_eventdev.h | 22 +++++
2 files changed, 171 insertions(+), 4 deletions(-)
Comments
-----Original Message-----
> Date: Thu, 25 May 2017 23:37:41 +0530
> From: Nipun Gupta <nipun.gupta@nxp.com>
> To: dev@dpdk.org
> CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
> harry.van.haaren@intel.com, bruce.richardson@intel.com,
> gage.eads@intel.com, shreyansh.jain@nxp.com, Nipun Gupta
> <nipun.gupta@nxp.com>
> Subject: [PATCH 10/20] event/dpaa2: add initialization of event device
> X-Mailer: git-send-email 1.9.1
>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
> drivers/event/dpaa2/dpaa2_eventdev.c | 153 ++++++++++++++++++++++++++++++++++-
> drivers/event/dpaa2/dpaa2_eventdev.h | 22 +++++
> 2 files changed, 171 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 191901e..7fa17f2 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -30,17 +30,164 @@
> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> +#include <assert.h>
> +#include <stdio.h>
> +#include <stdbool.h>
> +#include <errno.h>
> +#include <stdint.h>
> +#include <string.h>
> +#include <stdint.h>
> +#include <sys/epoll.h>
> +
> +#include <rte_byteorder.h>
> +#include <rte_common.h>
> +#include <rte_debug.h>
> +#include <rte_dev.h>
> #include <rte_eal.h>
> +#include <rte_log.h>
> +#include <rte_memory.h>
> +#include <rte_memzone.h>
> +#include <rte_malloc.h>
> +#include <rte_pci.h>
> +#include <rte_lcore.h>
> #include <rte_vdev.h>
> +#include <rte_fslmc.h>
> +#include <rte_atomic.h>
Maintain alphabetical order in header inclusion.
>
> +#include <fslmc_vfio.h>
> +#include <dpaa2_hw_pvt.h>
> +#include <dpaa2_hw_mempool.h>
> +#include <dpaa2_hw_dpio.h>
> #include "dpaa2_eventdev.h"
> +#include <portal/dpaa2_hw_pvt.h>
> +#include <mc/fsl_dpci.h>
> +
> +/* Clarifications
> + * Evendev = SoC Instance
> + * Eventport = DPIO Instance
> + * Eventqueue = DPCON Instance
> + * 1 Eventdev can have N Eventqueue
> + * Soft Event Flow is DPCI Instance
> + */
> +
> +static uint16_t
> +dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
> + uint16_t nb_events)
> +{
> + RTE_SET_USED(port);
> + RTE_SET_USED(ev);
> + RTE_SET_USED(nb_events);
> +
> + return 0;
> +}
> +
> +static uint16_t
> +dpaa2_eventdev_enqueue(void *port, const struct rte_event *ev)
> +{
> + return dpaa2_eventdev_enqueue_burst(port, ev, 1);
> +}
> +
> +static uint16_t
> +dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
> + uint16_t nb_events, uint64_t timeout_ticks)
> +{
> + RTE_SET_USED(port);
> + RTE_SET_USED(ev);
> + RTE_SET_USED(nb_events);
> + RTE_SET_USED(timeout_ticks);
> +
> + return 0;
> +}
> +
> +static uint16_t
> +dpaa2_eventdev_dequeue(void *port, struct rte_event *ev,
> + uint64_t timeout_ticks)
> +{
> + return dpaa2_eventdev_dequeue_burst(port, ev, 1, timeout_ticks);
> +}
> +
> +static const struct rte_eventdev_ops dpaa2_eventdev_ops;
> +
> +static int
> +dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev,
> + struct dpaa2_dpcon_dev *dpcon_dev)
> +{
> + struct dpci_rx_queue_cfg rx_queue_cfg;
> + int ret, i;
> +
> + /*Do settings to get the frame on a DPCON object*/
> + rx_queue_cfg.options = DPCI_QUEUE_OPT_DEST;
> + rx_queue_cfg.dest_cfg.dest_type = DPCI_DEST_DPCON;
> + rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id;
> + rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO;
> +
> + for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) {
> + rx_queue_cfg.user_ctx = (uint64_t)(&dpci_dev->queue[i]);
> + ret = dpci_set_rx_queue(&dpci_dev->dpci,
> + CMD_PRI_LOW,
> + dpci_dev->token, i,
> + &rx_queue_cfg);
> + if (ret) {
> + PMD_DRV_LOG(ERR, PMD,
> + "set_rx_q failed with err code: %d", ret);
> + return ret;
> + }
> + }
> + return 0;
> +}
>
> static int
> dpaa2_eventdev_create(const char *name)
> {
> - RTE_SET_USED(name);
> + struct rte_eventdev *eventdev;
> + struct dpaa2_eventdev *priv;
> + struct dpaa2_dpcon_dev *dpcon_dev = NULL;
> + struct dpaa2_dpci_dev *dpci_dev = NULL;
> + int ret;
> +
> + eventdev = rte_event_pmd_vdev_init(name,
> + sizeof(struct dpaa2_eventdev),
> + rte_socket_id());
> + if (eventdev == NULL) {
> + PMD_DRV_ERR("Failed to create eventdev vdev %s", name);
> + goto fail;
> + }
> +
> + eventdev->dev_ops = &dpaa2_eventdev_ops;
> + eventdev->schedule = NULL;
> + eventdev->enqueue = dpaa2_eventdev_enqueue;
> + eventdev->enqueue_burst = dpaa2_eventdev_enqueue_burst;
> + eventdev->dequeue = dpaa2_eventdev_dequeue;
> + eventdev->dequeue_burst = dpaa2_eventdev_dequeue_burst;
If it makes senses, you can return from here if its in multi process mode.
> +
> + priv = eventdev->data->dev_private;
> + priv->max_event_queues = 0;
> +
> + do {
> + dpcon_dev = rte_dpaa2_alloc_dpcon_dev();
> + if (!dpcon_dev)
> + break;
> + priv->evq_info[priv->max_event_queues].dpcon = dpcon_dev;
> +
> + dpci_dev = rte_dpaa2_alloc_dpci_dev();
> + if (!dpci_dev) {
> + rte_dpaa2_free_dpcon_dev(dpcon_dev);
> + break;
> + }
> + priv->evq_info[priv->max_event_queues].dpci = dpci_dev;
> +
> + ret = dpaa2_eventdev_setup_dpci(dpci_dev, dpcon_dev);
> + if (ret) {
> + PMD_DRV_LOG(ERR, PMD,
> + "dpci setup failed with err code: %d", ret);
> + return ret;
> + }
> + priv->max_event_queues++;
> + } while (dpcon_dev && dpci_dev);
>
> return 0;
> +fail:
> + return -EFAULT;
> }
>
> static int
> @@ -61,9 +208,7 @@
> name = rte_vdev_device_name(vdev);
> PMD_DRV_LOG(INFO, "Closing %s", name);
>
> - RTE_SET_USED(name);
> -
> - return 0;
> + return rte_event_pmd_vdev_uninit(name);
> }
> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Wednesday, May 31, 2017 20:40
> To: Nipun Gupta <nipun.gupta@nxp.com>
> Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>;
> harry.van.haaren@intel.com; bruce.richardson@intel.com;
> gage.eads@intel.com; Shreyansh Jain <shreyansh.jain@nxp.com>
> Subject: Re: [PATCH 10/20] event/dpaa2: add initialization of event device
>
> -----Original Message-----
> > Date: Thu, 25 May 2017 23:37:41 +0530
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > To: dev@dpdk.org
> > CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
> > harry.van.haaren@intel.com, bruce.richardson@intel.com,
> > gage.eads@intel.com, shreyansh.jain@nxp.com, Nipun Gupta
> > <nipun.gupta@nxp.com>
> > Subject: [PATCH 10/20] event/dpaa2: add initialization of event device
> > X-Mailer: git-send-email 1.9.1
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> > drivers/event/dpaa2/dpaa2_eventdev.c | 153
> ++++++++++++++++++++++++++++++++++-
> > drivers/event/dpaa2/dpaa2_eventdev.h | 22 +++++
> > 2 files changed, 171 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> > index 191901e..7fa17f2 100644
> > --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> > +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> > @@ -30,17 +30,164 @@
> > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> DAMAGE.
> > */
> >
> > +#include <assert.h>
> > +#include <stdio.h>
> > +#include <stdbool.h>
> > +#include <errno.h>
> > +#include <stdint.h>
> > +#include <string.h>
> > +#include <stdint.h>
> > +#include <sys/epoll.h>
> > +
> > +#include <rte_byteorder.h>
> > +#include <rte_common.h>
> > +#include <rte_debug.h>
> > +#include <rte_dev.h>
> > #include <rte_eal.h>
> > +#include <rte_log.h>
> > +#include <rte_memory.h>
> > +#include <rte_memzone.h>
> > +#include <rte_malloc.h>
> > +#include <rte_pci.h>
> > +#include <rte_lcore.h>
> > #include <rte_vdev.h>
> > +#include <rte_fslmc.h>
> > +#include <rte_atomic.h>
>
> Maintain alphabetical order in header inclusion.
Thank you for the review.
Regarding this I check most of the c files in DPDK and do not see that alphabetical
being maintained in the header file inclusions. Are you suggesting to have an alphabetical
order here across all inclusions of rte* as well as gcc standard header files (combined) or
to have them ordered separately?
>
> >
> > +#include <fslmc_vfio.h>
> > +#include <dpaa2_hw_pvt.h>
> > +#include <dpaa2_hw_mempool.h>
> > +#include <dpaa2_hw_dpio.h>
> > #include "dpaa2_eventdev.h"
> > +#include <portal/dpaa2_hw_pvt.h>
> > +#include <mc/fsl_dpci.h>
> > +
> > +/* Clarifications
> > + * Evendev = SoC Instance
> > + * Eventport = DPIO Instance
> > + * Eventqueue = DPCON Instance
> > + * 1 Eventdev can have N Eventqueue
> > + * Soft Event Flow is DPCI Instance
> > + */
> > +
> > +static uint16_t
> > +dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
> > + uint16_t nb_events)
> > +{
> > + RTE_SET_USED(port);
> > + RTE_SET_USED(ev);
> > + RTE_SET_USED(nb_events);
> > +
> > + return 0;
> > +}
> > +
> > +static uint16_t
> > +dpaa2_eventdev_enqueue(void *port, const struct rte_event *ev)
> > +{
> > + return dpaa2_eventdev_enqueue_burst(port, ev, 1);
> > +}
> > +
> > +static uint16_t
> > +dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
> > + uint16_t nb_events, uint64_t timeout_ticks)
> > +{
> > + RTE_SET_USED(port);
> > + RTE_SET_USED(ev);
> > + RTE_SET_USED(nb_events);
> > + RTE_SET_USED(timeout_ticks);
> > +
> > + return 0;
> > +}
> > +
> > +static uint16_t
> > +dpaa2_eventdev_dequeue(void *port, struct rte_event *ev,
> > + uint64_t timeout_ticks)
> > +{
> > + return dpaa2_eventdev_dequeue_burst(port, ev, 1, timeout_ticks);
> > +}
> > +
> > +static const struct rte_eventdev_ops dpaa2_eventdev_ops;
> > +
> > +static int
> > +dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev,
> > + struct dpaa2_dpcon_dev *dpcon_dev)
> > +{
> > + struct dpci_rx_queue_cfg rx_queue_cfg;
> > + int ret, i;
> > +
> > + /*Do settings to get the frame on a DPCON object*/
> > + rx_queue_cfg.options = DPCI_QUEUE_OPT_DEST;
> > + rx_queue_cfg.dest_cfg.dest_type = DPCI_DEST_DPCON;
> > + rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id;
> > + rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO;
> > +
> > + for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) {
> > + rx_queue_cfg.user_ctx = (uint64_t)(&dpci_dev->queue[i]);
> > + ret = dpci_set_rx_queue(&dpci_dev->dpci,
> > + CMD_PRI_LOW,
> > + dpci_dev->token, i,
> > + &rx_queue_cfg);
> > + if (ret) {
> > + PMD_DRV_LOG(ERR, PMD,
> > + "set_rx_q failed with err code: %d", ret);
> > + return ret;
> > + }
> > + }
> > + return 0;
> > +}
> >
> > static int
> > dpaa2_eventdev_create(const char *name)
> > {
> > - RTE_SET_USED(name);
> > + struct rte_eventdev *eventdev;
> > + struct dpaa2_eventdev *priv;
> > + struct dpaa2_dpcon_dev *dpcon_dev = NULL;
> > + struct dpaa2_dpci_dev *dpci_dev = NULL;
> > + int ret;
> > +
> > + eventdev = rte_event_pmd_vdev_init(name,
> > + sizeof(struct dpaa2_eventdev),
> > + rte_socket_id());
> > + if (eventdev == NULL) {
> > + PMD_DRV_ERR("Failed to create eventdev vdev %s", name);
> > + goto fail;
> > + }
> > +
> > + eventdev->dev_ops = &dpaa2_eventdev_ops;
> > + eventdev->schedule = NULL;
> > + eventdev->enqueue = dpaa2_eventdev_enqueue;
> > + eventdev->enqueue_burst = dpaa2_eventdev_enqueue_burst;
> > + eventdev->dequeue = dpaa2_eventdev_dequeue;
> > + eventdev->dequeue_burst = dpaa2_eventdev_dequeue_burst;
>
> If it makes senses, you can return from here if its in multi process mode.
Makes sense. Ill update this in next version.
>
> > +
> > + priv = eventdev->data->dev_private;
> > + priv->max_event_queues = 0;
> > +
> > + do {
> > + dpcon_dev = rte_dpaa2_alloc_dpcon_dev();
> > + if (!dpcon_dev)
> > + break;
> > + priv->evq_info[priv->max_event_queues].dpcon = dpcon_dev;
> > +
> > + dpci_dev = rte_dpaa2_alloc_dpci_dev();
> > + if (!dpci_dev) {
> > + rte_dpaa2_free_dpcon_dev(dpcon_dev);
> > + break;
> > + }
> > + priv->evq_info[priv->max_event_queues].dpci = dpci_dev;
> > +
> > + ret = dpaa2_eventdev_setup_dpci(dpci_dev, dpcon_dev);
> > + if (ret) {
> > + PMD_DRV_LOG(ERR, PMD,
> > + "dpci setup failed with err code: %d", ret);
> > + return ret;
> > + }
> > + priv->max_event_queues++;
> > + } while (dpcon_dev && dpci_dev);
> >
> > return 0;
> > +fail:
> > + return -EFAULT;
> > }
> >
> > static int
> > @@ -61,9 +208,7 @@
> > name = rte_vdev_device_name(vdev);
> > PMD_DRV_LOG(INFO, "Closing %s", name);
> >
> > - RTE_SET_USED(name);
> > -
> > - return 0;
> > + return rte_event_pmd_vdev_uninit(name);
> > }
-----Original Message-----
> Date: Thu, 1 Jun 2017 10:25:02 +0000
> From: Nipun Gupta <nipun.gupta@nxp.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> CC: "dev@dpdk.org" <dev@dpdk.org>, Hemant Agrawal <hemant.agrawal@nxp.com>,
> "harry.van.haaren@intel.com" <harry.van.haaren@intel.com>,
> "bruce.richardson@intel.com" <bruce.richardson@intel.com>,
> "gage.eads@intel.com" <gage.eads@intel.com>, Shreyansh Jain
> <shreyansh.jain@nxp.com>
> Subject: RE: [PATCH 10/20] event/dpaa2: add initialization of event device
>
>
>
> > -----Original Message-----
> > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> > Sent: Wednesday, May 31, 2017 20:40
> > To: Nipun Gupta <nipun.gupta@nxp.com>
> > Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>;
> > harry.van.haaren@intel.com; bruce.richardson@intel.com;
> > gage.eads@intel.com; Shreyansh Jain <shreyansh.jain@nxp.com>
> > Subject: Re: [PATCH 10/20] event/dpaa2: add initialization of event device
> >
> > -----Original Message-----
> > > Date: Thu, 25 May 2017 23:37:41 +0530
> > > From: Nipun Gupta <nipun.gupta@nxp.com>
> > > To: dev@dpdk.org
> > > CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
> > > harry.van.haaren@intel.com, bruce.richardson@intel.com,
> > > gage.eads@intel.com, shreyansh.jain@nxp.com, Nipun Gupta
> > > <nipun.gupta@nxp.com>
> > > Subject: [PATCH 10/20] event/dpaa2: add initialization of event device
> > > X-Mailer: git-send-email 1.9.1
> > >
> > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > > ---
> > > drivers/event/dpaa2/dpaa2_eventdev.c | 153
> > ++++++++++++++++++++++++++++++++++-
> > > drivers/event/dpaa2/dpaa2_eventdev.h | 22 +++++
> > > 2 files changed, 171 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> > b/drivers/event/dpaa2/dpaa2_eventdev.c
> > > index 191901e..7fa17f2 100644
> > > --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> > > +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> > > @@ -30,17 +30,164 @@
> > > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> > DAMAGE.
> > > */
> > >
> > > +#include <assert.h>
> > > +#include <stdio.h>
> > > +#include <stdbool.h>
> > > +#include <errno.h>
> > > +#include <stdint.h>
> > > +#include <string.h>
> > > +#include <stdint.h>
> > > +#include <sys/epoll.h>
> > > +
> > > +#include <rte_byteorder.h>
> > > +#include <rte_common.h>
> > > +#include <rte_debug.h>
> > > +#include <rte_dev.h>
> > > #include <rte_eal.h>
> > > +#include <rte_log.h>
> > > +#include <rte_memory.h>
> > > +#include <rte_memzone.h>
> > > +#include <rte_malloc.h>
> > > +#include <rte_pci.h>
> > > +#include <rte_lcore.h>
> > > #include <rte_vdev.h>
> > > +#include <rte_fslmc.h>
> > > +#include <rte_atomic.h>
> >
> > Maintain alphabetical order in header inclusion.
>
> Thank you for the review.
>
> Regarding this I check most of the c files in DPDK and do not see that alphabetical
> being maintained in the header file inclusions. Are you suggesting to have an alphabetical
> order here across all inclusions of rte* as well as gcc standard header files (combined) or
> to have them ordered separately?
Just the rte_*.h header files in the new files.
@@ -30,17 +30,164 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <assert.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdint.h>
+#include <sys/epoll.h>
+
+#include <rte_byteorder.h>
+#include <rte_common.h>
+#include <rte_debug.h>
+#include <rte_dev.h>
#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_malloc.h>
+#include <rte_pci.h>
+#include <rte_lcore.h>
#include <rte_vdev.h>
+#include <rte_fslmc.h>
+#include <rte_atomic.h>
+#include <fslmc_vfio.h>
+#include <dpaa2_hw_pvt.h>
+#include <dpaa2_hw_mempool.h>
+#include <dpaa2_hw_dpio.h>
#include "dpaa2_eventdev.h"
+#include <portal/dpaa2_hw_pvt.h>
+#include <mc/fsl_dpci.h>
+
+/* Clarifications
+ * Evendev = SoC Instance
+ * Eventport = DPIO Instance
+ * Eventqueue = DPCON Instance
+ * 1 Eventdev can have N Eventqueue
+ * Soft Event Flow is DPCI Instance
+ */
+
+static uint16_t
+dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
+ uint16_t nb_events)
+{
+ RTE_SET_USED(port);
+ RTE_SET_USED(ev);
+ RTE_SET_USED(nb_events);
+
+ return 0;
+}
+
+static uint16_t
+dpaa2_eventdev_enqueue(void *port, const struct rte_event *ev)
+{
+ return dpaa2_eventdev_enqueue_burst(port, ev, 1);
+}
+
+static uint16_t
+dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
+ uint16_t nb_events, uint64_t timeout_ticks)
+{
+ RTE_SET_USED(port);
+ RTE_SET_USED(ev);
+ RTE_SET_USED(nb_events);
+ RTE_SET_USED(timeout_ticks);
+
+ return 0;
+}
+
+static uint16_t
+dpaa2_eventdev_dequeue(void *port, struct rte_event *ev,
+ uint64_t timeout_ticks)
+{
+ return dpaa2_eventdev_dequeue_burst(port, ev, 1, timeout_ticks);
+}
+
+static const struct rte_eventdev_ops dpaa2_eventdev_ops;
+
+static int
+dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev,
+ struct dpaa2_dpcon_dev *dpcon_dev)
+{
+ struct dpci_rx_queue_cfg rx_queue_cfg;
+ int ret, i;
+
+ /*Do settings to get the frame on a DPCON object*/
+ rx_queue_cfg.options = DPCI_QUEUE_OPT_DEST;
+ rx_queue_cfg.dest_cfg.dest_type = DPCI_DEST_DPCON;
+ rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id;
+ rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO;
+
+ for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) {
+ rx_queue_cfg.user_ctx = (uint64_t)(&dpci_dev->queue[i]);
+ ret = dpci_set_rx_queue(&dpci_dev->dpci,
+ CMD_PRI_LOW,
+ dpci_dev->token, i,
+ &rx_queue_cfg);
+ if (ret) {
+ PMD_DRV_LOG(ERR, PMD,
+ "set_rx_q failed with err code: %d", ret);
+ return ret;
+ }
+ }
+ return 0;
+}
static int
dpaa2_eventdev_create(const char *name)
{
- RTE_SET_USED(name);
+ struct rte_eventdev *eventdev;
+ struct dpaa2_eventdev *priv;
+ struct dpaa2_dpcon_dev *dpcon_dev = NULL;
+ struct dpaa2_dpci_dev *dpci_dev = NULL;
+ int ret;
+
+ eventdev = rte_event_pmd_vdev_init(name,
+ sizeof(struct dpaa2_eventdev),
+ rte_socket_id());
+ if (eventdev == NULL) {
+ PMD_DRV_ERR("Failed to create eventdev vdev %s", name);
+ goto fail;
+ }
+
+ eventdev->dev_ops = &dpaa2_eventdev_ops;
+ eventdev->schedule = NULL;
+ eventdev->enqueue = dpaa2_eventdev_enqueue;
+ eventdev->enqueue_burst = dpaa2_eventdev_enqueue_burst;
+ eventdev->dequeue = dpaa2_eventdev_dequeue;
+ eventdev->dequeue_burst = dpaa2_eventdev_dequeue_burst;
+
+ priv = eventdev->data->dev_private;
+ priv->max_event_queues = 0;
+
+ do {
+ dpcon_dev = rte_dpaa2_alloc_dpcon_dev();
+ if (!dpcon_dev)
+ break;
+ priv->evq_info[priv->max_event_queues].dpcon = dpcon_dev;
+
+ dpci_dev = rte_dpaa2_alloc_dpci_dev();
+ if (!dpci_dev) {
+ rte_dpaa2_free_dpcon_dev(dpcon_dev);
+ break;
+ }
+ priv->evq_info[priv->max_event_queues].dpci = dpci_dev;
+
+ ret = dpaa2_eventdev_setup_dpci(dpci_dev, dpcon_dev);
+ if (ret) {
+ PMD_DRV_LOG(ERR, PMD,
+ "dpci setup failed with err code: %d", ret);
+ return ret;
+ }
+ priv->max_event_queues++;
+ } while (dpcon_dev && dpci_dev);
return 0;
+fail:
+ return -EFAULT;
}
static int
@@ -61,9 +208,7 @@
name = rte_vdev_device_name(vdev);
PMD_DRV_LOG(INFO, "Closing %s", name);
- RTE_SET_USED(name);
-
- return 0;
+ return rte_event_pmd_vdev_uninit(name);
}
static struct rte_vdev_driver vdev_eventdev_dpaa2_pmd = {
@@ -52,6 +52,16 @@
#define PMD_DRV_ERR(fmt, args...) \
RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ## args)
+#define DPAA2_EVENT_DEFAULT_DPCI_PRIO 0
+
+#define DPAA2_EVENT_MAX_QUEUES 16
+
+enum {
+ DPAA2_EVENT_DPCI_PARALLEL_QUEUE,
+ DPAA2_EVENT_DPCI_ATOMIC_QUEUE,
+ DPAA2_EVENT_DPCI_MAX_QUEUES
+};
+
struct dpaa2_dpcon_dev {
TAILQ_ENTRY(dpaa2_dpcon_dev) next;
struct fsl_mc_io dpcon;
@@ -63,6 +73,18 @@ struct dpaa2_dpcon_dev {
uint8_t channel_index;
};
+struct evq_info_t {
+ /* DPcon device */
+ struct dpaa2_dpcon_dev *dpcon;
+ /* Attached DPCI device */
+ struct dpaa2_dpci_dev *dpci;
+};
+
+struct dpaa2_eventdev {
+ struct evq_info_t evq_info[DPAA2_EVENT_MAX_QUEUES];
+ uint8_t max_event_queues;
+};
+
struct dpaa2_dpcon_dev *rte_dpaa2_alloc_dpcon_dev(void);
void rte_dpaa2_free_dpcon_dev(struct dpaa2_dpcon_dev *dpcon);