[dpdk-dev] [PATCH v8 09/14] bus: introduce device plug/unplug functionality

Jan Blunck jblunck at infradead.org
Fri Jun 30 20:52:12 CEST 2017


On Fri, Jun 30, 2017 at 8:38 PM, Gaëtan Rivet <gaetan.rivet at 6wind.com> wrote:
> On Fri, Jun 30, 2017 at 08:19:38PM +0200, Jan Blunck wrote:
>> This allows the buses to plug and probe specific devices. This is meant to
>> be a building block for hotplug support.
>>
>> Signed-off-by: Jan Blunck <jblunck at infradead.org>
>> ---
>>  lib/librte_eal/common/eal_common_bus.c  |  2 ++
>>  lib/librte_eal/common/include/rte_bus.h | 32 ++++++++++++++++++++++++++++++++
>>  2 files changed, 34 insertions(+)
>>
>> diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
>> index bf2b138..87b0c6e 100644
>> --- a/lib/librte_eal/common/eal_common_bus.c
>> +++ b/lib/librte_eal/common/eal_common_bus.c
>> @@ -51,6 +51,8 @@ rte_bus_register(struct rte_bus *bus)
>>       RTE_VERIFY(bus->scan);
>>       RTE_VERIFY(bus->probe);
>>       RTE_VERIFY(bus->find_device);
>> +     /* Buses supporting driver plug also require unplug. */
>> +     RTE_VERIFY(!bus->plug || bus->unplug);
>>
>>       TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
>>       RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name);
>> diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
>> index 509292d..34ea9d5 100644
>> --- a/lib/librte_eal/common/include/rte_bus.h
>> +++ b/lib/librte_eal/common/include/rte_bus.h
>> @@ -108,6 +108,36 @@ typedef struct rte_device *
>>                        const void *data);
>>
>>  /**
>> + * Implementation specific probe function which is responsible for linking
>> + * devices on that bus with applicable drivers.
>> + *
>> + * @param dev
>> + *   Device pointer that was returned by a previous call to find_device.
>> + *
>> + * @param devargs
>> + *   Device declaration.
>> + *
>> + * @return
>> + *   The pointer to a valid rte_device usable by the bus on success.
>> + *   NULL on error. rte_errno is then set.
>> + */
>> +typedef int (*rte_bus_plug_t)(struct rte_device *dev,
>
> This typedef does not match its doc.
> If it is the doc that is right, the PCI and vdev implementation should
> be fixed as well.
>

No, its the doc that needs fixing.

diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/inc
lude/rte_bus.h
index 34ea9d5..2f1c911 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -118,8 +118,8 @@ typedef struct rte_device *
  *     Device declaration.
  *
  * @return
- *     The pointer to a valid rte_device usable by the bus on success.
- *     NULL on error. rte_errno is then set.
+ *     0 on success.
+ *     !0 on error.
  */
 typedef int (*rte_bus_plug_t)(struct rte_device *dev,
                              const char *devargs);
@@ -133,7 +133,7 @@ typedef int (*rte_bus_plug_t)(struct rte_device *dev,
  *
  * @return
  *     0 on success.
- *     !0 on error. rte_errno is then set.
+ *     !0 on error.
  */
 typedef int (*rte_bus_unplug_t)(struct rte_device *dev);


More information about the dev mailing list