1@@ -21,6 +21,7 @@ extern "C" { 2 3 #include <rte_config.h> 4 #include <rte_common.h> 5+#include <rte_compat.h> 6 #include <rte_log.h> 7 8 struct rte_bus; 9@@ -41,6 +42,19 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name, 10 enum rte_dev_event_type event, 11 void *cb_arg); 12 13+/* Macros to check for invalid function pointers */ 14+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) RTE_DEPRECATED(RTE_FUNC_PTR_OR_ERR_RET) \ 15+do { \ 16+ if ((func) == NULL) \ 17+ return retval; \ 18+} while (0) 19+ 20+#define RTE_FUNC_PTR_OR_RET(func) RTE_DEPRECATED(RTE_FUNC_PTR_OR_RET) \ 21+do { \ 22+ if ((func) == NULL) \ 23+ return; \ 24+} while (0) 25+ 26 /** 27 * Device policies. 28 */ 29@@ -340,6 +354,7 @@ typedef void *(*rte_dev_iterate_t)(const void *start, 30 * 0 on successful initialization. 31 * <0 on error. 32 */ 33+__rte_experimental 34 int 35 rte_dev_iterator_init(struct rte_dev_iterator *it, const char *str); 36 37@@ -359,6 +374,7 @@ rte_dev_iterator_init(struct rte_dev_iterator *it, const char *str); 38 * NULL if an error occurred (rte_errno is set). 39 * NULL if no device could be found (rte_errno is not set). 40 */ 41+__rte_experimental 42 struct rte_device * 43 rte_dev_iterator_next(struct rte_dev_iterator *it); 44 45@@ -369,6 +385,9 @@ rte_dev_iterator_next(struct rte_dev_iterator *it); 46 dev = rte_dev_iterator_next(it)) 47 48 /** 49+ * @warning 50+ * @b EXPERIMENTAL: this API may change without prior notice 51+ * 52 * It registers the callback for the specific device. 53 * Multiple callbacks can be registered at the same time. 54 * 55@@ -384,12 +403,16 @@ rte_dev_iterator_next(struct rte_dev_iterator *it); 56 * - On success, zero. 57 * - On failure, a negative value. 58 */ 59+__rte_experimental 60 int 61 rte_dev_event_callback_register(const char *device_name, 62 rte_dev_event_cb_fn cb_fn, 63 void *cb_arg); 64 65 /** 66+ * @warning 67+ * @b EXPERIMENTAL: this API may change without prior notice 68+ * 69 * It unregisters the callback according to the specified device. 70 * 71 * @param device_name 72@@ -405,12 +428,16 @@ rte_dev_event_callback_register(const char *device_name, 73 * - On success, return the number of callback entities removed. 74 * - On failure, a negative value. 75 */ 76+__rte_experimental 77 int 78 rte_dev_event_callback_unregister(const char *device_name, 79 rte_dev_event_cb_fn cb_fn, 80 void *cb_arg); 81 82 /** 83+ * @warning 84+ * @b EXPERIMENTAL: this API may change without prior notice 85+ * 86 * Executes all the user application registered callbacks for 87 * the specific device. 88 * 89@@ -419,47 +446,64 @@ rte_dev_event_callback_unregister(const char *device_name, 90 * @param event 91 * the device event type. 92 */ 93+__rte_experimental 94 void 95 rte_dev_event_callback_process(const char *device_name, 96 enum rte_dev_event_type event); 97 98 /** 99+ * @warning 100+ * @b EXPERIMENTAL: this API may change without prior notice 101+ * 102 * Start the device event monitoring. 103 * 104 * @return 105 * - On success, zero. 106 * - On failure, a negative value. 107 */ 108+__rte_experimental 109 int 110 rte_dev_event_monitor_start(void); 111 112 /** 113+ * @warning 114+ * @b EXPERIMENTAL: this API may change without prior notice 115+ * 116 * Stop the device event monitoring. 117 * 118 * @return 119 * - On success, zero. 120 * - On failure, a negative value. 121 */ 122+__rte_experimental 123 int 124 rte_dev_event_monitor_stop(void); 125 126 /** 127+ * @warning 128+ * @b EXPERIMENTAL: this API may change without prior notice 129+ * 130 * Enable hotplug handling for devices. 131 * 132 * @return 133 * - On success, zero. 134 * - On failure, a negative value. 135 */ 136+__rte_experimental 137 int 138 rte_dev_hotplug_handle_enable(void); 139 140 /** 141+ * @warning 142+ * @b EXPERIMENTAL: this API may change without prior notice 143+ * 144 * Disable hotplug handling for devices. 145 * 146 * @return 147 * - On success, zero. 148 * - On failure, a negative value. 149 */ 150+__rte_experimental 151 int 152 rte_dev_hotplug_handle_disable(void); 153 154@@ -483,6 +527,7 @@ rte_dev_hotplug_handle_disable(void); 155 * 0 if mapping was successful. 156 * Negative value and rte_errno is set otherwise. 157 */ 158+__rte_experimental 159 int 160 rte_dev_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len); 161 162@@ -506,6 +551,7 @@ rte_dev_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len); 163 * 0 if un-mapping was successful. 164 * Negative value and rte_errno is set otherwise. 165 */ 166+__rte_experimental 167 int 168 rte_dev_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, 169 size_t len); 170