Skip to content

Commit 7dd3d51

Browse files
ayalevin123shemminger
authored andcommitted
devlink: Left justification on FMSG output
FMSG output is dynamic, space separator must be on the left hand side of the value. Otherwise output has redundant left indentation regardless the hierarchy. Before the patch: Common config: SQ: stride size: 64 size: 1024 CQ: stride size: 64 size: 1024 SQs: channel ix: 0 tc: 0 txq ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0 channel ix: 1 tc: 0 txq ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0 channel ix: 2 tc: 0 txq ix: 2 sqn: 18 HW state: 1 stopped: false cc: 5 pc: 5 CQ: cqn: 14 HW status: 0 channel ix: 3 tc: 0 txq ix: 3 sqn: 22 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 18 HW status: 0 With the patch: Common config: SQ: stride size: 64 size: 1024 CQ: stride size: 64 size: 1024 SQs: channel ix: 0 tc: 0 txq ix: 0 sqn: 10 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 6 HW status: 0 channel ix: 1 tc: 0 txq ix: 1 sqn: 14 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 10 HW status: 0 channel ix: 2 tc: 0 txq ix: 2 sqn: 18 HW state: 1 stopped: false cc: 5 pc: 5 CQ: cqn: 14 HW status: 0 channel ix: 3 tc: 0 txq ix: 3 sqn: 22 HW state: 1 stopped: false cc: 0 pc: 0 CQ: cqn: 18 HW status: 0 Fixes: 844a617 ("devlink: Add helper functions for name and value separately") Signed-off-by: Aya Levin <ayal@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
1 parent 56b725a commit 7dd3d51

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

devlink/devlink.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -1872,26 +1872,29 @@ static void pr_out_u64(struct dl *dl, const char *name, uint64_t val)
18721872

18731873
static void pr_out_bool_value(struct dl *dl, bool value)
18741874
{
1875+
__pr_out_indent_newline(dl);
18751876
if (dl->json_output)
18761877
jsonw_bool(dl->jw, value);
18771878
else
1878-
pr_out(" %s", value ? "true" : "false");
1879+
pr_out("%s", value ? "true" : "false");
18791880
}
18801881

18811882
static void pr_out_uint_value(struct dl *dl, unsigned int value)
18821883
{
1884+
__pr_out_indent_newline(dl);
18831885
if (dl->json_output)
18841886
jsonw_uint(dl->jw, value);
18851887
else
1886-
pr_out(" %u", value);
1888+
pr_out("%u", value);
18871889
}
18881890

18891891
static void pr_out_uint64_value(struct dl *dl, uint64_t value)
18901892
{
1893+
__pr_out_indent_newline(dl);
18911894
if (dl->json_output)
18921895
jsonw_u64(dl->jw, value);
18931896
else
1894-
pr_out(" %"PRIu64, value);
1897+
pr_out("%"PRIu64, value);
18951898
}
18961899

18971900
static bool is_binary_eol(int i)
@@ -1918,18 +1921,20 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len)
19181921

19191922
static void pr_out_str_value(struct dl *dl, const char *value)
19201923
{
1924+
__pr_out_indent_newline(dl);
19211925
if (dl->json_output)
19221926
jsonw_string(dl->jw, value);
19231927
else
1924-
pr_out(" %s", value);
1928+
pr_out("%s", value);
19251929
}
19261930

19271931
static void pr_out_name(struct dl *dl, const char *name)
19281932
{
1933+
__pr_out_indent_newline(dl);
19291934
if (dl->json_output)
19301935
jsonw_name(dl->jw, name);
19311936
else
1932-
pr_out(" %s:", name);
1937+
pr_out("%s:", name);
19331938
}
19341939

19351940
static void pr_out_region_chunk_start(struct dl *dl, uint64_t addr)

0 commit comments

Comments
 (0)