1. 25 4月, 2014 1 次提交
  2. 12 3月, 2014 1 次提交
    • S
      tap: avoid deadlocking rx · 68e5ec64
      Stefan Hajnoczi 提交于
      The net subsystem has a control flow mechanism so peer NetClientStates
      can tell each other to stop sending packets.  This is used to stop
      monitoring the tap file descriptor for incoming packets if the guest rx
      ring has no spare buffers.
      
      There is a corner case when tap_can_send() is true at the beginning of
      an event loop iteration but becomes false before the tap_send() fd
      handler is invoked.
      
      tap_send() will read the packet from the tap file descriptor and attempt
      to send it.  The net queue will hold on to the packet and return 0,
      indicating that further I/O is not possible.  tap then stops monitoring
      the file descriptor for reads.
      
      This is unlike the normal case where tap_can_send() is the same before
      and during the event loop iteration.  The event loop would simply not
      monitor the file descriptor if tap_can_send() returns true.  Upon next
      iteration it would check tap_can_send() again and begin monitoring if we
      can send.
      
      The deadlock happens because tap_send() explicitly disabled read_poll.
      This is done with the expectation that the peer will call
      qemu_net_queue_flush().  But hw/net/virtio-net.c does not monitor
      vm_running transitions and issue the flush.  Hence we're left with a
      broken tap device.
      
      Cc: qemu-stable@nongnu.org
      Reported-by: NNeil Skrypuch <neil@tembosocial.com>
      Tested-by: NNeil Skrypuch <neil@tembosocial.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      68e5ec64
  3. 25 2月, 2014 3 次提交
  4. 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
  5. 03 5月, 2013 1 次提交
  6. 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
  7. 25 3月, 2013 1 次提交
    • S
      net: increase buffer size to accommodate Jumbo frame pkts · d32fcad3
      Scott Feldman 提交于
      Socket buffer sizes were hard-coded to 4K for VDE and socket netdevs.  Bump this
      up to 68K (ala tap netdev) to handle maximum GSO packet size (64k) plus plenty
      of room for the ethernet and virtio_net headers.
      
      Originally, ran into this limitation when using -netdev UDP sockets to connect
      VM-to-VM, where VM interface is configure with MTU=9000.  (Using virtio_net
      NIC model).  Test is simple: ping -M do -s 8500 <target>.  This test will
      attempt to ping with unfragmented packet of given size.  Without patch, size
      is limited to < 4K (minus protocol hdrs).  With patch, ping test works with pkt
      size up to 9000 (again, minus protocol hdrs).
      
      v2: per Stefan, increase buf size to (4096+65536) as done in tap and apply
          to vde and socket netdevs.
      v1: increase buf size to 12K just for -netdev UDP sockets
      Signed-off-by: NScott Feldman <sfeldma@cumulusnetworks.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      d32fcad3
  8. 22 3月, 2013 1 次提交
  9. 27 2月, 2013 1 次提交
  10. 02 2月, 2013 5 次提交
    • 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: 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: 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
      net: tap: using bool instead of bitfield · ec45f083
      Jason Wang 提交于
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      ec45f083
  11. 19 12月, 2012 5 次提交
  12. 20 11月, 2012 1 次提交
  13. 08 10月, 2012 1 次提交
    • P
      net: consolidate NetClientState header files into one · a245fc18
      Paolo Bonzini 提交于
      This patch doesn't seem much useful alone, I must admit.  However,
      it makes sense as part of the upcoming directory reorganization,
      where I want to have include/net/tap.h as the net<->hw interface
      for tap.  Then having both net/tap.h and include/net/tap.h does
      not work.  "Fixed" by moving all the init functions to a single
      header file net/clients.h.
      
      The patch also adopts a uniform style for including net/*.h files
      from net/*.c, without the net/ path.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@gmail.com>
      a245fc18
  14. 07 9月, 2012 1 次提交
  15. 01 8月, 2012 3 次提交
  16. 23 7月, 2012 5 次提交
  17. 15 6月, 2012 1 次提交
  18. 05 6月, 2012 1 次提交
  19. 02 2月, 2012 1 次提交
    • C
      Add support for net bridge · a7c36ee4
      Corey Bryant 提交于
      The most common use of -net tap is to connect a tap device to a bridge.  This
      requires the use of a script and running qemu as root in order to allocate a
      tap device to pass to the script.
      
      This model is great for portability and flexibility but it's incredibly
      difficult to eliminate the need to run qemu as root.  The only really viable
      mechanism is to use tunctl to create a tap device, attach it to a bridge as
      root, and then hand that tap device to qemu.  The problem with this mechanism
      is that it requires administrator intervention whenever a user wants to create
      a guest.
      
      By essentially writing a helper that implements the most common qemu-ifup
      script that can be safely given cap_net_admin, we can dramatically simplify
      things for non-privileged users.  We still support existing -net tap options
      as a mechanism for advanced users and backwards compatibility.
      
      Currently, this is very Linux centric but there's really no reason why it
      couldn't be extended for other Unixes.
      
      A typical invocation would be similar to one of the following:
      
        qemu linux.img -net bridge -net nic,model=virtio
      
        qemu linux.img -net tap,helper="/usr/local/libexec/qemu-bridge-helper"
                       -net nic,model=virtio
      
        qemu linux.img -netdev bridge,id=hn0
                       -device virtio-net-pci,netdev=hn0,id=nic1
      
        qemu linux.img -netdev tap,helper="/usr/local/libexec/qemu-bridge-helper",id=hn0
                       -device virtio-net-pci,netdev=hn0,id=nic1
      
      The default bridge that we attach to is br0.  The thinking is that a distro
      could preconfigure such an interface to allow out-of-the-box bridged networking.
      
      Alternatively, if a user wants to use a different bridge, a typical invocation
      would be simliar to one of the following:
      
        qemu linux.img -net bridge,br=qemubr0 -net nic,model=virtio
      
        qemu linux.img -net tap,helper="/usr/local/libexec/qemu-bridge-helper --br=qemubr0"
                       -net nic,model=virtio
      
        qemu linux.img -netdev bridge,br=qemubr0,id=hn0
                       -device virtio-net-pci,netdev=hn0,id=nic1
      
        qemu linux.img -netdev tap,helper="/usr/local/libexec/qemu-bridge-helper --br=qemubr0",id=hn0
                       -device virtio-net-pci,netdev=hn0,id=nic1
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      Signed-off-by: NRicha Marwaha <rmarwah@linux.vnet.ibm.com>
      Signed-off-by: NCorey Bryant <coreyb@linux.vnet.ibm.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      a7c36ee4
  20. 16 12月, 2011 1 次提交
  21. 08 6月, 2011 1 次提交
  22. 02 2月, 2011 1 次提交
  23. 16 11月, 2010 2 次提交