All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <me@pmachata.org>
To: netdev@vger.kernel.org, dsahern@gmail.com, stephen@networkplumber.org
Cc: Po.Liu@nxp.com, toke@toke.dk, dave.taht@gmail.com,
	edumazet@google.com, tahiliani@nitk.edu.in, vtlam@google.com,
	leon@kernel.org, Petr Machata <me@pmachata.org>
Subject: [PATCH iproute2-next 0/6] Move rate and size parsing and output to lib
Date: Mon, 30 Nov 2020 23:59:36 +0100	[thread overview]
Message-ID: <cover.1606774951.git.me@pmachata.org> (raw)

The DCB tool will have commands that deal with buffers sizes and traffic
rates. TC is another tool that has a number of such commands, and functions
to support them: get_size(), get_rate/64(), s/print_size() and
s/print_rate(). In this patchset, these functions are moved to lib/ for
possible reuse.

s/print_rate() has a hidden parameter of a global variable use_iec, which
made the conversion non-trivial. The parameter was made explicit,
print_rate() converted to a mostly json_print-like function, and
sprint_rate() retired in favor of the new print_rate. Patches #1 and #2
deal with this.

The intention was to treat s/print_size() similarly, but unfortunately two
use cases of sprint_size() cannot be converted to a json_print-like
print_size(), and the function sprint_size() had to remain as a discouraged
backdoor to print_size(). This is done in patch #3.

Patches #4 and #5 handle a routine movement of, respectively,
get_rate/64() and get_size() from tc to lib.

Patch #6 fixes a buglet in formatting small rates in IEC mode.

This patchset does not actually add any new uses of these functions. A
follow-up patchset will add subtools for management of DCB buffer and DCB
maxrate objects that will make use of them.

Petr Machata (6):
  Move the use_iec declaration to the tools
  lib: Move print_rate() from tc here; modernize
  lib: Move sprint_size() from tc here, add print_size()
  lib: Move get_rate(), get_rate64() from tc here
  lib: Move get_size() from tc here
  lib: print_rate(): Fix formatting small rates in IEC mode

 include/json_print.h |  14 ++++
 include/utils.h      |   4 +-
 ip/ip_common.h       |   2 +
 lib/json_print.c     |  61 +++++++++++++++
 lib/utils.c          | 114 +++++++++++++++++++++++++++
 tc/m_gate.c          |   6 +-
 tc/m_police.c        |  14 ++--
 tc/q_cake.c          |  44 +++++------
 tc/q_cbq.c           |  14 +---
 tc/q_drr.c           |  10 +--
 tc/q_fifo.c          |  10 +--
 tc/q_fq.c            |  34 +++-----
 tc/q_fq_codel.c      |   5 +-
 tc/q_fq_pie.c        |   9 +--
 tc/q_gred.c          |  39 ++--------
 tc/q_hfsc.c          |   4 +-
 tc/q_hhf.c           |   9 +--
 tc/q_htb.c           |  23 +++---
 tc/q_mqprio.c        |   8 +-
 tc/q_netem.c         |   4 +-
 tc/q_red.c           |  13 +---
 tc/q_sfq.c           |  15 +---
 tc/q_tbf.c           |  32 +++-----
 tc/tc_common.h       |   1 +
 tc/tc_util.c         | 180 +++----------------------------------------
 tc/tc_util.h         |   8 +-
 26 files changed, 307 insertions(+), 370 deletions(-)

-- 
2.25.1


             reply	other threads:[~2020-11-30 23:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 22:59 Petr Machata [this message]
2020-11-30 22:59 ` [PATCH iproute2-next 1/6] Move the use_iec declaration to the tools Petr Machata
2020-11-30 22:59 ` [PATCH iproute2-next 2/6] lib: Move print_rate() from tc here; modernize Petr Machata
2020-12-01  0:35   ` Stephen Hemminger
2020-12-01 22:56     ` Petr Machata
2020-11-30 22:59 ` [PATCH iproute2-next 3/6] lib: Move sprint_size() from tc here, add print_size() Petr Machata
2020-12-01  0:39   ` Stephen Hemminger
2020-12-01 22:41     ` Petr Machata
2020-12-02  4:07       ` David Ahern
2020-11-30 22:59 ` [PATCH iproute2-next 4/6] lib: Move get_rate(), get_rate64() from tc here Petr Machata
2020-11-30 22:59 ` [PATCH iproute2-next 5/6] lib: Move get_size() " Petr Machata
2020-11-30 22:59 ` [PATCH iproute2-next 6/6] lib: print_rate(): Fix formatting small rates in IEC mode Petr Machata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1606774951.git.me@pmachata.org \
    --to=me@pmachata.org \
    --cc=Po.Liu@nxp.com \
    --cc=dave.taht@gmail.com \
    --cc=dsahern@gmail.com \
    --cc=edumazet@google.com \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=tahiliani@nitk.edu.in \
    --cc=toke@toke.dk \
    --cc=vtlam@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.