qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Dmitry Fleytman <dmitry@daynix.com>,
	Jason Wang <jasowang@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/4] e1000e: Use regular DEFINE_PROP_<type> macros for properties
Date: Thu, 27 Oct 2016 17:13:34 +0200	[thread overview]
Message-ID: <20161027171334.29db5536@nial.brq.redhat.com> (raw)
In-Reply-To: <20161027112527.GE5057@thinpad.lan.raisama.net>

On Thu, 27 Oct 2016 09:25:27 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> On Thu, Oct 27, 2016 at 09:38:28AM +0300, Dmitry Fleytman wrote:
> >   
> > > On 27 Oct 2016, at 06:12 AM, Jason Wang <jasowang@redhat.com> wrote:
> > > 
> > > 
> > > 
> > > On 2016年10月27日 03:21, Eduardo Habkost wrote:  
> > >> Instead of hacking custom PropertyInfo structs, use the regular
> > >> DEFINE_PROP_<type> macros for the e1000e properties.
> > >> 
> > >> This also fixes a bug in the disable_vnet_hdr property
> > >> definition, that was using qdev_prop_uint8 for a bool field.
> > >> 
> > >> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > >> ---
> > >>  hw/net/e1000e.c | 25 +++----------------------
> > >>  1 file changed, 3 insertions(+), 22 deletions(-)
> > >> 
> > >> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
> > >> index 4994e1c..df24e55 100644
> > >> --- a/hw/net/e1000e.c
> > >> +++ b/hw/net/e1000e.c
> > >> @@ -638,19 +638,11 @@ static const VMStateDescription e1000e_vmstate = {
> > >>      }
> > >>  };
> > >>  -static PropertyInfo e1000e_prop_disable_vnet,
> > >> -                    e1000e_prop_subsys_ven,
> > >> -                    e1000e_prop_subsys;
> > >> -
> > >>  static Property e1000e_properties[] = {
> > >>      DEFINE_NIC_PROPERTIES(E1000EState, conf),
> > >> -    DEFINE_PROP_DEFAULT("disable_vnet_hdr", E1000EState, disable_vnet, false,
> > >> -                        e1000e_prop_disable_vnet, bool),
> > >> -    DEFINE_PROP_DEFAULT("subsys_ven", E1000EState, subsys_ven,
> > >> -                        PCI_VENDOR_ID_INTEL,
> > >> -                        e1000e_prop_subsys_ven, uint16_t),
> > >> -    DEFINE_PROP_DEFAULT("subsys", E1000EState, subsys, 0,
> > >> -                        e1000e_prop_subsys, uint16_t),
> > >> +    DEFINE_PROP_BOOL("disable_vnet_hdr", E1000EState, disable_vnet, false),
> > >> +    DEFINE_PROP_UINT16("subsys_ven", E1000EState, subsys_ven, PCI_VENDOR_ID_INTEL),
> > >> +    DEFINE_PROP_UINT16("subsys", E1000EState, subsys, 0),
> > >>      DEFINE_PROP_END_OF_LIST(),
> > >>  };
> > >>  @@ -673,17 +665,6 @@ static void e1000e_class_init(ObjectClass *class, void *data)
> > >>      dc->vmsd = &e1000e_vmstate;
> > >>      dc->props = e1000e_properties;
> > >>  -    e1000e_prop_disable_vnet = qdev_prop_uint8;
> > >> -    e1000e_prop_disable_vnet.description = "Do not use virtio headers, "
> > >> -                                           "perform SW offloads emulation "
> > >> -                                           "instead";
> > >> -
> > >> -    e1000e_prop_subsys_ven = qdev_prop_uint16;
> > >> -    e1000e_prop_subsys_ven.description = "PCI device Subsystem Vendor ID";
> > >> -
> > >> -    e1000e_prop_subsys = qdev_prop_uint16;
> > >> -    e1000e_prop_subsys.description = "PCI device Subsystem ID";
> > >> -
> > >>      set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
> > >>  }
> > >>    
> > > 
> > > Is there a way to keep the description here? At least for "vnet" I believe.  
> > 
> > Actually, ability to add description was the only reason for having custom PropertyInfo structs.
> > Does DEFINE_PROP_… macros set worth an improvement?  
> 
> I think it would be reasonable to add a descrition field to
> struct Property.
> 
> Alternatively, you can call object_property_set_description() on
> instance_init.
that would look sort of convoluted in case of class properties.
description should be set at the same time the property is added.

> 

  reply	other threads:[~2016-10-27 15:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 19:21 [Qemu-devel] [PATCH 0/4] e1000e: QOM property & configuration cleanups Eduardo Habkost
2016-10-26 19:21 ` [Qemu-devel] [PATCH 1/4] e1000e: Use regular DEFINE_PROP_<type> macros for properties Eduardo Habkost
2016-10-27  3:12   ` Jason Wang
2016-10-27  6:38     ` Dmitry Fleytman
2016-10-27 11:25       ` Eduardo Habkost
2016-10-27 15:13         ` Igor Mammedov [this message]
2016-10-27 16:39           ` Eduardo Habkost
2016-10-26 19:21 ` [Qemu-devel] [PATCH 2/4] e1000e: No need to validate configuration on migration Eduardo Habkost
2016-10-27  6:42   ` Dmitry Fleytman
2016-10-27 11:39     ` Eduardo Habkost
2016-10-27 12:22       ` Dr. David Alan Gilbert
2016-10-27 14:28         ` Eduardo Habkost
2016-10-26 19:21 ` [Qemu-devel] [PATCH 3/4] e1000e: Rename "disable_vnet_hdr" property to "vnet" Eduardo Habkost
2016-10-27  6:47   ` Dmitry Fleytman
2016-10-26 19:21 ` [Qemu-devel] [PATCH 4/4] e1000e: Rename "subsys_ven" property to "subsys-vendor" Eduardo Habkost
2016-10-27  6:45   ` Dmitry Fleytman
2016-10-27 11:30     ` Eduardo Habkost

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=20161027171334.29db5536@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=dmitry@daynix.com \
    --cc=ehabkost@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).