ifconfig shows uIP stats
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@450 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
cd2decaedb
commit
28b8f4a2e6
@ -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)
|
||||
|
@ -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%">
|
||||
|
2
TODO
2
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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user