[PATCH v2 1/6] bus/cdx: introduce cdx bus
Gupta, Nipun
Nipun.Gupta at amd.com
Sun Apr 16 11:20:06 CEST 2023
> -----Original Message-----
> From: Yigit, Ferruh <Ferruh.Yigit at amd.com>
> Sent: Friday, April 14, 2023 10:15 PM
> To: Gupta, Nipun <Nipun.Gupta at amd.com>; dev at dpdk.org;
> thomas at monjalon.net; david.marchand at redhat.com
> Cc: Anand, Harpreet <harpreet.anand at amd.com>; Agarwal, Nikhil
> <nikhil.agarwal at amd.com>
> Subject: Re: [PATCH v2 1/6] bus/cdx: introduce cdx bus
>
> On 4/13/2023 2:26 PM, Nipun Gupta wrote:
> > CDX bus supports multiple type of devices, which can be
> > exposed to user-space via vfio-cdx.
> >
> > vfio-cdx provides the MMIO IO_MEMORY regions as well as the
> > DMA interface for the device (IOMMU).
> >
> > This support aims to enable the DPDK to support the cdx
> > devices in user-space using VFIO interface.
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta at amd.com>
>
> <...>
>
> > +/* map a particular resource from a file */
> > +void *
> > +cdx_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
> > + int additional_flags)
> > +{
> > + void *mapaddr;
> > +
> > + /* Map the cdx MMIO memory resource of device */
> > + mapaddr = rte_mem_map(requested_addr, size,
> > + RTE_PROT_READ | RTE_PROT_WRITE,
> > + RTE_MAP_SHARED | additional_flags, fd, offset);
> > + if (mapaddr == NULL) {
> > + CDX_BUS_ERR("%s(): cannot map resource(%d, %p, 0x%zx,
> 0x%llx): %s (%p)",
> > + __func__, fd, requested_addr, size,
> > + (unsigned long long)offset,
>
> `checkpatches.sh` complains about '%l' usage, and 'offset' seems defined
> as 'off_t' type.
>
> As far as I can see 'off_t' is not part of C standard (but posix
> standard), and it is signed, also not clear if 32 bits or 64 bits.
>
> Since caller of this function already passes parameter with 'uint64_t'
> type, why not change the 'offset' type of this function to 'uint64_t'
> for simplification, and use 'PRIu64' format specifier?
Makes sense. Will update this in next respin.
More information about the dev
mailing list