[dpdk-dev] [PATCH v4 06/14] eal: pci: vfio: add rd/wr func for pci bar space

Santosh Shukla sshukla at mvista.com
Sat Jan 16 09:06:24 CET 2016


On Fri, Jan 15, 2016 at 11:18 AM, Yuanhan Liu
<yuanhan.liu at linux.intel.com> wrote:
> On Thu, Jan 14, 2016 at 06:58:29PM +0530, Santosh Shukla wrote:
> ...
>> +int rte_eal_pci_read_bar(const struct rte_pci_device *device,
>> +                      void *buf, size_t len, off_t offset,
>> +                      int bar_idx)
>> +
>> +{
>> +#ifdef VFIO_PRESENT
>> +     const struct rte_intr_handle *intr_handle = &device->intr_handle;
>> +     return pci_vfio_read_bar(intr_handle, buf, len, offset, bar_idx);
>> +#else
>> +     /* UIO's not applicable */
>> +     RTE_SET_USED(device);
>> +     RTE_SET_USED(buf);
>> +     RTE_SET_USED(len);
>> +     RTE_SET_USED(offset);
>> +     RTE_SET_USED(bar_idx);
>> +     return 0;
>> +#endif
>
> Maybe you could do that like what pci_map_device() does:
>
>         switch(dev->kdrv) {
>         case RTE_KDRV_NIC_VFIO:
>                 return pci_vfio_read_bar(..);
>                 break;
>         default:
>                 RTE_LOG(.... not supported by driver: %d\n"..);
>                 break;
>         }
>
> With that, you could get rid of those ugly RTE_SET_USED....
>

Even better, Thanks!
>         --yliu


More information about the dev mailing list