From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by dpdk.org (Postfix) with ESMTP id 934E7B6A8 for ; Tue, 17 Feb 2015 07:15:33 +0100 (CET) Received: by pdjp10 with SMTP id p10so41623167pdj.3 for ; Mon, 16 Feb 2015 22:15:33 -0800 (PST) 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=zwPiLAwjGcQ0kefgvzHRXZbvSwmUsG2KzOvgdwyGSNE=; b=HveesHP9/c2yuSTBzeQB4KEoaO3DCxtJm3NoHR4Sj2FLQzbdCSxVCDEw8b5+otgcft Yy8j2L6THQMebDmNyMSDhhIGPt69ek/44M7XY4h1dX/K0IfWTqObor1ByDHHK1VDnJ8I 6+uZ6L8EHbGEXiGiicdJ34tlBiLb9aCrVeNA72oNMN+N9tZ38yFdCb6YNUQq6cnT3Qv8 hHkeNdwgY2w9SxmrfQs9SBaAhu/rp7e2fc8wQXcOE0k8J4BuRnM0CAz1P4AuePoFEb4S IqE3XiqhapEg/80MiU7R3s48yGCeIbQxZVNoUco0sf7d+NtIa70gaeSoKfTx9gsLsdvI ZGuw== X-Gm-Message-State: ALoCoQlxX6abHGNhNl59c3QYsD/uw6iQepa7TDzvByXWHp8J9o743vyRuN7hmMZhe3I2MpG16gfy X-Received: by 10.70.37.238 with SMTP id b14mr20189906pdk.50.1424153733030; Mon, 16 Feb 2015 22:15:33 -0800 (PST) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id bw3sm16476583pbb.9.2015.02.16.22.15.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2015 22:15:32 -0800 (PST) Message-ID: <54E2DC82.8070901@igel.co.jp> Date: Tue, 17 Feb 2015 15:15:30 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Thomas Monjalon References: <1423470639-15744-2-git-send-email-mukawa@igel.co.jp> <1424060073-23484-1-git-send-email-mukawa@igel.co.jp> <1424060073-23484-9-git-send-email-mukawa@igel.co.jp> <2770102.I27SuxhSqW@xps13> In-Reply-To: <2770102.I27SuxhSqW@xps13> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v8 08/14] eal/linux/pci: Add functions for unmapping igb_uio resources 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, 17 Feb 2015 06:15:34 -0000 On 2015/02/17 10:11, Thomas Monjalon wrote: > 2015-02-16 13:14, Tetsuya Mukawa: >> The patch adds functions for unmapping igb_uio resources. The patch is= only >> for Linux and igb_uio environment. VFIO and BSD are not supported. >> >> v8: >> - Fix typo. >> (Thanks to Iremonger, Bernard) >> v5: >> - Fix pci_unmap_device() to check pt_driver. >> v4: >> - Add parameter checking. >> - Add header file to determine if hotplug can be enabled. >> >> Signed-off-by: Tetsuya Mukawa >> --- >> lib/librte_eal/common/Makefile | 1 + >> lib/librte_eal/common/include/rte_dev_hotplug.h | 44 ++++++++++++++++= + >> lib/librte_eal/linuxapp/eal/eal_pci.c | 44 ++++++++++++++++= + >> lib/librte_eal/linuxapp/eal/eal_pci_init.h | 8 +++ >> lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 65 ++++++++++++++++= +++++++++ >> 5 files changed, 162 insertions(+) >> create mode 100644 lib/librte_eal/common/include/rte_dev_hotplug.h >> >> diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Ma= kefile >> index 52c1a5f..db7cc93 100644 >> --- a/lib/librte_eal/common/Makefile >> +++ b/lib/librte_eal/common/Makefile >> @@ -41,6 +41,7 @@ INC +=3D rte_eal_memconfig.h rte_malloc_heap.h >> INC +=3D rte_hexdump.h rte_devargs.h rte_dev.h >> INC +=3D rte_common_vect.h >> INC +=3D rte_pci_dev_feature_defs.h rte_pci_dev_features.h >> +INC +=3D rte_dev_hotplug.h >> =20 >> ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y) >> INC +=3D rte_warnings.h >> diff --git a/lib/librte_eal/common/include/rte_dev_hotplug.h b/lib/lib= rte_eal/common/include/rte_dev_hotplug.h >> new file mode 100644 >> index 0000000..b333e0f >> --- /dev/null >> +++ b/lib/librte_eal/common/include/rte_dev_hotplug.h >> @@ -0,0 +1,44 @@ >> +/*- >> + * BSD LICENSE >> + * >> + * Copyright(c) 2015 IGEL Co.,LTd. >> + * All rights reserved. >> + * >> + * Redistribution and use in source and binary forms, with or witho= ut >> + * modification, are permitted provided that the following conditio= ns >> + * are met: >> + * >> + * * Redistributions of source code must retain the above copyrig= ht >> + * notice, this list of conditions and the following disclaimer= =2E >> + * * Redistributions in binary form must reproduce the above copy= right >> + * notice, this list of conditions and the following disclaimer= in >> + * the documentation and/or other materials provided with the >> + * distribution. >> + * * Neither the name of IGEL Co.,Ltd. nor the names of its >> + * contributors may be used to endorse or promote products deri= ved >> + * from this software without specific prior written permission= =2E >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUT= ORS >> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NO= T >> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNES= S FOR >> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYR= IGHT >> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDE= NTAL, >> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT= >> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF= USE, >> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O= N ANY >> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR T= ORT >> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF TH= E USE >> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM= AGE. >> + */ >> + >> +#ifndef _RTE_DEV_HOTPLUG_H_ >> +#define _RTE_DEV_HOTPLUG_H_ >> + >> +/* >> + * determine if hotplug can be enabled on the system >> + */ >> +#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAP= P) >> +#define ENABLE_HOTPLUG >> +#endif /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */ > Please no. > You just have to set the build option to no in the default BSD config f= ile > with a comment explaining it is not supported. OK, I will change like you said. >> + >> +#endif /* _RTE_DEV_HOTPLUG_H_ */ >> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/li= nuxapp/eal/eal_pci.c >> index 2d5f6a6..72a1362 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c >> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c >> @@ -167,6 +167,25 @@ pci_map_resource(void *requested_addr, int fd, of= f_t offset, size_t size) >> return mapaddr; >> } >> =20 >> +#ifdef ENABLE_HOTPLUG > Please avoid using #ifdef if not really necessary. I agree with you. In this case, only hotplug functions call pci_unmap_resource(). So this will be needed. >> +/* unmap a particular resource */ >> +void >> +pci_unmap_resource(void *requested_addr, size_t size) >> +{ >> + if (requested_addr =3D=3D NULL) >> + return; >> + >> + /* Unmap the PCI memory resource of device */ >> + if (munmap(requested_addr, size)) { >> + RTE_LOG(ERR, EAL, "%s(): cannot munmap(%p, 0x%lx): %s\n", >> + __func__, requested_addr, (unsigned long)size, >> + strerror(errno)); >> + } else >> + RTE_LOG(DEBUG, EAL, " PCI memory unmapped at %p\n", >> + requested_addr); >> +} >> +#endif /* ENABLE_HOTPLUG */ >> + >> /* parse the "resource" sysfs file */ >> #define IORESOURCE_MEM 0x00000200 > [...]