1 /* SPDX-License-Identifier: BSD-3-Clause
13 #include <sys/epoll.h>
15 #include <rte_atomic.h>
16 #include <rte_byteorder.h>
17 #include <rte_common.h>
18 #include <rte_debug.h>
21 #include <rte_fslmc.h>
22 #include <rte_lcore.h>
24 #include <rte_malloc.h>
25 #include <rte_memcpy.h>
26 #include <rte_memory.h>
28 #include <rte_bus_vdev.h>
29 #include <rte_ethdev_driver.h>
30 #include <rte_event_eth_rx_adapter.h>
32 #include <fslmc_vfio.h>
33 #include <dpaa2_hw_pvt.h>
34 #include <dpaa2_hw_mempool.h>
35 #include <dpaa2_hw_dpio.h>
36 #include <dpaa2_ethdev.h>
37 #include "dpaa2_eventdev.h"
38 #include "dpaa2_eventdev_logs.h"
39 #include <portal/dpaa2_hw_pvt.h>
40 #include <mc/fsl_dpci.h>
43 * Evendev = SoC Instance
44 * Eventport = DPIO Instance
45 * Eventqueue = DPCON Instance
46 * 1 Eventdev can have N Eventqueue
47 * Soft Event Flow is DPCI Instance
50 /* Dynamic logging identified for mempool */
51 int dpaa2_logtype_event;
54 dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
57 struct rte_eventdev *ev_dev =
58 ((struct dpaa2_io_portal_t *)port)->eventdev;
59 struct dpaa2_eventdev *priv = ev_dev->data->dev_private;
60 uint32_t queue_id = ev[0].queue_id;
61 struct dpaa2_eventq *evq_info = &priv->evq_info[queue_id];
63 struct qbman_swp *swp;
64 struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
65 uint32_t loop, frames_to_send;
66 struct qbman_eq_desc eqdesc[MAX_TX_RING_SLOTS];
72 if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
73 ret = dpaa2_affine_qbman_swp();
75 DPAA2_EVENTDEV_ERR("Failure in affining portal");
80 swp = DPAA2_PER_LCORE_PORTAL;
83 frames_to_send = (nb_events >> 3) ?
84 MAX_TX_RING_SLOTS : nb_events;
86 for (loop = 0; loop < frames_to_send; loop++) {
87 const struct rte_event *event = &ev[num_tx + loop];
89 if (event->sched_type != RTE_SCHED_TYPE_ATOMIC)
90 fqid = evq_info->dpci->rx_queue[
91 DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid;
93 fqid = evq_info->dpci->rx_queue[
94 DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid;
96 /* Prepare enqueue descriptor */
97 qbman_eq_desc_clear(&eqdesc[loop]);
98 qbman_eq_desc_set_fq(&eqdesc[loop], fqid);
99 qbman_eq_desc_set_no_orp(&eqdesc[loop], 0);
100 qbman_eq_desc_set_response(&eqdesc[loop], 0, 0);
102 if (event->mbuf->seqn) {
103 uint8_t dqrr_index = event->mbuf->seqn - 1;
105 qbman_eq_desc_set_dca(&eqdesc[loop], 1,
107 DPAA2_PER_LCORE_DQRR_SIZE--;
108 DPAA2_PER_LCORE_DQRR_HELD &=
112 memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
115 * todo - need to align with hw context data
118 struct rte_event *ev_temp = rte_malloc(NULL,
119 sizeof(struct rte_event), 0);
124 frames_to_send = loop;
126 "Unable to allocate event object");
129 rte_memcpy(ev_temp, event, sizeof(struct rte_event));
130 DPAA2_SET_FD_ADDR((&fd_arr[loop]), (size_t)ev_temp);
131 DPAA2_SET_FD_LEN((&fd_arr[loop]),
132 sizeof(struct rte_event));
136 while (loop < frames_to_send) {
137 loop += qbman_swp_enqueue_multiple_desc(swp,
138 &eqdesc[loop], &fd_arr[loop],
139 frames_to_send - loop);
141 num_tx += frames_to_send;
142 nb_events -= frames_to_send;
149 dpaa2_eventdev_enqueue(void *port, const struct rte_event *ev)
151 return dpaa2_eventdev_enqueue_burst(port, ev, 1);
154 static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
156 struct epoll_event epoll_ev;
158 qbman_swp_interrupt_clear_status(DPAA2_PER_LCORE_PORTAL,
159 QBMAN_SWP_INTERRUPT_DQRI);
161 epoll_wait(DPAA2_PER_LCORE_DPIO->epoll_fd,
162 &epoll_ev, 1, timeout_ticks);
165 static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
166 const struct qbman_fd *fd,
167 const struct qbman_result *dq,
168 struct dpaa2_queue *rxq,
169 struct rte_event *ev)
171 struct rte_event *ev_temp =
172 (struct rte_event *)(size_t)DPAA2_GET_FD_ADDR(fd);
176 rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
179 qbman_swp_dqrr_consume(swp, dq);
182 static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
183 const struct qbman_fd *fd,
184 const struct qbman_result *dq,
185 struct dpaa2_queue *rxq,
186 struct rte_event *ev)
188 struct rte_event *ev_temp =
189 (struct rte_event *)(size_t)DPAA2_GET_FD_ADDR(fd);
190 uint8_t dqrr_index = qbman_get_dqrr_idx(dq);
195 rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
197 ev->mbuf->seqn = dqrr_index + 1;
198 DPAA2_PER_LCORE_DQRR_SIZE++;
199 DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index;
200 DPAA2_PER_LCORE_DQRR_MBUF(dqrr_index) = ev->mbuf;
204 dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
205 uint16_t nb_events, uint64_t timeout_ticks)
207 const struct qbman_result *dq;
208 struct qbman_swp *swp;
209 const struct qbman_fd *fd;
210 struct dpaa2_queue *rxq;
211 int num_pkts = 0, ret, i = 0;
215 if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
216 ret = dpaa2_affine_qbman_swp();
218 DPAA2_EVENTDEV_ERR("Failure in affining portal");
222 swp = DPAA2_PER_LCORE_PORTAL;
224 /* Check if there are atomic contexts to be released */
225 while (DPAA2_PER_LCORE_DQRR_SIZE) {
226 if (DPAA2_PER_LCORE_DQRR_HELD & (1 << i)) {
227 qbman_swp_dqrr_idx_consume(swp, i);
228 DPAA2_PER_LCORE_DQRR_SIZE--;
229 DPAA2_PER_LCORE_DQRR_MBUF(i)->seqn =
230 DPAA2_INVALID_MBUF_SEQN;
234 DPAA2_PER_LCORE_DQRR_HELD = 0;
237 dq = qbman_swp_dqrr_next(swp);
239 if (!num_pkts && timeout_ticks) {
240 dpaa2_eventdev_dequeue_wait(timeout_ticks);
246 qbman_swp_prefetch_dqrr_next(swp);
248 fd = qbman_result_DQ_fd(dq);
249 rxq = (struct dpaa2_queue *)(size_t)qbman_result_DQ_fqd_ctx(dq);
251 rxq->cb(swp, fd, dq, rxq, &ev[num_pkts]);
253 qbman_swp_dqrr_consume(swp, dq);
254 DPAA2_EVENTDEV_ERR("Null Return VQ received");
259 } while (num_pkts < nb_events);
265 dpaa2_eventdev_dequeue(void *port, struct rte_event *ev,
266 uint64_t timeout_ticks)
268 return dpaa2_eventdev_dequeue_burst(port, ev, 1, timeout_ticks);
272 dpaa2_eventdev_info_get(struct rte_eventdev *dev,
273 struct rte_event_dev_info *dev_info)
275 struct dpaa2_eventdev *priv = dev->data->dev_private;
277 EVENTDEV_INIT_FUNC_TRACE();
281 memset(dev_info, 0, sizeof(struct rte_event_dev_info));
282 dev_info->min_dequeue_timeout_ns =
283 DPAA2_EVENT_MIN_DEQUEUE_TIMEOUT;
284 dev_info->max_dequeue_timeout_ns =
285 DPAA2_EVENT_MAX_DEQUEUE_TIMEOUT;
286 dev_info->dequeue_timeout_ns =
287 DPAA2_EVENT_PORT_DEQUEUE_TIMEOUT_NS;
288 dev_info->max_event_queues = priv->max_event_queues;
289 dev_info->max_event_queue_flows =
290 DPAA2_EVENT_MAX_QUEUE_FLOWS;
291 dev_info->max_event_queue_priority_levels =
292 DPAA2_EVENT_MAX_QUEUE_PRIORITY_LEVELS;
293 dev_info->max_event_priority_levels =
294 DPAA2_EVENT_MAX_EVENT_PRIORITY_LEVELS;
295 dev_info->max_event_ports = rte_fslmc_get_device_count(DPAA2_IO);
296 dev_info->max_event_port_dequeue_depth =
297 DPAA2_EVENT_MAX_PORT_DEQUEUE_DEPTH;
298 dev_info->max_event_port_enqueue_depth =
299 DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH;
300 dev_info->max_num_events = DPAA2_EVENT_MAX_NUM_EVENTS;
301 dev_info->event_dev_cap = RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED |
302 RTE_EVENT_DEV_CAP_BURST_MODE|
303 RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK |
304 RTE_EVENT_DEV_CAP_MULTIPLE_QUEUE_PORT |
305 RTE_EVENT_DEV_CAP_NONSEQ_MODE;
310 dpaa2_eventdev_configure(const struct rte_eventdev *dev)
312 struct dpaa2_eventdev *priv = dev->data->dev_private;
313 struct rte_event_dev_config *conf = &dev->data->dev_conf;
315 EVENTDEV_INIT_FUNC_TRACE();
317 priv->nb_event_queues = conf->nb_event_queues;
318 priv->nb_event_ports = conf->nb_event_ports;
319 priv->nb_event_queue_flows = conf->nb_event_queue_flows;
320 priv->nb_event_port_dequeue_depth = conf->nb_event_port_dequeue_depth;
321 priv->nb_event_port_enqueue_depth = conf->nb_event_port_enqueue_depth;
322 priv->event_dev_cfg = conf->event_dev_cfg;
324 /* Check dequeue timeout method is per dequeue or global */
325 if (priv->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) {
327 * Use timeout value as given in dequeue operation.
328 * So invalidating this timeout value.
330 priv->dequeue_timeout_ns = 0;
332 } else if (conf->dequeue_timeout_ns == 0) {
333 priv->dequeue_timeout_ns = DPAA2_EVENT_PORT_DEQUEUE_TIMEOUT_NS;
335 priv->dequeue_timeout_ns = conf->dequeue_timeout_ns;
338 DPAA2_EVENTDEV_DEBUG("Configured eventdev devid=%d",
344 dpaa2_eventdev_start(struct rte_eventdev *dev)
346 EVENTDEV_INIT_FUNC_TRACE();
354 dpaa2_eventdev_stop(struct rte_eventdev *dev)
356 EVENTDEV_INIT_FUNC_TRACE();
362 dpaa2_eventdev_close(struct rte_eventdev *dev)
364 EVENTDEV_INIT_FUNC_TRACE();
372 dpaa2_eventdev_queue_def_conf(struct rte_eventdev *dev, uint8_t queue_id,
373 struct rte_event_queue_conf *queue_conf)
375 EVENTDEV_INIT_FUNC_TRACE();
378 RTE_SET_USED(queue_id);
379 RTE_SET_USED(queue_conf);
381 queue_conf->nb_atomic_flows = DPAA2_EVENT_QUEUE_ATOMIC_FLOWS;
382 queue_conf->schedule_type = RTE_SCHED_TYPE_ATOMIC |
383 RTE_SCHED_TYPE_PARALLEL;
384 queue_conf->priority = RTE_EVENT_DEV_PRIORITY_NORMAL;
388 dpaa2_eventdev_queue_release(struct rte_eventdev *dev, uint8_t queue_id)
390 EVENTDEV_INIT_FUNC_TRACE();
393 RTE_SET_USED(queue_id);
397 dpaa2_eventdev_queue_setup(struct rte_eventdev *dev, uint8_t queue_id,
398 const struct rte_event_queue_conf *queue_conf)
400 struct dpaa2_eventdev *priv = dev->data->dev_private;
401 struct dpaa2_eventq *evq_info =
402 &priv->evq_info[queue_id];
404 EVENTDEV_INIT_FUNC_TRACE();
406 evq_info->event_queue_cfg = queue_conf->event_queue_cfg;
412 dpaa2_eventdev_port_def_conf(struct rte_eventdev *dev, uint8_t port_id,
413 struct rte_event_port_conf *port_conf)
415 EVENTDEV_INIT_FUNC_TRACE();
418 RTE_SET_USED(port_id);
419 RTE_SET_USED(port_conf);
421 port_conf->new_event_threshold =
422 DPAA2_EVENT_MAX_NUM_EVENTS;
423 port_conf->dequeue_depth =
424 DPAA2_EVENT_MAX_PORT_DEQUEUE_DEPTH;
425 port_conf->enqueue_depth =
426 DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH;
427 port_conf->disable_implicit_release = 0;
431 dpaa2_eventdev_port_release(void *port)
433 EVENTDEV_INIT_FUNC_TRACE();
439 dpaa2_eventdev_port_setup(struct rte_eventdev *dev, uint8_t port_id,
440 const struct rte_event_port_conf *port_conf)
442 EVENTDEV_INIT_FUNC_TRACE();
444 RTE_SET_USED(port_conf);
446 if (!dpaa2_io_portal[port_id].dpio_dev) {
447 dpaa2_io_portal[port_id].dpio_dev =
448 dpaa2_get_qbman_swp(port_id);
449 rte_atomic16_inc(&dpaa2_io_portal[port_id].dpio_dev->ref_count);
450 if (!dpaa2_io_portal[port_id].dpio_dev)
454 dpaa2_io_portal[port_id].eventdev = dev;
455 dev->data->ports[port_id] = &dpaa2_io_portal[port_id];
460 dpaa2_eventdev_port_unlink(struct rte_eventdev *dev, void *port,
461 uint8_t queues[], uint16_t nb_unlinks)
463 struct dpaa2_eventdev *priv = dev->data->dev_private;
464 struct dpaa2_io_portal_t *dpaa2_portal = port;
465 struct dpaa2_eventq *evq_info;
468 EVENTDEV_INIT_FUNC_TRACE();
470 for (i = 0; i < nb_unlinks; i++) {
471 evq_info = &priv->evq_info[queues[i]];
472 qbman_swp_push_set(dpaa2_portal->dpio_dev->sw_portal,
473 evq_info->dpcon->channel_index, 0);
474 dpio_remove_static_dequeue_channel(dpaa2_portal->dpio_dev->dpio,
475 0, dpaa2_portal->dpio_dev->token,
476 evq_info->dpcon->dpcon_id);
479 return (int)nb_unlinks;
483 dpaa2_eventdev_port_link(struct rte_eventdev *dev, void *port,
484 const uint8_t queues[], const uint8_t priorities[],
487 struct dpaa2_eventdev *priv = dev->data->dev_private;
488 struct dpaa2_io_portal_t *dpaa2_portal = port;
489 struct dpaa2_eventq *evq_info;
490 uint8_t channel_index;
493 EVENTDEV_INIT_FUNC_TRACE();
495 for (i = 0; i < nb_links; i++) {
496 evq_info = &priv->evq_info[queues[i]];
498 ret = dpio_add_static_dequeue_channel(
499 dpaa2_portal->dpio_dev->dpio,
500 CMD_PRI_LOW, dpaa2_portal->dpio_dev->token,
501 evq_info->dpcon->dpcon_id, &channel_index);
504 "Static dequeue config failed: err(%d)", ret);
508 qbman_swp_push_set(dpaa2_portal->dpio_dev->sw_portal,
510 evq_info->dpcon->channel_index = channel_index;
513 RTE_SET_USED(priorities);
515 return (int)nb_links;
517 for (n = 0; n < i; n++) {
518 evq_info = &priv->evq_info[queues[n]];
519 qbman_swp_push_set(dpaa2_portal->dpio_dev->sw_portal,
520 evq_info->dpcon->channel_index, 0);
521 dpio_remove_static_dequeue_channel(dpaa2_portal->dpio_dev->dpio,
522 0, dpaa2_portal->dpio_dev->token,
523 evq_info->dpcon->dpcon_id);
529 dpaa2_eventdev_timeout_ticks(struct rte_eventdev *dev, uint64_t ns,
530 uint64_t *timeout_ticks)
532 uint32_t scale = 1000*1000;
534 EVENTDEV_INIT_FUNC_TRACE();
537 *timeout_ticks = ns * scale;
543 dpaa2_eventdev_dump(struct rte_eventdev *dev, FILE *f)
545 EVENTDEV_INIT_FUNC_TRACE();
552 dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
553 const struct rte_eth_dev *eth_dev,
556 const char *ethdev_driver = eth_dev->device->driver->name;
558 EVENTDEV_INIT_FUNC_TRACE();
562 if (!strcmp(ethdev_driver, "net_dpaa2"))
563 *caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
565 *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
571 dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
572 const struct rte_eth_dev *eth_dev,
573 const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
575 struct dpaa2_eventdev *priv = dev->data->dev_private;
576 uint8_t ev_qid = queue_conf->ev.queue_id;
577 uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
580 EVENTDEV_INIT_FUNC_TRACE();
582 for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
583 ret = dpaa2_eth_eventq_attach(eth_dev, i,
584 dpcon_id, queue_conf);
587 "Event queue attach failed: err(%d)", ret);
593 for (i = (i - 1); i >= 0 ; i--)
594 dpaa2_eth_eventq_detach(eth_dev, i);
600 dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
601 const struct rte_eth_dev *eth_dev,
603 const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
605 struct dpaa2_eventdev *priv = dev->data->dev_private;
606 uint8_t ev_qid = queue_conf->ev.queue_id;
607 uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
610 EVENTDEV_INIT_FUNC_TRACE();
612 if (rx_queue_id == -1)
613 return dpaa2_eventdev_eth_queue_add_all(dev,
614 eth_dev, queue_conf);
616 ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
617 dpcon_id, queue_conf);
620 "Event queue attach failed: err(%d)", ret);
627 dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
628 const struct rte_eth_dev *eth_dev)
632 EVENTDEV_INIT_FUNC_TRACE();
636 for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
637 ret = dpaa2_eth_eventq_detach(eth_dev, i);
640 "Event queue detach failed: err(%d)", ret);
649 dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
650 const struct rte_eth_dev *eth_dev,
655 EVENTDEV_INIT_FUNC_TRACE();
657 if (rx_queue_id == -1)
658 return dpaa2_eventdev_eth_queue_del_all(dev, eth_dev);
660 ret = dpaa2_eth_eventq_detach(eth_dev, rx_queue_id);
663 "Event queue detach failed: err(%d)", ret);
671 dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
672 const struct rte_eth_dev *eth_dev)
674 EVENTDEV_INIT_FUNC_TRACE();
677 RTE_SET_USED(eth_dev);
683 dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
684 const struct rte_eth_dev *eth_dev)
686 EVENTDEV_INIT_FUNC_TRACE();
689 RTE_SET_USED(eth_dev);
694 static struct rte_eventdev_ops dpaa2_eventdev_ops = {
695 .dev_infos_get = dpaa2_eventdev_info_get,
696 .dev_configure = dpaa2_eventdev_configure,
697 .dev_start = dpaa2_eventdev_start,
698 .dev_stop = dpaa2_eventdev_stop,
699 .dev_close = dpaa2_eventdev_close,
700 .queue_def_conf = dpaa2_eventdev_queue_def_conf,
701 .queue_setup = dpaa2_eventdev_queue_setup,
702 .queue_release = dpaa2_eventdev_queue_release,
703 .port_def_conf = dpaa2_eventdev_port_def_conf,
704 .port_setup = dpaa2_eventdev_port_setup,
705 .port_release = dpaa2_eventdev_port_release,
706 .port_link = dpaa2_eventdev_port_link,
707 .port_unlink = dpaa2_eventdev_port_unlink,
708 .timeout_ticks = dpaa2_eventdev_timeout_ticks,
709 .dump = dpaa2_eventdev_dump,
710 .eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
711 .eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
712 .eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
713 .eth_rx_adapter_start = dpaa2_eventdev_eth_start,
714 .eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
718 dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev,
719 struct dpaa2_dpcon_dev *dpcon_dev)
721 struct dpci_rx_queue_cfg rx_queue_cfg;
724 /*Do settings to get the frame on a DPCON object*/
725 rx_queue_cfg.options = DPCI_QUEUE_OPT_DEST |
726 DPCI_QUEUE_OPT_USER_CTX;
727 rx_queue_cfg.dest_cfg.dest_type = DPCI_DEST_DPCON;
728 rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id;
729 rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO;
731 dpci_dev->rx_queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb =
732 dpaa2_eventdev_process_parallel;
733 dpci_dev->rx_queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb =
734 dpaa2_eventdev_process_atomic;
736 for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) {
737 rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->rx_queue[i]);
738 ret = dpci_set_rx_queue(&dpci_dev->dpci,
744 "DPCI Rx queue setup failed: err(%d)",
753 dpaa2_eventdev_create(const char *name)
755 struct rte_eventdev *eventdev;
756 struct dpaa2_eventdev *priv;
757 struct dpaa2_dpcon_dev *dpcon_dev = NULL;
758 struct dpaa2_dpci_dev *dpci_dev = NULL;
761 eventdev = rte_event_pmd_vdev_init(name,
762 sizeof(struct dpaa2_eventdev),
764 if (eventdev == NULL) {
765 DPAA2_EVENTDEV_ERR("Failed to create Event device %s", name);
769 eventdev->dev_ops = &dpaa2_eventdev_ops;
770 eventdev->enqueue = dpaa2_eventdev_enqueue;
771 eventdev->enqueue_burst = dpaa2_eventdev_enqueue_burst;
772 eventdev->enqueue_new_burst = dpaa2_eventdev_enqueue_burst;
773 eventdev->enqueue_forward_burst = dpaa2_eventdev_enqueue_burst;
774 eventdev->dequeue = dpaa2_eventdev_dequeue;
775 eventdev->dequeue_burst = dpaa2_eventdev_dequeue_burst;
777 /* For secondary processes, the primary has done all the work */
778 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
781 priv = eventdev->data->dev_private;
782 priv->max_event_queues = 0;
785 dpcon_dev = rte_dpaa2_alloc_dpcon_dev();
788 priv->evq_info[priv->max_event_queues].dpcon = dpcon_dev;
790 dpci_dev = rte_dpaa2_alloc_dpci_dev();
792 rte_dpaa2_free_dpcon_dev(dpcon_dev);
795 priv->evq_info[priv->max_event_queues].dpci = dpci_dev;
797 ret = dpaa2_eventdev_setup_dpci(dpci_dev, dpcon_dev);
800 "DPCI setup failed: err(%d)", ret);
803 priv->max_event_queues++;
804 } while (dpcon_dev && dpci_dev);
812 dpaa2_eventdev_probe(struct rte_vdev_device *vdev)
816 name = rte_vdev_device_name(vdev);
817 DPAA2_EVENTDEV_INFO("Initializing %s", name);
818 return dpaa2_eventdev_create(name);
822 dpaa2_eventdev_remove(struct rte_vdev_device *vdev)
826 name = rte_vdev_device_name(vdev);
827 DPAA2_EVENTDEV_INFO("Closing %s", name);
829 return rte_event_pmd_vdev_uninit(name);
832 static struct rte_vdev_driver vdev_eventdev_dpaa2_pmd = {
833 .probe = dpaa2_eventdev_probe,
834 .remove = dpaa2_eventdev_remove
837 RTE_PMD_REGISTER_VDEV(EVENTDEV_NAME_DPAA2_PMD, vdev_eventdev_dpaa2_pmd);
839 RTE_INIT(dpaa2_eventdev_init_log)
841 dpaa2_logtype_event = rte_log_register("pmd.event.dpaa2");
842 if (dpaa2_logtype_event >= 0)
843 rte_log_set_level(dpaa2_logtype_event, RTE_LOG_NOTICE);