@@ -110,16 +110,33 @@ static void print_eth_stats(struct net_if *iface, struct net_stats_eth *data,
110
110
111
111
#if defined(CONFIG_NET_STATISTICS_ETHERNET_VENDOR )
112
112
if (data -> vendor ) {
113
- PR ("Vendor specific statistics for Ethernet "
114
- "interface %p [%d]:\n" ,
115
- iface , net_if_get_by_iface (iface ));
116
113
size_t i = 0 ;
117
114
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" );
118
119
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 );
121
121
i ++ ;
122
122
} while (data -> vendor [i ].key );
123
+
124
+ /*
125
+ * Print vendor stats as a contiguous hex blob, little-endian, no delimiters.
126
+ * This format is suitable for direct typecasting to a C struct for offline parsing.
127
+ * Each value is output as 4 bytes, least significant byte first.
128
+ */
129
+ PR ("Vendor stats hex blob: " );
130
+ for (i = 0 ; data -> vendor [i ].key ; i ++ ) {
131
+ uint32_t v = data -> vendor [i ].value ;
132
+
133
+ PR ("%02x%02x%02x%02x" ,
134
+ (uint8_t )(v & 0xFF ),
135
+ (uint8_t )((v >> 8 ) & 0xFF ),
136
+ (uint8_t )((v >> 16 ) & 0xFF ),
137
+ (uint8_t )((v >> 24 ) & 0xFF ));
138
+ }
139
+ PR ("\n" );
123
140
}
124
141
#endif /* CONFIG_NET_STATISTICS_ETHERNET_VENDOR */
125
142
}
0 commit comments