1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Cavium, Inc
5 #ifndef _RTE_EVENTDEV_PMD_VDEV_H_
6 #define _RTE_EVENTDEV_PMD_VDEV_H_
9 * RTE Eventdev VDEV PMD APIs
12 * These API are from event VDEV PMD only and user applications should not call
18 #include <rte_config.h>
19 #include <rte_debug.h>
21 #include <rte_bus_vdev.h>
23 #include "eventdev_pmd.h"
27 * Creates a new virtual event device and returns the pointer to that device.
31 * @param dev_private_size
32 * Size of event PMDs private data
34 * Socket to allocate resources on.
37 * - Eventdev pointer if device is successfully created.
38 * - NULL if device cannot be created.
40 static inline struct rte_eventdev *
41 rte_event_pmd_vdev_init(const char *name, size_t dev_private_size,
45 struct rte_eventdev *eventdev;
47 /* Allocate device structure */
48 eventdev = rte_event_pmd_allocate(name, socket_id);
52 /* Allocate private device structure */
53 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
54 eventdev->data->dev_private =
55 rte_zmalloc_socket("eventdev device private",
60 if (eventdev->data->dev_private == NULL)
61 rte_panic("Cannot allocate memzone for private device"
70 * Destroy the given virtual event device
75 * - 0 on success, negative on error
78 rte_event_pmd_vdev_uninit(const char *name)
81 struct rte_eventdev *eventdev;
86 eventdev = rte_event_pmd_get_named_dev(name);
90 ret = rte_event_dev_close(eventdev->data->dev_id);
94 /* Free the event device */
95 rte_event_pmd_release(eventdev);
100 #endif /* _RTE_EVENTDEV_PMD_VDEV_H_ */