On 2015/07/07 17:05, David Marchand wrote: > > > On Mon, Jul 6, 2015 at 8:24 AM, Tetsuya Mukawa <mukawa at igel.co.jp > <mailto:mukawa at igel.co.jp>> wrote: > > From: "Tetsuya.Mukawa" <mukawa at igel.co.jp <mailto:mukawa at > igel.co.jp>> > > This patch adds a new function called pci_uio_map_resource_by_index(). > The function hides how to map uio resource in linuxapp and bsdapp. > With the function, pci_uio_map_resource() will be more abstracted. > > Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp > <mailto:mukawa at igel.co.jp>> > --- > lib/librte_eal/bsdapp/eal/eal_pci.c | 107 > +++++++++++++++----------- > lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 124 > +++++++++++++++++------------- > 2 files changed, 133 insertions(+), 98 deletions(-) > > diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c > b/lib/librte_eal/bsdapp/eal/eal_pci.c > index ce0ca07..c76f936 100644 > --- a/lib/librte_eal/bsdapp/eal/eal_pci.c > +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c > @@ -241,20 +241,73 @@ error: > return -1; > } > > +static int > +pci_uio_map_resource_by_index(struct rte_pci_device *dev, int > res_idx, > + struct mapped_pci_resource *uio_res, int map_idx) > +{ > + int fd; > + char *devname; > + void *mapaddr; > + uint64_t offset; > + uint64_t pagesz; > + struct pci_map *maps; > + > + if ((dev == NULL) || (uio_res == NULL) || (uio_res->path > == NULL)) > + return -1; > > > No need for these checks. >
I will fix it. > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > index f408bd3..cafabba 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > @@ -333,19 +333,82 @@ error: > return -1; > } > > +static int > +pci_uio_map_resource_by_index(struct rte_pci_device *dev, int > res_idx, > + struct mapped_pci_resource *uio_res, int map_idx) > +{ > + int fd; > + char devname[PATH_MAX]; /* contains the /dev/uioX */ > + void *mapaddr; > + struct rte_pci_addr *loc; > + struct pci_map *maps; > + > + if ((dev == NULL) || (uio_res == NULL)) > + return -1; > > > Idem. > > Also, I will fix it. Tetsuya > Then, > Acked-by: David Marchand <david.marchand at 6wind.com > <mailto:david.marchand at 6wind.com>> > > > -- > David Marchand >