1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2021 NVIDIA Corporation & Affiliates
5 #ifndef BUS_AUXILIARY_PRIVATE_H
6 #define BUS_AUXILIARY_PRIVATE_H
11 #include "rte_bus_auxiliary.h"
13 extern struct rte_auxiliary_bus auxiliary_bus;
14 extern int auxiliary_bus_logtype;
16 #define AUXILIARY_LOG(level, ...) \
17 rte_log(RTE_LOG_ ## level, auxiliary_bus_logtype, \
18 RTE_FMT("auxiliary bus: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
19 RTE_FMT_TAIL(__VA_ARGS__,)))
21 /* Auxiliary bus iterators */
22 #define FOREACH_DEVICE_ON_AUXILIARY_BUS(p) \
23 TAILQ_FOREACH(p, &(auxiliary_bus.device_list), next)
25 #define FOREACH_DRIVER_ON_AUXILIARY_BUS(p) \
26 TAILQ_FOREACH(p, &(auxiliary_bus.driver_list), next)
28 /* List of auxiliary devices. */
29 TAILQ_HEAD(rte_auxiliary_device_list, rte_auxiliary_device);
30 /* List of auxiliary drivers. */
31 TAILQ_HEAD(rte_auxiliary_driver_list, rte_auxiliary_driver);
34 * Structure describing the auxiliary bus
36 struct rte_auxiliary_bus {
37 struct rte_bus bus; /* Inherit the generic class */
38 struct rte_auxiliary_device_list device_list; /* List of devices */
39 struct rte_auxiliary_driver_list driver_list; /* List of drivers */
43 * Test whether the auxiliary device exist.
45 bool auxiliary_dev_exists(const char *name);
48 * Scan the content of the auxiliary bus, and the devices in the devices
51 int auxiliary_scan(void);
54 * Update a device being scanned.
56 void auxiliary_on_scan(struct rte_auxiliary_device *aux_dev);
59 * Validate whether a device with given auxiliary device should be ignored
62 bool auxiliary_is_ignored_device(const char *name);
65 * Add an auxiliary device to the auxiliary bus (append to auxiliary device
66 * list). This function also updates the bus references of the auxiliary
67 * device and the generic device object embedded within.
69 void auxiliary_add_device(struct rte_auxiliary_device *aux_dev);
72 * Insert an auxiliary device in the auxiliary bus at a particular location
73 * in the device list. It also updates the auxiliary bus reference of the
74 * new devices to be inserted.
76 void auxiliary_insert_device(struct rte_auxiliary_device *exist_aux_dev,
77 struct rte_auxiliary_device *new_aux_dev);
80 * Match the auxiliary driver and device by driver function.
82 bool auxiliary_match(const struct rte_auxiliary_driver *aux_drv,
83 const struct rte_auxiliary_device *aux_dev);
86 * Iterate over devices, matching any device against the provided string.
88 void *auxiliary_dev_iterate(const void *start, const char *str,
89 const struct rte_dev_iterator *it);
91 #endif /* BUS_AUXILIARY_PRIVATE_H */