From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tetsuya Mukawa Subject: Re: [PATCH v8 05/12] eal: Fix uio mapping differences between linuxapp and bsdapp Date: Wed, 08 Jul 2015 11:42:32 +0900 Message-ID: <559C8E18.9090804@igel.co.jp> References: <1435652668-3380-12-git-send-email-mukawa@igel.co.jp> <1436163861-3025-1-git-send-email-mukawa@igel.co.jp> <1436163861-3025-6-git-send-email-mukawa@igel.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" To: David Marchand Return-path: Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by dpdk.org (Postfix) with ESMTP id 390095A58 for ; Wed, 8 Jul 2015 04:42:38 +0200 (CEST) Received: by pddu5 with SMTP id u5so49016001pdd.3 for ; Tue, 07 Jul 2015 19:42:36 -0700 (PDT) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 2015/07/07 17:04, David Marchand wrote: > On Mon, Jul 6, 2015 at 8:24 AM, Tetsuya Mukawa > wrote: > > diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c > b/lib/librte_eal/bsdapp/eal/eal_pci.c > index 21d1e66..92d9886 100644 > --- a/lib/librte_eal/bsdapp/eal/eal_pci.c > +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c > > @@ -170,19 +154,33 @@ pci_uio_map_secondary(struct rte_pci_device > *dev) > TAILQ_FOREACH(uio_res, uio_res_list, next) { > > /* skip this element if it doesn't match our PCI > address */ > - if (memcmp(&uio_res->pci_addr, &dev->addr, > sizeof(dev->addr))) > + if (rte_eal_compare_pci_addr(&uio_res->pci_addr, > &dev->addr)) > continue; > > for (i = 0; i != uio_res->nb_maps; i++) { > - if (pci_map_resource(uio_res->maps[i].addr, > - uio_res->path, > - > (off_t)uio_res->maps[i].offset, > - > (size_t)uio_res->maps[i].size) > - != uio_res->maps[i].addr) { > + /* > + * open devname, to mmap it > + */ > + fd = open(uio_res->maps[i].path, O_RDWR); > + if (fd < 0) { > + RTE_LOG(ERR, EAL, "Cannot open %s: > %s\n", > + uio_res->maps[i].path, > strerror(errno)); > + return -1; > + } > + > + void *mapaddr = > pci_map_resource(uio_res->maps[i].addr, > + fd, > (off_t)uio_res->maps[i].offset, > + > (size_t)uio_res->maps[i].size, 0); > > > I suppose you can close fd here Yes, I will move close() here. Tetsuya > > > + if (mapaddr != uio_res->maps[i].addr) { > RTE_LOG(ERR, EAL, > - "Cannot mmap device > resource\n"); > + "Cannot mmap device > resource file %s to address: %p\n", > + uio_res->maps[i].path, > + uio_res->maps[i].addr); > + close(fd); > > > and remove it from here > > return -1; > } > + /* fd is not needed in slave process, > close it */ > + close(fd); > > > and here. > > > The rest is ok for me. > Acked-by: David Marchand > > > -- > David Marchand