1. 27 5月, 2015 4 次提交
    • S
      net/net: Record usage status of mac address · 2bc22a58
      Shannon Zhao 提交于
      Currently QEMU dynamically generates mac address for the NIC which
      doesn't specify the mac address. But when we hotplug a NIC without
      specifying mac address, the mac address will increase for the same NIC
      along with hotplug and hot-unplug, and at last it will overflow. And if
      we codeplug one NIC with mac address e.g. "52:54:00:12:34:56", then
      hotplug one NIC without specifying mac address and the mac address of
      the hotplugged NIC is duplicate of "52:54:00:12:34:56".
      
      This patch add a mac_table to record the usage status and free the mac
      address when the NIC is unrealized.
      Signed-off-by: NShannon Zhao <zhaoshenglong@huawei.com>
      Signed-off-by: NShannon Zhao <shannon.zhao@linaro.org>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      2bc22a58
    • M
      net: Improve -net nic error reporting · 66308868
      Markus Armbruster 提交于
      When -net nic fails, it first reports a specific error, then a generic
      one, like this:
      
          $ qemu-system-x86_64 -net nic,netdev=nonexistent
          qemu-system-x86_64: -net nic,netdev=nonexistent: netdev 'nonexistent' not found
          qemu-system-x86_64: -net nic,netdev=nonexistent: Device 'nic' could not be initialized
      
      Convert net_init_nic() to Error to get rid of the unwanted second
      error message.
      
      While there, tidy up an Overcapitalized Error Message.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1431691143-1015-4-git-send-email-armbru@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      66308868
    • M
      net: Permit incremental conversion of init functions to Error · a30ecde6
      Markus Armbruster 提交于
      Error reporting for netdev_add is broken: the net_client_init_fun[]
      report the actual errors with (at best) error_report(), and their
      caller net_client_init1() makes up a generic error on top.
      
      For command line and HMP, this produces an mildly ugly error cascade.
      
      In QMP, the actual errors go to stderr, and the generic error becomes
      the command's error reply.
      
      To fix this, we need to convert the net_client_init_fun[] to Error.
      
      To permit fixing them one by one, add an Error ** parameter to the
      net_client_init_fun[].  If the call fails without returning an Error,
      make up the same generic Error as before.  But if it returns one, use
      that instead.  Since none of them does so far, no functional change.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1431691143-1015-3-git-send-email-armbru@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      a30ecde6
    • M
      net: Improve error message for -net hubport a bit · ca7eb184
      Markus Armbruster 提交于
      Type "hubport" is valid only with -netdev.  Unfortunately, that's
      detected late and the error message doesn't explain why:
      
          $ qemu-system-i386 -net hubport,id=foo,hubid=0
          qemu-system-i386: -net hubport,id=foo,hubid=0: Device 'hubport' could not be initialized
      
      Improve the error message to "Parameter 'type' expects a net type".
      
      Not fixed: -net hubport without the parameters required by -netdev
      hubport still asks for those parameters:
      
          $ qemu-system-i386 -net hubport
          qemu-system-i386: -net hubport: Parameter 'hubid' is missing
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1431691143-1015-2-git-send-email-armbru@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      ca7eb184
  2. 11 5月, 2015 1 次提交
  3. 13 3月, 2015 1 次提交
  4. 26 2月, 2015 2 次提交
  5. 18 2月, 2015 3 次提交
    • M
      hmp: Name HMP info handler functions hmp_info_SUBCOMMAND() · 1ce6be24
      Markus Armbruster 提交于
      Some are called do_info_SUBCOMMAND() (old ones, usually), some
      hmp_info_SUBCOMMAND(), some SUBCOMMAND_info(), sometimes SUBCOMMAND
      pointlessly differs in spelling.
      
      Normalize to hmp_info_SUBCOMMAND(), where SUBCOMMAND is exactly the
      subcommand name with '-' replaced by '_'.
      
      Exceptions:
      
      * sun4m_irq_info(), sun4m_pic_info() renamed to sun4m_hmp_info_irq(),
        sun4m_hmp_info_pic().
      
      * lm32_irq_info(), lm32_pic_info() renamed to lm32_hmp_info_irq(),
        lm32_hmp_info_pic().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      1ce6be24
    • M
      hmp: Name HMP command handler functions hmp_COMMAND() · 3e5a50d6
      Markus Armbruster 提交于
      Some are called do_COMMAND() (old ones, usually), some hmp_COMMAND(),
      and sometimes COMMAND pointlessly differs in spelling.
      
      Normalize to hmp_COMMAND(), where COMMAND is exactly the command name
      with '-' replaced by '_'.
      
      Exceptions:
      
      * do_device_add() and client_migrate_info() *not* renamed to
        hmp_device_add(), hmp_client_migrate_info(), because they're also
        QMP handlers.  They still need to be converted to QAPI.
      
      * do_memory_dump(), do_physical_memory_dump(), do_ioport_read(),
        do_ioport_write() renamed do hmp_* instead of hmp_x(), hmp_xp(),
        hmp_i(), hmp_o(), because those names are too cryptic for my taste.
      
      * do_info_help() renamed to hmp_info_help() instead of hmp_info(),
        because it only covers help.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3e5a50d6
    • M
      net: Avoid qerror_report_err() outside QMP command handlers · 12d0cc2d
      Markus Armbruster 提交于
      qerror_report_err() is a transitional interface to help with
      converting existing monitor commands to QMP.  It should not be used
      elsewhere.  Replace by error_report_err() in HMP command handler
      hmp_host_net_add() and initial startup helpers net_init_client(),
      net_init_netdev().  Keep it in QMP command handler qmp_netdev_add().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      12d0cc2d
  6. 06 2月, 2015 1 次提交
  7. 05 9月, 2014 1 次提交
  8. 04 9月, 2014 1 次提交
    • Z
      net: Forbid dealing with packets when VM is not running · e1d64c08
      zhanghailiang 提交于
      For all NICs(except virtio-net) emulated by qemu,
      Such as e1000, rtl8139, pcnet and ne2k_pci,
      Qemu can still receive packets when VM is not running.
      
      If this happened in *migration's* last PAUSE VM stage, but
      before the end of the migration, the new receiving packets will possibly dirty
      parts of RAM which has been cached in *iovec*(will be sent asynchronously) and
      dirty parts of new RAM which will be missed.
      This will lead serious network fault in VM.
      
      To avoid this, we forbid receiving packets in generic net code when
      VM is not running.
      
      Bug reproduction steps:
      (1) Start a VM which configured at least one NIC
      (2) In VM, open several Terminal and do *Ping IP -i 0.1*
      (3) Migrate the VM repeatedly between two Hosts
      And the *PING* command in VM will very likely fail with message:
      'Destination HOST Unreachable', the NIC in VM will stay unavailable unless you
      run 'service network restart'
      Signed-off-by: Nzhanghailiang <zhang.zhanghailiang@huawei.com>
      Reviewed-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NJuan Quintela <quintela@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      e1d64c08
  9. 02 7月, 2014 1 次提交
  10. 27 6月, 2014 2 次提交
  11. 19 6月, 2014 1 次提交
  12. 11 6月, 2014 1 次提交
  13. 16 5月, 2014 1 次提交
  14. 28 4月, 2014 1 次提交
  15. 25 4月, 2014 3 次提交
  16. 18 4月, 2014 1 次提交
  17. 25 2月, 2014 2 次提交
  18. 18 2月, 2014 1 次提交
  19. 27 1月, 2014 1 次提交
  20. 23 12月, 2013 1 次提交
  21. 09 12月, 2013 2 次提交
    • V
      net: Update netdev peer on link change · 02d38fcb
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      02d38fcb
    • V
      net: Adding netmap network backend · 58952137
      Vincenzo Maffione 提交于
      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
      options:
          ./configure [...] --enable-netmap --extra-cflags=-I/path/to/netmap/sys
      where "/path/to/netmap" contains the netmap source code, available at
          http://info.iet.unipi.it/~luigi/netmap/
      
      The same webpage contains more information about the netmap project
      (together with papers and presentations).
      Signed-off-by: NVincenzo Maffione <v.maffione@gmail.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      58952137
  22. 09 11月, 2013 2 次提交
  23. 06 9月, 2013 1 次提交
  24. 23 8月, 2013 1 次提交
  25. 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
  26. 03 5月, 2013 1 次提交
    • 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
  27. 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
  28. 27 2月, 2013 1 次提交
    • 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