1. 23 8月, 2013 1 次提交
  2. 27 7月, 2013 1 次提交
  3. 16 7月, 2013 1 次提交
    • A
      net: add support of mac-programming over macvtap in QEMU side · b1be4280
      Amos Kong 提交于
      Currently macvtap based macvlan device is working in promiscuous
      mode, we want to implement mac-programming over macvtap through
      Libvirt for better performance.
      
      Design:
       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
      information.
      
      Test:
       If we repeatedly add/remove vlan, and change macaddr of vlan
       interfaces in guest by a loop script.
      
      Result:
       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: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NAmos Kong <akong@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      b1be4280
  4. 19 6月, 2013 1 次提交
  5. 07 6月, 2013 1 次提交
    • J
      tap: fix NULL dereference when passing invalid parameters to tap · c87826a8
      Jason Wang 提交于
      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: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      c87826a8
  6. 24 5月, 2013 1 次提交
  7. 03 5月, 2013 2 次提交
    • J
      tap: properly initialize vhostfds · 7873df40
      Jason Wang 提交于
      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.
      Reportyed-by: NMichal Privoznik <mprivozn@redhat.com>
      Cc: Michal Privoznik <mprivozn@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7873df40
    • A
      net: make network client name unique · c963530a
      Amos Kong 提交于
      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: NAmos Kong <akong@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      c963530a
  8. 16 4月, 2013 1 次提交
  9. 09 4月, 2013 1 次提交
    • P
      hw: move headers to include/ · 0d09e41a
      Paolo Bonzini 提交于
      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: NPaolo Bonzini <pbonzini@redhat.com>
      0d09e41a
  10. 05 4月, 2013 1 次提交
  11. 02 4月, 2013 2 次提交
  12. 25 3月, 2013 5 次提交
  13. 22 3月, 2013 2 次提交
  14. 27 2月, 2013 5 次提交
    • J
      net: reduce the unnecessary memory allocation of multiqueue · f6b26cf2
      Jason Wang 提交于
      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
      used.
      
      Instead of static arrays, solving this issue by allocating the queues on demand
      for both the NetClientState array in NICState and VirtIONetQueue array in
      VirtIONet.
      
      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: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      f6b26cf2
    • P
      tap: set IFF_ONE_QUEUE per default · d26e445c
      Peter Lieven 提交于
      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
      5d097109257c03a71845729f8db6b5770c4bbedc
      Signed-off-by: NPeter Lieven <pl@kamp.de>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      d26e445c
    • J
      tap: forbid creating multiqueue tap when hub is used · ce675a75
      Jason Wang 提交于
      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: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      ce675a75
    • L
      net: fix unbounded NetQueue · 7d91ddd2
      Luigi Rizzo 提交于
      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: NLuigi Rizzo <rizzo@iet.unipi.it>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7d91ddd2
    • L
      net: fix qemu_flush_queued_packets() in presence of a hub · 199ee608
      Luigi Rizzo 提交于
      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: NLuigi Rizzo <rizzo@iet.unipi.it>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      199ee608
  15. 14 2月, 2013 1 次提交
  16. 08 2月, 2013 1 次提交
    • M
      net: fix infinite loop on exit · b8904921
      Michael Roth 提交于
      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
      device.
      
      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: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      b8904921
  17. 02 2月, 2013 13 次提交
    • A
      tap: unbreak -netdev tap,fd=X · 02cd8090
      Anthony Liguori 提交于
      The multiqueue patch series broke -netdev tap,fd=X which manifests
      as libvirt not being able to start a guest.  This was because it
      passed NULL for the netdev name which results in an anonymous netdev
      device regardless of what the user specified.
      
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Bruce Rogers <brogers@suse.com>
      Reported-by: NBruce Rogers <brogers@suse.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      02cd8090
    • J
      tap: multiqueue support · 264986e2
      Jason Wang 提交于
      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
      TUNSETQUEUE.
      
      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: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      264986e2
    • J
      tap: introduce a helper to get the name of an interface · e5dc0b40
      Jason Wang 提交于
      This patch introduces a helper tap_get_ifname() to get the device name of tap
      device. This is needed when ifname is unspecified in the command line and qemu
      were asked to create tap device by itself. In this situation, the name were
      allocated by kernel, so if multiqueue is asked, we need to fetch its name after
      creating the first queue.
      
      Only linux has this support since it's the only platform that supports
      multiqueue tap.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      e5dc0b40
    • J
      tap: support enabling or disabling a queue · 16dbaf90
      Jason Wang 提交于
      This patch introduce a new bit - enabled in TAPState which tracks whether a
      specific queue/fd is enabled. The tap/fd is enabled during initialization and
      could be enabled/disabled by tap_enalbe() and tap_disable() which calls platform
      specific helpers to do the real work. Polling of a tap fd can only done when
      the tap was enabled.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      16dbaf90
    • J
      tap: add Linux multiqueue support · 94fdc6d0
      Jason Wang 提交于
      This patch add basic multiqueue support for Linux. When multiqueue is needed, we
      will first check whether kernel support multiqueue tap before creating more
      queues. Two new functions tap_fd_enable() and tap_fd_disable() were introduced
      to enable and disable a specific queue. Since the multiqueue is only supported
      in Linux, return error on other platforms.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      94fdc6d0
    • J
      tap: factor out common tap initialization · 5193e5fb
      Jason Wang 提交于
      This patch factors out the common initialization of tap into a new helper
      net_init_tap_one(). This will be used by multiqueue tap patches.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      5193e5fb
    • J
      tap: import linux multiqueue constants · 4e4f9ae7
      Jason Wang 提交于
      Import multiqueue constants from if_tun.h from 3.8-rc3. A new ifr flag
      IFF_MULTI_QUEUE were introduced to create a multiqueue backend by calling
      TUNSETIFF with the this flag and with the same interface name many times.
      
      A new ioctl TUNSETQUEUE were introduced. When doing this ioctl with
      IFF_DETACH_QUEUE, the queue were disabled in the linux kernel. When doing this
      ioctl with IFF_ATTACH_QUEUE, the queue were enabled in the linux kernel.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      4e4f9ae7
    • J
      net: multiqueue support · 1ceef9f2
      Jason Wang 提交于
      This patch adds basic multiqueue support for qemu. The idea is simple, an array
      of NetClientStates were introduced in NICState, parse_netdev() were extended to
      find and match all NetClientStates belongs to the backend and place their
      pointers in NICConf. Then qemu_new_nic can setup a N:N mapping between NICStates
      that belongs to a nic and NICStates belongs to the netdev. And a queue_index
      were introduced in NetClientState to track its index. After this, each peers of
      a NICState were abstracted as a queue.
      
      After this change, all NetClientState that belongs to the same backend/nic has
      the same id. When use want to change the link status, all NetClientStates that
      belongs to the same backend/nic will be also changed. When user want to delete
      a device or netdev, all NetClientStates that belongs to the same backend/nic
      will be deleted also. Changing or deleting an specific queue is not allowed.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      1ceef9f2
    • J
      net: introduce NetClientState destructor · f7860455
      Jason Wang 提交于
      To allow allocating an array of NetClientState and free it once, this patch
      introduces destructor of NetClientState. Which could do type specific free,
      which could be used by multiqueue to free the array once.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      f7860455
    • J
      net: introduce qemu_net_client_setup() · 18a1541a
      Jason Wang 提交于
      This patch separates the setup of NetClientState from its allocation, this will
      allow allocating an arrays of NetClientState and does the initialization one by
      one which is what multiqueue needs.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      18a1541a
    • J
      net: introduce qemu_find_net_clients_except() · 6c51ae73
      Jason Wang 提交于
      In multiqueue, all NetClientState that belongs to the same netdev or nic has the
      same id. So this patches introduces an helper qemu_find_net_clients_except()
      which finds all NetClientState with the same id. This will be used by multiqueue
      networking.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      6c51ae73
    • J
      net: intorduce qemu_del_nic() · 948ecf21
      Jason Wang 提交于
      To support multiqueue nic, this patch separate the nic destructor from
      qemu_del_net_client() to a new helper qemu_del_nic() since the mapping bettween
      NiCState and NetClientState were not 1:1 in multiqueue. The following patches
      would refactor this function to support multiqueue nic.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      948ecf21
    • J
      net: introduce qemu_get_nic() · cc1f0f45
      Jason Wang 提交于
      To support multiqueue, this patch introduces a helper qemu_get_nic() to get
      NICState from a NetClientState. The following patches would refactor this helper
      to support multiqueue.
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      cc1f0f45