1. 09 2月, 2016 4 次提交
    • E
      qapi: Drop unused 'kind' for struct/enum visit · 337283df
      Eric Blake 提交于
      visit_start_struct() and visit_type_enum() had a 'kind' argument
      that was usually set to either the stringized version of the
      corresponding qapi type name, or to NULL (although some clients
      didn't even get that right).  But nothing ever used the argument.
      It's even hard to argue that it would be useful in a debugger,
      as a stack backtrace also tells which type is being visited.
      
      Therefore, drop the 'kind' argument as dead.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-22-git-send-email-eblake@redhat.com>
      [Harmless rebase mistake cleaned up]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      337283df
    • E
      qapi: Swap visit_* arguments for consistent 'name' placement · 51e72bc1
      Eric Blake 提交于
      JSON uses "name":value, but many of our visitor interfaces were
      called with visit_type_FOO(v, &value, name, errp).  This can be
      a bit confusing to have to mentally swap the parameter order to
      match JSON order.  It's particularly bad for visit_start_struct(),
      where the 'name' parameter is smack in the middle of the
      otherwise-related group of 'obj, kind, size' parameters! It's
      time to do a global swap of the parameter ordering, so that the
      'name' parameter is always immediately after the Visitor argument.
      
      Additional reason in favor of the swap: the existing include/qjson.h
      prefers listing 'name' first in json_prop_*(), and I have plans to
      unify that file with the qapi visitors; listing 'name' first in
      qapi will minimize churn to the (admittedly few) qjson.h clients.
      
      Later patches will then fix docs, object.h, visitor-impl.h, and
      those clients to match.
      
      Done by first patching scripts/qapi*.py by hand to make generated
      files do what I want, then by running the following Coccinelle
      script to affect the rest of the code base:
       $ spatch --sp-file script `git grep -l '\bvisit_' -- '**/*.[ch]'`
      I then had to apply some touchups (Coccinelle insisted on TAB
      indentation in visitor.h, and botched the signature of
      visit_type_enum() by rewriting 'const char *const strings[]' to
      the syntactically invalid 'const char*const[] strings').  The
      movement of parameters is sufficient to provoke compiler errors
      if any callers were missed.
      
          // Part 1: Swap declaration order
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_start_struct
          -(TV v, TObj OBJ, T1 ARG1, const char *name, T2 ARG2, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type bool, TV, T1;
          identifier ARG1;
          @@
           bool visit_optional
          -(TV v, T1 ARG1, const char *name)
          +(TV v, const char *name, T1 ARG1)
           { ... }
      
          @@
          type TV, TErr, TObj, T1;
          identifier OBJ, ARG1;
          @@
           void visit_get_next_type
          -(TV v, TObj OBJ, T1 ARG1, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_type_enum
          -(TV v, TObj OBJ, T1 ARG1, T2 ARG2, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj;
          identifier OBJ;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
           void VISIT_TYPE
          -(TV v, TObj OBJ, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, TErr errp)
           { ... }
      
          // Part 2: swap caller order
          @@
          expression V, NAME, OBJ, ARG1, ARG2, ERR;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
          (
          -visit_start_struct(V, OBJ, ARG1, NAME, ARG2, ERR)
          +visit_start_struct(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -visit_optional(V, ARG1, NAME)
          +visit_optional(V, NAME, ARG1)
          |
          -visit_get_next_type(V, OBJ, ARG1, NAME, ERR)
          +visit_get_next_type(V, NAME, OBJ, ARG1, ERR)
          |
          -visit_type_enum(V, OBJ, ARG1, ARG2, NAME, ERR)
          +visit_type_enum(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -VISIT_TYPE(V, OBJ, NAME, ERR)
          +VISIT_TYPE(V, NAME, OBJ, ERR)
          )
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-19-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      51e72bc1
    • E
      hmp: Cache use of qapi visitor · 9b65859d
      Eric Blake 提交于
      Cache the visitor in a local variable instead of repeatedly
      calling the accessor.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-8-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9b65859d
    • E
      hmp: Drop pointless allocation during qapi visit · 7019738d
      Eric Blake 提交于
      The qapi visitor contract allows us to visit a virtual structure,
      where we don't have any corresponding qapi struct.  Most such uses
      pass NULL for @obj; but these two callers were passing a dummy
      pointer, which then gets allocated to heap memory but then
      immediately freed without use.  Clean this up to suppress unwanted
      allocation, like we do elsewhere.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-7-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7019738d
  2. 05 2月, 2016 1 次提交
    • P
      all: Clean up includes · d38ea87a
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
      d38ea87a
  3. 03 2月, 2016 1 次提交
  4. 13 1月, 2016 2 次提交
    • M
      error: Consistently name Error * objects err, and not errp · 533fdaed
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1450452927-8346-25-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      533fdaed
    • M
      error: Use error_report_err() instead of monitor_printf() · 193227f9
      Markus Armbruster 提交于
      Both error_report_err() and monitor_printf() print to the same
      destination when monitor_printf() is used correctly, i.e. within an
      HMP monitor.  Elsewhere, monitor_printf() does nothing, while
      error_report_err() reports to stderr.
      
      Most changed functions are HMP command handlers.  These should only
      run within an HMP monitor.  The one exception is bdrv_password_cb(),
      which should also only run within an HMP monitor.
      
      Four command handlers prefix the error message with the command name:
      balloon, migrate_set_capability, migrate_set_parameter, migrate.
      Pointless, drop.
      
      Unlike monitor_printf(), error_report_err() uses the error whole
      instead of just its message obtained with error_get_pretty().  This
      avoids suppressing its hint (see commit 50b7b000).  Example:
      
          (qemu) device_add ivshmem,id=666
          Parameter 'id' expects an identifier
          Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.
          Try "help device_add" for more information
      
      The "Identifiers consist of..." line is new with this patch.
      
      Coccinelle semantic patch:
      
          @@
          expression M, E;
          @@
          -    monitor_printf(M, "%s\n", error_get_pretty(E));
          -    error_free(E);
          +    error_report_err(E);
          @r1@
          expression M, E;
          format F;
          position p;
          @@
          -    monitor_printf(M, "...%@F@\n", error_get_pretty(E));@p
          -    error_free(E);
          +    error_report_err(E);
          @script:python@
      	p << r1.p;
          @@
          print "%s:%s:%s: prefix dropped" % (p[0].file, p[0].line, p[0].column)
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1450452927-8346-4-git-send-email-armbru@redhat.com>
      193227f9
  5. 17 12月, 2015 2 次提交
    • E
      cpu: Convert CpuInfo into flat union · 86f4b687
      Eric Blake 提交于
      The CpuInfo struct is used only by the 'query-cpus' output
      command, so we are free to modify it by adding fields (clients
      are already supposed to ignore unknown output fields), or by
      changing optional members to mandatory, while still keeping
      QMP wire compatibility with older versions of qemu.
      
      When qapi type CpuInfo was originally created for 0.14, we had
      no notion of a flat union, and instead just listed a bunch of
      optional fields with documentation about the mutually-exclusive
      choice of which instruction pointer field(s) would be provided
      for a given architecture.  But now that we have flat unions and
      introspection, it is better to segregate off which fields will
      be provided according to the actual architecture.  With this in
      place, we no longer need the fields to be optional, because the
      choice of the new 'arch' discriminator serves that role.
      
      This has an additional benefit: the old all-in-one struct was
      the only place in the code base that had a case-sensitive
      naming of members 'pc' vs. 'PC'.  Separating these spellings
      into different branches of the flat union will allow us to add
      restrictions against future case-insensitive collisions, since
      that is generally a poor interface practice.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-25-git-send-email-eblake@redhat.com>
      [Spelling of CPUInfo{SPARC,PPC,MIPS} fixed]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      86f4b687
    • E
      qapi: Don't let implicit enum MAX member collide · 7fb1cf16
      Eric Blake 提交于
      Now that we guarantee the user doesn't have any enum values
      beginning with a single underscore, we can use that for our
      own purposes.  Renaming ENUM_MAX to ENUM__MAX makes it obvious
      that the sentinel is generated.
      
      This patch was mostly generated by applying a temporary patch:
      
      |diff --git a/scripts/qapi.py b/scripts/qapi.py
      |index e6d014b..b862ec9 100644
      |--- a/scripts/qapi.py
      |+++ b/scripts/qapi.py
      |@@ -1570,6 +1570,7 @@ const char *const %(c_name)s_lookup[] = {
      |     max_index = c_enum_const(name, 'MAX', prefix)
      |     ret += mcgen('''
      |     [%(max_index)s] = NULL,
      |+// %(max_index)s
      | };
      | ''',
      |                max_index=max_index)
      
      then running:
      
      $ cat qapi-{types,event}.c tests/test-qapi-types.c |
          sed -n 's,^// \(.*\)MAX,s|\1MAX|\1_MAX|g,p' > list
      $ git grep -l _MAX | xargs sed -i -f list
      
      The only things not generated are the changes in scripts/qapi.py.
      
      Rejecting enum members named 'MAX' is now useless, and will be dropped
      in the next patch.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-23-git-send-email-eblake@redhat.com>
      Reviewed-by: NJuan Quintela <quintela@redhat.com>
      [Rebased to current master, commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7fb1cf16
  6. 12 11月, 2015 1 次提交
  7. 11 11月, 2015 3 次提交
  8. 10 11月, 2015 1 次提交
  9. 02 11月, 2015 4 次提交
    • E
      tpm: Convert to new qapi union layout · ce21131a
      Eric Blake 提交于
      We have two issues with our qapi union layout:
      1) Even though the QMP wire format spells the tag 'type', the
      C code spells it 'kind', requiring some hacks in the generator.
      2) The C struct uses an anonymous union, which places all tag
      values in the same namespace as all non-variant members. This
      leads to spurious collisions if a tag value matches a non-variant
      member's name.
      
      Make the conversion to the new layout for TPM-related code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-22-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      ce21131a
    • E
      memory: Convert to new qapi union layout · 1fd5d4fe
      Eric Blake 提交于
      We have two issues with our qapi union layout:
      1) Even though the QMP wire format spells the tag 'type', the
      C code spells it 'kind', requiring some hacks in the generator.
      2) The C struct uses an anonymous union, which places all tag
      values in the same namespace as all non-variant members. This
      leads to spurious collisions if a tag value matches a non-variant
      member's name.
      
      Make the conversion to the new layout for memory-related code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-21-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      1fd5d4fe
    • E
      input: Convert to new qapi union layout · 568c73a4
      Eric Blake 提交于
      We have two issues with our qapi union layout:
      1) Even though the QMP wire format spells the tag 'type', the
      C code spells it 'kind', requiring some hacks in the generator.
      2) The C struct uses an anonymous union, which places all tag
      values in the same namespace as all non-variant members. This
      leads to spurious collisions if a tag value matches a non-variant
      member's name.
      
      Make the conversion to the new layout for input-related code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-20-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      568c73a4
    • E
      qapi: Unbox base members · ddf21908
      Eric Blake 提交于
      Rather than storing a base class as a pointer to a box, just
      store the fields of that base class in the same order, so that
      a child struct can be directly cast to its parent.  This gives
      less malloc overhead, less pointer dereferencing, and even less
      generated code.  Compare to the earlier commit 1e6c1616 "qapi:
      Generate a nicer struct for flat unions" (although that patch
      had fewer places to change, as less of qemu was directly using
      qapi structs for flat unions).  It also allows us to turn on
      automatic type-safe wrappers for upcasting to the base class
      of a struct.
      
      Changes to the generated code look like this in qapi-types.h:
      
      | struct SpiceChannel {
      |-    SpiceBasicInfo *base;
      |+    /* Members inherited from SpiceBasicInfo: */
      |+    char *host;
      |+    char *port;
      |+    NetworkAddressFamily family;
      |+    /* Own members: */
      |     int64_t connection_id;
      
      as well as additional upcast functions like qapi_SpiceChannel_base().
      Meanwhile, changes to qapi-visit.c look like:
      
      | static void visit_type_SpiceChannel_fields(Visitor *v, SpiceChannel **obj, Error **errp)
      | {
      |     Error *err = NULL;
      |
      |-    visit_type_implicit_SpiceBasicInfo(v, &(*obj)->base, &err);
      |+    visit_type_SpiceBasicInfo_fields(v, (SpiceBasicInfo **)obj, &err);
      |     if (err) {
      
      (the cast is necessary, since our upcast wrappers only deal with a
      single pointer, not pointer-to-pointer); plus the wholesale
      elimination of some now-unused visit_type_implicit_FOO() functions.
      
      Without boxing, the corner case of one empty struct having
      another empty struct as its base type now requires inserting a
      dummy member (previously, the 'Base *base' member sufficed).
      
      And now that we no longer consume a 'base' member in the generated
      C struct, we can delete the former negative struct-base-clash-base
      test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-11-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      ddf21908
  10. 30 9月, 2015 2 次提交
  11. 04 9月, 2015 1 次提交
  12. 02 7月, 2015 1 次提交
  13. 23 6月, 2015 5 次提交
    • M
      Include qapi/qmp/qerror.h exactly where needed · cc7a8ea7
      Markus Armbruster 提交于
      In particular, don't include it into headers.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      cc7a8ea7
    • M
      qmp: Wean off qerror_report() · 485febc6
      Markus Armbruster 提交于
      The traditional QMP command handler interface
      
          int qmp_FOO(Monitor *mon, const QDict *params, QObject **ret_data);
      
      doesn't provide for returning an Error object.  Instead, the handler
      is expected to stash it in the monitor with qerror_report().
      
      When we rebased QMP on top of QAPI, we didn't change this interface.
      Instead, commit 776574d6 introduced "middle mode" as a temporary aid
      for converting existing QMP commands to QAPI one by one.  More than
      three years later, we're still using it.
      
      Middle mode has two effects:
      
      * Instead of the native input marshallers
      
            static void qmp_marshal_input_FOO(QDict *, QObject **, Error **)
      
        it generates input marshallers conforming to the traditional QMP
        command handler interface.
      
      * It suppresses generation of code to register them with
        qmp_register_command()
      
        This permits giving them internal linkage.
      
      As long as we need qmp-commands.hx, we can't use the registry behind
      qmp_register_command(), so the latter has to stay for now.
      
      The former has to go to get rid of qerror_report().  Changing all QMP
      commands to fit the QAPI mold in one go was impractical back when we
      started, but by now there are just a few stragglers left:
      do_qmp_capabilities(), qmp_qom_set(), qmp_qom_get(), qmp_object_add(),
      qmp_netdev_add(), do_device_add().
      
      Switch middle mode to generate native input marshallers, and adapt the
      stragglers.  Simplifies both the monitor code and the stragglers.
      
      Rename do_qmp_capabilities() to qmp_capabilities(), and
      do_device_add() to qmp_device_add, because that's how QMP command
      handlers are named today.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      485febc6
    • M
      qerror: Clean up QERR_ macros to expand into a single string · c6bd8c70
      Markus Armbruster 提交于
      These macros expand into error class enumeration constant, comma,
      string.  Unclean.  Has been that way since commit 13f59ae8.
      
      The error class is always ERROR_CLASS_GENERIC_ERROR since the previous
      commit.
      
      Clean up as follows:
      
      * Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and
        delete it from the QERR_ macro.  No change after preprocessing.
      
      * Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into
        error_setg(...).  Again, no change after preprocessing.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      c6bd8c70
    • M
      qerror: Eliminate QERR_DEVICE_NOT_FOUND · 75158ebb
      Markus Armbruster 提交于
      Error classes other than ERROR_CLASS_GENERIC_ERROR should not be used
      in new code.  Hiding them in QERR_ macros makes new uses hard to spot.
      Fortunately, there's just one such macro left.  Eliminate it with this
      coccinelle semantic patch:
      
          @@
          expression EP, E;
          @@
          -error_set(EP, QERR_DEVICE_NOT_FOUND, E)
          +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      75158ebb
    • M
      QemuOpts: Wean off qerror_report_err() · 70b94331
      Markus Armbruster 提交于
      qerror_report_err() is a transitional interface to help with
      converting existing monitor commands to QMP.  It should not be used
      elsewhere.
      
      The only remaining user in qemu-option.c is qemu_opts_parse().  Is it
      used in QMP context?  If not, we can simply replace
      qerror_report_err() by error_report_err().
      
      The uses in qemu-img.c, qemu-io.c, qemu-nbd.c and under tests/ are
      clearly not in QMP context.
      
      The uses in vl.c aren't either, because the only QMP command handlers
      there are qmp_query_status() and qmp_query_machines(), and they don't
      call it.
      
      Remaining uses:
      
      * drive_def(): Command line -drive and such, HMP drive_add and pci_add
      
      * hmp_chardev_add(): HMP chardev-add
      
      * monitor_parse_command(): HMP core
      
      * tmp_config_parse(): Command line -tpmdev
      
      * net_host_device_add(): HMP host_net_add
      
      * net_client_parse(): Command line -net and -netdev
      
      * qemu_global_option(): Command line -global
      
      * vnc_parse_func(): Command line -display, -vnc, default display, HMP
        change, QMP change.  Bummer.
      
      * qemu_pci_hot_add_nic(): HMP pci_add
      
      * usb_net_init(): Command line -usbdevice, HMP usb_add
      
      Propagate errors through qemu_opts_parse().  Create a convenience
      function qemu_opts_parse_noisily() that passes errors to
      error_report_err().  Switch all non-QMP users outside tests to it.
      
      That leaves vnc_parse_func().  Propagate errors through it.  Since I'm
      touching it anyway, rename it to vnc_parse().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      70b94331
  14. 22 6月, 2015 1 次提交
  15. 12 6月, 2015 3 次提交
    • A
      throttle: add the name of the ThrottleGroup to BlockDeviceInfo · b8fe1694
      Alberto Garcia 提交于
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 172df91f09c69c6f0440a697bbd1b3f95b077ee4.1433779731.git.berto@igalia.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      b8fe1694
    • A
      throttle: Add throttle group support · 76f4afb4
      Alberto Garcia 提交于
      The throttle group support use a cooperative round robin scheduling
      algorithm.
      
      The principles of the algorithm are simple:
      - Each BDS of the group is used as a token in a circular way.
      - The active BDS computes if a wait must be done and arms the right
        timer.
      - If a wait must be done the token timer will be armed so the token
        will become the next active BDS.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: f0082a86f3ac01c46170f7eafe2101a92e8fde39.1433779731.git.berto@igalia.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      76f4afb4
    • S
      qmp/hmp: add rocker device support · fafa4d50
      Scott Feldman 提交于
      Add QMP/HMP support for rocker devices.  This is mostly for debugging purposes
      to see inside the device's tables and port configurations.  Some examples:
      
      (qemu) info rocker sw1
      name: sw1
      id: 0x0000013512005452
      ports: 4
      
      (qemu) info rocker-ports sw1
                  ena/    speed/ auto
            port  link    duplex neg?
           sw1.1  up     10G  FD  No
           sw1.2  up     10G  FD  No
           sw1.3  !ena   10G  FD  No
           sw1.4  !ena   10G  FD  No
      
      (qemu) info rocker-of-dpa-flows sw1
      prio tbl hits key(mask) --> actions
      2    60       pport 1 vlan 1 LLDP src 00:02:00:00:02:00 dst 01:80:c2:00:00:0e
      2    60       pport 1 vlan 1 ARP src 00:02:00:00:02:00 dst 00:02:00:00:03:00
      2    60       pport 2 vlan 2 IPv6 src 00:02:00:00:03:00 dst 33:33:ff:00:00:02 proto 58
      3    50       vlan 2 dst 33:33:ff:00:00:02 --> write group 0x32000001 goto tbl 60
      2    60       pport 2 vlan 2 IPv6 src 00:02:00:00:03:00 dst 33:33:ff:00:03:00 proto 58
      3    50  1    vlan 2 dst 33:33:ff:00:03:00 --> write group 0x32000001 goto tbl 60
      2    60       pport 2 vlan 2 ARP src 00:02:00:00:03:00 dst 00:02:00:00:02:00
      3    50  2    vlan 2 dst 00:02:00:00:02:00 --> write group 0x02000001 goto tbl 60
      2    60  1    pport 2 vlan 2 IP src 00:02:00:00:03:00 dst 00:02:00:00:02:00 proto 1
      3    50  2    vlan 1 dst 00:02:00:00:03:00 --> write group 0x01000002 goto tbl 60
      2    60  1    pport 1 vlan 1 IP src 00:02:00:00:02:00 dst 00:02:00:00:03:00 proto 1
      2    60       pport 1 vlan 1 IPv6 src 00:02:00:00:02:00 dst 33:33:ff:00:00:01 proto 58
      3    50       vlan 1 dst 33:33:ff:00:00:01 --> write group 0x31000000 goto tbl 60
      2    60       pport 1 vlan 1 IPv6 src 00:02:00:00:02:00 dst 33:33:ff:00:02:00 proto 58
      3    50  1    vlan 1 dst 33:33:ff:00:02:00 --> write group 0x31000000 goto tbl 60
      1    60  173  pport 2 vlan 2 LLDP src <any> dst 01:80:c2:00:00:0e --> write group 0x02000000
      1    60  6    pport 2 vlan 2 IPv6 src <any> dst <any> --> write group 0x02000000
      1    60  174  pport 1 vlan 1 LLDP src <any> dst 01:80:c2:00:00:0e --> write group 0x01000000
      1    60  174  pport 2 vlan 2 IP src <any> dst <any> --> write group 0x02000000
      1    60  6    pport 1 vlan 1 IPv6 src <any> dst <any> --> write group 0x01000000
      1    60  181  pport 2 vlan 2 ARP src <any> dst <any> --> write group 0x02000000
      1    10  715  pport 2 --> apply new vlan 2 goto tbl 20
      1    60  177  pport 1 vlan 1 ARP src <any> dst <any> --> write group 0x01000000
      1    60  174  pport 1 vlan 1 IP src <any> dst <any> --> write group 0x01000000
      1    10  717  pport 1 --> apply new vlan 1 goto tbl 20
      1    0   1432 pport 0(0xffff) --> goto tbl 10
      
      (qemu) info rocker-of-dpa-groups sw1
      id (decode) --> buckets
      0x32000001 (type L2 multicast vlan 2 index 1) --> groups [0x02000001,0x02000000]
      0x02000001 (type L2 interface vlan 2 pport 1) --> pop vlan out pport 1
      0x01000002 (type L2 interface vlan 1 pport 2) --> pop vlan out pport 2
      0x02000000 (type L2 interface vlan 2 pport 0) --> pop vlan out pport 0
      0x01000000 (type L2 interface vlan 1 pport 0) --> pop vlan out pport 0
      0x31000000 (type L2 multicast vlan 1 index 0) --> groups [0x01000002,0x01000000]
      
      [Added "query-" prefixes to rocker.json commands as suggested by Eric
      Blake <eblake@redhat.com>.
      --Stefan]
      Signed-off-by: NScott Feldman <sfeldma@gmail.com>
      Signed-off-by: NJiri Pirko <jiri@resnulli.us>
      Message-id: 1433985681-56138-5-git-send-email-sfeldma@gmail.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      fafa4d50
  16. 02 6月, 2015 2 次提交
  17. 08 5月, 2015 1 次提交
  18. 06 5月, 2015 2 次提交
    • E
      qapi: Drop inline nested structs in query-pci · 9fa02cd1
      Eric Blake 提交于
      A future patch will be using a 'name':{dictionary} entry in the
      QAPI schema to specify a default value for an optional argument
      (see previous commit message for more details why); but existing
      use of inline nested structs conflicts with that goal. This patch
      fixes one of only two commands relying on nested types, by
      breaking the nesting into an explicit type; it means that the
      type is now boxed instead of unboxed in C code, but the QMP wire
      format is unaffected by this change.
      
      Prefer the safer g_new0() while making the conversion, and reduce
      some long lines.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9fa02cd1
    • E
      qapi: Drop inline nested struct in query-version · 4752cdbb
      Eric Blake 提交于
      A future patch will be using a 'name':{dictionary} entry in the
      QAPI schema to specify a default value for an optional argument
      (see previous commit message for more details why); but existing
      use of inline nested structs conflicts with that goal. This patch
      fixes one of only two commands relying on nested types, by
      breaking the nesting into an explicit type; it means that the
      type is now boxed instead of unboxed in C code, but the QMP wire
      format is unaffected by this change.
      
      Prefer the safer g_new0() while making the conversion.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      4752cdbb
  19. 28 4月, 2015 2 次提交
  20. 17 4月, 2015 1 次提交
    • A
      hmp: fix crash in 'info block -n -v' · 638b8366
      Alberto Garcia 提交于
      The image field in BlockDeviceInfo should never be null, however
      bdrv_block_device_info() is not filling it in.
      
      This makes the 'info block -n -v' command crash QEMU.
      
      The proper solution is probably to move the relevant code from
      bdrv_query_info() to bdrv_block_device_info(), but since we're too
      close to the release for that this simpler workaround solves the
      crash.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Message-id: 1429274688-8115-1-git-send-email-berto@igalia.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      638b8366