summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-12-12 14:41:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-12-12 14:41:36 +0000
commit1dbeb7137b593584b54bb6acbe9da4f3e5d5bf71 (patch)
tree30f6350d32b4fdb7ce8cc14954f1a0a8e1f309c1
parent5fe3de54cf5d76704b60d598169031aad2b7130f (diff)
downloadnuttx-1dbeb7137b593584b54bb6acbe9da4f3e5d5bf71.tar.gz
nuttx-1dbeb7137b593584b54bb6acbe9da4f3e5d5bf71.tar.bz2
nuttx-1dbeb7137b593584b54bb6acbe9da4f3e5d5bf71.zip
ifconfig shows uIP stats
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@450 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog1
-rw-r--r--nuttx/Documentation/NuttX.html3
-rw-r--r--nuttx/TODO2
-rw-r--r--nuttx/configs/c5471evm/nshconfig2
-rw-r--r--nuttx/examples/nsh/nsh_netcmds.c120
-rw-r--r--nuttx/include/net/uip/uip-tcp.h2
6 files changed, 126 insertions, 4 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 611da81bc..fe40ebcb1 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/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/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 979d25e9b..d795e086e 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/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/nuttx/TODO b/nuttx/TODO
index 3351d7e46..9cd59baa3 100644
--- a/nuttx/TODO
+++ b/nuttx/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/nuttx/configs/c5471evm/nshconfig b/nuttx/configs/c5471evm/nshconfig
index 5389284db..fc611ac73 100644
--- a/nuttx/configs/c5471evm/nshconfig
+++ b/nuttx/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/nuttx/examples/nsh/nsh_netcmds.c b/nuttx/examples/nsh/nsh_netcmds.c
index c58a23f07..3874d3a53 100644
--- a/nuttx/examples/nsh/nsh_netcmds.c
+++ b/nuttx/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"
/****************************************************************************
@@ -78,6 +82,119 @@
****************************************************************************/
/****************************************************************************
+ * 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/nuttx/include/net/uip/uip-tcp.h b/nuttx/include/net/uip/uip-tcp.h
index f6d19b8de..789a5b479 100644
--- a/nuttx/include/net/uip/uip-tcp.h
+++ b/nuttx/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 */