qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Luigi Rizzo <rizzo@iet.unipi.it>
Cc: Giuseppe Lettieri <giuseppe.lettieri@iet.unipi.it>,
	qemu-devel@nongnu.org, v.maffione@gmail.com
Subject: Re: [Qemu-devel] nic-specific options ? (Re: [RFC] updated e1000 mitigation patch)
Date: Mon, 14 Jan 2013 09:58:29 +0100	[thread overview]
Message-ID: <20130114085829.GA11260@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <20130111145350.GD79361@onelab2.iet.unipi.it>

On Fri, Jan 11, 2013 at 03:53:50PM +0100, Luigi Rizzo wrote:
> On Thu, Jan 10, 2013 at 01:25:48PM +0100, Stefan Hajnoczi wrote:
> > On Thu, Dec 27, 2012 at 11:06:58AM +0100, Luigi Rizzo wrote:
> > > diff -urp qemu-1.3.0-orig/hw/e1000.c qemu-1.3.0/hw/e1000.c
> > > --- qemu-1.3.0-orig/hw/e1000.c	2012-12-03 20:37:05.000000000 +0100
> > > +++ qemu-1.3.0/hw/e1000.c	2012-12-27 09:47:16.000000000 +0100
> > > @@ -35,6 +35,8 @@
> > >  
> > >  #include "e1000_hw.h"
> > >  
> > > +static int mit_on = 1;	/* interrupt mitigation enable */
> > 
> > If you want to make this optional then please put it inside E1000State
> > so it can be toggled per NIC.
> 
> what is the simplest way to add NIC-specific options ?
> I have added one line to e1000_properties, as below
> 
>  static Property e1000_properties[] = {
>      DEFINE_NIC_PROPERTIES(E1000State, conf),
> +    DEFINE_PROP_UINT32("mit_on, E1000State, mit_on, 0),
>      DEFINE_PROP_END_OF_LIST(),
>  };
> 
> and this way i can do recognise this on the command line
> 	qemu ... -device e1000,mit_on=1 ...
> 
> but i do not know how to set the property for the NIC i am using.
> Specifically, i normally run qemu with "-net nic,model=1000"
> (leaving the nic unconnected to the host network, so i can
> test the tx path without being constrained by the backend's speed)

Short answer: -device e1000,mit_on=1,vlan=2

That puts the e1000 on its own hub (QEMU "VLAN") and not connected to
the outside world.  This is equivalent what you get with "-net
nic,model=e1000" except you can specify device properties like "mit_on".

Long answer:

"-net nic" is handled in net_init_nic().  Unfortunately this goes via
the intermediate NICInfo struct instead of directly to the e1000
properties.  You'd need to plumb the option through NICInfo, but that's
ugly since NICInfo is not e1000-specific and other NICs don't have the
option.

I'm not sure if it's possible to get rid of NICInfo and the nd_table[]
global but I hope so.

For the time being I'd avoid using device-specific options with "-net
nic".

Stefan

      reply	other threads:[~2013-01-14  8:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27 10:06 [Qemu-devel] [RFC] updated e1000 mitigation patch Luigi Rizzo
2012-12-28 17:48 ` Blue Swirl
2013-01-10 12:25 ` Stefan Hajnoczi
2013-01-11 14:53   ` [Qemu-devel] nic-specific options ? (Re: [RFC] updated e1000 mitigation patch) Luigi Rizzo
2013-01-14  8:58     ` Stefan Hajnoczi [this message]

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=20130114085829.GA11260@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=giuseppe.lettieri@iet.unipi.it \
    --cc=qemu-devel@nongnu.org \
    --cc=rizzo@iet.unipi.it \
    --cc=v.maffione@gmail.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).