qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] nic-specific options ? (Re: [RFC] updated e1000 mitigat


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] nic-specific options ? (Re: [RFC] updated e1000 mitigation patch)
Date: Mon, 14 Jan 2013 09:58:29 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]