Skip to contentSkip to conversation

Net patches

GIT PULL New Stefan Hajnoczi 1 participant 3 messages May 3, 2013 Networking

lore
Share & tools
lore
#0 lore raw

Two bug fixes for QEMU 1.5.

The following changes since commit 8ca27ce2e1150486ea2db4116a03706b28294f16:

Merge remote-tracking branch 'afaerber/qom-cpu' into staging (2013-05-02 10:57:01 -0500)

are available in the git repository at:

git://github.com/stefanha/qemu.git net

for you to fetch changes up to 7873df408dd44eb92840b108211d5aa5db7db526:

tap: properly initialize vhostfds (2013-05-03 13:53:46 +0200)

----------------------------------------------------------------
Amos Kong (1):
net: make network client name unique

Jason Wang (1):
tap: properly initialize vhostfds

 net/net.c | 7 ++-----
 net/tap.c | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/2 net: make network client name unique

From: Amos Kong <[email protected]>

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

---
 net/net.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
net/net.c +2 -5
index 7869161..43a74e4 100644
@@ -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++;
         }
     }
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 2/2 tap: properly initialize vhostfds

In reply to Stefan Hajnoczi

From: Jason Wang <[email protected]>

Only tap->vhostfd were checked net_init_tap_one(), but tap->vhostfds were forgot, this will lead qemu to ignore all fds passed by management through vhostfds, and tries to create vhost_net device itself. Fix by adding this check also.

---
 net/tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/tap.c +1 -1
index 17bdf01..e0b7a2a 100644
@@ -623,7 +623,7 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
         vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
         int vhostfd;
 
-        if (tap->has_vhostfd) {
+        if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_handle_fd_param(cur_mon, vhostfdname);
             if (vhostfd == -1) {
                 return -1;
Signature · 1 line
1.8.1.4