DPDK 21.11.9
rte_bus_vdev.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016 RehiveTech. All rights reserved.
3 */
4
5#ifndef RTE_VDEV_H
6#define RTE_VDEV_H
7
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#include <rte_dev.h>
19#include <rte_devargs.h>
20
21struct rte_vdev_device {
22 RTE_TAILQ_ENTRY(rte_vdev_device) next;
23 struct rte_device device;
24};
25
30#define RTE_DEV_TO_VDEV(ptr) \
31 container_of(ptr, struct rte_vdev_device, device)
32
33#define RTE_DEV_TO_VDEV_CONST(ptr) \
34 container_of(ptr, const struct rte_vdev_device, device)
35
36#define RTE_ETH_DEV_TO_VDEV(eth_dev) RTE_DEV_TO_VDEV((eth_dev)->device)
37
38static inline const char *
39rte_vdev_device_name(const struct rte_vdev_device *dev)
40{
41 if (dev && dev->device.name)
42 return dev->device.name;
43 return NULL;
44}
45
46static inline const char *
47rte_vdev_device_args(const struct rte_vdev_device *dev)
48{
49 if (dev && dev->device.devargs)
50 return dev->device.devargs->args;
51 return "";
52}
53
56
60typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
61
65typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
66
83typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
84 uint64_t iova, size_t len);
85
102typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
103 uint64_t iova, size_t len);
104
115 uint32_t drv_flags;
116};
117
119#define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
120
129
138
139#define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
140static const char *vdrvinit_ ## nm ## _alias;\
141RTE_INIT(vdrvinitfn_ ##vdrv)\
142{\
143 (vdrv).driver.name = RTE_STR(nm);\
144 (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
145 rte_vdev_register(&vdrv);\
146} \
147RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
148
149#define RTE_PMD_REGISTER_ALIAS(nm, alias)\
150static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
151
152typedef void (*rte_vdev_scan_callback)(void *user_arg);
153
168int
169rte_vdev_add_custom_scan(rte_vdev_scan_callback callback, void *user_arg);
170
184int
185rte_vdev_remove_custom_scan(rte_vdev_scan_callback callback, void *user_arg);
186
197int rte_vdev_init(const char *name, const char *args);
198
207int rte_vdev_uninit(const char *name);
208
209#ifdef __cplusplus
210}
211#endif
212
213#endif
int rte_vdev_init(const char *name, const char *args)
int rte_vdev_add_custom_scan(rte_vdev_scan_callback callback, void *user_arg)
int() rte_vdev_dma_unmap_t(struct rte_vdev_device *dev, void *addr, uint64_t iova, size_t len)
Definition: rte_bus_vdev.h:102
int() rte_vdev_remove_t(struct rte_vdev_device *dev)
Definition: rte_bus_vdev.h:65
void rte_vdev_register(struct rte_vdev_driver *driver)
RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver)
int() rte_vdev_dma_map_t(struct rte_vdev_device *dev, void *addr, uint64_t iova, size_t len)
Definition: rte_bus_vdev.h:83
int rte_vdev_remove_custom_scan(rte_vdev_scan_callback callback, void *user_arg)
int rte_vdev_uninit(const char *name)
int() rte_vdev_probe_t(struct rte_vdev_device *dev)
Definition: rte_bus_vdev.h:60
void rte_vdev_unregister(struct rte_vdev_driver *driver)
const char * name
Definition: rte_dev.h:72
rte_vdev_remove_t * remove
Definition: rte_bus_vdev.h:112
rte_vdev_probe_t * probe
Definition: rte_bus_vdev.h:111
rte_vdev_dma_map_t * dma_map
Definition: rte_bus_vdev.h:113
struct rte_driver driver
Definition: rte_bus_vdev.h:110
RTE_TAILQ_ENTRY(rte_vdev_driver) next
rte_vdev_dma_unmap_t * dma_unmap
Definition: rte_bus_vdev.h:114
uint32_t drv_flags
Definition: rte_bus_vdev.h:115