From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
Amos Kong <akong@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] net: make network client name unique
Date: Fri, 3 May 2013 13:57:33 +0200 [thread overview]
Message-ID: <1367582254-15060-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1367582254-15060-1-git-send-email-stefanha@redhat.com>
From: Amos Kong <akong@redhat.com>
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>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
net/net.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/net/net.c b/net/net.c
index 7869161..43a74e4 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
next prev parent reply other threads:[~2013-05-03 11:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 11:57 [Qemu-devel] [PULL 0/2] Net patches Stefan Hajnoczi
2013-05-03 11:57 ` Stefan Hajnoczi [this message]
2013-05-03 11:57 ` [Qemu-devel] [PATCH 2/2] tap: properly initialize vhostfds Stefan Hajnoczi
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=1367582254-15060-2-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=akong@redhat.com \
--cc=aliguori@us.ibm.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).