Skip to contentSkip to conversation

netlink: fec: Add missing newlines in FEC statistics output

PATCH In review Eric Joyner 2 participants 2 messages Jun 5 – Jun 8

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: fec: Add missing newlines in FEC statistics output

The non-histogram stats don't have newlines printed after them if they don't have per-lane counts, and so they (and the first histogram bin, if applicable) were displayed on the same line with the rest of the stats being displayed with one stat per line, which looked inconsistent and doesn't match the display in previous versions of ethtool.

Fix this by printing a final newline in the case where there are no per-lane counts so that each stat gets printed with a newline at the end.

Fixes 3426a920183f ("netlink: fec: add errors histogram statistics")
---
 netlink/fec.c | 2 ++
 1 file changed, 2 insertions(+)
netlink/fec.c +2 -0
index 36ad3f504a83..c014749ac950 100644
@@ -166,6 +166,8 @@ static int fec_show_stats(const struct nlattr *nest)
 		if (lanes) {
 			close_json_array("");
 			printf(" ]\n");
+		} else {
+			printf("\n");
 		}
 
 		close_json_object();

base-commit: 75fd12445ffd6d697d53b7d296e345d524a9bedd

Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 30 lines · Eric Joyner

The non-histogram stats don't have newlines printed after them if they don't have per-lane counts, and so they (and the first histogram bin, if applicable) were displayed on the same line with the rest of the stats being displayed with one stat per line, which looked inconsistent and doesn't match the display in previous versions of ethtool.

Fix this by printing a final newline in the case where there are no per-lane counts so that each stat gets printed with a newline at the end.

Fixes 3426a920183f ("netlink: fec: add errors histogram statistics")
---
 netlink/fec.c | 2 ++
 1 file changed, 2 insertions(+)
netlink/fec.c +2 -0
index 36ad3f504a83..c014749ac950 100644
@@ -166,6 +166,8 @@ static int fec_show_stats(const struct nlattr *nest)
 		if (lanes) {
 			close_json_array("");
 			printf(" ]\n");
+		} else {
+			printf("\n");
 		}
 
 		close_json_object();
Quoted 1 line

base-commit: 75fd12445ffd6d697d53b7d296e345d524a9bedd