#endif
-#if defined(CONFIG_NET_STATISTICS)
-static inline void net_statistics()
-{
- /* Headings */
-
- printf(" ");
-#ifdef CONFIG_NET_IPv4
- printf(" IPv4");
-#endif
-#ifdef CONFIG_NET_IPv6
- printf(" IPv6");
-#endif
-#ifdef CONFIG_NET_UDP
- printf(" UDP");
-#endif
-#ifdef CONFIG_NET_ICMP
- printf(" ICMP");
-#endif
-#ifdef CONFIG_NET_ICMPv6
- printf(" ICMPv6");
-#endif
- printf("\n");
-
- /* Received packets */
-
- printf("Received ");
-#ifdef CONFIG_NET_IPv4
- printf(" %04x", g_netstats.ipv4.recv);
-#endif
-#ifdef CONFIG_NET_IPv6
- printf(" %04x", g_netstats.ipv6.recv);
-#endif
-#ifdef CONFIG_NET_UDP
- printf(" %04x", g_netstats.udp.recv);
-#endif
-#ifdef CONFIG_NET_ICMP
- printf(" %04x", g_netstats.icmp.recv);
-#endif
-#ifdef CONFIG_NET_ICMPv6
- printf(" %04x", g_netstats.icmpv6.recv);
-#endif
- printf("\n");
-
- /* Dropped packets */
-
- printf("Dropped ");
-#ifdef CONFIG_NET_IPv4
- printf(" %04x", g_netstats.ipv4.drop);
-#endif
-#ifdef CONFIG_NET_IPv6
- printf(" %04x", g_netstats.ipv6.drop);
-#endif
-#ifdef CONFIG_NET_UDP
- printf(" %04x", g_netstats.udp.drop);
-#endif
-#ifdef CONFIG_NET_ICMP
- printf(" %04x", g_netstats.icmp.drop);
-#endif
-#ifdef CONFIG_NET_ICMPv6
- printf(" %04x", g_netstats.icmpv6.drop);
-#endif
- printf("\n");
-
- /* Dropped IP packets */
-
-#ifdef CONFIG_NET_IPv4
- printf(" IPv4 VHL: %04x Frg: %04x\n", g_netstats.ipv4.vhlerr, g_netstats.ipv4.fragerr);
-#endif
-#ifdef CONFIG_NET_IPv6
- printf(" IPv6 VHL: %04x\n", g_netstats.ipv6.vhlerr);
-#endif
-
- /* Checksum errors */
-
- printf(" Checksum ");
-#ifdef CONFIG_NET_IPv4
- printf(" %04x", g_netstats.ipv4.chkerr);
-#endif
-#ifdef CONFIG_NET_IPv6
- printf(" ----");
-#endif
-#ifdef CONFIG_NET_UDP
- printf(" %04x", g_netstats.udp.chkerr);
-#endif
-#ifdef CONFIG_NET_ICMP
- printf(" ----");
-#endif
-#ifdef CONFIG_NET_ICMPv6
- printf(" ----");
-#endif
- printf("\n");
-
- /* Prototype errors */
-
- printf(" Type ");
-#ifdef CONFIG_NET_IPv4
- printf(" %04x", g_netstats.ipv4.protoerr);
-#endif
-#ifdef CONFIG_NET_IPv6
- printf(" %04x", g_netstats.ipv6.protoerr);
-#endif
-#ifdef CONFIG_NET_UDP
- printf(" ----");
-#endif
-#ifdef CONFIG_NET_ICMP
- printf(" %04x", g_netstats.icmp.typeerr);
-#endif
-#ifdef CONFIG_NET_ICMPv6
- printf(" %04x", g_netstats.icmpv6.typeerr);
-#endif
- printf("\n");
-
- /* Sent packets */
-
- printf("Sent ");
-#ifdef CONFIG_NET_IPv4
- printf(" %04x", g_netstats.ipv4.sent);
-#endif
-#ifdef CONFIG_NET_IPv6
- printf(" %04x", g_netstats.ipv6.sent);
-#endif
-#ifdef CONFIG_NET_UDP
- printf(" %04x", g_netstats.udp.sent);
-#endif
-#ifdef CONFIG_NET_ICMP
- printf(" %04x", g_netstats.icmp.sent);
-#endif
-#ifdef CONFIG_NET_ICMPv6
- printf(" %04x", g_netstats.icmpv6.sent);
-#endif
- printf("\n");
-}
-#else
-#define net_statistics()
-#endif
static void
nic_display_state(void)
if (argc <= 2) {
nic_display_state();
- net_statistics();
return OK;
}
};
#endif /* CONFIG_NET_IPv6 */
-#ifdef CONFIG_NET_STATISTICS
-#ifdef CONFIG_NET_IPv4
-struct ipv4_stats_s {
- net_stats_t drop; /* Number of dropped packets at the IP layer */
- net_stats_t recv; /* Number of received packets at the IP layer */
- net_stats_t sent; /* Number of sent packets at the IP layer */
- net_stats_t vhlerr; /* Number of packets dropped due to wrong
- IP version or header length */
- net_stats_t fragerr; /* Number of packets dropped since they
- were IP fragments */
- net_stats_t chkerr; /* Number of packets dropped due to IP
- checksum errors */
- net_stats_t protoerr; /* Number of packets dropped since they
- were neither ICMP, UDP nor TCP */
-};
-#endif /* CONFIG_NET_IPv6 */
-
-#ifdef CONFIG_NET_IPv6
-struct ipv6_stats_s {
- net_stats_t drop; /* Number of dropped packets at the IP layer */
- net_stats_t recv; /* Number of received packets at the IP layer */
- net_stats_t sent; /* Number of sent packets at the IP layer */
- net_stats_t vhlerr; /* Number of packets dropped due to wrong
- IP version or header length */
- net_stats_t protoerr; /* Number of packets dropped since they
- were neither ICMP, UDP nor TCP */
-};
-#endif /* CONFIG_NET_IPv6 */
-#endif /* CONFIG_NET_STATISTICS */
-
/****************************************************************************
* Public Data
****************************************************************************/