diff options
author | Steffen Vogel <post@steffenvogel.de> | 2015-07-24 06:42:26 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-08-14 12:55:02 (GMT) |
commit | 5cd9cce1afff76695c63dda463b5afed65f6c3ad (patch) | |
tree | f05856a20e69193d0282a9e030d7d4bc94cea94f | |
parent | d0406d3838d4e70f19dcac1747decd7dd9b7435c (diff) | |
download | libnl-5cd9cce1afff76695c63dda463b5afed65f6c3ad.zip libnl-5cd9cce1afff76695c63dda463b5afed65f6c3ad.tar.gz libnl-5cd9cce1afff76695c63dda463b5afed65f6c3ad.tar.bz2 |
route/qdisc: added more attributes to netem dump
I added all the netem attributes (except for limit) to the NL_DUMP_DETAILS section.
[thaller@redhat.com: whitespace fixes]
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | lib/route/qdisc/netem.c | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/lib/route/qdisc/netem.c b/lib/route/qdisc/netem.c index 06d9fe8..7846a68 100644 --- a/lib/route/qdisc/netem.c +++ b/lib/route/qdisc/netem.c @@ -141,8 +141,65 @@ static void netem_dump_line(struct rtnl_tc *tc, void *data, { struct rtnl_netem *netem = data; - if (netem) - nl_dump(p, "limit %d", netem->qnm_limit); + if (netem) { + if (netem->qnm_mask & SCH_NETEM_ATTR_LIMIT && netem->qnm_limit > 0) + nl_dump(p, " limit %dpkts", netem->qnm_limit); + else + nl_dump(p, " no limit"); + } +} + +static void netem_dump_details(struct rtnl_tc *tc, void *data, + struct nl_dump_params *p) +{ + struct rtnl_netem *netem = data; + char buf[32]; + + if (netem) { + if (netem->qnm_mask & SCH_NETEM_ATTR_LATENCY && netem->qnm_latency > 0) { + nl_msec2str(nl_ticks2us(netem->qnm_latency) / 1000, buf, sizeof(buf)); + nl_dump(p, " latency %s", buf); + + if (netem->qnm_mask & SCH_NETEM_ATTR_JITTER && netem->qnm_jitter > 0) { + nl_msec2str(nl_ticks2us(netem->qnm_jitter) / 1000, buf, sizeof(buf)); + nl_dump(p, " jitter %s", buf); + + if (netem->qnm_mask & SCH_NETEM_ATTR_DELAY_CORR && netem->qnm_corr.nmc_delay > 0) + nl_dump(p, " %d%", netem->qnm_corr.nmc_delay); + } + } + + if (netem->qnm_mask & SCH_NETEM_ATTR_LOSS && netem->qnm_loss > 0) { + nl_dump(p, " loss %d%", netem->qnm_loss); + + if (netem->qnm_mask & SCH_NETEM_ATTR_LOSS_CORR && netem->qnm_corr.nmc_loss > 0) + nl_dump(p, " %d%", netem->qnm_corr.nmc_loss); + } + + if (netem->qnm_mask & SCH_NETEM_ATTR_DUPLICATE && netem->qnm_duplicate > 0) { + nl_dump(p, " duplicate %d%", netem->qnm_duplicate); + + if (netem->qnm_mask & SCH_NETEM_ATTR_DUP_CORR && netem->qnm_corr.nmc_duplicate > 0) + nl_dump(p, " %d%", netem->qnm_corr.nmc_duplicate); + } + + if (netem->qnm_mask & SCH_NETEM_ATTR_RO_PROB && netem->qnm_ro.nmro_probability > 0) { + nl_dump(p, " reorder %d%", netem->qnm_ro.nmro_probability); + + if (netem->qnm_mask & SCH_NETEM_ATTR_RO_CORR && netem->qnm_ro.nmro_correlation > 0) + nl_dump(p, " %d%", netem->qnm_ro.nmro_correlation); + + if (netem->qnm_mask & SCH_NETEM_ATTR_GAP && netem->qnm_gap > 0) + nl_dump(p, " gap %d", netem->qnm_gap); + } + + if (netem->qnm_mask & SCH_NETEM_ATTR_CORRUPT_PROB && netem->qnm_crpt.nmcr_probability > 0) { + nl_dump(p, " reorder %d%", netem->qnm_crpt.nmcr_probability); + + if (netem->qnm_mask & SCH_NETEM_ATTR_CORRUPT_CORR && netem->qnm_crpt.nmcr_correlation > 0) + nl_dump(p, " %d%", netem->qnm_crpt.nmcr_correlation); + } + } } static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, @@ -892,6 +949,7 @@ static struct rtnl_tc_ops netem_ops = { .to_msg_parser = netem_msg_parser, .to_free_data = netem_free_data, .to_dump[NL_DUMP_LINE] = netem_dump_line, + .to_dump[NL_DUMP_DETAILS] = netem_dump_details, .to_msg_fill_raw = netem_msg_fill_raw, }; |