From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 7D29F475E for ; Wed, 25 May 2016 13:54:43 +0200 (CEST) Received: by mail-wm0-f43.google.com with SMTP id n129so177672889wmn.1 for ; Wed, 25 May 2016 04:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=VeFyxoiblkTrPxuh1k7Ed5VfJJu7ZlVeK/HJj0rPVkk=; b=dffWpX9jcBwc8ByP7ntbGwJdpCfRPQZFpC/N1rcYoWEFjZH0uLr9QwoLnr2LBdnAwz E832hW8CYDrPhfdczkoNkEswmQfspaXnwU3J+iXVs32oNIDH2/4Y2vvSZU9G9t5EBFtf lp+7RT1mbtIBRbyHO59W1ggvymmsQdW/ysodBZ/3r/Ba8eqLrTwHpbf8PKc6C4WG/Doc fwZk6bEzCKPeBlbECHCr3b4VNxYKF1B3kbBj4TyKsPeytMkk5KCBHd2sCI7f6UDuD5WN 6L8ZX3e5YKX7ptzaLEj1XRgI4kq22mJSI3Y7FgtcxiQkBMhwSEHIwAD5tcIdUwZkgNKX VWsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=VeFyxoiblkTrPxuh1k7Ed5VfJJu7ZlVeK/HJj0rPVkk=; b=GjPcwpSi/2paeqoBg0OEIZGgKWgYFg3ZEr9NvSEraqnWwx8tJUlv2oKX0qBJ7qVvmX lWgSf9J1zn4d365Zd3klsZWZfAGWBTVE7qOHhKmKU+42szSut9hxVjgAIUm6wIgpPQpU xTsSCVnz6cSGxVhGH0+IrX+1jge3OjRUm01G0zyd6J+23Nk6vy5FtwejYg8024a4Z6BZ oZVadRtpwL1mEp/HYhMJsSdhOEdFYlQ8l9Qv/vPntfQai78p9Vw7YIuiejAOPQxfSqq1 kwsFlbqt4DCQgYkJ7Que6G/NnsRbXoi+TuWRlpfaNQS1VHuXA1Qzv1AYvg6EBqRqjPL3 IrUg== X-Gm-Message-State: ALyK8tKOflXoirFQsB0mSRJuEHbwUVRGAwRhlcHeEEDPmnKQiDCkczD+4mVwLz101lBfL5/U X-Received: by 10.195.8.40 with SMTP id dh8mr43991wjd.178.1464177283234; Wed, 25 May 2016 04:54:43 -0700 (PDT) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id f8sm8427907wjm.13.2016.05.25.04.54.41 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 May 2016 04:54:42 -0700 (PDT) From: Thomas Monjalon To: Yuanhan Liu Cc: Bruce Richardson , Ferruh Yigit , dev@dpdk.org, Tetsuya Mukawa , david.marchand@6wind.com Date: Wed, 25 May 2016 13:54:41 +0200 Message-ID: <3536324.AAsUjNi441@xps13> User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20160525044159.GS5641@yliu-dev.sh.intel.com> References: <20160509213124.GK5641@yliu-dev.sh.intel.com> <20160524094256.GA3264@bricha3-MOBL3> <20160525044159.GS5641@yliu-dev.sh.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2] vhost: add support for dynamic vhost PMD creation 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, 25 May 2016 11:54:43 -0000 2016-05-25 12:41, Yuanhan Liu: > On Tue, May 24, 2016 at 10:42:56AM +0100, Bruce Richardson wrote: > > On Tue, May 24, 2016 at 01:11:26PM +0800, Yuanhan Liu wrote: > > > On Mon, May 23, 2016 at 06:06:21PM +0100, Ferruh Yigit wrote: > > > > On 5/23/2016 2:24 PM, Yuanhan Liu wrote: > > > > > On Fri, May 20, 2016 at 11:37:47AM +0100, Bruce Richardson wrote: > > > > >> On Thu, May 19, 2016 at 06:44:44PM +0200, Thomas Monjalon wrote: > > > > >>> 2016-05-19 17:28, Ferruh Yigit: > > > > >>>> On 5/19/2016 9:33 AM, Thomas Monjalon wrote: > > > > >>>>> 2016-05-18 18:10, Ferruh Yigit: > > > > >>>>>> Add rte_eth_from_vhost() API to create vhost PMD dynamically from > > > > >>>>>> applications. > > > > >>>>> > > > > >>>>> How is it different from rte_eth_dev_attach() calling rte_eal_vdev_init()? > > > > >>>>> > > > > >>>> > > > > >>>> When used rte_eth_dev_attach(), application also needs to do: > > > > >>>> rte_eth_dev_configure() > > > > >>>> rte_eth_rx_queue_setup() > > > > >>>> rte_eth_tx_queue_setup() > > > > >>>> rte_eth_dev_start() > > > > >>>> > > > > >>>> rte_eth_from_vhost() does these internally, easier to use for applications. > > > > >>> > > > > >>> This argument is not sufficient. > > > > >>> We are not going to add new APIs just for wrapping others. > > > > >> > > > > >> Why not - if there is a sufficient increase in developer usability by doing so? > > > > >> Having one API that saves an app from having to call 5 other APIs looks like > > > > >> something that should always be given fair consideration. > > > > > > > > > > Good point. Judging that vhost is not the only virtual device we > > > > > support, and it may also look reasonable to add something similar > > > > > for others in future (say, IIRC, you proposed two more internally > > > > > that also introduced similar APIs). So, instead of introducing a > > > > > new API for each such vdev, may we introduce a common one? Say, > > > > > a refined rte_eth_dev_attach(), including dev_configure(), > > > > > queue_setup(), etc. > > > > > > > > > > > > > This sounds good to me. If there is not objection, I will send a patch > > > > and we can discuss based on patch. > > > > > > Let's wait and gather some comments first? > > > > > I'm not sure that such a general approach is likely to work, > > Me, neither. Thus I threw it out for more discussion. > > > as the parameters > > needed for each individual driver are going to be different. > > Well, if you plan to pass all necessary informations to the driver by > parameters like this v1 does, then yes, that's true and a generic API > is unlikely to work. But what I was thinking is that we feed it by > strings, like the arguments for '--vdev' option. In such way, we could > have an unified interface (if that works, which is something I'm not > quite sure). Yes, that is the plan with the EAL rework in progress. Hotplugging is being redefined at EAL level and needs a configuration API with devargs to be complete. > OTOH, let's assume there is a switch that supports quite many such > vdevs, as well as the ability to add a new device dynamically by > corresponding API. And assume there is just one external interface > from the switch to add a dynamical device (say, "ovs-vsctl add-port"), > you then also need build some codes to invoke the right API, as well > as constructing the right parameters, like what you said below. > > This let me think of the vhost dequeue/enqueue API. Basically speaking, > it has the same functionality the rte_eth_rx/tx_burst has, but just > different API name and different parameters. This results to OVS has > to write different netdev_class, one for NIC, another one for vhost-user. > (actually, there is yet another one for vhost-cuse). > > And now since we have vhost-pmd, we could just have one netdev_class > at OVS, saving their (and other application's) effort to build/maintain > similar codes. Yes, it was a good improvement. > Thus, I'm __just wondering__ could we add a generic interface to create > vdev dynamically for all such vdevs? I was thinking something like: > > rte_create_vdev(type, char *options); Actually, it has more sense to first create the device with an attach() function and the configure it with devargs. So neither attaching nor configuring are specific to vdev. And devargs configuration can happen long after creating the device object. I suggest to reject this patch and continue the EAL rework initiated by David.