From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f177.google.com (mail-ob0-f177.google.com [209.85.214.177]) by dpdk.org (Postfix) with ESMTP id 567BD5A52 for ; Tue, 7 Jul 2015 10:04:43 +0200 (CEST) Received: by obdbs4 with SMTP id bs4so123592145obd.3 for ; Tue, 07 Jul 2015 01:04:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=3T9ElGaCJlc/5p5s6mNtof65LZp4RAsFIcyAbN0Ohvw=; b=QOkkDnkGov5xSDlAymsW5PTrByEEEFEgZnBTNlnxtfE5GJxfCNx6ImS4cfosdlbr/Q TaOCtU7WKwf5kNopsNoe8BFTNqGNiu5sLi1mwYf6CRgYmrl7tEd6CRSHUG4vdPkcAxfI yObh2ztltQOXgcntDtyvD8Ow8CLnmzU0B8ESsj6xOEbrecBzZS/2X4uCtvJWaMQAszHi VGmhX4bMCa4FbUe60bkGDF7Rsv0svTRzzaVkLOk2zeYrM22sCRpXr6r5avL4PsTFt48a nPyKR9EBQsD3U+Giaoy6p8fZrxGygzjrfFfIqXDw+BNTYsi8/TUrn3/BUsWAzbm8Fjq5 BKoQ== X-Gm-Message-State: ALoCoQl1opc65vTXj8aBUp50MtExRG00uWPw2btQawi8FJ4MOgmoykKGnWWzMeDf55wRDfQVaJOh MIME-Version: 1.0 X-Received: by 10.60.78.104 with SMTP id a8mr2793484oex.58.1436256282799; Tue, 07 Jul 2015 01:04:42 -0700 (PDT) Received: by 10.76.84.233 with HTTP; Tue, 7 Jul 2015 01:04:42 -0700 (PDT) In-Reply-To: <1436163861-3025-6-git-send-email-mukawa@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> Date: Tue, 7 Jul 2015 10:04:42 +0200 Message-ID: From: David Marchand To: Tetsuya Mukawa Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v8 05/12] eal: Fix uio mapping differences between linuxapp and bsdapp X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jul 2015 08:04:43 -0000 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 > + 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