Skip to contentSkip to conversation

Net patches

GIT PULL Stefan Hajnoczi 1 participant 6 messages Sep 6, 2013 Networking

lore
Share & tools
lore
#0 lore raw

Resolved 1.7 machine type conflicts and added Aurelien's ne2k endianness fix.

The following changes since commit df7131623daf4823e087eb1128f6c1c351519774:

Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging (2013-09-05 13:38:53 -0500)

are available in the git repository at:

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

for you to fetch changes up to 45d883dcf208160e2db308d1b368beb74f37dc7e:

ne2000: mark I/O as LITTLE_ENDIAN (2013-09-06 17:27:40 +0200)

----------------------------------------------------------------
Aurelien Jarno (1):
ne2000: mark I/O as LITTLE_ENDIAN

Brad Smith (2):
tap: Use numbered tap/tun devices on all *BSD OS's
vmxnet3: Eliminate __packed redefined warning

Jan Kiszka (1):
net: Rename send_queue to incoming_queue

Vincenzo Maffione (1):
e1000: add interrupt mitigation support

 hw/i386/pc_piix.c    |  16 ++++++-
 hw/i386/pc_q35.c     |  15 +++++-
 hw/net/e1000.c       | 131 +++++++++++++++++++++++++++++++++++++++++++++++++--
 hw/net/ne2000.c      |   2 +-
 hw/net/vmxnet3.h     |   2 -
 include/hw/i386/pc.h |   8 ++++
 include/net/net.h    |   2 +-
 net/hub.c            |   2 +-
 net/net.c            |  14 +++---
 net/tap-bsd.c        |  11 -----
 10 files changed, 174 insertions(+), 29 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

[Qemu-devel] [PULL v2 2/5] net: Rename send_queue to incoming_queue

From: Jan Kiszka <[email protected]>

Each networking client has a queue for packets that could not yet be delivered to that client. Calling this queue "send_queue" is highly confusing as it has nothing to to with packets send from this client but to it. Avoid this confusing by renaming it to "incoming_queue".

---
 include/net/net.h |  2 +-
 net/hub.c         |  2 +-
 net/net.c         | 14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)
include/net/net.h +1 -1
index 30e4b04..11e1468 100644
@@ -69,7 +69,7 @@ struct NetClientState {
     int link_down;
     QTAILQ_ENTRY(NetClientState) next;
     NetClientState *peer;
-    NetQueue *send_queue;
+    NetQueue *incoming_queue;
     char *model;
     char *name;
     char info_str[256];
net/hub.c +1 -1
index df32074..33a99c9 100644
@@ -347,7 +347,7 @@ bool net_hub_flush(NetClientState *nc)
 
     QLIST_FOREACH(port, &source_port->hub->ports, next) {
         if (port != source_port) {
-            ret += qemu_net_queue_flush(port->nc.send_queue);
+            ret += qemu_net_queue_flush(port->nc.incoming_queue);
         }
     }
     return ret ? true : false;
net/net.c +7 -7
index 1148592..c330c9a 100644
@@ -207,7 +207,7 @@ static void qemu_net_client_setup(NetClientState *nc,
     }
     QTAILQ_INSERT_TAIL(&net_clients, nc, next);
 
-    nc->send_queue = qemu_new_net_queue(nc);
+    nc->incoming_queue = qemu_new_net_queue(nc);
     nc->destructor = destructor;
 }
 
@@ -289,8 +289,8 @@ static void qemu_cleanup_net_client(NetClientState *nc)
 
 static void qemu_free_net_client(NetClientState *nc)
 {
-    if (nc->send_queue) {
-        qemu_del_net_queue(nc->send_queue);
+    if (nc->incoming_queue) {
+        qemu_del_net_queue(nc->incoming_queue);
     }
     if (nc->peer) {
         nc->peer->peer = NULL;
@@ -431,7 +431,7 @@ void qemu_purge_queued_packets(NetClientState *nc)
         return;
     }
 
-    qemu_net_queue_purge(nc->peer->send_queue, nc);
+    qemu_net_queue_purge(nc->peer->incoming_queue, nc);
 }
 
 void qemu_flush_queued_packets(NetClientState *nc)
@@ -444,7 +444,7 @@ void qemu_flush_queued_packets(NetClientState *nc)
         }
         return;
     }
-    if (qemu_net_queue_flush(nc->send_queue)) {
+    if (qemu_net_queue_flush(nc->incoming_queue)) {
         /* We emptied the queue successfully, signal to the IO thread to repoll
          * the file descriptor (for tap, for example).
          */
@@ -468,7 +468,7 @@ static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender,
         return size;
     }
 
-    queue = sender->peer->send_queue;
+    queue = sender->peer->incoming_queue;
 
     return qemu_net_queue_send(queue, sender, flags, buf, size, sent_cb);
 }
@@ -543,7 +543,7 @@ ssize_t qemu_sendv_packet_async(NetClientState *sender,
         return iov_size(iov, iovcnt);
     }
 
-    queue = sender->peer->send_queue;
+    queue = sender->peer->incoming_queue;
 
     return qemu_net_queue_send_iov(queue, sender,
                                    QEMU_NET_PACKET_FLAG_NONE,
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL v2 3/5] e1000: add interrupt mitigation support

In reply to Stefan Hajnoczi

From: Vincenzo Maffione <[email protected]>

This patch partially implements the e1000 interrupt mitigation mechanisms. Using a single QEMUTimer, it emulates the ITR register (which is the newer mitigation register, recommended by Intel) and approximately emulates RADV and TADV registers. TIDV and RDTR register functionalities are not emulated (RDTR is only used to validate RADV, according to the e1000 specs).

RADV, TADV, TIDV and RDTR registers make up the older e1000 mitigation mechanism and would need a timer each to be completely emulated. However, a single timer has been used in order to reach a good compromise between emulation accuracy and simplicity/efficiency.

The implemented mechanism can be enabled/disabled specifying the command line e1000-specific boolean parameter "mitigation", e.g.

    qemu-system-x86_64 -device e1000,mitigation=on,... ...

For more information, see the Software developer's manual at
http://download.intel.com/design/network/manuals/8254x_GBe_SDM.pdf.

Interrupt mitigation boosts performance when the guest suffers from an high interrupt rate (i.e. receiving short UDP packets at high packet rate). For some numerical results see the following link
http://info.iet.unipi.it/~luigi/papers/20130520-rizzo-vm.pdf

---
 hw/i386/pc_piix.c    |  16 ++++++-
 hw/i386/pc_q35.c     |  15 +++++-
 hw/net/e1000.c       | 131 +++++++++++++++++++++++++++++++++++++++++++++++++--
 include/hw/i386/pc.h |   8 ++++
 4 files changed, 164 insertions(+), 6 deletions(-)
hw/i386/pc_piix.c +14 -2
index 275e395..147d08c 100644
@@ -339,14 +339,25 @@ static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
     .desc = "Standard PC (i440FX + PIIX, 1996)", \
     .hot_add_cpu = pc_hot_add_cpu
 
+#define PC_I440FX_1_7_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
+static QEMUMachine pc_i440fx_machine_v1_7 = {
+    PC_I440FX_1_7_MACHINE_OPTIONS,
+    .name = "pc-i440fx-1.7",
+    .alias = "pc",
+    .init = pc_init_pci,
+    .is_default = 1,
+};
+
 #define PC_I440FX_1_6_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
 
 static QEMUMachine pc_i440fx_machine_v1_6 = {
     PC_I440FX_1_6_MACHINE_OPTIONS,
     .name = "pc-i440fx-1.6",
-    .alias = "pc",
     .init = pc_init_pci_1_6,
-    .is_default = 1,
+    .compat_props = (GlobalProperty[]) {
+        PC_COMPAT_1_6,
+        { /* end of list */ }
+    },
 };
 
 static QEMUMachine pc_i440fx_machine_v1_5 = {
@@ -735,6 +746,7 @@ static QEMUMachine xenfv_machine = {
 
 static void pc_machine_init(void)
 {
+    qemu_register_machine(&pc_i440fx_machine_v1_7);
     qemu_register_machine(&pc_i440fx_machine_v1_6);
     qemu_register_machine(&pc_i440fx_machine_v1_5);
     qemu_register_machine(&pc_i440fx_machine_v1_4);
hw/i386/pc_q35.c +14 -1
index d7b7c3b..b4b5155 100644
@@ -258,13 +258,25 @@ static void pc_q35_init_1_4(QEMUMachineInitArgs *args)
     .desc = "Standard PC (Q35 + ICH9, 2009)", \
     .hot_add_cpu = pc_hot_add_cpu
 
+#define PC_Q35_1_7_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS
+
+static QEMUMachine pc_q35_machine_v1_7 = {
+    PC_Q35_1_7_MACHINE_OPTIONS,
+    .name = "pc-q35-1.7",
+    .alias = "q35",
+    .init = pc_q35_init,
+};
+
 #define PC_Q35_1_6_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS
 
 static QEMUMachine pc_q35_machine_v1_6 = {
     PC_Q35_1_6_MACHINE_OPTIONS,
     .name = "pc-q35-1.6",
-    .alias = "q35",
     .init = pc_q35_init_1_6,
+    .compat_props = (GlobalProperty[]) {
+        PC_COMPAT_1_6,
+        { /* end of list */ }
+    },
 };
 
 static QEMUMachine pc_q35_machine_v1_5 = {
@@ -293,6 +305,7 @@ static QEMUMachine pc_q35_machine_v1_4 = {
 
 static void pc_q35_machine_init(void)
 {
+    qemu_register_machine(&pc_q35_machine_v1_7);
     qemu_register_machine(&pc_q35_machine_v1_6);
     qemu_register_machine(&pc_q35_machine_v1_5);
     qemu_register_machine(&pc_q35_machine_v1_4);
hw/net/e1000.c +128 -3

228 lines not on this page · raw message

include/hw/i386/pc.h +8 -0
index 7fb04d8..9b2ddc4 100644
@@ -225,7 +225,15 @@ void pvpanic_init(ISABus *bus);
 
 int e820_add_entry(uint64_t, uint64_t, uint32_t);
 
+#define PC_COMPAT_1_6 \
+        {\
+            .driver   = "e1000",\
+            .property = "mitigation",\
+            .value    = "off",\
+        }
+
 #define PC_COMPAT_1_5 \
+        PC_COMPAT_1_6, \
         {\
             .driver   = "Conroe-" TYPE_X86_CPU,\
             .property = "model",\
Signature · 1 line
1.8.3.1
#3 lore raw

[Qemu-devel] [PULL v2 1/5] tap: Use numbered tap/tun devices on all *BSD OS's

In reply to Stefan Hajnoczi

From: Brad Smith <[email protected]>

The following patch simplifies the *BSD tap/tun code and makes use of numbered tap/tun interfaces on all *BSD OS's. NetBSD has a patch in their pkgsrc tree to make use of this feature and DragonFly also supports this as well.

---
 net/tap-bsd.c | 11 -----------
 1 file changed, 11 deletions(-)
net/tap-bsd.c +0 -11
index f61d580..90f8a02 100644
@@ -44,8 +44,6 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
     struct stat s;
 #endif
 
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
-    defined(__OpenBSD__) || defined(__APPLE__)
     /* if no ifname is given, always start the search from tap0/tun0. */
     int i;
     char dname[100];
@@ -76,15 +74,6 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
                    dname, strerror(errno));
         return -1;
     }
-#else
-    TFR(fd = open("/dev/tap", O_RDWR));
-    if (fd < 0) {
-        fprintf(stderr,
-            "warning: could not open /dev/tap: no virtual network emulation: %s\n",
-            strerror(errno));
-        return -1;
-    }
-#endif
 
 #ifdef TAPGIFNAME
     if (ioctl(fd, TAPGIFNAME, (void *)&ifr) < 0) {
Signature · 1 line
1.8.3.1
#4 lore raw

[Qemu-devel] [PULL v2 4/5] vmxnet3: Eliminate __packed redefined warning

In reply to Stefan Hajnoczi

From: Brad Smith <[email protected]>

This eliminates a warning about __packed being redefined as exposed by the vmxnet3 code. __packed is not used anywhere in the vmxnet3 code.

CC hw/net/vmxnet3.o
In file included from hw/net/vmxnet3.c:29:
hw/net/vmxnet3.h:37:1: warning: "__packed" redefined In file included from /usr/include/stdlib.h:38,

                 from /buildbot-qemu/default_openbsd_current/build/include/qemu-common.h:26,
                 from /buildbot-qemu/default_openbsd_current/build/include/hw/hw.h:5,
                 from hw/net/vmxnet3.c:18:

/usr/include/sys/cdefs.h:209:1: warning: this is the location of the previous definition

---
 hw/net/vmxnet3.h | 2 --
 1 file changed, 2 deletions(-)
hw/net/vmxnet3.h +0 -2
index 4eae7c7..f987d71 100644
@@ -34,7 +34,6 @@
 #define __le16  uint16_t
 #define __le32  uint32_t
 #define __le64  uint64_t
-#define __packed QEMU_PACKED
 
 #if defined(HOST_WORDS_BIGENDIAN)
 #define __BIG_ENDIAN_BITFIELD
@@ -749,7 +748,6 @@ struct Vmxnet3_DriverShared {
 #undef __le16
 #undef __le32
 #undef __le64
-#undef __packed
 #if defined(HOST_WORDS_BIGENDIAN)
 #undef __BIG_ENDIAN_BITFIELD
 #endif
Signature · 1 line
1.8.3.1
#5 lore raw

[Qemu-devel] [PULL v2 5/5] ne2000: mark I/O as LITTLE_ENDIAN

In reply to Stefan Hajnoczi

From: Aurelien Jarno <[email protected]>

Now that the memory subsystem is propagating the endianness correctly, the ne2000 device should have its I/O ports marked as LITTLE_ENDIAN, as PCI devices are little endian.

This makes the ne2000 NIC to work again on PowerPC.

---
 hw/net/ne2000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/ne2000.c +1 -1
index 31afd28..c961258 100644
@@ -693,7 +693,7 @@ static void ne2000_write(void *opaque, hwaddr addr,
 static const MemoryRegionOps ne2000_ops = {
     .read = ne2000_read,
     .write = ne2000_write,
-    .endianness = DEVICE_NATIVE_ENDIAN,
+    .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
 /***********************************************************/
Signature · 1 line
1.8.3.1