From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by dpdk.org (Postfix) with ESMTP id 4645958EF for ; Fri, 20 Mar 2015 02:53:31 +0100 (CET) Received: by pdbop1 with SMTP id op1so93409307pdb.2 for ; Thu, 19 Mar 2015 18:53:30 -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=3s+LjqrKpTS3ryhp09qsqiY/EV+BcVspUUsnkOR8Lsc=; b=hN8xVX8dPMLsRcsqY6HhNRXvZUAOnvQexzcDjN9I9815g2MasidLh/9JA24BaWBkN2 BvPc6BeJUeKqzdIKnD9HXRztHrqfxM0OSVhNjCQszTM7qADTFVWZmTm5ezfCEeb6zRQV NfbpKrcUmafuhwZfSC/6opDiAHouPo2kru/KUpE+ZaREGicKXwdkSuYfY/GHWiF0TrMh 7REnHfHOk38TqckCY9aRCBB5OWGFjXvvElPnfihCEDTx11uC0ip1SrSHQgVnGk0SqQiY XaU00u3dseIFseB8ZzBc3j++T3RJGquh03o28FmIla2Y68VR2tPjvnGM6Mq7KMntF/2C +ZlA== X-Gm-Message-State: ALoCoQkJdRmX5k5vXXr040UbP+oi92qNQs8XUNZ6Y0FstSay8B5wz4H9lMmgTU2tRsAsDEr11cwS X-Received: by 10.70.134.74 with SMTP id pi10mr78942554pdb.119.1426816410390; Thu, 19 Mar 2015 18:53:30 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id c16sm5042898pdk.94.2015.03.19.18.53.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 18:53:29 -0700 (PDT) Message-ID: <550B7D9B.4080302@igel.co.jp> Date: Fri, 20 Mar 2015 10:53:31 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: David Marchand References: <1426155474-1596-4-git-send-email-mukawa@igel.co.jp> <1426584645-28828-1-git-send-email-mukawa@igel.co.jp> <1426584645-28828-3-git-send-email-mukawa@igel.co.jp> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 2/6] eal: Close file descriptor of uio configuration 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: Fri, 20 Mar 2015 01:53:31 -0000 On 2015/03/19 0:19, David Marchand wrote: > On Tue, Mar 17, 2015 at 10:30 AM, Tetsuya Mukawa > wrote: > > When pci_uio_unmap_resource() is called, a file descriptor that is > used > for uio configuration should be closed. > > Signed-off-by: Tetsuya Mukawa > > --- > lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > index 9cdf24f..b971ec9 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > @@ -459,8 +459,14 @@ pci_uio_unmap_resource(struct rte_pci_device > *dev) > > /* close fd if in primary process */ > close(dev->intr_handle.fd); > - > dev->intr_handle.fd =3D -1; > + > + /* close cfg_fd if in primary process */ > > + if (dev->intr_handle.uio_cfg_fd >=3D 0) { > + close(dev->intr_handle.uio_cfg_fd); > + dev->intr_handle.uio_cfg_fd =3D -1; > + } > + > dev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN; > } > #endif /* RTE_LIBRTE_EAL_HOTPLUG */ > > > Hum, why check for < 0 value ? > There is no such check for intr_handle.fd and I can see no reason why > we should behave differently. > Hi David, There is a reason, but 'if-condition' should move to later patch. When we move this function to eal common, bsdapp will not use cfg_fd at a= ll. (Nic uio of BSD will not use this file descriptor.) So I added the 'if-condition' like above. But, I will move this fixing in later patch that actually consolidate this function. Thanks, Tetsuya > > --=20 > David Marchand