1. 27 Jan, 2014 2 commits
  2. 23 Dec, 2013 1 commit
  3. 09 Dec, 2013 2 commits
    • Vlad Yasevich's avatar
      net: Update netdev peer on link change · 02d38fcb
      Vlad Yasevich authored
      When a link change occurs on a backend (like tap), we currently do
      not propage such change to the nic.  As a result, when someone turns
      off a link on a tap device, for instance, then a guest doesn't see
      that change and continues to try to send traffic or run DHCP even
      though the lower-layer is disconnected.  This is OK when the network
      is set up as a HUB since the the guest may be connected to other HUB
      ports too, but when it's set up as a netdev, it makes thinkgs worse.
      The patch addresses this by setting the peers link down only when the
      peer is not a HUBPORT device.  With this patch, in the following config
        -netdev tap,id=net0 -device e1000,mac=XXXXX,netdev=net0
      when net0 link is turned off, the guest e1000 shows lower-layer link
      down. This allows guests to boot much faster in such configurations.
      With windows guest, it also allows the network to recover properly
      since windows will not configure the link-local IPv4 address, and
      when the link is turned on, the proper address address is configured.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    • Vincenzo Maffione's avatar
      net: Adding netmap network backend · 58952137
      Vincenzo Maffione authored
      This patch adds support for a network backend based on netmap.
      netmap is a framework for high speed packet I/O. You can use it
      to build extremely fast traffic generators, monitors, software
      switches or network middleboxes. Its companion software switch
      VALE lets you interconnect virtual machines.
      netmap and VALE are implemented as a non-intrusive kernel module,
      support NICs from multiple vendors, are part of standard FreeBSD
      distributions and available in source format for Linux too.
      To compile QEMU with netmap support, use the following configure
          ./configure [...] --enable-netmap --extra-cflags=-I/path/to/netmap/sys
      where "/path/to/netmap" contains the netmap source code, available at
      The same webpage contains more information about the netmap project
      (together with papers and presentations).
      Signed-off-by: default avatarVincenzo Maffione <v.maffione@gmail.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
  4. 08 Nov, 2013 2 commits
  5. 02 Oct, 2013 1 commit
  6. 06 Sep, 2013 2 commits
  7. 22 Aug, 2013 2 commits
  8. 27 Jul, 2013 1 commit
  9. 15 Jul, 2013 1 commit
    • Amos Kong's avatar
      net: add support of mac-programming over macvtap in QEMU side · b1be4280
      Amos Kong authored
      Currently macvtap based macvlan device is working in promiscuous
      mode, we want to implement mac-programming over macvtap through
      Libvirt for better performance.
       QEMU notifies Libvirt when rx-filter config is changed in guest,
       then Libvirt query the rx-filter information by a monitor command,
       and sync the change to macvtap device. Related rx-filter config
       of the nic contains main mac, rx-mode items and vlan table.
      This patch adds a QMP event to notify management of rx-filter change,
      and adds a monitor command for management to query rx-filter
       If we repeatedly add/remove vlan, and change macaddr of vlan
       interfaces in guest by a loop script.
       The events will flood the QMP client(management), management takes
       too much resource to process the events.
       Event_throttle API (set rate to 1 ms) can avoid the events to flood
       QMP client, but it could cause an unexpected delay (~1ms), guests
       guests normally expect rx-filter updates immediately.
       So we use a flag for each nic to avoid events flooding, the event
       is emitted once until the query command is executed. The flag
       implementation could not introduce unexpected delay.
      There maybe exist an uncontrollable delay if we let Libvirt do the
      real change, guests normally expect rx-filter updates immediately.
      But it's another separate issue, we can investigate it when the
      work in Libvirt side is done.
      Michael S. Tsirkin: tweaked to enable events on start
      Michael S. Tsirkin: fixed not to crash when no id
      Michael S. Tsirkin: fold in patch:
         "additional fixes for mac-programming feature"
      Amos Kong: always notify QMP client if mactable is changed
      Amos Kong: return NULL list if no net client supports rx-filter query
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarAmos Kong <akong@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
  10. 19 Jun, 2013 1 commit
  11. 07 Jun, 2013 1 commit
    • Jason Wang's avatar
      tap: fix NULL dereference when passing invalid parameters to tap · c87826a8
      Jason Wang authored
      This patch forbid the following invalid parameters to tap:
      1) fd and vhostfds were specified but vhostfd were not specified
      2) vhostfds were specified but fds were not specified
      3) fds and vhostfd were specified
      For 1 and 2, net_init_tap_one() will still pass NULL as vhostfdname to
      monitor_handle_fd_param(), which may crash the qemu.
      Also remove the unnecessary has_fd check.
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Stefan Hajnoczi <shajnocz@redhat.com>
      Cc: Laszlo Ersek <lersek@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
  12. 24 May, 2013 1 commit
  13. 03 May, 2013 2 commits
    • Jason Wang's avatar
      tap: properly initialize vhostfds · 7873df40
      Jason Wang authored
      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
      Reportyed-by: default avatarMichal Privoznik <mprivozn@redhat.com>
      Cc: Michal Privoznik <mprivozn@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Reviewed-by: default avatarMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    • Amos Kong's avatar
      net: make network client name unique · c963530a
      Amos Kong authored
      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.
       # 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: default avatarAmos Kong <akong@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
  14. 15 Apr, 2013 1 commit
  15. 08 Apr, 2013 1 commit
    • Paolo Bonzini's avatar
      hw: move headers to include/ · 0d09e41a
      Paolo Bonzini authored
      Many of these should be cleaned up with proper qdev-/QOM-ification.
      Right now there are many catch-all headers in include/hw/ARCH depending
      on cpu.h, and this makes it necessary to compile these files per-target.
      However, fixing this does not belong in these patches.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
  16. 05 Apr, 2013 1 commit
  17. 02 Apr, 2013 2 commits
  18. 25 Mar, 2013 5 commits
  19. 22 Mar, 2013 2 commits
  20. 27 Feb, 2013 5 commits
    • Jason Wang's avatar
      net: reduce the unnecessary memory allocation of multiqueue · f6b26cf2
      Jason Wang authored
      Edivaldo reports a problem that the array of NetClientState in NICState is too
      large - MAX_QUEUE_NUM(1024) which will wastes memory even if multiqueue is not
      Instead of static arrays, solving this issue by allocating the queues on demand
      for both the NetClientState array in NICState and VirtIONetQueue array in
      Tested by myself, with single virtio-net-pci device. The memory allocation is
      almost the same as when multiqueue is not merged.
      Cc: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    • Peter Lieven's avatar
      tap: set IFF_ONE_QUEUE per default · d26e445c
      Peter Lieven authored
      historically the kernel queues packets two times. once
      at the device and second in qdisc. this is believed to cause
      interface stalls if one of these queues overruns.
      setting IFF_ONE_QUEUE is the default in kernels >= 3.8. the
      flag is ignored since then. see kernel commit
      Signed-off-by: default avatarPeter Lieven <pl@kamp.de>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    • Jason Wang's avatar
      tap: forbid creating multiqueue tap when hub is used · ce675a75
      Jason Wang authored
      Obviously, hub does not support multiqueue tap. So this patch forbids creating
      multiple queue tap when hub is used to prevent the crash when command line such
      as "-net tap,queues=2" is used.
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    • Luigi Rizzo's avatar
      net: fix unbounded NetQueue · 7d91ddd2
      Luigi Rizzo authored
      In the current implementation of qemu, running without a network
      backend will cause the queue to grow unbounded when the guest is
      transmitting traffic.
      This patch fixes the problem by implementing bounded size NetQueue,
      used with an arbitrary limit of 10000 packets, and dropping packets
      when the queue is full _and_ the sender does not pass a callback.
      The second condition makes sure that we never drop packets that
      contains a callback (which would be tricky, because the producer
      expects the callback to be run when all previous packets have been
      consumed; so we cannot run it when the packet is dropped).
      If documentation is correct, producers that submit a callback should
      stop sending when their packet is queued, so there is no real risk
      that the queue exceeds the max size by large values.
      Signed-off-by: default avatarLuigi Rizzo <rizzo@iet.unipi.it>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    • Luigi Rizzo's avatar
      net: fix qemu_flush_queued_packets() in presence of a hub · 199ee608
      Luigi Rizzo authored
      When frontend and backend are connected through a hub as below
      (showing only one direction), and the frontend (or in general, all
      output ports of the hub) cannot accept more traffic, the backend
      queues packets in queue-A.
      When the frontend (or in general, one output port) becomes ready again,
      quemu tries to flush packets from queue-B, which is unfortunately empty.
        e1000.0 <--[queue B]-- hub0port0(hub)hub0port1 <--[queue A]-- tap.0
      To fix this i propose to introduce a new function net_hub_flush()
      which is called when trying to flush a queue connected to a hub.
      Signed-off-by: default avatarLuigi Rizzo <rizzo@iet.unipi.it>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
  21. 13 Feb, 2013 1 commit
  22. 07 Feb, 2013 1 commit
    • Michael Roth's avatar
      net: fix infinite loop on exit · b8904921
      Michael Roth authored
      1ceef9f2 added handling for cleaning
      up multiple queues in qemu_del_nic() for cases where multiqueue is in
      use. To determine the number of queues it looks at nic->conf->queues,
      then iterates through all the queues to cleanup the associated
      NetClientStates. If no queues are found, no NetClientStates are deleted.
      However, nic->conf->queues is only set when a peer is created via
      -netdev or netdev_add, and is otherwise 0. This causes us to spin in
      net_cleanup() if we attempt to shut down qemu before adding a host
      Since qemu_new_nic() unconditionally creates at least 1
      queue/NetClientState at queue idx 0, make qemu_del_nic() always attempt
      to clean it up.
      Signed-off-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
  23. 02 Feb, 2013 1 commit
  24. 01 Feb, 2013 1 commit
    • Jason Wang's avatar
      tap: multiqueue support · 264986e2
      Jason Wang authored
      Recently, linux support multiqueue tap which could let userspace call TUNSETIFF
      for a signle device many times to create multiple file descriptors as
      independent queues. User could also enable/disabe a specific queue through
      The patch adds the generic infrastructure to create multiqueue taps. To achieve
      this a new parameter "queues" were introduced to specify how many queues were
      expected to be created for tap by qemu itself. Alternatively, management could
      also pass multiple pre-created tap file descriptors separated with ':' through a
      new parameter fds like -netdev tap,id=hn0,fds="X:Y:..:Z". Multiple vhost file
      descriptors could also be passed in this way.
      Each TAPState were still associated to a tap fd, which mean multiple TAPStates
      were created when user needs multiqueue taps. Since each TAPState contains one
      NetClientState, with the multiqueue nic support, an N peers of NetClientState
      were built up.
      A new parameter, mq_required were introduce in tap_open() to create multiqueue
      tap fds.
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>