From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by dpdk.org (Postfix) with ESMTP id 00E666A95 for ; Thu, 11 Dec 2014 04:14:45 +0100 (CET) Received: by mail-pa0-f49.google.com with SMTP id eu11so4103252pac.36 for ; Wed, 10 Dec 2014 19:14:45 -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=82LrGcpOAB6QEblszOAMhxOmOJo7s7fam9c91anygXk=; b=kq78fSsrc7QMVRmZ9XI5FgZLE8Xe8yFQrtc0OkO13OIC9OKYWVTRm2cK9R564N1Mx9 96dQzjsn6qZQJJGdIfTFamMD271WL1fHrq1e0BPrwuYarwmT7Jwy3Z9vbcTDT//BNELq Hdfy+4/2qojrvixUGpJVoeTdyo8oA5pdVOLCkFuxfI57/DD1i5RQomkQo7eMpw85DHx3 Su0+2Mie9EbHw3eCQdwqzrfjrchh/8dz4zO5UM2ld7PPSWSSDFCA1PhkXHWaCzkbBizl MtotOLvFSuNXcHqOn8ODdnVFdLx9jX2rh74KEEjTYR3CxuZAYcKrvmAU0seMts9SrNim ZxyA== X-Gm-Message-State: ALoCoQnxbWy6McafjR+4BXPA9Lck2nqKpHc4Uh9H3sWUglyVxsWnzbN8Z01uuRqDesy17Z4A0SDt X-Received: by 10.66.171.206 with SMTP id aw14mr12959258pac.40.1418267685228; Wed, 10 Dec 2014 19:14:45 -0800 (PST) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id fr1sm5442782pbb.32.2014.12.10.19.14.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 19:14:44 -0800 (PST) Message-ID: <54890C22.7060703@igel.co.jp> Date: Thu, 11 Dec 2014 12:14:42 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "Qiu, Michael" , "dev@dpdk.org" References: <1416474399-16851-1-git-send-email-mukawa@igel.co.jp> <1418106629-22227-1-git-send-email-mukawa@igel.co.jp> <1418106629-22227-16-git-send-email-mukawa@igel.co.jp> <533710CFB86FA344BFBF2D6802E60286C9E24E@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E60286C9E24E@SHSMSX101.ccr.corp.intel.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "nakajima.yoshihiro@lab.ntt.co.jp" , "masutani.hitoshi@lab.ntt.co.jp" , "menrigh@brocade.com" Subject: Re: [dpdk-dev] [PATCH v3 15/28] eal/pci: Add probe and close function for virtual drivers 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: Thu, 11 Dec 2014 03:14:46 -0000 Hi Michael, (2014/12/10 0:51), Qiu, Michael wrote: > On 2014/12/9 14:33, Tetsuya Mukawa wrote: >> The patch adds rte_eal_dev_init_one() and rte_eal_dev_close_one(). >> These are used for attaching and detaching virtual devices. >> >> Signed-off-by: Tetsuya Mukawa >> --- >> lib/librte_eal/common/eal_common_dev.c | 66 +++++++++++++++++++++++++++++++++ >> lib/librte_eal/common/include/rte_dev.h | 6 +++ >> lib/librte_eal/linuxapp/eal/Makefile | 1 + >> 3 files changed, 73 insertions(+) >> >> diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c >> index eae5656..f573a54 100644 >> --- a/lib/librte_eal/common/eal_common_dev.c >> +++ b/lib/librte_eal/common/eal_common_dev.c >> @@ -32,10 +32,13 @@ >> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> */ >> >> +#include >> +#include >> #include >> #include >> #include >> >> +#include >> #include >> #include >> #include >> @@ -107,3 +110,66 @@ rte_eal_dev_init(void) >> } >> return 0; >> } >> + >> +/* So far, linux only supports DPDK hotplug function. */ > Sorry, I don't know if I get your point, should be "only linux" right? I am sorry for my bad English. "DPDK hotplug function only supports linux" will be correct. Thanks, Tetsuya > >> +#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP) >> + >> +#define INVOKE_PROBE (0) >> +#define INVOKE_CLOSE (1) >> + >> +static void >> +rte_eal_dev_invoke(struct rte_driver *driver, >> + struct rte_devargs *devargs, int type) >> +{ >> + if ((driver == NULL) || (devargs == NULL)) >> + return; >> + >> + switch (type) { >> + case INVOKE_PROBE: >> + driver->init(devargs->virtual.drv_name, devargs->args); >> + break; >> + case INVOKE_CLOSE: >> + driver->close(devargs->virtual.drv_name, devargs->args); >> + break; >> + } >> +} >> + >> +static int >> +rte_eal_dev_find_and_invoke(const char *name, int type) >> +{ >> + struct rte_devargs *devargs; >> + struct rte_driver *driver; >> + >> + if (name == NULL) >> + return -EINVAL; >> + >> + /* call the init function for each virtual device */ >> + TAILQ_FOREACH(devargs, &devargs_list, next) { >> + >> + if (devargs->type != RTE_DEVTYPE_VIRTUAL) >> + continue; >> + >> + if (strncmp(name, devargs->virtual.drv_name, strlen(name))) >> + continue; >> + >> + TAILQ_FOREACH(driver, &dev_driver_list, next) { >> + if (driver->type != PMD_VDEV) >> + continue; >> + >> + /* search a driver prefix in virtual device name */ >> + if (!strncmp(driver->name, devargs->virtual.drv_name, >> + strlen(driver->name))) { >> + rte_eal_dev_invoke(driver, devargs, type); >> + break; >> + } >> + } >> + >> + if (driver == NULL) { >> + RTE_LOG(WARNING, EAL, "no driver found for %s\n", >> + devargs->virtual.drv_name); >> + } >> + return 0; >> + } >> + return 1; >> +} >> +#endif /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */ >> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h >> index f7e3a10..71d40c3 100644 >> --- a/lib/librte_eal/common/include/rte_dev.h >> +++ b/lib/librte_eal/common/include/rte_dev.h >> @@ -57,6 +57,11 @@ TAILQ_HEAD(rte_driver_list, rte_driver); >> typedef int (rte_dev_init_t)(const char *name, const char *args); >> >> /** >> + * Close function called for each device driver once. >> + */ >> +typedef int (rte_dev_close_t)(const char *name, const char *args); >> + >> +/** >> * Driver type enumeration >> */ >> enum pmd_type { >> @@ -72,6 +77,7 @@ struct rte_driver { >> enum pmd_type type; /**< PMD Driver type */ >> const char *name; /**< Driver name. */ >> rte_dev_init_t *init; /**< Device init. function. */ >> + rte_dev_close_t *close; /**< Device close. function. */ >> }; >> >> /** >> diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile >> index 72ecf3a..0ec83b5 100644 >> --- a/lib/librte_eal/linuxapp/eal/Makefile >> +++ b/lib/librte_eal/linuxapp/eal/Makefile >> @@ -41,6 +41,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include >> CFLAGS += -I$(RTE_SDK)/lib/librte_ring >> CFLAGS += -I$(RTE_SDK)/lib/librte_mempool >> CFLAGS += -I$(RTE_SDK)/lib/librte_malloc >> +CFLAGS += -I$(RTE_SDK)/lib/librte_mbuf >> CFLAGS += -I$(RTE_SDK)/lib/librte_ether >> CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem >> CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring