DPDK  21.11.8
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
15 extern "C" {
16 #endif
17 
18 #include <rte_dev.h>
19 #include <rte_devargs.h>
20 
21 struct 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 
38 static inline const char *
39 rte_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 
46 static inline const char *
47 rte_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 
55 RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
56 
60 typedef int (rte_vdev_probe_t)(struct rte_vdev_device *dev);
61 
65 typedef int (rte_vdev_remove_t)(struct rte_vdev_device *dev);
66 
83 typedef int (rte_vdev_dma_map_t)(struct rte_vdev_device *dev, void *addr,
84  uint64_t iova, size_t len);
85 
102 typedef int (rte_vdev_dma_unmap_t)(struct rte_vdev_device *dev, void *addr,
103  uint64_t iova, size_t len);
104 
109  RTE_TAILQ_ENTRY(rte_vdev_driver) next;
110  struct rte_driver driver;
115  uint32_t drv_flags;
116 };
117 
119 #define RTE_VDEV_DRV_NEED_IOVA_AS_VA 0x0001
120 
128 void rte_vdev_register(struct rte_vdev_driver *driver);
129 
137 void rte_vdev_unregister(struct rte_vdev_driver *driver);
138 
139 #define RTE_PMD_REGISTER_VDEV(nm, vdrv)\
140 static const char *vdrvinit_ ## nm ## _alias;\
141 RTE_INIT(vdrvinitfn_ ##vdrv)\
142 {\
143  (vdrv).driver.name = RTE_STR(nm);\
144  (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\
145  rte_vdev_register(&vdrv);\
146 } \
147 RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
148 
149 #define RTE_PMD_REGISTER_ALIAS(nm, alias)\
150 static const char *vdrvinit_ ## nm ## _alias = RTE_STR(alias)
151 
152 typedef void (*rte_vdev_scan_callback)(void *user_arg);
153 
168 int
169 rte_vdev_add_custom_scan(rte_vdev_scan_callback callback, void *user_arg);
170 
184 int
185 rte_vdev_remove_custom_scan(rte_vdev_scan_callback callback, void *user_arg);
186 
197 int rte_vdev_init(const char *name, const char *args);
198 
207 int rte_vdev_uninit(const char *name);
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 
213 #endif
rte_vdev_dma_map_t * dma_map
Definition: rte_bus_vdev.h:113
rte_vdev_probe_t * probe
Definition: rte_bus_vdev.h:111
RTE_TAILQ_HEAD(vdev_driver_list, rte_vdev_driver)
int rte_vdev_uninit(const char *name)
int rte_vdev_init(const char *name, const char *args)
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
void rte_vdev_register(struct rte_vdev_driver *driver)
uint32_t drv_flags
Definition: rte_bus_vdev.h:115
int rte_vdev_remove_custom_scan(rte_vdev_scan_callback callback, void *user_arg)
void rte_vdev_unregister(struct rte_vdev_driver *driver)
int rte_vdev_add_custom_scan(rte_vdev_scan_callback callback, void *user_arg)
int() rte_vdev_remove_t(struct rte_vdev_device *dev)
Definition: rte_bus_vdev.h:65
rte_vdev_dma_unmap_t * dma_unmap
Definition: rte_bus_vdev.h:114
const char * name
Definition: rte_dev.h:72
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_probe_t(struct rte_vdev_device *dev)
Definition: rte_bus_vdev.h:60