This series adds --format json support to five more ovs-appctl commands:
fdb/stats-show, upcall/show, dpif-netdev/pmd-sleep-show,
dpif-netdev/pmd-perf-show and dpctl/show.

Changes since v6:
- Rebased on top of the current main.
- Series wide: the NEWS entry added by 1/5 is extended by the later
  patches with their command, instead of one entry per command (Ilya).
- Series wide: dropped the man page descriptions of the JSON output,
  as the format is not a stable API (Ilya).
- 1/5: kept the original wrapping of the ds_put_format() calls moved
  into the text helper.  The output stays keyed by the bridge name even
  though the command takes exactly one bridge, to match fdb/show,
  dpif/show and dpif/offload/show, and so the format does not change if
  more bridges are ever reported (Eelco); the commit message now says
  so (Ilya).  Dropped Eelco's Acked-by, as the patch changed.
- 2/5: revalidators that are not fully initialized yet (ID 0) are
  skipped, otherwise they overwrite each other's entry (Ilya).  The
  revalidators are still an object keyed by ID, and the ID is a string
  because JSON object keys are always strings.  The JSON check moved
  out of the revalidation regression test into its own test, which
  masks all the numbers with a single sed (Ilya).  Dropped Eelco's
  Acked-by, as the patch changed.
- 3/5: "core" and "numa" are next to each other (Ilya).
- 4/5: reworked the "cycles" and "iterations" split, so every
  percentage names what it is calculated from: "cycles" holds the used,
  idle and busy cycles with "used-percentage-of-total",
  "idle-percentage-of-used" and "busy-percentage-of-used",
  "iterations" holds the total, idle, busy and sleep iterations with
  "sleep-percentage-of-total" and "us-per-iteration", and the sleep
  time moved to a new "sleep" object (Ilya).
- 4/5: derived values are computed into local variables before
  json_object_put(), and are omitted when their denominator is zero
  instead of being reported as 0.  This also covers
  "packets-per-tx-batch" with zero tx batches, which used to produce an
  invalid JSON number (Ilya).
- 4/5: "rx-kpps", "tx-kpps" and "cycles-per-packet" are integers,
  rounded the same way as the text output; "us-per-upcall" stays a
  real number, as the text output prints it with one decimal (Ilya).
- 4/5: histograms are objects keyed by the bin upper bound, with the
  last bin keyed "more", instead of "walls" and "bins" arrays (Ilya).
- 4/5: fixed a misaligned argument and the unchecked time/warp in the
  test (Ilya).  The text output is unchanged, the existing text tests
  pass without changes.
- 5/5: "hits" is used everywhere ("lookups", "masks" and
  "hits-per-packet"); "masks" "hits-per-packet" and the cache
  "hit-rate" are omitted when no packet was looked up; the cache
  "config" is an object keyed by cache level name (Ilya).
- 5/5: the ports are no longer collected and sorted, the JSON helper
  iterates the port dump directly, as the order does not matter in an
  object (Ilya).  New code uses SMAP_INITIALIZER (Ilya).
- 5/5: the JSON checks moved to a new "dpctl - show JSON output" test,
  the existing test is left untouched (Ilya).

Changes since v5:
- 1/5 and 2/5: only picked up the Acked-by, they are otherwise
  unchanged.
- 3/5: blank line after the declaration and the pmd list is now freed
  outside of the datapath mutex (Eelco).
- 4/5: declaration order fixes in pmd_perf_format_overall_stats_json()
  and in dpif_netdev_pmd_info(), blank lines after the if and for blocks
  of the JSON helpers, and the man page no longer claims the histograms
  are selected by -nh, since they are reported unless -nh is given
  (Eelco).
- 4/5: the -nh, -it and -ms test does not grep for a few keys anymore
  (Eelco).  Checking the whole reply would mean 575 lines of expected
  output, 441 of them the seven histograms, so the test extracts the
  sections the three options control and compares those: the histogram
  "averages" object, which lists every histogram, one histogram in full
  with its constant walls and its cleared bins, and both histories,
  which is where the number of samples shows up.
- 5/5: the two first returns of dps_for_each() are combined and the
  dpctl/show man page entry is now a two line summary instead of a
  field by field description that would have to be kept in sync
  (Eelco).

The one comment on v5 not applied is the removal of the "if (enumerror)"
check in dps_for_each().  enumerror can be zero there: it only takes a
switch where every datapath type enumerates fine and no datapath has
been created yet, and dpctl_error() with an errno of zero still appends
"enumerating datapaths failed" to the reply, so a successful dpctl/show
would grow a bogus error line.  The check stays for that reason.

Changes since v4:
- Only the two tests added in v4 changed, the code is untouched.
- 2/5: the second datapath of the upcall/show test now uses the netdev
  type instead of the system one.  --enable-dummy=override only
  overrides the datapath types that are already registered, and the
  system type is not registered on the platforms without the kernel
  datapath, so the bridge failed to be created there.
- 5/5: the dpctl/show test does not expect the cache statistics
  anymore.  They are reported only when the datapath reports a non zero
  mask cache hit count, which a datapath that has not forwarded any
  packet yet never does, so the check depended on a state the test does
  not create.

Changes since v3:
- Rebased on top of the current main.
- Series wide: no key is reported with a null value anymore.  A key that
  has no value is simply not reported (Ilya).
- Series wide: each patch now carries its own NEWS entry, instead of a
  single combined one in the last patch (Ilya, v1).
- 1/5: dropped the bridge_name argument of both helpers and moved the
  mac_learning rwlock into them (Eelco).
- 2/5: declaration order and blank line fixes (Eelco); added a test
  covering two datapaths at once (Eelco, v1).
- 3/5: declaration order fix, dropped a ds_destroy() on a path where the
  dynamic string is never written (Eelco).
- 4/5: the raw counters and the derived ratios are now computed once by
  pmd_perf_summarize() and shared by the text and the JSON formatter
  (Ilya); reworked the JSON schema (Ilya); all the JSON handling moved
  into the output format check, so the per PMD loop is text only again,
  plus prototype, declaration order and indentation fixes (Eelco).
- 5/5: dropped json_integer_or_null_create(), grouped the cache hit
  statistics and the cache level configuration under a single "cache"
  object (Ilya); include order, declaration order and blank line fixes,
  and dps_for_each() now reports the datapath enumeration failure it
  used to return silently, which answers "is ds set in all error cases
  for json?" with "it was not, now it is" (Eelco).

Changes since v2:
- 4/5: target dpif-netdev/pmd-perf-show instead of
  dpif-netdev/pmd-stats-show, which was removed in favor of
  pmd-perf-show.  The JSON formatter lives in dpif-netdev-perf.c
  beside the text formatter, and reports the aggregated "main" thread
  in addition to the PMD threads.
- 5/5: make "caches" an independent field (null when unavailable),
  matching the "masks" and "cache" fields, so the schema is consistent
  regardless of datapath capabilities.
- 1-3/5 are unchanged since v2.

Changes since v1:
- All patches: split the main handler into separate text and JSON
  helper functions (Eelco).
- All patches: use dashes (not underscores) in JSON field names, and
  full words instead of abbreviations (Eelco, Ilya).
- All patches: validate the complete pretty-printed JSON output in
  tests rather than grepping for individual fields (Eelco).
- 1/5: use bridge name as the top-level key; group statistics into
  "entries" and "events" sub-objects (Eelco, Ilya).
- 2/5: use datapath name as the top-level key; group flow counters
  under "flows"; index revalidators by ID as an object (Eelco).
- 3/5: use "threads" as the container key and thread names (pmd-cXX)
  as keys, matching the names visible in system tools like "top"
  (Ilya, Eelco).  Drop the "_id" suffix from field names (Ilya).
- 4/5: use thread names as keys (matching 3/5); group average metrics
  under an "averages" sub-object (Ilya).
- 5/5: use datapath name as the top-level key and port name as port
  key; use "port-number" field name (Eelco, Ilya).  Make masks, cache,
  and statistics independent fields (null when unavailable) for a
  consistent schema regardless of command-line flags (Eelco).

Timothy Redaelli (5):
  ofproto-dpif: Add JSON output to fdb/stats-show.
  ofproto-dpif-upcall: Add JSON output to upcall/show.
  dpif-netdev: Add JSON output to pmd-sleep-show.
  dpif-netdev: Add JSON output to pmd-perf-show.
  dpctl: Add JSON output to dpctl/show.

 NEWS                          |   4 +
 lib/dpctl.c                   | 199 +++++++++++++-
 lib/dpctl.h                   |  11 +
 lib/dpif-netdev-perf.c        | 505 ++++++++++++++++++++++++++++++----
 lib/dpif-netdev-perf.h        |  11 +
 lib/dpif-netdev.c             | 139 +++++++++-
 ofproto/ofproto-dpif-upcall.c | 101 ++++++-
 ofproto/ofproto-dpif.c        |  85 ++++--
 tests/dpctl.at                |  93 +++++++
 tests/ofproto-dpif.at         |  61 ++++
 tests/pmd.at                  | 191 +++++++++++++
 tests/system-traffic.at       |  31 +++
 12 files changed, 1327 insertions(+), 104 deletions(-)


base-commit: 466ceb401c99d883ec44d637d6908481cddfd377
-- 
2.56.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to