From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=OozmFKbTGBT0g6qeT87MK6VjC+nPovrKwGOmmygBEIw=; b=kmglo/i2uTAjyeZDzkXkIf2UcmuYPQfuCshx5jHLB2XHCeGq1ORw7QIL7AUXipyfMK jZauAMDOlwXbndGcdyqQnQjIrZE79bZVr/Ogid8QBFyfzngRNaCXwNdap7HyFDb3dsMb +pMul3uKc7gywZvqNDnsxdUAp/PoXiv82Yms/yzayYM6jYW9vbULIaMYs7aN+pp67sv9 YLmvFSXU2m5M2LqNPz/fNic3XDUsT+BPT8y6KcCUqj8lnKQTBWUMWPMqGgqFctT3+7Lj 2GeTkCYJVr23Oc9biQYwsLbukBkTnIwZ6KHG5iWm8RCLkUgUpRbTcIZYVUUj6n591qpI 1cfw== X-Gm-Message-State: ALoCoQnNhRogCP/BVwdR2N6H5vLZL4J6Eg0/nwddkVKlEIIdM2PanNHDA3nOpPK7pJjG045ZmjZZ X-Received: by 10.67.5.197 with SMTP id co5mr11597805pad.68.1436323356426; Tue, 07 Jul 2015 19:42:36 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by smtp.googlemail.com with ESMTPSA id l1sm529218pdp.71.2015.07.07.19.42.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 19:42:35 -0700 (PDT) Message-ID: <559C8E18.9090804@igel.co.jp> Date: Wed, 08 Jul 2015 11:42:32 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: David Marchand 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> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Wed, 08 Jul 2015 02:42:40 -0000 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