KVM Archive on lore.kernel.org
 help / color / Atom feed
From: Alex Williamson <alex.williamson@hp.com>
To: Mark McLoughlin <markmc@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>, kvm <kvm@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH 2/4] virtio_net: Add a virtqueue for outbound control commands
Date: Wed, 14 Jan 2009 09:01:08 -0700
Message-ID: <1231948868.7109.288.camel@lappy> (raw)
In-Reply-To: <1231928110.4944.290.camel@localhost.localdomain>

On Wed, 2009-01-14 at 10:15 +0000, Mark McLoughlin wrote:
> On Tue, 2009-01-13 at 14:23 -0700, Alex Williamson wrote:
> > This will be used for RX mode, MAC filter table, VLAN filtering, etc...
> 
> Looks very reasonable. I'm a bit wary of send_command() being
> synchronous, but it probably makes sense.

Yes, I tried to make it async, but quickly ran into problems sleeping
when I wasn't allowed to.  Using it in this way does pretty much limit
it to an outbound channel though... all worthy of commit log comments.

> > +static int virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
> > +				void *data, unsigned int len)
> > +{
> > +	struct scatterlist sg[3];
> > +	struct {
> > +		u8 class;
> > +		u8 cmd;
> > +	} ctrl_cmd;
> 
> I'd like to see this defined in virtio_net_hdr.

As part of struct virtio_net_hdr?  I'm not sure what that'd buy us and
would likely break compatibility.  Or do you simply mean defined in
virtio-net.h?

> Why the need for class/cmd? Why not just a single 16 bit command field?

It seemed like a good way to logically divide up an address space and
makes it easy for the backend to break up the code so it doesn't become
a huge table.

> > +	u8 ctrl_status;
> > +	unsigned int tmp;
> > +	int i = 0;
> > +
> > +	if (!vi->cvq)
> > +		return -EFAULT;
> 
> BUG_ON() probably makes more sense here.

This is to allow a newer virtio_net guest driver to run on an old qemu.
That's why I don't generate a fatal error if we don't find the control
queue.  In that case the backend will be running in promiscuous mode and
I think all of these commands can safely fail.  Thanks for the comments.

Alex

-- 
Alex Williamson                             HP Open Source & Linux Org.


  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 21:23 Alex Williamson
2009-01-14 10:15 ` Mark McLoughlin
2009-01-14 16:01   ` Alex Williamson [this message]
2009-01-14 16:37     ` Mark McLoughlin

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=1231948868.7109.288.camel@lappy \
    --to=alex.williamson@hp.com \
    --cc=kvm@vger.kernel.org \
    --cc=markmc@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
		kvm@vger.kernel.org
	public-inbox-index kvm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.kvm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git