From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by dpdk.org (Postfix) with ESMTP id 8A56EB5F6 for ; Thu, 19 Feb 2015 14:37:31 +0100 (CET) Received: by pdbnh10 with SMTP id nh10so8889125pdb.11 for ; Thu, 19 Feb 2015 05:37:30 -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=Ol6jeigayIaI/V0V2VOcWsHJcFSyjOXJUhRl2b2uGTg=; b=Eb9eSage1oaBRU0Wt7nIhSO+5wvi8jodCqBO/MIYSYxnntJtNQZ80OqqsHD9guM6Bt cnCD9UKdkC0PL1Yg7WvT28/g7/DYahQQh564OKTHaaOzzp7hP5YgUjtbGNFzn2d3AUoR uPXQvg14SjH8ZCDrU9eAkf6v460MQUxTabnDrZS+rhUUmFelmGFT4xMOtd+A5O9KEVsY ON2M8xwKyylkMuNcwniCc4pYX2o5fzrsbBqUyycKFrghg4xYmUvEo4H3Ir0QCdur/57i RBdykd1cFldgnc7XN7+IHv3gIKwBPpRDAesM3/2odK3s3DBXIr9UKp+X7QxzVwh2LUU9 iEdQ== X-Gm-Message-State: ALoCoQlmlp12a8zlc5wV2S3/s9foKpNCCTHv3z2odtHdu2TYlL2Wk0yaT2/sjsZKlGKLQpOaEqwI X-Received: by 10.70.88.105 with SMTP id bf9mr7680924pdb.77.1424353050847; Thu, 19 Feb 2015 05:37:30 -0800 (PST) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id rj7sm23753797pbc.58.2015.02.19.05.37.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Feb 2015 05:37:30 -0800 (PST) Message-ID: <54E5E716.4060108@igel.co.jp> Date: Thu, 19 Feb 2015 22:37:26 +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: <1424060073-23484-12-git-send-email-mukawa@igel.co.jp> <1424314187-25177-1-git-send-email-mukawa@igel.co.jp> <1424314187-25177-14-git-send-email-mukawa@igel.co.jp> <10399957.vsF1Tt8fsr@xps13> <54E5E55F.7020905@igel.co.jp> In-Reply-To: <54E5E55F.7020905@igel.co.jp> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v9 13/14] eal/pci: Add rte_eal_dev_attach/detach() functions 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, 19 Feb 2015 13:37:32 -0000 On 2015/02/19 22:30, Tetsuya Mukawa wrote: > On 2015/02/19 21:10, Thomas Monjalon wrote: >> 2015-02-19 11:49, Tetsuya Mukawa: >>> +/* attach the new virtual device, then store port_id of the device *= / >>> +static int >>> +rte_eal_dev_attach_vdev(const char *vdevargs, uint8_t *port_id) >>> +{ >>> + char *args; >>> + uint8_t new_port_id; >>> + struct rte_eth_dev devs[RTE_MAX_ETHPORTS]; >>> + >>> + if ((vdevargs =3D=3D NULL) || (port_id =3D=3D NULL)) >>> + goto err0; >>> + >>> + args =3D strdup(vdevargs); >>> + if (args =3D=3D NULL) >>> + goto err0; >>> + >>> + /* save current port status */ >>> + if (rte_eth_dev_save(devs, sizeof(devs))) >>> + goto err1; >>> + /* add the vdevargs to devargs_list */ >>> + if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, args)) >>> + goto err1; >> Could you explain why you store devargs in a list? > I try to do same behavior when rte_eal_init() is called. Sorry for lack of explanation. "vdevargs" of rte_eal_dev_attach_vdev() will be same format of "--vdev" option. And when rte_eal_init() is called, such a "--vdev" option value will be stored in devargs_list. So I try to same thing here. > If only hotplug doesn't do this, someone may be confused when they try > to realize devargs_list. > >>> + /* parse vdevargs, then retrieve device name */ >>> + get_vdev_name(args); >>> + /* walk around dev_driver_list to find the driver of the device, >>> + * then invoke probe function o the driver */ >>> + if (rte_eal_vdev_find_and_init(args)) >> TODO: get port_id from init. > Yes, I will. > I also add comment about it. > >>> + goto err2; >>> + /* get port_id enabled by above procedures */ >>> + if (rte_eth_dev_get_changed_port(devs, &new_port_id)) >>> + goto err2; >> [...] >>> --- a/lib/librte_eal/common/include/rte_dev.h >>> +++ b/lib/librte_eal/common/include/rte_dev.h >>> @@ -47,6 +47,7 @@ extern "C" { >>> #endif >>> =20 >>> #include >>> +#include >>> =20 >>> /** Double linked list of device drivers. */ >>> TAILQ_HEAD(rte_driver_list, rte_driver); >>> @@ -57,6 +58,11 @@ TAILQ_HEAD(rte_driver_list, rte_driver); >>> typedef int (rte_dev_init_t)(const char *name, const char *args); >>> =20 >>> /** >>> + * Uninitilization function called for each device driver once. >>> + */ >>> +typedef int (rte_dev_uninit_t)(const char *name); >> Why using name as parameter and not port_id? > This function pointer will be implemented in PMDs. > For example, in pcap PMD, rte_pmd_pcap_devuninit() is the function. > > static struct rte_driver pmd_pcap_drv =3D { > .name =3D "eth_pcap", > .type =3D PMD_VDEV, > .init =3D rte_pmd_pcap_devinit, > .uninit =3D rte_pmd_pcap_devuninit, > }; > > "port_id" isn't needed in PMD. > >> [...] >>> --- a/lib/librte_eal/linuxapp/eal/Makefile >>> +++ b/lib/librte_eal/linuxapp/eal/Makefile >>> @@ -45,6 +45,7 @@ CFLAGS +=3D -I$(RTE_SDK)/lib/librte_eal/common/incl= ude >>> CFLAGS +=3D -I$(RTE_SDK)/lib/librte_ring >>> CFLAGS +=3D -I$(RTE_SDK)/lib/librte_mempool >>> CFLAGS +=3D -I$(RTE_SDK)/lib/librte_malloc >>> +CFLAGS +=3D -I$(RTE_SDK)/lib/librte_mbuf >> Why do you need mbuf? > To include rte_ethdev.h in this code, rte_mbuf.h is also needed. > >> [...] >>> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map >>> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map >>> @@ -21,6 +21,8 @@ DPDK_2.0 { >>> rte_eal_alarm_cancel; >>> rte_eal_alarm_set; >>> rte_eal_dev_init; >>> + rte_eal_dev_attach; >>> + rte_eal_dev_detach; >> Please keep alphabetical order. >> > Sure, I will. > > Thanks, > Tetsuya >