Skip to content

Commit aafb7bc

Browse files
committed
net: lib: shell: Print vendor value as hex blob
Along with key-value pairs, print only the value as hex blob for easier parsing to a C struct. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 86f7188 commit aafb7bc

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

subsys/net/lib/shell/stats.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,23 @@ static void print_eth_stats(struct net_if *iface, struct net_stats_eth *data,
110110

111111
#if defined(CONFIG_NET_STATISTICS_ETHERNET_VENDOR)
112112
if (data->vendor) {
113-
PR("Vendor specific statistics for Ethernet "
114-
"interface %p [%d]:\n",
115-
iface, net_if_get_by_iface(iface));
116113
size_t i = 0;
117114

115+
PR("Vendor specific statistics for Ethernet interface %p [%d]:\n",
116+
iface, net_if_get_by_iface(iface));
117+
118+
PR("Key-Value Pairs:\n");
118119
do {
119-
PR("%s : %u\n", data->vendor[i].key,
120-
data->vendor[i].value);
120+
PR("%s : %u\n", data->vendor[i].key, data->vendor[i].value);
121121
i++;
122122
} while (data->vendor[i].key);
123+
124+
/* Print as a hex blob: all values in order, no spaces */
125+
PR("Vendor stats hex blob: ");
126+
for (i = 0; data->vendor[i].key; i++) {
127+
PR("%08x", data->vendor[i].value);
128+
}
129+
PR("\n");
123130
}
124131
#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */
125132
}

0 commit comments

Comments
 (0)