1. 17 7月, 2009 1 次提交
  2. 16 7月, 2009 1 次提交
  3. 10 7月, 2009 2 次提交
    • M
      Don't abort if TUNSETSNDBUF fails where no sndbuf= arg is supplied · d026fb6d
      Mark McLoughlin 提交于
      If no tap,sndbuf= arg is supplied, we use a default value. If
      TUNSETSNDBUF fails in this case, we should not abort.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      d026fb6d
    • M
      net: set a default value for sndbuf= · fc5b81d1
      Mark McLoughlin 提交于
      On reflection, perhaps it does make sense to set a default value for
      the sndbuf= tap parameter.
      
      For best effect, sndbuf= should be set to just below the capacity of
      the physical NIC.
      
      Setting it higher will cause packets to be dropped before the limit
      is hit. Setting it much lower will not cause any problems unless
      you set it low enough such that the guest cannot queue up new packets
      before the NIC has emptied its queue.
      
      In Linux, txqueuelen=1000 by default for ethernet NICs. Given a 1500
      byte MTU, 1Mb is a good choice for sndbuf.
      
      If it turns out that txqueuelen is actually much lower than this, then
      sndbuf is essentially disabled. In the event that txqueuelen is much
      higher, it's unlikely that the NIC will be able to empty a 1Mb queue.
      
      Thanks to Herbert Xu for this logic.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      Cc: Herbert Xu <herbert.xu@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      fc5b81d1
  4. 02 7月, 2009 1 次提交
  5. 29 6月, 2009 19 次提交
  6. 24 6月, 2009 1 次提交
  7. 22 6月, 2009 10 次提交
  8. 13 6月, 2009 2 次提交
  9. 11 6月, 2009 1 次提交
  10. 09 6月, 2009 2 次提交
    • M
      net: make use of async packet sending API in tap client · e19eb224
      Mark McLoughlin 提交于
      If a packet is queued by qemu_send_packet(), remove I/O
      handler for the tap fd until we get notification that the
      packet has been sent.
      
      A not insignificant side effect of this is we can now
      drain the tap send queue in one go without fear of packets
      being dropped.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      e19eb224
    • M
      net: add qemu_send_packet_async() · f3b6c7fc
      Mark McLoughlin 提交于
      Add a qemu_send_packet() variant which will queue up the packet
      if it cannot be sent when all client queues are full. It later
      invokes the supplied callback when the packet has been sent.
      
      If qemu_send_packet_async() returns zero, the caller is expected
      to not send any more packets until the queued packet has been
      sent.
      
      Packets are queued iff a receive() handler returns zero (indicating
      queue full) and the caller has provided a sent notification callback
      (indicating it will stop and start its own queue).
      
      We need the packet sending API to support queueing because:
      
        - a sending client should process all available packets in one go
          (e.g. virtio-net emptying its tx ring)
      
        - a receiving client may not be able to handle the packet
          (e.g. -EAGAIN from write() to tapfd)
      
        - the sending client could detect this condition in advance
          (e.g. by select() for writable on tapfd)
      
        - that's too much overhead (e.g. a select() call per packet)
      
        - therefore the sending client must handle the condition by
          dropping the packet or queueing it
      
        - dropping packets is poor form; we should queue.
      
      However, we don't want queueing to be completely transparent. We
      want the sending client to stop sending packets as soon as a
      packet is queued. This allows the sending client to be throttled
      by the receiver.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      f3b6c7fc