#define INDENT_STR_MAXLEN 32
static char g_indent_str[INDENT_STR_MAXLEN + 1] = "";
+static bool use_iec = false;
+
static void __attribute__((format(printf, 1, 2)))
pr_err(const char *fmt, ...)
{
mnl_attr_get_u64(tb[DEVLINK_ATTR_RATE_TX_SHARE]);
if (rate)
- print_rate(false, PRINT_ANY, "tx_share",
+ print_rate(use_iec, PRINT_ANY, "tx_share",
" tx_share %s", rate);
}
if (tb[DEVLINK_ATTR_RATE_TX_MAX]) {
mnl_attr_get_u64(tb[DEVLINK_ATTR_RATE_TX_MAX]);
if (rate)
- print_rate(false, PRINT_ANY, "tx_max",
+ print_rate(use_iec, PRINT_ANY, "tx_max",
" tx_max %s", rate);
}
if (tb[DEVLINK_ATTR_RATE_PARENT_NODE_NAME]) {
{ "verbose", no_argument, NULL, 'v' },
{ "statistics", no_argument, NULL, 's' },
{ "Netns", required_argument, NULL, 'N' },
+ { "iec", no_argument, NULL, 'i' },
{ NULL, 0, NULL, 0 }
};
const char *batch_file = NULL;
return EXIT_FAILURE;
}
- while ((opt = getopt_long(argc, argv, "Vfb:njpvsN:",
+ while ((opt = getopt_long(argc, argv, "Vfb:njpvsN:i",
long_options, NULL)) >= 0) {
switch (opt) {
goto dl_free;
}
break;
+ case 'i':
+ use_iec = true;
+ break;
default:
pr_err("Unknown option.\n");
help();
.ti -8
.IR OPTIONS " := { "
-.BR -j [ \fIson "] | " -p [ \fIretty "] }"
+.BR -j [ \fIson "] | " -p [ \fIretty "] | " -i [ \fIec "] }"
.ti -8
.B devlink port function rate show
.PP
Command output show rate object identifier, it's type and rate values along with
parent node name. Rate values printed in SI units which are more suitable to
-represent specific value. JSON (\fB-j\fR) output always print rate values in
-bytes per second. Zero rate values means "unlimited" rates and ommited in
-output, as well as parent node name.
+represent specific value. To print values in IEC units \fB-i\fR switch is
+used. JSON (\fB-j\fR) output always print rate values in bytes per second. Zero
+rate values means "unlimited" rates and ommited in output, as well as parent
+node name.
.SS devlink port function rate set - set rate object parameters.
Allows set rate object's parameters. If any parameter specified multiple times
.TP 8
.I VALUE
These parameter accept a floating point number, possibly followed by either a
-unit.
+unit (both SI and IEC units supported).
.RS
.TP
bit or a bare number
.TP
tbps
Terabytes per second
+.P
+To specify in IEC units, replace the SI prefix (k-, m-, g-, t-) with IEC prefix
+(ki-, mi-, gi- and ti-) respectively. Input is case-insensitive.
.RE
.PP
.BI parent " NODE_NAME \fR| " noparent
.br
.RE
+.PP
+\fB*\fR Display leaf rate object rate values using IEC units:
+.RS 4
+.PP
+# devlink -i port function rate show pci/0000:03:00.0/2
+.br
+pci/0000:03:00.0/2 type leaf 11718Kibit
+.br
+.RE
+
.PP
\fB*\fR Display node rate object with name some_group of the pci/0000:03:00.0 device:
.RS 4