qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Mark McLoughlin <markmc@redhat.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com
Subject: [Qemu-devel] Re: [PATCH 3/7] net: create the VLANClientState for NICs early
Date: Mon, 16 Nov 2009 10:26:01 +0100	[thread overview]
Message-ID: <4B011AA9.1060301@redhat.com> (raw)
In-Reply-To: <1258057742-18699-4-git-send-email-markmc@redhat.com>

   Hi,

> diff --git a/hw/e1000.c b/hw/e1000.c
> index 00f6a57..d9c9f79 100644
> --- a/hw/e1000.c
> +++ b/hw/e1000.c
> @@ -1107,11 +1107,11 @@ static int pci_e1000_init(PCIDevice *pci_dev)
>       checksum = (uint16_t) EEPROM_SUM - checksum;
>       d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;
>
> -    d->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC,
> -                                 d->conf.vlan, d->conf.peer,
> -                                 d->dev.qdev.info->name, d->dev.qdev.id,
> -                                 e1000_can_receive, e1000_receive, NULL,
> -                                 NULL, e1000_cleanup, d);
> +    d->vc = d->conf.client;
> +    d->vc->opaque = d;
> +    d->vc->can_receive = e1000_can_receive;
> +    d->vc->receive = e1000_receive;
> +    d->vc->cleanup = e1000_cleanup;
>       d->vc->link_status_changed = e1000_set_link_status;
>
>       qemu_format_nic_info_str(d->vc, macaddr);

... and now -device $nic,args is completely broken.

There are netdev, vlan and net-client properties but none of them will work.


If you want to have net.c prepare vlanclientstate (there might be good 
reasons for it), then it must be properly:

   * Create a named vlanclientstate.
   * Have drivers lookup the vlanclientstate by name.  Pretty much like
     the netdev peer lookup works today, only with the difference that
     it is used directly instead of being passed as peer on vlanclient
     creation.

i.e. something like

   -netdev client,id=foo,<moreargs>
   -device e1000,client=foo,mac=11:22:33:44:55:66

It is probably a good idea to zap the vlan and netdev properties then, 
so we don't have tons of different ways to setup a nic.  Fortunaly we 
had no release with the vlan+netdev properties yet, so this shouldn't be 
a backward compatibility issue IMHO.

Also take care that the creation and destruction is symmetric.  If net.c 
creates the vlanclient it should also net.c's job to clean it up, i.e. 
all the qemu_del_vlan_client() calls in the nic drivers should go away, 
otherwise hotplug will have some unpleasant surprises for you.

cheers,
   Gerd

  reply	other threads:[~2009-11-16  9:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-12 20:28 [Qemu-devel] [RFC PATCH 0/7] Fix qemu_announce_self() properly Mark McLoughlin
2009-11-12 20:28 ` [Qemu-devel] [PATCH 1/7] net: remove NICInfo::vc Mark McLoughlin
2009-11-12 20:28 ` [Qemu-devel] [PATCH 2/7] qdev: add "net-client" property Mark McLoughlin
2009-11-16  9:03   ` [Qemu-devel] " Gerd Hoffmann
2009-11-12 20:28 ` [Qemu-devel] [PATCH 3/7] net: create the VLANClientState for NICs early Mark McLoughlin
2009-11-16  9:26   ` Gerd Hoffmann [this message]
2009-11-12 20:28 ` [Qemu-devel] [PATCH 4/7] net: kill off NICInfo/NICConf::vlan/netdev Mark McLoughlin
2009-11-12 20:29 ` [Qemu-devel] [PATCH 5/7] qdev: add qdev_foreach() Mark McLoughlin
2009-11-16  9:28   ` [Qemu-devel] " Gerd Hoffmann
2009-11-20 14:20     ` Mark McLoughlin
2009-11-23  9:55       ` Gerd Hoffmann
2009-11-12 20:29 ` [Qemu-devel] [PATCH 6/7] qdev: add qdev_prop_get_{macaddr, net_client}() Mark McLoughlin
2009-11-12 20:29 ` [Qemu-devel] [PATCH 7/7] net: fix qemu_announce_self() Mark McLoughlin
2009-11-13  7:41   ` Mark McLoughlin
2009-11-13  8:14   ` Markus Armbruster

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=4B011AA9.1060301@redhat.com \
    --to=kraxel@redhat.com \
    --cc=markmc@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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).