xref: /dpdk/drivers/bus/vdev/rte_bus_vdev.h (revision 4851ef2b40bc31accfffc3bb476930a73f50afac)
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 
8 /**
9  * @file
10  * RTE virtual bus API
11  *
12  */
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 typedef void (*rte_vdev_scan_callback)(void *user_arg);
19 
20 /**
21  * Add a callback to be called on vdev scan
22  * before reading the devargs list.
23  *
24  * This function cannot be called in a scan callback
25  * because of deadlock.
26  *
27  * @param callback
28  *   The function to be called which can update the devargs list.
29  * @param user_arg
30  *   An opaque pointer passed to callback.
31  * @return
32  *   0 on success, negative on error
33  */
34 int
35 rte_vdev_add_custom_scan(rte_vdev_scan_callback callback, void *user_arg);
36 
37 /**
38  * Remove a registered scan callback.
39  *
40  * This function cannot be called in a scan callback
41  * because of deadlock.
42  *
43  * @param callback
44  *   The registered function to be removed.
45  * @param user_arg
46  *   The associated opaque pointer or (void*)-1 for any.
47  * @return
48  *   0 on success
49  */
50 int
51 rte_vdev_remove_custom_scan(rte_vdev_scan_callback callback, void *user_arg);
52 
53 /**
54  * Initialize a driver specified by name.
55  *
56  * @param name
57  *   The pointer to a driver name to be initialized.
58  * @param args
59  *   The pointer to arguments used by driver initialization.
60  * @return
61  *  0 on success, negative on error
62  */
63 int rte_vdev_init(const char *name, const char *args);
64 
65 /**
66  * Uninitialize a driver specified by name.
67  *
68  * @param name
69  *   The pointer to a driver name to be uninitialized.
70  * @return
71  *  0 on success, negative on error
72  */
73 int rte_vdev_uninit(const char *name);
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif
80