@@ -501,6 +501,23 @@ static const char *priority2str(enum net_priority priority)
501501}
502502#endif
503503
504+ #if defined(CONFIG_NET_STATISTICS_ETHERNET )
505+ static void print_eth_stats (struct net_if * iface , struct net_stats_eth * data )
506+ {
507+ printk ("Statistics for Ethernet interface %p [%d]\n" , iface ,
508+ net_if_get_by_iface (iface ));
509+
510+ printk ("Bytes received : %u\n" , data -> bytes .received );
511+ printk ("Bytes sent : %u\n" , data -> bytes .sent );
512+ printk ("Packets received : %u\n" , data -> pkts .rx );
513+ printk ("Packets sent : %u\n" , data -> pkts .tx );
514+ printk ("Bcast received : %u\n" , data -> broadcast .rx );
515+ printk ("Bcast sent : %u\n" , data -> broadcast .tx );
516+ printk ("Mcast received : %u\n" , data -> multicast .rx );
517+ printk ("Mcast sent : %u\n" , data -> multicast .tx );
518+ }
519+ #endif /* CONFIG_NET_STATISTICS_ETHERNET */
520+
504521static void net_shell_print_statistics (struct net_if * iface , void * user_data )
505522{
506523 ARG_UNUSED (user_data );
@@ -663,6 +680,19 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data)
663680 }
664681#endif
665682#endif /* NET_TC_COUNT > 1 */
683+
684+ #if defined(CONFIG_NET_STATISTICS_ETHERNET )
685+ if (iface && net_if_l2 (iface ) == & NET_L2_GET_NAME (ETHERNET )) {
686+ struct net_stats_eth eth_data ;
687+ int ret ;
688+
689+ ret = net_mgmt (NET_REQUEST_STATS_GET_ETHERNET , iface ,
690+ & eth_data , sizeof (eth_data ));
691+ if (!ret ) {
692+ print_eth_stats (iface , & eth_data );
693+ }
694+ }
695+ #endif /* CONFIG_NET_STATISTICS_ETHERNET */
666696}
667697#endif /* CONFIG_NET_STATISTICS */
668698
0 commit comments