JSON output support for Netlink implementation of --show-coalesce option
Add --json support for Netlink implementation of --show-coalesce option
No changes for non-JSON output for this feature.
Example output without --json:
[ethtool-git]$ sudo ./ethtool --show-coalesce enp9s0u2u1u2
Coalesce parameters for enp9s0u2u1u2:
Adaptive RX: n/a TX: n/a
stats-block-usecs: n/a
sample-interval: n/a
pkt-rate-low: n/a
pkt-rate-high: n/a
rx-usecs: 15000
rx-frames: n/a
rx-usecs-irq: n/a
rx-frames-irq: n/a
tx-usecs: 0
tx-frames: n/a
tx-usecs-irq: n/a
tx-frames-irq: n/a
rx-usecs-low: n/a
rx-frame-low: n/a
tx-usecs-low: n/a
tx-frame-low: n/a
rx-usecs-high: n/a
rx-frame-high: n/a
tx-usecs-high: n/a
tx-frame-high: n/a
CQE mode RX: n/a TX: n/a
Same output with --json:
[ethtool-git]$ sudo ./ethtool --json --show-coalesce enp9s0u2u1u2
[ {
"ifname": "enp9s0u2u1u2",
"rx-usecs": 15000,
"tx-usecs": 0
} ]
Note that since show_u32() signature was changed, all show_u32() call
sites had to be updated. So far only coalesce.c of all the updated files
supports JSON output. It's OK for now to mix show_u32() calls with
printf() calls in rings.c and channels.c since they can't print
JSON yet. Something to fix in future.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Maxim Georgiev <glipus@gmail.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
5 files changed