DPDK 25.03.0-rc0
rte_dev.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2014 6WIND S.A.
3 */
4
5#ifndef _RTE_DEV_H_
6#define _RTE_DEV_H_
7
16#include <stdio.h>
17
18#include <rte_config.h>
19#include <rte_common.h>
20#include <rte_log.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26struct rte_bus;
27struct rte_devargs;
28struct rte_device;
29struct rte_driver;
30
38};
39
40typedef void (*rte_dev_event_cb_fn)(const char *device_name,
41 enum rte_dev_event_type event,
42 void *cb_arg);
43
48 RTE_DEV_ALLOWED,
49 RTE_DEV_BLOCKED,
50};
51
56 uint64_t phys_addr;
57 uint64_t len;
58 void *addr;
59};
60
69const char *
70rte_driver_name(const struct rte_driver *driver);
71
80const struct rte_bus *
81rte_dev_bus(const struct rte_device *dev);
82
91const char *
92rte_dev_bus_info(const struct rte_device *dev);
93
102const struct rte_devargs *
103rte_dev_devargs(const struct rte_device *dev);
104
113const struct rte_driver *
114rte_dev_driver(const struct rte_device *dev);
115
124const char *
125rte_dev_name(const struct rte_device *dev);
126
135int
136rte_dev_numa_node(const struct rte_device *dev);
137
138/*
139 * Internal identifier length
140 * Sufficiently large to allow for UUID or PCI address
141 */
142#define RTE_DEV_NAME_MAX_LEN 64
143
152int rte_dev_is_probed(const struct rte_device *dev);
153
170int rte_eal_hotplug_add(const char *busname, const char *devname,
171 const char *drvargs);
172
184int rte_dev_probe(const char *devargs);
185
199int rte_eal_hotplug_remove(const char *busname, const char *devname);
200
212int rte_dev_remove(struct rte_device *dev);
213
233typedef int (*rte_dev_cmp_t)(const struct rte_device *dev, const void *data);
234
235#define RTE_PMD_EXPORT_NAME_ARRAY(n, idx) n##idx[]
236
237#define RTE_PMD_EXPORT_NAME(name, idx) \
238static const char RTE_PMD_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
239__rte_used = RTE_STR(name)
240
241#define DRV_EXP_TAG(name, tag) __##name##_##tag
242
243#define RTE_PMD_REGISTER_PCI_TABLE(name, table) \
244static const char DRV_EXP_TAG(name, pci_tbl_export)[] __rte_used = \
245RTE_STR(table)
246
247#define RTE_PMD_REGISTER_PARAM_STRING(name, str) \
248static const char DRV_EXP_TAG(name, param_string_export)[] \
249__rte_used = str
250
272#define RTE_PMD_REGISTER_KMOD_DEP(name, str) \
273static const char DRV_EXP_TAG(name, kmod_dep_export)[] \
274__rte_used = str
275
282 const char *dev_str;
283 const char *bus_str;
284 const char *cls_str;
285 struct rte_bus *bus;
286 struct rte_class *cls;
287 struct rte_device *device;
289};
290
319typedef void *(*rte_dev_iterate_t)(const void *start,
320 const char *devstr,
321 const struct rte_dev_iterator *it);
322
343int
344rte_dev_iterator_init(struct rte_dev_iterator *it, const char *str);
345
362struct rte_device *
364
365#define RTE_DEV_FOREACH(dev, devstr, it) \
366 for (rte_dev_iterator_init(it, devstr), \
367 dev = rte_dev_iterator_next(it); \
368 dev != NULL; \
369 dev = rte_dev_iterator_next(it))
370
387int
388rte_dev_event_callback_register(const char *device_name,
389 rte_dev_event_cb_fn cb_fn,
390 void *cb_arg);
391
408int
409rte_dev_event_callback_unregister(const char *device_name,
410 rte_dev_event_cb_fn cb_fn,
411 void *cb_arg);
412
422void
423rte_dev_event_callback_process(const char *device_name,
424 enum rte_dev_event_type event);
425
433int
435
443int
445
453int
455
463int
465
486int
487rte_dev_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len);
488
509int
510rte_dev_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
511 size_t len);
512
513#ifdef __cplusplus
514}
515#endif
516
517#endif /* _RTE_DEV_H_ */
int rte_dev_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
int rte_dev_event_monitor_start(void)
int rte_dev_event_monitor_stop(void)
struct rte_device * rte_dev_iterator_next(struct rte_dev_iterator *it)
rte_dev_policy
Definition: rte_dev.h:47
int rte_dev_is_probed(const struct rte_device *dev)
int rte_dev_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
int rte_dev_event_callback_register(const char *device_name, rte_dev_event_cb_fn cb_fn, void *cb_arg)
const struct rte_driver * rte_dev_driver(const struct rte_device *dev)
int rte_dev_iterator_init(struct rte_dev_iterator *it, const char *str)
int rte_dev_probe(const char *devargs)
const char * rte_dev_name(const struct rte_device *dev)
const struct rte_bus * rte_dev_bus(const struct rte_device *dev)
int rte_dev_hotplug_handle_enable(void)
int rte_dev_event_callback_unregister(const char *device_name, rte_dev_event_cb_fn cb_fn, void *cb_arg)
const char * rte_driver_name(const struct rte_driver *driver)
int rte_dev_hotplug_handle_disable(void)
int rte_dev_remove(struct rte_device *dev)
int rte_eal_hotplug_add(const char *busname, const char *devname, const char *drvargs)
int rte_dev_numa_node(const struct rte_device *dev)
const char * rte_dev_bus_info(const struct rte_device *dev)
const struct rte_devargs * rte_dev_devargs(const struct rte_device *dev)
int(* rte_dev_cmp_t)(const struct rte_device *dev, const void *data)
Definition: rte_dev.h:233
void rte_dev_event_callback_process(const char *device_name, enum rte_dev_event_type event)
rte_dev_event_type
Definition: rte_dev.h:34
@ RTE_DEV_EVENT_ADD
Definition: rte_dev.h:35
@ RTE_DEV_EVENT_REMOVE
Definition: rte_dev.h:36
@ RTE_DEV_EVENT_MAX
Definition: rte_dev.h:37
int rte_eal_hotplug_remove(const char *busname, const char *devname)
const char * bus_str
Definition: rte_dev.h:283
struct rte_class * cls
Definition: rte_dev.h:286
void * class_device
Definition: rte_dev.h:288
struct rte_device * device
Definition: rte_dev.h:287
struct rte_bus * bus
Definition: rte_dev.h:285
const char * cls_str
Definition: rte_dev.h:284
const char * dev_str
Definition: rte_dev.h:282
uint64_t phys_addr
Definition: rte_dev.h:56
uint64_t len
Definition: rte_dev.h:57
void * addr
Definition: rte_dev.h:58