Skip to content
Snippets Groups Projects
  1. May 02, 2021
  2. Apr 08, 2021
  3. Mar 15, 2021
    • Alexey Kirillov's avatar
      qapi: net: Add query-netdev command · d32ad10a
      Alexey Kirillov authored
      
      The query-netdev command is used to get the configuration of the current
      network device backends (netdevs).
      This is the QMP analog of the HMP command "info network" but only for
      netdevs (i.e. excluding NIC and hubports).
      
      The query-netdev command returns an array of objects of the NetdevInfo
      type, which are an extension of Netdev type. It means that response can
      be used for netdev-add after small modification. This can be useful for
      recreate the same netdev configuration.
      
      Information about the network device is filled in when it is created or
      modified and is available through the NetClientState->stored_config.
      
      Signed-off-by: default avatarAlexey Kirillov <lekiravi@yandex-team.ru>
      Acked-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      d32ad10a
  4. Aug 16, 2019
  5. Mar 05, 2019
  6. Jul 19, 2016
    • Eric Blake's avatar
      qapi: Change Netdev into a flat union · f394b2e2
      Eric Blake authored
      
      This is a mostly-mechanical conversion that creates a new flat
      union 'Netdev' QAPI type that covers all the branches of the
      former 'NetClientOptions' simple union, where the branches are
      now listed in a new 'NetClientDriver' enum rather than generated
      from the simple union.  The existence of a flat union has no
      change to the command line syntax accepted for new code, and
      will make it possible for a future patch to switch the QMP
      command to parse a boxed union for no change to valid QMP; but
      it does have some ripple effect on the C code when dealing with
      the new types.
      
      While making the conversion, note that the 'NetLegacy' type
      remains unchanged: it applies only to legacy command line options,
      and will not be ported to QMP, so it should remain a wrapper
      around a simple union; to avoid confusion, the type named
      'NetClientOptions' is now gone, and we introduce 'NetLegacyOptions'
      in its place.  Then, in the C code, we convert from NetLegacy to
      Netdev as soon as possible, so that the bulk of the net stack
      only has to deal with one QAPI type, not two.  Note that since
      the old legacy code always rejected 'hubport', we can just omit
      that branch from the new 'NetLegacyOptions' simple union.
      
      Based on an idea originally by Zoltán Kővágó <DirtY.iCE.hu@gmail.com>:
      Message-Id: <01a527fbf1a5de880091f98cf011616a78adeeee.1441627176.git.DirtY.iCE.hu@gmail.com>
      although the sed script in that patch no longer applies due to
      other changes in the tree since then, and I also did some manual
      cleanups (such as fixing whitespace to keep checkpatch happy).
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-13-git-send-email-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      [Fixup from Eric squashed in]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      f394b2e2
    • Kővágó, Zoltán's avatar
      net: use Netdev instead of NetClientOptions in client init · cebea510
      Kővágó, Zoltán authored
      
      This way we no longer need NetClientOptions and can convert Netdev
      into a flat union.
      
      Signed-off-by: default avatarKővágó, Zoltán <DirtY.iCE.hu@gmail.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <93ffdfed7054529635e6acb935150d95dc173a12.1441627176.git.DirtY.iCE.hu@gmail.com>
      
      [rework net_client_init1() to pass Netdev by copying from NetdevLegacy,
      rather than merging the two types - which means that we still need
      NetClientOptions after all.  Rebase to qapi changes. The bulk of the
      patch is mechanical, replacing 'opts' by 'netdev->opts', while
      net_client_init1() takes care of converting between legacy and modern
      types.]
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-2-git-send-email-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      cebea510
  7. Jun 16, 2016
  8. Apr 05, 2016
  9. Apr 04, 2016
  10. Mar 22, 2016
  11. Mar 18, 2016
    • Eric Blake's avatar
      qapi: Don't special-case simple union wrappers · 32bafa8f
      Eric Blake authored
      
      Simple unions were carrying a special case that hid their 'data'
      QMP member from the resulting C struct, via the hack method
      QAPISchemaObjectTypeVariant.simple_union_type().  But by using
      the work we started by unboxing flat union and alternate
      branches, coupled with the ability to visit the members of an
      implicit type, we can now expose the simple union's implicit
      type in qapi-types.h:
      
      | struct q_obj_ImageInfoSpecificQCow2_wrapper {
      |     ImageInfoSpecificQCow2 *data;
      | };
      |
      | struct q_obj_ImageInfoSpecificVmdk_wrapper {
      |     ImageInfoSpecificVmdk *data;
      | };
      ...
      | struct ImageInfoSpecific {
      |     ImageInfoSpecificKind type;
      |     union { /* union tag is @type */
      |         void *data;
      |-        ImageInfoSpecificQCow2 *qcow2;
      |-        ImageInfoSpecificVmdk *vmdk;
      |+        q_obj_ImageInfoSpecificQCow2_wrapper qcow2;
      |+        q_obj_ImageInfoSpecificVmdk_wrapper vmdk;
      |     } u;
      | };
      
      Doing this removes asymmetry between QAPI's QMP side and its
      C side (both sides now expose 'data'), and means that the
      treatment of a simple union as sugar for a flat union is now
      equivalent in both languages (previously the two approaches used
      a different layer of dereferencing, where the simple union could
      be converted to a flat union with equivalent C layout but
      different {} on the wire, or to an equivalent QMP wire form
      but with different C representation).  Using the implicit type
      also lets us get rid of the simple_union_type() hack.
      
      Of course, now all clients of simple unions have to adjust from
      using su->u.member to using su->u.member.data; while this touches
      a number of files in the tree, some earlier cleanup patches
      helped minimize the change to the initialization of a temporary
      variable rather than every single member access.  The generated
      qapi-visit.c code is also affected by the layout change:
      
      |@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member
      |     }
      |     switch (obj->type) {
      |     case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
      |-        visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err);
      |+        visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err);
      |         break;
      |     case IMAGE_INFO_SPECIFIC_KIND_VMDK:
      |-        visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err);
      |+        visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err);
      |         break;
      |     default:
      |         abort();
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-13-git-send-email-eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      32bafa8f
  12. Mar 08, 2016
  13. Feb 04, 2016
  14. Nov 12, 2015
  15. Jun 12, 2015
    • Fam Zheng's avatar
      Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handler · 82e1cc4b
      Fam Zheng authored
      
      Done with following Coccinelle semantic patch, plus manual cosmetic changes in
      net/*.c.
      
          @@
          expression E1, E2, E3, E4;
          @@
          -   qemu_set_fd_handler2(E1, NULL, E2, E3, E4);
          +   qemu_set_fd_handler(E1, E2, E3, E4);
      
      Signed-off-by: default avatarFam Zheng <famz@redhat.com>
      Message-id: 1433400324-7358-8-git-send-email-famz@redhat.com
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      82e1cc4b
    • Fam Zheng's avatar
      netmap: Drop netmap_can_send · e8dd1d9c
      Fam Zheng authored
      
      This callback is called by main loop before polling s->fd, if it returns
      false, the fd will not be polled in this iteration.
      
      This is redundant with checks inside read callback. After this patch,
      the data will be copied from s->fd to s->iov when it arrives. If the
      device can't receive, it will be queued to incoming_queue, and when the
      device status changes, this queue will be flushed.
      
      Also remove the qemu_can_send_packet() check in netmap_send. If it's
      true, we are good; if it's false, the qemu_sendv_packet_async would
      return 0 and read poll will be disabled until netmap_send_completed is
      called.
      
      Signed-off-by: default avatarFam Zheng <famz@redhat.com>
      Message-id: 1433400324-7358-5-git-send-email-famz@redhat.com
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      e8dd1d9c
  16. May 27, 2015
    • Markus Armbruster's avatar
      net: Permit incremental conversion of init functions to Error · a30ecde6
      Markus Armbruster authored
      
      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: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-id: 1431691143-1015-3-git-send-email-armbru@redhat.com
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      a30ecde6
  17. Mar 25, 2014
  18. Feb 25, 2014
    • Vincenzo Maffione's avatar
      net: Disable netmap backend when not supported · 0a985b37
      Vincenzo Maffione authored
      
      This patch fixes configure so that the netmap backend is not compiled in if the
      host doesn't support an API version >= 11. A version upper bound (15) has been
      added so that the netmap API can be extended with some minor features without
      requiring QEMU code modifications.
      
      Moreover, some changes have been done to net/netmap.c in order to reflect the
      current netmap API/ABI (11).
      
      The NETMAP_WITH_LIBS macro makes possible to include some utilities (e.g.
      netmap ring macros, D(), RD() and other high level functions) through the netmap
      headers. In this way we get rid of the D and RD macro definitions in the QEMU
      code, and we open the way for further code simplifications that will be
      introduced by future patches.
      
      Signed-off-by: default avatarVincenzo Maffione <v.maffione@gmail.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      0a985b37
    • Vincenzo Maffione's avatar
      net: add offloading support to netmap backend · f6c65bfb
      Vincenzo Maffione authored
      
      Whit this patch, the netmap backend supports TSO/UFO/CSUM
      offloadings, and accepts the virtio-net header, similarly to what
      happens with TAP. The offloading callbacks in the NetClientInfo
      interface have been implemented.
      
      Signed-off-by: default avatarVincenzo Maffione <v.maffione@gmail.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      f6c65bfb
  19. Dec 09, 2013
    • Vincenzo Maffione's avatar
      net: Adding netmap network backend · 58952137
      Vincenzo Maffione authored
      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: default avatarVincenzo Maffione <v.maffione@gmail.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      58952137
Loading