qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Nic devices' name are wrongly repeated
@ 2013-04-10 12:05 Amos Kong
  2013-04-10 12:28 ` Andreas Färber
  0 siblings, 1 reply; 13+ messages in thread
From: Amos Kong @ 2013-04-10 12:05 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Hi Stefan,

If we don't assign 'id' for nic device, device name will be $model.$idx. The $idx are always 0 if we set nic by new style.

# qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ...
(qemu) info network
virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
 \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
 \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown

it's introduced by commit d33d93b2

If we set links down by 'set_link virtio-net-pci.0', the first nic
will be set down. But how to set the second link down by id?


-- 
			Amos.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] Nic devices' name are wrongly repeated
  2013-04-10 12:05 [Qemu-devel] Nic devices' name are wrongly repeated Amos Kong
@ 2013-04-10 12:28 ` Andreas Färber
  2013-04-10 14:17   ` Amos Kong
  2013-04-18  8:19   ` [Qemu-devel] 'id' assigned to -device could not be set as net-client name (was Re: Nic devices' name are wrongly repeated) Amos Kong
  0 siblings, 2 replies; 13+ messages in thread
From: Andreas Färber @ 2013-04-10 12:28 UTC (permalink / raw)
  To: Amos Kong
  Cc: Anthony Liguori, Paolo Bonzini, qemu-devel, Stefan Hajnoczi,
	Gerd Hoffmann

Hi,

Am 10.04.2013 14:05, schrieb Amos Kong:
> If we don't assign 'id' for nic device, device name will be $model.$idx. The $idx are always 0 if we set nic by new style.
> 
> # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ...
> (qemu) info network
> virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
>  \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
>  \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> 
> it's introduced by commit d33d93b2

I can see that's inconvenient, but...

> If we set links down by 'set_link virtio-net-pci.0', the first nic
> will be set down. But how to set the second link down by id?

As you would do for all devices? I.e., add ,id=youruniqueid to -device.

Having said that, in a different context (USB) I was made aware that we
don't know the bus name at QOM initialization time yet and, if we want
to create a bus at that point, will need to rename it later. Thus we'd
need an overridable ID setter hook to propagate to busses, and if we had
such a settable ID property it would be convenient for your use case to
have a matching monitor command as well to be able to resolve name
conflicts at runtime rather than with a QEMU restart.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] Nic devices' name are wrongly repeated
  2013-04-10 12:28 ` Andreas Färber
@ 2013-04-10 14:17   ` Amos Kong
  2013-04-11  8:22     ` Stefan Hajnoczi
  2013-04-18  8:19   ` [Qemu-devel] 'id' assigned to -device could not be set as net-client name (was Re: Nic devices' name are wrongly repeated) Amos Kong
  1 sibling, 1 reply; 13+ messages in thread
From: Amos Kong @ 2013-04-10 14:17 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Anthony Liguori, Paolo Bonzini, qemu-devel, Stefan Hajnoczi,
	Gerd Hoffmann

On Wed, Apr 10, 2013 at 02:28:40PM +0200, Andreas Färber wrote:
> Hi,
> 
> Am 10.04.2013 14:05, schrieb Amos Kong:
> > If we don't assign 'id' for nic device, device name will be $model.$idx. The $idx are always 0 if we set nic by new style.
> > 
> > # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ...
> > (qemu) info network
> > virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
> >  \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> > virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
> >  \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> > 
> > it's introduced by commit d33d93b2
> 
> I can see that's inconvenient, but...
> 
> > If we set links down by 'set_link virtio-net-pci.0', the first nic
> > will be set down. But how to set the second link down by id?
> 
> As you would do for all devices? I.e., add ,id=youruniqueid to -device.

If we also assigned unique ids for nic devices, it works.
 
> Having said that, in a different context (USB) I was made aware that we
> don't know the bus name at QOM initialization time yet and, if we want
> to create a bus at that point, will need to rename it later. Thus we'd
> need an overridable ID setter hook to propagate to busses, and if we had
> such a settable ID property it would be convenient for your use case to
> have a matching monitor command as well to be able to resolve name
> conflicts at runtime rather than with a QEMU restart.

It's better to allocate an increased & uniqued index suffix
automatically as past. monitor command is good for human, but
it's difficult for management tools to identify & resolve the
conflicts.
 
> Andreas
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

-- 
			Amos.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] Nic devices' name are wrongly repeated
  2013-04-10 14:17   ` Amos Kong
@ 2013-04-11  8:22     ` Stefan Hajnoczi
  2013-04-11 11:58       ` [Qemu-devel] [PATCH] net: make nic name unique Amos Kong
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Hajnoczi @ 2013-04-11  8:22 UTC (permalink / raw)
  To: Amos Kong
  Cc: Paolo Bonzini, Gerd Hoffmann, Andreas Färber,
	Anthony Liguori, qemu-devel

On Wed, Apr 10, 2013 at 10:17:04PM +0800, Amos Kong wrote:
> On Wed, Apr 10, 2013 at 02:28:40PM +0200, Andreas Färber wrote:
> > Hi,
> > 
> > Am 10.04.2013 14:05, schrieb Amos Kong:
> > > If we don't assign 'id' for nic device, device name will be $model.$idx. The $idx are always 0 if we set nic by new style.
> > > 
> > > # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ...
> > > (qemu) info network
> > > virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
> > >  \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> > > virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
> > >  \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> > > 
> > > it's introduced by commit d33d93b2
> > 
> > I can see that's inconvenient, but...
> > 
> > > If we set links down by 'set_link virtio-net-pci.0', the first nic
> > > will be set down. But how to set the second link down by id?
> > 
> > As you would do for all devices? I.e., add ,id=youruniqueid to -device.
> 
> If we also assigned unique ids for nic devices, it works.

I was unaware of this issue.  Do you want to send a fix so NICs get
unique names?

Stefan

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH] net: make nic name unique
  2013-04-11  8:22     ` Stefan Hajnoczi
@ 2013-04-11 11:58       ` Amos Kong
  2013-04-12  9:06         ` Stefan Hajnoczi
  2013-04-15 10:55         ` [Qemu-devel] [PATCH v2] net: make network client " Amos Kong
  0 siblings, 2 replies; 13+ messages in thread
From: Amos Kong @ 2013-04-11 11:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: anthony, stefanha, afaerber

If we don't assign 'id' for nic device, device's name will be $model.$idx.
The $idx is always 0 if we use new style of cmdline. This problem was
introduced by commit d33d93b2.

eg:
 # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 \
                    -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ..
 (qemu) info network
 virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
  \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
 virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
  \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown

This patch remove the check of hub, allocate increased id for all devices
that have same model.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 net/net.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/net.c b/net/net.c
index 67032f5..631e7d0 100644
--- a/net/net.c
+++ b/net/net.c
@@ -171,8 +171,7 @@ static char *assign_name(NetClientState *nc1, const char *model)
             continue;
         }
         /* For compatibility only bump id for net clients on a vlan */
-        if (strcmp(nc->model, model) == 0 &&
-            net_hub_id_for_client(nc, NULL) == 0) {
+        if (strcmp(nc->model, model) == 0) {
             id++;
         }
     }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] net: make nic name unique
  2013-04-11 11:58       ` [Qemu-devel] [PATCH] net: make nic name unique Amos Kong
@ 2013-04-12  9:06         ` Stefan Hajnoczi
  2013-04-12 10:50           ` Markus Armbruster
  2013-04-15 10:55         ` [Qemu-devel] [PATCH v2] net: make network client " Amos Kong
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Hajnoczi @ 2013-04-12  9:06 UTC (permalink / raw)
  To: Amos Kong; +Cc: stefanha, qemu-devel, anthony, afaerber

On Thu, Apr 11, 2013 at 07:58:39PM +0800, Amos Kong wrote:
> If we don't assign 'id' for nic device, device's name will be $model.$idx.
> The $idx is always 0 if we use new style of cmdline. This problem was
> introduced by commit d33d93b2.
> 
> eg:
>  # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 \
>                     -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ..
>  (qemu) info network
>  virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
>   \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>  virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
>   \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> 
> This patch remove the check of hub, allocate increased id for all devices
> that have same model.
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  net/net.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

I looked a bit more into this.  Markus added NIC naming in
53e51d85ef1fdd295c8f09792b8e7490c148f4b3.  Please include this commit ID
in the commit message.

My hub patches incorrectly dropped Markus' fix and I actually documented
this:

+/**
+ * Generate a name for net client
+ *
+ * Only net clients created with the legacy -net option need this.
Naming is
+ * mandatory for net clients created with -netdev.
+ */
 static char *assign_name(VLANClientState *vc1, const char *model)

Please update this comment to say "Only net clients created with the legacy
-net option and NICs need this".

> diff --git a/net/net.c b/net/net.c
> index 67032f5..631e7d0 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -171,8 +171,7 @@ static char *assign_name(NetClientState *nc1, const char *model)
>              continue;
>          }
>          /* For compatibility only bump id for net clients on a vlan */
> -        if (strcmp(nc->model, model) == 0 &&
> -            net_hub_id_for_client(nc, NULL) == 0) {
> +        if (strcmp(nc->model, model) == 0) {
>              id++;
>          }

Please delete the incorrect comment about compatibility when dropping the
net_hub_id_for_client() call.

Stefan

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH] net: make nic name unique
  2013-04-12  9:06         ` Stefan Hajnoczi
@ 2013-04-12 10:50           ` Markus Armbruster
  0 siblings, 0 replies; 13+ messages in thread
From: Markus Armbruster @ 2013-04-12 10:50 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: anthony, Amos Kong, qemu-devel, stefanha, afaerber

Stefan Hajnoczi <stefanha@gmail.com> writes:

> On Thu, Apr 11, 2013 at 07:58:39PM +0800, Amos Kong wrote:
>> If we don't assign 'id' for nic device, device's name will be $model.$idx.
>> The $idx is always 0 if we use new style of cmdline. This problem was
>> introduced by commit d33d93b2.
>> 
>> eg:
>>  # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 \
>>                     -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ..
>>  (qemu) info network
>>  virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
>>   \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>>  virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
>>   \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown

There are two kinds of names around here: network client names and
device (qdev) IDs.  Commit message could be tweaked to make it clearer
that this is about network client names.

As a general rule in QEMU, we call all objects "device", and all classes
"driver" %-/

>> 
>> This patch remove the check of hub, allocate increased id for all devices
>> that have same model.
>>
>> Signed-off-by: Amos Kong <akong@redhat.com>
>> ---
>>  net/net.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> I looked a bit more into this.  Markus added NIC naming in
> 53e51d85ef1fdd295c8f09792b8e7490c148f4b3.

Added it to non-VLAN clients, actually.  It already existed for VLAN
clients.

>                                            Please include this commit ID
> in the commit message.
>
> My hub patches incorrectly dropped Markus' fix and I actually documented
> this:
>
> +/**
> + * Generate a name for net client
> + *
> + * Only net clients created with the legacy -net option need this.
> Naming is
> + * mandatory for net clients created with -netdev.
> + */
>  static char *assign_name(VLANClientState *vc1, const char *model)
>
> Please update this comment to say "Only net clients created with the legacy
>
>> diff --git a/net/net.c b/net/net.c
>> index 67032f5..631e7d0 100644
>> --- a/net/net.c
>> +++ b/net/net.c
>> @@ -171,8 +171,7 @@ static char *assign_name(NetClientState *nc1, const char *model)
>>              continue;
>>          }
>>          /* For compatibility only bump id for net clients on a vlan */
>> -        if (strcmp(nc->model, model) == 0 &&
>> -            net_hub_id_for_client(nc, NULL) == 0) {
>> +        if (strcmp(nc->model, model) == 0) {
>>              id++;
>>          }
>
> Please delete the incorrect comment about compatibility when dropping the
> net_hub_id_for_client() call.
>
> Stefan

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2] net: make network client name unique
  2013-04-11 11:58       ` [Qemu-devel] [PATCH] net: make nic name unique Amos Kong
  2013-04-12  9:06         ` Stefan Hajnoczi
@ 2013-04-15 10:55         ` Amos Kong
  2013-04-18 11:25           ` Stefan Hajnoczi
  1 sibling, 1 reply; 13+ messages in thread
From: Amos Kong @ 2013-04-15 10:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

assign_name() creates a name MODEL.NUM, where MODEL is the client's model,
and NUM is the number of MODELs that already exist.

Markus added NIC naming for non-VLAN clients in commit 53e51d85.
commit d33d93b2 incorrectly added a judgement of net-hub. It caused
net clients created with -netdev get same names.

eg:
 # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 \
                    -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ..
 (qemu) info network
 virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
  \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
 virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
  \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown

This patch removed the check of nic-hub, and created unique names for
all net clients that have same model.

v2: update commitlog & comments

Signed-off-by: Amos Kong <akong@redhat.com>
---
 net/net.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/net.c b/net/net.c
index 67032f5..9011174 100644
--- a/net/net.c
+++ b/net/net.c
@@ -157,8 +157,7 @@ void qemu_macaddr_default_if_unset(MACAddr *macaddr)
 /**
  * Generate a name for net client
  *
- * Only net clients created with the legacy -net option need this.  Naming is
- * mandatory for net clients created with -netdev.
+ * Only net clients created with the legacy -net option and NICs need this.
  */
 static char *assign_name(NetClientState *nc1, const char *model)
 {
@@ -170,9 +169,7 @@ static char *assign_name(NetClientState *nc1, const char *model)
         if (nc == nc1) {
             continue;
         }
-        /* For compatibility only bump id for net clients on a vlan */
-        if (strcmp(nc->model, model) == 0 &&
-            net_hub_id_for_client(nc, NULL) == 0) {
+        if (strcmp(nc->model, model) == 0) {
             id++;
         }
     }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] 'id' assigned to -device could not be set as net-client name (was Re: Nic devices' name are wrongly repeated)
  2013-04-10 12:28 ` Andreas Färber
  2013-04-10 14:17   ` Amos Kong
@ 2013-04-18  8:19   ` Amos Kong
  2013-04-18  9:12     ` KONRAD Frédéric
  1 sibling, 1 reply; 13+ messages in thread
From: Amos Kong @ 2013-04-18  8:19 UTC (permalink / raw)
  To: Andreas Färber, fred.konrad
  Cc: Paolo Bonzini, Stefan Hajnoczi, qemu-devel, Anthony Liguori,
	Gerd Hoffmann

On Wed, Apr 10, 2013 at 02:28:40PM +0200, Andreas Färber wrote:
> Hi,
> 
> Am 10.04.2013 14:05, schrieb Amos Kong:
> > If we don't assign 'id' for nic device, device name will be $model.$idx. The $idx are always 0 if we set nic by new style.
> > 
> > # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ...
> > (qemu) info network
> > virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
> >  \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> > virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
> >  \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> > 
> > it's introduced by commit d33d93b2
> 
> I can see that's inconvenient, but...
> 
> > If we set links down by 'set_link virtio-net-pci.0', the first nic
> > will be set down. But how to set the second link down by id?
> 
> As you would do for all devices? I.e., add ,id=youruniqueid to -device.


Hi KONRAD,

 Your following patch just introduced a regression, 'id' assigned to -device
 could not be set as net-client name.

qemu -device virtio-net-pci,netdev=ndev1,id=id1 -netdev tap,id=ndev1 \
              -device e1000,netdev=ndev2,id=id2 -netdev tap,id=ndev2

(qemu) info network
virtio-net-device.0: index=0,type=nic,model=virtio-net-device,macaddr=52:54:00:12:34:56
 \ ndev1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
id2: index=0,type=nic,model=e1000,macaddr=52:54:00:12:34:57
 \ ndev2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown



===============================================
commit 1773d9ee6e7138e3956081670215e8bc0ae14828
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date:   Thu Apr 11 16:30:02 2013 +0200

    virtio-net: cleanup: init and exit function.
    
    This remove old init and exit function as they are no longer needed.
    
    Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Message-id: 1365690602-22729-8-git-send-email-fred.konrad@greensocs.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

commit 17a0ca55657114c055cb407291c1163e09b29973
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date:   Thu Apr 11 16:30:01 2013 +0200

    virtio-net: cleanup: use QOM cast.
    
    As the virtio-net-pci and virtio-net-s390 are switched to the new API,
    we can use QOM casts.
    
    Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Message-id: 1365690602-22729-7-git-send-email-fred.konrad@greensocs.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

commit 89334c8b6baebb1e84cd9bb6e796683e53391769
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date:   Thu Apr 11 16:30:00 2013 +0200

    virtio-net-ccw: switch to the new API.
    
    Here the virtio-net-ccw is modified for the new API. The device
    virtio-net-ccw extends virtio-ccw-device as before. It creates and
    connects a virtio-net-device during the init. The properties are not modified.
    
    Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Message-id: 1365690602-22729-6-git-send-email-fred.konrad@greensocs.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

commit 74b4fe3d79098b72813e461af565557bb5d35649
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date:   Thu Apr 11 16:29:59 2013 +0200

    virtio-net-s390: switch to the new API.
    
    Here the virtio-net-s390 is modified for the new API. The device
    virtio-net-s390 extends virtio-s390-device as before. It creates and
    connects a virtio-net-device during the init. The properties are not modified.
    
    Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Message-id: 1365690602-22729-5-git-send-email-fred.konrad@greensocs.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

commit e37da3945fa2fde161e1b217f937fc318c4b7639
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date:   Thu Apr 11 16:29:58 2013 +0200

    virtio-net-pci: switch to the new API.
    
    Here the virtio-net-pci is modified for the new API. The device
    virtio-net-pci extends virtio-pci. It creates and connects a
    virtio-net-device during the init. The properties are not changed.
    
    Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

commit 17ec5a8686143da66208273d355f2eeb09807614
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date:   Thu Apr 11 16:29:57 2013 +0200

    virtio-net: add the virtio-net device.
    
    Create virtio-net-device which extends virtio-device, so it can be connected on
    virtio-bus.
    
    Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Message-id: 1365690602-22729-3-git-send-email-fred.konrad@greensocs.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

commit 6a87acf7df4b31ca0896b95b86dac9698420a9ed
Author: KONRAD Frederic <fred.konrad@greensocs.com>
Date:   Thu Apr 11 16:29:56 2013 +0200

    virtio: add two functions to VirtioDeviceClass.
    
    Recent changes need two functions to VirtioDevice. This just add them
    into VirtioDeviceClass.
    
    Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
    Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
    Message-id: 1365690602-22729-2-git-send-email-fred.konrad@greensocs.com
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


-- 
			Amos.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] 'id' assigned to -device could not be set as net-client name (was Re: Nic devices' name are wrongly repeated)
  2013-04-18  8:19   ` [Qemu-devel] 'id' assigned to -device could not be set as net-client name (was Re: Nic devices' name are wrongly repeated) Amos Kong
@ 2013-04-18  9:12     ` KONRAD Frédéric
  2013-04-18  9:47       ` Amos Kong
  0 siblings, 1 reply; 13+ messages in thread
From: KONRAD Frédéric @ 2013-04-18  9:12 UTC (permalink / raw)
  To: Amos Kong
  Cc: Anthony Liguori, qemu-devel, Gerd Hoffmann, Stefan Hajnoczi,
	Paolo Bonzini, Andreas Färber

On 18/04/2013 10:19, Amos Kong wrote:
> On Wed, Apr 10, 2013 at 02:28:40PM +0200, Andreas Färber wrote:
>> Hi,
>>
>> Am 10.04.2013 14:05, schrieb Amos Kong:
>>> If we don't assign 'id' for nic device, device name will be $model.$idx. The $idx are always 0 if we set nic by new style.
>>>
>>> # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ...
>>> (qemu) info network
>>> virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
>>>   \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>>> virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
>>>   \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>>>
>>> it's introduced by commit d33d93b2
>> I can see that's inconvenient, but...
>>
>>> If we set links down by 'set_link virtio-net-pci.0', the first nic
>>> will be set down. But how to set the second link down by id?
>> As you would do for all devices? I.e., add ,id=youruniqueid to -device.
>
> Hi KONRAD,
>
>   Your following patch just introduced a regression, 'id' assigned to -device
>   could not be set as net-client name.

A regression from "net: make nic name unique" ?
>
> qemu -device virtio-net-pci,netdev=ndev1,id=id1 -netdev tap,id=ndev1 \
>                -device e1000,netdev=ndev2,id=id2 -netdev tap,id=ndev2
>
> (qemu) info network
> virtio-net-device.0: index=0,type=nic,model=virtio-net-device,macaddr=52:54:00:12:34:56
>   \ ndev1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> id2: index=0,type=nic,model=e1000,macaddr=52:54:00:12:34:57
>   \ ndev2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown

yes :/, that seems to be the side effect of cutting virtio-net-pci in

virtio-net-pci + virtio-net-device.

Here virtio-net-device is the network device as you see in info network.

virtio-net-pci isn't anymore.

I wonder how to solve that as we can't duplicate the id.

I will take a look.

Fred
>
>
> ===============================================
> commit 1773d9ee6e7138e3956081670215e8bc0ae14828
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:30:02 2013 +0200
>
>      virtio-net: cleanup: init and exit function.
>      
>      This remove old init and exit function as they are no longer needed.
>      
>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1365690602-22729-8-git-send-email-fred.konrad@greensocs.com
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> commit 17a0ca55657114c055cb407291c1163e09b29973
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:30:01 2013 +0200
>
>      virtio-net: cleanup: use QOM cast.
>      
>      As the virtio-net-pci and virtio-net-s390 are switched to the new API,
>      we can use QOM casts.
>      
>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1365690602-22729-7-git-send-email-fred.konrad@greensocs.com
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> commit 89334c8b6baebb1e84cd9bb6e796683e53391769
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:30:00 2013 +0200
>
>      virtio-net-ccw: switch to the new API.
>      
>      Here the virtio-net-ccw is modified for the new API. The device
>      virtio-net-ccw extends virtio-ccw-device as before. It creates and
>      connects a virtio-net-device during the init. The properties are not modified.
>      
>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1365690602-22729-6-git-send-email-fred.konrad@greensocs.com
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> commit 74b4fe3d79098b72813e461af565557bb5d35649
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:29:59 2013 +0200
>
>      virtio-net-s390: switch to the new API.
>      
>      Here the virtio-net-s390 is modified for the new API. The device
>      virtio-net-s390 extends virtio-s390-device as before. It creates and
>      connects a virtio-net-device during the init. The properties are not modified.
>      
>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1365690602-22729-5-git-send-email-fred.konrad@greensocs.com
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> commit e37da3945fa2fde161e1b217f937fc318c4b7639
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:29:58 2013 +0200
>
>      virtio-net-pci: switch to the new API.
>      
>      Here the virtio-net-pci is modified for the new API. The device
>      virtio-net-pci extends virtio-pci. It creates and connects a
>      virtio-net-device during the init. The properties are not changed.
>      
>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> commit 17ec5a8686143da66208273d355f2eeb09807614
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:29:57 2013 +0200
>
>      virtio-net: add the virtio-net device.
>      
>      Create virtio-net-device which extends virtio-device, so it can be connected on
>      virtio-bus.
>      
>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1365690602-22729-3-git-send-email-fred.konrad@greensocs.com
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> commit 6a87acf7df4b31ca0896b95b86dac9698420a9ed
> Author: KONRAD Frederic <fred.konrad@greensocs.com>
> Date:   Thu Apr 11 16:29:56 2013 +0200
>
>      virtio: add two functions to VirtioDeviceClass.
>      
>      Recent changes need two functions to VirtioDevice. This just add them
>      into VirtioDeviceClass.
>      
>      Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>      Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>      Message-id: 1365690602-22729-2-git-send-email-fred.konrad@greensocs.com
>      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] 'id' assigned to -device could not be set as net-client name (was Re: Nic devices' name are wrongly repeated)
  2013-04-18  9:12     ` KONRAD Frédéric
@ 2013-04-18  9:47       ` Amos Kong
  2013-04-18 10:03         ` KONRAD Frédéric
  0 siblings, 1 reply; 13+ messages in thread
From: Amos Kong @ 2013-04-18  9:47 UTC (permalink / raw)
  To: KONRAD Frédéric
  Cc: Anthony Liguori, qemu-devel, Gerd Hoffmann, Stefan Hajnoczi,
	Paolo Bonzini, Andreas Färber

On Thu, Apr 18, 2013 at 11:12:56AM +0200, KONRAD Frédéric wrote:
> On 18/04/2013 10:19, Amos Kong wrote:
> >On Wed, Apr 10, 2013 at 02:28:40PM +0200, Andreas Färber wrote:
> >>Hi,
> >>
> >>Am 10.04.2013 14:05, schrieb Amos Kong:
> >>>If we don't assign 'id' for nic device, device name will be $model.$idx. The $idx are always 0 if we set nic by new style.
> >>>
> >>># qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ...
> >>>(qemu) info network
> >>>virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
> >>>  \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> >>>virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
> >>>  \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> >>>
> >>>it's introduced by commit d33d93b2
> >>I can see that's inconvenient, but...
> >>
> >>>If we set links down by 'set_link virtio-net-pci.0', the first nic
> >>>will be set down. But how to set the second link down by id?
> >>As you would do for all devices? I.e., add ,id=youruniqueid to -device.
> >
> >Hi KONRAD,
> >
> >  Your following patch just introduced a regression, 'id' assigned to -device
> >  could not be set as net-client name.
> 
> A regression from "net: make nic name unique" ?

No, regression caused by commit: e37da3945fa2fde161e1b217f937fc318c4b7639

> >qemu -device virtio-net-pci,netdev=ndev1,id=id1 -netdev tap,id=ndev1 \
> >               -device e1000,netdev=ndev2,id=id2 -netdev tap,id=ndev2
> >
> >(qemu) info network
> >virtio-net-device.0: index=0,type=nic,model=virtio-net-device,macaddr=52:54:00:12:34:56
> >  \ ndev1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> >id2: index=0,type=nic,model=e1000,macaddr=52:54:00:12:34:57
> >  \ ndev2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> 
> yes :/, that seems to be the side effect of cutting virtio-net-pci in
> 
> virtio-net-pci + virtio-net-device.
> 
> Here virtio-net-device is the network device as you see in info network.
> 
> virtio-net-pci isn't anymore.
> 
> I wonder how to solve that as we can't duplicate the id.

If we don't assign 'id' for -device, the net-client name will be auto
generated (not duplicated).

Before your commit e37da394, user assigned 'id' will be record to
(DeviceState *)dev->id, it will be used in qemu_new_nic().

> I will take a look.
> > Fred

-- 
			Amos.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] 'id' assigned to -device could not be set as net-client name (was Re: Nic devices' name are wrongly repeated)
  2013-04-18  9:47       ` Amos Kong
@ 2013-04-18 10:03         ` KONRAD Frédéric
  0 siblings, 0 replies; 13+ messages in thread
From: KONRAD Frédéric @ 2013-04-18 10:03 UTC (permalink / raw)
  To: Amos Kong
  Cc: Anthony Liguori, qemu-devel, Gerd Hoffmann, Stefan Hajnoczi,
	Paolo Bonzini, Andreas Färber

On 18/04/2013 11:47, Amos Kong wrote:
> On Thu, Apr 18, 2013 at 11:12:56AM +0200, KONRAD Frédéric wrote:
>> On 18/04/2013 10:19, Amos Kong wrote:
>>> On Wed, Apr 10, 2013 at 02:28:40PM +0200, Andreas Färber wrote:
>>>> Hi,
>>>>
>>>> Am 10.04.2013 14:05, schrieb Amos Kong:
>>>>> If we don't assign 'id' for nic device, device name will be $model.$idx. The $idx are always 0 if we set nic by new style.
>>>>>
>>>>> # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ...
>>>>> (qemu) info network
>>>>> virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
>>>>>   \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>>>>> virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
>>>>>   \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>>>>>
>>>>> it's introduced by commit d33d93b2
>>>> I can see that's inconvenient, but...
>>>>
>>>>> If we set links down by 'set_link virtio-net-pci.0', the first nic
>>>>> will be set down. But how to set the second link down by id?
>>>> As you would do for all devices? I.e., add ,id=youruniqueid to -device.
>>> Hi KONRAD,
>>>
>>>   Your following patch just introduced a regression, 'id' assigned to -device
>>>   could not be set as net-client name.
>> A regression from "net: make nic name unique" ?
> No, regression caused by commit: e37da3945fa2fde161e1b217f937fc318c4b7639
>
>>> qemu -device virtio-net-pci,netdev=ndev1,id=id1 -netdev tap,id=ndev1 \
>>>                -device e1000,netdev=ndev2,id=id2 -netdev tap,id=ndev2
>>>
>>> (qemu) info network
>>> virtio-net-device.0: index=0,type=nic,model=virtio-net-device,macaddr=52:54:00:12:34:56
>>>   \ ndev1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>>> id2: index=0,type=nic,model=e1000,macaddr=52:54:00:12:34:57
>>>   \ ndev2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>> yes :/, that seems to be the side effect of cutting virtio-net-pci in
>>
>> virtio-net-pci + virtio-net-device.
>>
>> Here virtio-net-device is the network device as you see in info network.
>>
>> virtio-net-pci isn't anymore.
>>
>> I wonder how to solve that as we can't duplicate the id.
> If we don't assign 'id' for -device, the net-client name will be auto
> generated (not duplicated).
>
> Before your commit e37da394, user assigned 'id' will be record to
> (DeviceState *)dev->id, it will be used in qemu_new_nic().

Yes sure, what I mean, is:

virtio-net-pci actually get the id and is not the nic device anymore.

and virtio-net-pci create the new virtio-net-device which has no id
(so it is autogenerated).

That's why you didn't the id in info network.

>> I will take a look.
>>> Fred

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2] net: make network client name unique
  2013-04-15 10:55         ` [Qemu-devel] [PATCH v2] net: make network client " Amos Kong
@ 2013-04-18 11:25           ` Stefan Hajnoczi
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2013-04-18 11:25 UTC (permalink / raw)
  To: Amos Kong; +Cc: qemu-devel

On Mon, Apr 15, 2013 at 06:55:19PM +0800, Amos Kong wrote:
> assign_name() creates a name MODEL.NUM, where MODEL is the client's model,
> and NUM is the number of MODELs that already exist.
> 
> Markus added NIC naming for non-VLAN clients in commit 53e51d85.
> commit d33d93b2 incorrectly added a judgement of net-hub. It caused
> net clients created with -netdev get same names.
> 
> eg:
>  # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 \
>                     -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 ..
>  (qemu) info network
>  virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
>   \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
>  virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57
>   \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
> 
> This patch removed the check of nic-hub, and created unique names for
> all net clients that have same model.
> 
> v2: update commitlog & comments
> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  net/net.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net

Stefan

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-04-18 11:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-10 12:05 [Qemu-devel] Nic devices' name are wrongly repeated Amos Kong
2013-04-10 12:28 ` Andreas Färber
2013-04-10 14:17   ` Amos Kong
2013-04-11  8:22     ` Stefan Hajnoczi
2013-04-11 11:58       ` [Qemu-devel] [PATCH] net: make nic name unique Amos Kong
2013-04-12  9:06         ` Stefan Hajnoczi
2013-04-12 10:50           ` Markus Armbruster
2013-04-15 10:55         ` [Qemu-devel] [PATCH v2] net: make network client " Amos Kong
2013-04-18 11:25           ` Stefan Hajnoczi
2013-04-18  8:19   ` [Qemu-devel] 'id' assigned to -device could not be set as net-client name (was Re: Nic devices' name are wrongly repeated) Amos Kong
2013-04-18  9:12     ` KONRAD Frédéric
2013-04-18  9:47       ` Amos Kong
2013-04-18 10:03         ` KONRAD Frédéric

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).