DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
	Thomas Monjalon <thomas.monjalon@6wind.com>,
	dev@dpdk.org, Tetsuya Mukawa <mukawa@igel.co.jp>
Subject: Re: [dpdk-dev] [PATCH v2] vhost: add support for dynamic vhost PMD creation
Date: Wed, 25 May 2016 12:41:59 +0800	[thread overview]
Message-ID: <20160525044159.GS5641@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <20160524094256.GA3264@bricha3-MOBL3>

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).

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.

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);

Which in turn will invoke the right function pointer for different
"type" to do the right setups.

	--yliu

> For some devices,
> much of the parameters can be implied, while for others they may not be and still
> others needed additional setup parameters. For the simplest case, take the
> rte_eth_from_ring API, which creates an ethdev backed by a single rte_ring. The
> number of rx and tx queues and their sizes are all determined by the actual
> underlying ring, as is the numa node and all other parameters. On the other
> hand, we have something like a pcap PMD, where again none of the queue sizes
> need to be specified, but we do need additional parameters to provide the
> underlying pcap file/device to use. Other devices will similarly need different
> options, including in some cases queue counts and sizes.
> 
> Therefore, I think trying to generalise the function is pointless. If you have
> to write your code to build up a specific set of parameters to pass to a general
> API, then you are no better off than just calling a specific API directly. In
> both cases you need different code for each device type.
> 
> Regards,
> /Bruce

  reply	other threads:[~2016-05-25  4:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 18:11 [dpdk-dev] [PATCH] " Ferruh Yigit
2016-05-09 21:31 ` Yuanhan Liu
2016-05-10 17:11   ` Ferruh Yigit
2016-05-18 17:10   ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2016-05-19  8:33     ` Thomas Monjalon
2016-05-19 16:28       ` Ferruh Yigit
2016-05-19 16:44         ` Thomas Monjalon
2016-05-20  1:59           ` Yuanhan Liu
2016-05-20 10:37           ` Bruce Richardson
2016-05-20 12:03             ` Thomas Monjalon
2016-05-23 13:24             ` Yuanhan Liu
2016-05-23 17:06               ` Ferruh Yigit
2016-05-24  5:11                 ` Yuanhan Liu
2016-05-24  9:42                   ` Bruce Richardson
2016-05-25  4:41                     ` Yuanhan Liu [this message]
2016-05-25 11:54                       ` Thomas Monjalon
2016-05-26  7:58                         ` Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160525044159.GS5641@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=mukawa@igel.co.jp \
    --cc=thomas.monjalon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).