diff --git a/ChangeLog b/ChangeLog index 611da81bc9cbcbc160603ab5fb808cfd465f53bd..fe40ebcb13f6564cc7875219158930e947875242 100644 --- a/ChangeLog +++ b/ChangeLog @@ -281,3 +281,4 @@ * Fixed errors in C5471 configuration files for examples/uip * Modified DHCPC (netutils/dhcpc) so that it should work in environments where there are more than one DHCPD server. + * NSH ifconfig command now shows uIP status was well (examples/nsh) diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 979d25e9b71d573a7765803cd69ae1178614e862..d795e086e731e6944f84b05a6c3ca4d13174a0b0 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> - <p>Last Updated: December 11, 2007</p> + <p>Last Updated: December 12, 2007</p> </td> </tr> </table> @@ -975,6 +975,7 @@ Other memory: * Fixed errors in C5471 configuration files for examples/uip * Modified DHCPC (netutils/dhcpc) so that it should work in environments where there are more than one DHCPD server. + * NSH ifconfig command now shows uIP status was well (examples/nsh) </pre></ul> <table width ="100%"> diff --git a/TODO b/TODO index 3351d7e46c13bd0266962bf85d3180feae74c067..9cd59baa388b080348f4b5415e72ef6beb32d070 100644 --- a/TODO +++ b/TODO @@ -47,6 +47,8 @@ o Network for new data, the driver should be throttled. Perhaps the driver should disable RX interrupts when throttled and re-anable on each poll time. recvfrom would, of course, have to un-throttle. +- Need to standardize collection of statistics from network drivers. examples/nsh + ifconfig command should present statistics. o USB - Implement USB device support diff --git a/configs/c5471evm/nshconfig b/configs/c5471evm/nshconfig index 5389284dbf958d88f532c10e46e63b168ba40bc2..fc611ac73d2bd2ee1bcacae30c713fc471a37e16 100644 --- a/configs/c5471evm/nshconfig +++ b/configs/c5471evm/nshconfig @@ -286,7 +286,7 @@ CONFIG_NET_UDP_CHECKSUMS=y #CONFIG_NET_UDP_CONNS=10 CONFIG_NET_ICMP=y #CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=n +CONFIG_NET_STATISTICS=y #CONFIG_NET_RECEIVE_WINDOW= #CONFIG_NET_ARPTAB_SIZE=8 CONFIG_NET_BROADCAST=n diff --git a/examples/nsh/nsh_netcmds.c b/examples/nsh/nsh_netcmds.c index c58a23f079f7201499137b5e5084b3fe8cad1615..3874d3a53ec414c166667393f445265ccdab7045 100644 --- a/examples/nsh/nsh_netcmds.c +++ b/examples/nsh/nsh_netcmds.c @@ -51,6 +51,10 @@ #include <net/uip/uip-arch.h> #include <netinet/ether.h> +#ifdef CONFIG_NET_STATISTICS +#include <net/uip/uip.h> +#endif + #include "nsh.h" /**************************************************************************** @@ -77,6 +81,119 @@ * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: uip_statistics + ****************************************************************************/ + +#ifdef CONFIG_NET_STATISTICS +static inline void uip_statistics(void *handle) +{ + nsh_output(handle, "uIP IP "); +#ifdef CONFIG_NET_TCP + nsh_output(handle, " TCP"); +#endif +#ifdef CONFIG_NET_UDP + nsh_output(handle, " UDP"); +#endif +#ifdef CONFIG_NET_ICMP + nsh_output(handle, " ICMP"); +#endif + nsh_output(handle, "\n"); + + /* Received packets */ + + nsh_output(handle, "Received %04x",uip_stat.ip.recv); +#ifdef CONFIG_NET_TCP + nsh_output(handle, " %04x",uip_stat.tcp.recv); +#endif +#ifdef CONFIG_NET_UDP + nsh_output(handle, " %04x",uip_stat.udp.recv); +#endif +#ifdef CONFIG_NET_ICMP + nsh_output(handle, " %04x",uip_stat.icmp.recv); +#endif + nsh_output(handle, "\n"); + + /* Dropped packets */ + + nsh_output(handle, "Dropped %04x",uip_stat.ip.drop); +#ifdef CONFIG_NET_TCP + nsh_output(handle, " %04x",uip_stat.tcp.drop); +#endif +#ifdef CONFIG_NET_UDP + nsh_output(handle, " %04x",uip_stat.udp.drop); +#endif +#ifdef CONFIG_NET_ICMP + nsh_output(handle, " %04x",uip_stat.icmp.drop); +#endif + nsh_output(handle, "\n"); + + nsh_output(handle, " IP VHL: %04x HBL: %04x\n", + uip_stat.ip.vhlerr, uip_stat.ip.hblenerr); + nsh_output(handle, " LBL: %04x Frg: %04x\n", + uip_stat.ip.lblenerr, uip_stat.ip.fragerr); + + nsh_output(handle, " Checksum %04x",uip_stat.ip.chkerr); +#ifdef CONFIG_NET_TCP + nsh_output(handle, " %04x",uip_stat.tcp.chkerr); +#endif +#ifdef CONFIG_NET_UDP + nsh_output(handle, " %04x",uip_stat.udp.chkerr); +#endif +#ifdef CONFIG_NET_ICMP + nsh_output(handle, " ----"); +#endif + nsh_output(handle, "\n"); + +#ifdef CONFIG_NET_TCP + nsh_output(handle, " TCP ACK: %04x SYN: %04x\n", + uip_stat.tcp.ackerr, uip_stat.tcp.syndrop); + nsh_output(handle, " RST: %04x %04x\n", + uip_stat.tcp.rst, uip_stat.tcp.synrst); +#endif + + nsh_output(handle, " Type %04x",uip_stat.ip.protoerr); +#ifdef CONFIG_NET_TCP + nsh_output(handle, " ----"); +#endif +#ifdef CONFIG_NET_UDP + nsh_output(handle, " ----"); +#endif +#ifdef CONFIG_NET_ICMP + nsh_output(handle, " %04x",uip_stat.icmp.typeerr); +#endif + nsh_output(handle, "\n"); + + /* Sent packets */ + + nsh_output(handle, "Sent ----",uip_stat.ip.sent); +#ifdef CONFIG_NET_TCP + nsh_output(handle, " %04x",uip_stat.tcp.sent); +#endif +#ifdef CONFIG_NET_UDP + nsh_output(handle, " %04x",uip_stat.udp.sent); +#endif +#ifdef CONFIG_NET_ICMP + nsh_output(handle, " %04x",uip_stat.icmp.sent); +#endif + nsh_output(handle, "\n"); + +#ifdef CONFIG_NET_TCP + nsh_output(handle, " Rexmit ---- %04x",uip_stat.tcp.rexmit); +#ifdef CONFIG_NET_UDP + nsh_output(handle, " ----"); +#endif +#ifdef CONFIG_NET_ICMP + nsh_output(handle, " ----"); +#endif + nsh_output(handle, "\n"); +#endif + nsh_output(handle, "\n"); +} +#else +# define uip_statistics(handle) +#endif + /**************************************************************************** * Name: ifconfig_callback ****************************************************************************/ @@ -91,7 +208,7 @@ int ifconfig_callback(FAR struct uip_driver_s *dev, void *arg) addr.s_addr = dev->d_draddr; nsh_output(arg, "DRaddr:%s ", inet_ntoa(addr)); addr.s_addr = dev->d_netmask; - nsh_output(arg, "Mask:%s\n", inet_ntoa(addr)); + nsh_output(arg, "Mask:%s\n\n", inet_ntoa(addr)); } /**************************************************************************** @@ -105,6 +222,7 @@ int ifconfig_callback(FAR struct uip_driver_s *dev, void *arg) void cmd_ifconfig(FAR void *handle, int argc, char **argv) { netdev_foreach(ifconfig_callback, handle); + uip_statistics(handle); } #endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */ diff --git a/include/net/uip/uip-tcp.h b/include/net/uip/uip-tcp.h index f6d19b8de54e903235a4119eec93fa1fe98473c6..789a5b4795ecb4167450119c2d77e7f07204a257 100644 --- a/include/net/uip/uip-tcp.h +++ b/include/net/uip/uip-tcp.h @@ -191,7 +191,7 @@ struct uip_tcp_stats_s uip_stats_t sent; /* Number of sent TCP segments */ uip_stats_t chkerr; /* Number of TCP segments with a bad checksum */ uip_stats_t ackerr; /* Number of TCP segments with a bad ACK number */ - uip_stats_t rst; /* Number of recevied TCP RST (reset) segments */ + uip_stats_t rst; /* Number of received TCP RST (reset) segments */ uip_stats_t rexmit; /* Number of retransmitted TCP segments */ uip_stats_t syndrop; /* Number of dropped SYNs due to too few available connections */