[dpdk-dev] [PATCH] bus/pci: use device driver name instead of handler type

Alejandro Lucero alejandro.lucero at netronome.com
Thu Oct 25 08:00:51 CEST 2018


On Thu, Oct 25, 2018 at 6:30 AM Alejandro Lucero <
alejandro.lucero at netronome.com> wrote:

>
>
> On Thu, Oct 25, 2018 at 12:11 AM Thomas Monjalon <thomas at monjalon.net>
> wrote:
>
>> Hi,
>>
>> 19/10/2018 18:43, Alejandro Lucero:
>> > --- a/drivers/bus/pci/linux/pci.c
>> > +++ b/drivers/bus/pci/linux/pci.c
>> > +     char devname[RTE_DEV_NAME_MAX_LEN] = {0};
>>
>> I think "" would be more appropriate than {0}.
>>
>> >       const struct rte_intr_handle *intr_handle = &device->intr_handle;
>> >
>> > -     switch (intr_handle->type) {
>> > -     case RTE_INTR_HANDLE_UIO:
>> > -     case RTE_INTR_HANDLE_UIO_INTX:
>> > +     switch (device->kdrv) {
>> > +     case RTE_KDRV_IGB_UIO:
>> >               return pci_uio_read_config(intr_handle, buf, len, offset);
>> > -
>> > -#ifdef VFIO_PRESENT
>>
>> Why this #ifdef is removed?
>>
>>
> Because it is not needed. VFIO is present if the kdrv field tells us so.
>

And at this point it is clear VFIO is present if that is the case.
Otherwise this code is not executed.


>
>
>> > -     case RTE_INTR_HANDLE_VFIO_MSIX:
>> > -     case RTE_INTR_HANDLE_VFIO_MSI:
>> > -     case RTE_INTR_HANDLE_VFIO_LEGACY:
>> > +     case RTE_KDRV_VFIO:
>> >               return pci_vfio_read_config(intr_handle, buf, len,
>> offset);
>> > -#endif
>> >       default:
>> > +             rte_pci_device_name(&device->addr, devname,
>> > +                                 RTE_DEV_NAME_MAX_LEN);
>> >               RTE_LOG(ERR, EAL,
>> > -                     "Unknown handle type of fd %d\n",
>> > -                                     intr_handle->fd);
>> > +                     "Unknown driver type for %s\n", devname);
>> >               return -1;
>> >       }
>>
>>
>>
>>


More information about the dev mailing list