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

Santosh Shukla sshukla at mvista.com
Thu Jan 7 19:48:43 CET 2016


On Fri, Jan 8, 2016 at 12:09 AM, Stephen Hemminger <
stephen at networkplumber.org> wrote:

> On Thu, 7 Jan 2016 18:26:30 +0000
> "Wiles, Keith" <keith.wiles at intel.com> wrote:
>
> > On 1/7/16, 12:19 PM, "dev on behalf of Stephen Hemminger" <
> dev-bounces at dpdk.org on behalf of stephen at networkplumber.org> wrote:
> >
> > >On Thu,  7 Jan 2016 22:03:03 +0530
> > >Santosh Shukla <sshukla at mvista.com> wrote:
> > >
> > >>
> > >> +int rte_eal_pci_read_bar(const struct rte_pci_device *device
> __rte_unused,
> > >> +                   void *buf __rte_unused,
> > >> +                   size_t len __rte_unused,
> > >> +                   off_t offset __rte_unused,
> > >> +                   int bar_idx __rte_unused)
> > >> +{
> > >> +#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
> > >> +  return 0; /* UIO's not applicable */
> > >> +#endif
> > >> +}
> > >
> > >It seems wrong to declare all the parameters as unused but then use
> them.
> > >Maybe there is a way to have a macro for USED(x) in the #else case
> >
> > I would suggest we create a macro '#define RTE_UNUSED(x)  ((void)x)’,
> unless we have one and I missed it groping though the code.
> > >
> >
> >
> > Regards,
> > Keith
> >
> >
> >
> >
>
> Or just move the #ifdef outside the function and have two versions
>
> #ifdef VFIO_PRESENT
> int rte_eal_pci_read_bar(const struct rte_pci_device *device,
>                          void *buf, size_t len,
>                           off_t offset, int bar_idx)
> {
>         const struct rte_intr_handle *intr_handle = &device->intr_handle;
>
>         return pci_vfio_read_bar(intr_handle, buf, len, offset, bar_idx);
> }
> }
> #else
> int rte_eal_pci_read_bar(const struct rte_pci_device *device __rte_unused,
>                          void *buf __rte_unused,
>                          size_t len __rte_unused,
>                          off_t offset __rte_unused,
>                          int bar_idx __rte_unused)
> {
>         return 0; /* UIO's not applicable */
> }
> #endif
>

I'll pick this one!, Thanks.


More information about the dev mailing list