1. 15 10月, 2009 8 次提交
  2. 07 10月, 2009 4 次提交
    • M
      Final net cleanup after conversion to QemuOpts · dc1c9fe8
      Mark McLoughlin 提交于
      Now that net_client_init() has no users, kill it off and rename
      net_client_init_from_opts().
      
      There is no further need for the old code in net_client_parse() either.
      We use qemu_opts_parse() 'firstname' facitity for that. Instead, move
      the special handling of the 'vmchannel' type there.
      
      Simplify the vl.c code into merely call net_client_parse() for each
      -net command line option and then calling net_init_clients() later
      to iterate over the options and create the clients.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      dc1c9fe8
    • M
      Port usb net to QemuOpts · 13cf8f21
      Mark McLoughlin 提交于
      We need net_client_init_from_opts() exported for this
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      13cf8f21
    • M
      Don't exit() in config_error() · 0752706d
      Markus Armbruster 提交于
      Propagating errors up the call chain is tedious.  In startup code, we
      can take a shortcut: terminate the program.  This is wrong elsewhere,
      the monitor in particular.
      
      config_error() tries to cater for both customers: it terminates the
      program unless its mon parameter tells it it's working for the
      monitor.
      
      Its users need to return status anyway (unless passing a null mon
      argument, which none do), which their users need to check.  So this
      automatic exit buys us exactly nothing useful.  Only the dangerous
      delusion that we can get away without returning status.  Some of its
      users fell for that.  Their callers continue executing after failure
      when working for the monitor.
      
      This bites monitor command host_net_add in two places:
      
      * net_slirp_init() continues after slirp_hostfwd(), slirp_guestfwd(),
        or slirp_smb() failed, and may end up reporting success.  This
        happens for "host_net_add user guestfwd=foo": it complains about the
        invalid guest forwarding rule, then happily creates the user network
        without guest forwarding.
      
      * net_client_init() can't detect slirp_guestfwd() failure, and gets
        fooled by net_slirp_init() lying about success.  Suppresses its
        "Could not initialize device" message.
      
      Add the missing error reporting, make sure errors are checked, and
      drop the exit() from config_error().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      0752706d
    • M
      Make NICInfo string fields non-const · 9203f520
      Mark McLoughlin 提交于
      We now only assign strdup()ed strings to these fields, never static
      strings.
      
      aliguori: fix build for ppc_prep and mips_jazz
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      9203f520
  3. 05 10月, 2009 2 次提交
  4. 12 9月, 2009 1 次提交
    • B
      Fix sys-queue.h conflict for good · 72cf2d4f
      Blue Swirl 提交于
      Problem: Our file sys-queue.h is a copy of the BSD file, but there are
      some additions and it's not entirely compatible. Because of that, there have
      been conflicts with system headers on BSD systems. Some hacks have been
      introduced in the commits 15cc9235,
      f40d7537,
      96555a96 and
      3990d09a but the fixes were fragile.
      
      Solution: Avoid the conflict entirely by renaming the functions and the
      file. Revert the previous hacks.
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      72cf2d4f
  5. 04 9月, 2009 3 次提交
  6. 11 8月, 2009 1 次提交
  7. 17 7月, 2009 1 次提交
  8. 10 7月, 2009 1 次提交
  9. 29 6月, 2009 7 次提交
  10. 24 6月, 2009 1 次提交
  11. 22 6月, 2009 4 次提交
  12. 09 6月, 2009 6 次提交
    • 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
    • M
      net: add return value to packet receive handler · 4f1c942b
      Mark McLoughlin 提交于
      This allows us to handle queue full conditions rather than dropping
      the packet on the floor.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      4f1c942b
    • M
      net: pass VLANClientState* as first arg to receive handlers · e3f5ec2b
      Mark McLoughlin 提交于
      Give static type checking a chance to catch errors.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      e3f5ec2b
    • M
      net: re-name vc->fd_read() to vc->receive() · cda9046b
      Mark McLoughlin 提交于
      VLANClientState's fd_read() handler doesn't read from file
      descriptors, it adds a buffer to the client's receive queue.
      
      Re-name the handlers to make things a little less confusing.
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      cda9046b
    • M
      net: add fd_readv() handler to qemu_new_vlan_client() args · 463af534
      Mark McLoughlin 提交于
      This, apparently, is the style we prefer - all VLANClientState
      should be an argument to qemu_new_vlan_client().
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      463af534
    • J
      net: Improve parameter error reporting · 10ae5a7a
      Jan Kiszka 提交于
      As host network devices can also be instantiated via the monitor, errors
      should then be reported to the related monitor instead of stderr. This
      requires larger refactoring, so this patch starts small with introducing
      a helper to catch both cases and convert net_client_init as well as
      net_slirp_redir.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NMark McLoughlin <markmc@redhat.com>
      10ae5a7a
  13. 27 5月, 2009 1 次提交