diff options
62 files changed, 337 insertions, 191 deletions
diff --git a/apps/examples/uip/cgi.c b/apps/examples/uip/cgi.c index 8d081db92..af579fb48 100644 --- a/apps/examples/uip/cgi.c +++ b/apps/examples/uip/cgi.c @@ -40,6 +40,7 @@ #include <string.h> #include <sys/socket.h> +#include <nuttx/net/netstats.h> #include <apps/netutils/httpd.h> #include "cgi.h" @@ -70,9 +71,9 @@ static void net_stats(struct httpd_state *pstate, char *ptr) char buffer[16]; int i; - for (i = 0; i < sizeof(uip_stat) / sizeof(uip_stats_t); i++) + for (i = 0; i < sizeof(g_netstats) / sizeof(net_stats_t); i++) { - snprintf(buffer, 16, "%5u\n", ((uip_stats_t *)&uip_stat)[i]); + snprintf(buffer, 16, "%5u\n", ((net_stats_t *)&g_netstats)[i]); send(pstate->ht_sockfd, buffer, strlen(buffer), 0); } } diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c index 8ceadd182..1e0ac3222 100644 --- a/apps/nshlib/nsh_netcmds.c +++ b/apps/nshlib/nsh_netcmds.c @@ -61,6 +61,7 @@ #include <nuttx/clock.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/netstats.h> #ifdef CONFIG_NET_STATISTICS # include <nuttx/net/uip.h> @@ -162,11 +163,11 @@ static inline uint16_t ping_newid(void) #endif /**************************************************************************** - * Name: uip_statistics + * Name: net_statistics ****************************************************************************/ #if defined(CONFIG_NET_STATISTICS) && !defined(CONFIG_NSH_DISABLE_IFCONFIG) -static inline void uip_statistics(FAR struct nsh_vtbl_s *vtbl) +static inline void net_statistics(FAR struct nsh_vtbl_s *vtbl) { nsh_output(vtbl, "uIP IP "); #ifdef CONFIG_NET_TCP @@ -182,43 +183,43 @@ static inline void uip_statistics(FAR struct nsh_vtbl_s *vtbl) /* Received packets */ - nsh_output(vtbl, "Received %04x",uip_stat.ip.recv); + nsh_output(vtbl, "Received %04x", g_netstats.ip.recv); #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " %04x",uip_stat.tcp.recv); + nsh_output(vtbl, " %04x", g_netstats.tcp.recv); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " %04x",uip_stat.udp.recv); + nsh_output(vtbl, " %04x", g_netstats.udp.recv); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " %04x",uip_stat.icmp.recv); + nsh_output(vtbl, " %04x", g_netstats.icmp.recv); #endif nsh_output(vtbl, "\n"); /* Dropped packets */ - nsh_output(vtbl, "Dropped %04x",uip_stat.ip.drop); + nsh_output(vtbl, "Dropped %04x", g_netstats.ip.drop); #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " %04x",uip_stat.tcp.drop); + nsh_output(vtbl, " %04x", g_netstats.tcp.drop); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " %04x",uip_stat.udp.drop); + nsh_output(vtbl, " %04x", g_netstats.udp.drop); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " %04x",uip_stat.icmp.drop); + nsh_output(vtbl, " %04x", g_netstats.icmp.drop); #endif nsh_output(vtbl, "\n"); nsh_output(vtbl, " IP VHL: %04x HBL: %04x\n", - uip_stat.ip.vhlerr, uip_stat.ip.hblenerr); + g_netstats.ip.vhlerr, g_netstats.ip.hblenerr); nsh_output(vtbl, " LBL: %04x Frg: %04x\n", - uip_stat.ip.lblenerr, uip_stat.ip.fragerr); + g_netstats.ip.lblenerr, g_netstats.ip.fragerr); - nsh_output(vtbl, " Checksum %04x",uip_stat.ip.chkerr); + nsh_output(vtbl, " Checksum %04x",g_netstats.ip.chkerr); #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " %04x",uip_stat.tcp.chkerr); + nsh_output(vtbl, " %04x", g_netstats.tcp.chkerr); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " %04x",uip_stat.udp.chkerr); + nsh_output(vtbl, " %04x", g_netstats.udp.chkerr); #endif #ifdef CONFIG_NET_ICMP nsh_output(vtbl, " ----"); @@ -227,12 +228,12 @@ static inline void uip_statistics(FAR struct nsh_vtbl_s *vtbl) #ifdef CONFIG_NET_TCP nsh_output(vtbl, " TCP ACK: %04x SYN: %04x\n", - uip_stat.tcp.ackerr, uip_stat.tcp.syndrop); + g_netstats.tcp.ackerr, g_netstats.tcp.syndrop); nsh_output(vtbl, " RST: %04x %04x\n", - uip_stat.tcp.rst, uip_stat.tcp.synrst); + g_netstats.tcp.rst, g_netstats.tcp.synrst); #endif - nsh_output(vtbl, " Type %04x",uip_stat.ip.protoerr); + nsh_output(vtbl, " Type %04x", g_netstats.ip.protoerr); #ifdef CONFIG_NET_TCP nsh_output(vtbl, " ----"); #endif @@ -240,26 +241,26 @@ static inline void uip_statistics(FAR struct nsh_vtbl_s *vtbl) nsh_output(vtbl, " ----"); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " %04x",uip_stat.icmp.typeerr); + nsh_output(vtbl, " %04x", g_netstats.icmp.typeerr); #endif nsh_output(vtbl, "\n"); /* Sent packets */ - nsh_output(vtbl, "Sent ----",uip_stat.ip.sent); + nsh_output(vtbl, "Sent ----", g_netstats.ip.sent); #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " %04x",uip_stat.tcp.sent); + nsh_output(vtbl, " %04x", g_netstats.tcp.sent); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " %04x",uip_stat.udp.sent); + nsh_output(vtbl, " %04x", g_netstats.udp.sent); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " %04x",uip_stat.icmp.sent); + nsh_output(vtbl, " %04x", g_netstats.icmp.sent); #endif nsh_output(vtbl, "\n"); #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " Rexmit ---- %04x",uip_stat.tcp.rexmit); + nsh_output(vtbl, " Rexmit ---- %04x", g_netstats.tcp.rexmit); #ifdef CONFIG_NET_UDP nsh_output(vtbl, " ----"); #endif @@ -271,10 +272,9 @@ static inline void uip_statistics(FAR struct nsh_vtbl_s *vtbl) nsh_output(vtbl, "\n"); } #else -# define uip_statistics(vtbl) +# define net_statistics(vtbl) #endif - /**************************************************************************** * Name: ifconfig_callback ****************************************************************************/ @@ -607,7 +607,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) if (argc <= 2) { netdev_foreach(ifconfig_callback, vtbl); - uip_statistics(vtbl); + net_statistics(vtbl); return OK; } diff --git a/nuttx/TODO b/nuttx/TODO index 268121271..6523d3f90 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -384,7 +384,7 @@ o Kernel Build ps sched_foreach() ifup netdev_foreach() ifdown netdev_foreach() - ifconfig netdev_foreach(), uip_stat() + ifconfig netdev_foreach(), g_netstats ping uip_ping() Status: Open diff --git a/nuttx/include/nuttx/net/icmp.h b/nuttx/include/nuttx/net/icmp.h index 42e67f3a6..0e0fda6f7 100644 --- a/nuttx/include/nuttx/net/icmp.h +++ b/nuttx/include/nuttx/net/icmp.h @@ -180,10 +180,10 @@ struct icmp_iphdr_s #ifdef CONFIG_NET_STATISTICS struct icmp_stats_s { - uip_stats_t drop; /* Number of dropped ICMP packets */ - uip_stats_t recv; /* Number of received ICMP packets */ - uip_stats_t sent; /* Number of sent ICMP packets */ - uip_stats_t typeerr; /* Number of ICMP packets with a wrong type */ + net_stats_t drop; /* Number of dropped ICMP packets */ + net_stats_t recv; /* Number of received ICMP packets */ + net_stats_t sent; /* Number of sent ICMP packets */ + net_stats_t typeerr; /* Number of ICMP packets with a wrong type */ }; #endif diff --git a/nuttx/include/nuttx/net/igmp.h b/nuttx/include/nuttx/net/igmp.h index 4aeda5a65..fce07b0a6 100644 --- a/nuttx/include/nuttx/net/igmp.h +++ b/nuttx/include/nuttx/net/igmp.h @@ -56,6 +56,7 @@ #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/netconfig.h> #ifdef CONFIG_NET_IGMP @@ -180,17 +181,17 @@ struct igmp_iphdr_s #ifdef CONFIG_NET_STATISTICS struct igmp_stats_s { - uint32_t length_errors; - uint32_t chksum_errors; - uint32_t v1_received; - uint32_t joins; - uint32_t leaves; - uint32_t leave_sched; - uint32_t report_sched; - uint32_t poll_send; - uint32_t ucast_query; - uint32_t query_received; - uint32_t report_received; + net_stats_t length_errors; + net_stats_t chksum_errors; + net_stats_t v1_received; + net_stats_t joins; + net_stats_t leaves; + net_stats_t leave_sched; + net_stats_t report_sched; + net_stats_t poll_send; + net_stats_t ucast_query; + net_stats_t query_received; + net_stats_t report_received; }; # define IGMP_STATINCR(p) ((p)++) diff --git a/nuttx/include/nuttx/net/netconfig.h b/nuttx/include/nuttx/net/netconfig.h index 5638c2718..80fa26f66 100644 --- a/nuttx/include/nuttx/net/netconfig.h +++ b/nuttx/include/nuttx/net/netconfig.h @@ -302,6 +302,6 @@ * uIP. */ -typedef uint16_t uip_stats_t; +typedef uint16_t net_stats_t; #endif /* __INCLUDE_NUTTX_NET_NETCONFG_H */ diff --git a/nuttx/include/nuttx/net/netstats.h b/nuttx/include/nuttx/net/netstats.h new file mode 100644 index 000000000..e5d96bf95 --- /dev/null +++ b/nuttx/include/nuttx/net/netstats.h @@ -0,0 +1,137 @@ +/**************************************************************************** + * include/nuttx/net/netstats.h + * + * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * This logic was leveraged from uIP which also has a BSD-style license: + * + * Author Adam Dunkels <adam@dunkels.com> + * Copyright (c) 2001-2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_NET_NETSTATS_H +#define __INCLUDE_NUTTX_NET_NETSTATS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> + +#include <nuttx/net/netconfig.h> + +#ifdef CONFIG_NET_PKT +# include <nuttx/net/pkt.h> +#endif +#ifdef CONFIG_NET_TCP +# include <nuttx/net/tcp.h> +#endif +#ifdef CONFIG_NET_UDP +# include <nuttx/net/udp.h> +#endif +#ifdef CONFIG_NET_ICMP +# include <nuttx/net/icmp.h> +#endif +#ifdef CONFIG_NET_IGMP +# include <nuttx/net/igmp.h> +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/* The structure holding the uIP statistics that are gathered if + * CONFIG_NET_STATISTICS is defined. + */ + +#ifdef CONFIG_NET_STATISTICS +struct ip_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 hblenerr; /* Number of packets dropped due to wrong + IP length, high byte */ + net_stats_t lblenerr; /* Number of packets dropped due to wrong + IP length, low byte */ + 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 */ +}; + +struct net_stats_s +{ + struct ip_stats_s ip; /* IP statistics */ + +#ifdef CONFIG_NET_ICMP + struct icmp_stats_s icmp; /* ICMP statistics */ +#endif + +#ifdef CONFIG_NET_IGMP + struct igmp_stats_s igmp; /* IGMP statistics */ +#endif + +#ifdef CONFIG_NET_TCP + struct tcp_stats_s tcp; /* TCP statistics */ +#endif + +#ifdef CONFIG_NET_UDP + struct udp_stats_s udp; /* UDP statistics */ +#endif +}; +#endif /* CONFIG_NET_STATISTICS */ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* This is the structure in which the statistics are gathered. */ + +#ifdef CONFIG_NET_STATISTICS +extern struct net_stats_s g_netstats; +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __INCLUDE_NUTTX_NET_NETSTATS_H */ diff --git a/nuttx/include/nuttx/net/tcp.h b/nuttx/include/nuttx/net/tcp.h index 49d7a1254..c8c884806 100644 --- a/nuttx/include/nuttx/net/tcp.h +++ b/nuttx/include/nuttx/net/tcp.h @@ -316,16 +316,16 @@ struct tcp_backlog_s #ifdef CONFIG_NET_STATISTICS struct tcp_stats_s { - uip_stats_t drop; /* Number of dropped TCP segments */ - uip_stats_t recv; /* Number of received TCP segments */ - 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 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 + net_stats_t drop; /* Number of dropped TCP segments */ + net_stats_t recv; /* Number of received TCP segments */ + net_stats_t sent; /* Number of sent TCP segments */ + net_stats_t chkerr; /* Number of TCP segments with a bad checksum */ + net_stats_t ackerr; /* Number of TCP segments with a bad ACK number */ + net_stats_t rst; /* Number of received TCP RST (reset) segments */ + net_stats_t rexmit; /* Number of retransmitted TCP segments */ + net_stats_t syndrop; /* Number of dropped SYNs due to too few available connections */ - uip_stats_t synrst; /* Number of SYNs for closed ports triggering a RST */ + net_stats_t synrst; /* Number of SYNs for closed ports triggering a RST */ }; #endif diff --git a/nuttx/include/nuttx/net/udp.h b/nuttx/include/nuttx/net/udp.h index ed47b2948..fe777913d 100644 --- a/nuttx/include/nuttx/net/udp.h +++ b/nuttx/include/nuttx/net/udp.h @@ -134,10 +134,10 @@ struct udp_iphdr_s #ifdef CONFIG_NET_STATISTICS struct udp_stats_s { - uip_stats_t drop; /* Number of dropped UDP segments */ - uip_stats_t recv; /* Number of recived UDP segments */ - uip_stats_t sent; /* Number of sent UDP segments */ - uip_stats_t chkerr; /* Number of UDP segments with a bad checksum */ + net_stats_t drop; /* Number of dropped UDP segments */ + net_stats_t recv; /* Number of recived UDP segments */ + net_stats_t sent; /* Number of sent UDP segments */ + net_stats_t chkerr; /* Number of UDP segments with a bad checksum */ }; #endif diff --git a/nuttx/include/nuttx/net/uip.h b/nuttx/include/nuttx/net/uip.h index 32f8821e5..216d134dc 100644 --- a/nuttx/include/nuttx/net/uip.h +++ b/nuttx/include/nuttx/net/uip.h @@ -226,80 +226,10 @@ struct uip_callback_s uint16_t flags; }; -/* Protocol-specific support */ - -#ifdef CONFIG_NET_PKT -# include <nuttx/net/pkt.h> -#endif -#ifdef CONFIG_NET_TCP -# include <nuttx/net/tcp.h> -#endif -#ifdef CONFIG_NET_UDP -# include <nuttx/net/udp.h> -#endif -#ifdef CONFIG_NET_ICMP -# include <nuttx/net/icmp.h> -#endif -#ifdef CONFIG_NET_IGMP -# include <nuttx/net/igmp.h> -#endif - -/* The structure holding the uIP statistics that are gathered if - * CONFIG_NET_STATISTICS is defined. - */ - -#ifdef CONFIG_NET_STATISTICS -struct ip_stats_s -{ - uip_stats_t drop; /* Number of dropped packets at the IP layer */ - uip_stats_t recv; /* Number of received packets at the IP layer */ - uip_stats_t sent; /* Number of sent packets at the IP layer */ - uip_stats_t vhlerr; /* Number of packets dropped due to wrong - IP version or header length */ - uip_stats_t hblenerr; /* Number of packets dropped due to wrong - IP length, high byte */ - uip_stats_t lblenerr; /* Number of packets dropped due to wrong - IP length, low byte */ - uip_stats_t fragerr; /* Number of packets dropped since they - were IP fragments */ - uip_stats_t chkerr; /* Number of packets dropped due to IP - checksum errors */ - uip_stats_t protoerr; /* Number of packets dropped since they - were neither ICMP, UDP nor TCP */ -}; - -struct uip_stats -{ - struct ip_stats_s ip; /* IP statistics */ - -#ifdef CONFIG_NET_ICMP - struct icmp_stats_s icmp; /* ICMP statistics */ -#endif - -#ifdef CONFIG_NET_IGMP - struct igmp_stats_s igmp; /* IGMP statistics */ -#endif - -#ifdef CONFIG_NET_TCP - struct tcp_stats_s tcp; /* TCP statistics */ -#endif - -#ifdef CONFIG_NET_UDP - struct udp_stats_s udp; /* UDP statistics */ -#endif -}; -#endif /* CONFIG_NET_STATISTICS */ - /**************************************************************************** * Public Data ****************************************************************************/ -/* This is the structure in which the statistics are gathered. */ - -#ifdef CONFIG_NET_STATISTICS -extern struct uip_stats uip_stat; -#endif - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -308,7 +238,7 @@ extern struct uip_stats uip_stat; * * The uIP initialization functions are used for booting uIP. * - * This function should be called at boot up to initilize the uIP + * This function should be called at boot up to initialize the uIP * TCP/IP stack. */ diff --git a/nuttx/net/accept.c b/nuttx/net/accept.c index 9fabcecd6..3f0ca106c 100644 --- a/nuttx/net/accept.c +++ b/nuttx/net/accept.c @@ -51,6 +51,8 @@ #include <arch/irq.h> +#include <nuttx/net/tcp.h> + #include "net.h" /**************************************************************************** diff --git a/nuttx/net/arp/arp_inout.c b/nuttx/net/arp/arp_inout.c index 35355063b..9f5bd26c3 100644 --- a/nuttx/net/arp/arp_inout.c +++ b/nuttx/net/arp/arp_inout.c @@ -67,6 +67,8 @@ #include <nuttx/net/netdev.h> #include <nuttx/net/arp.h> +#include "net_route.h" + #ifdef CONFIG_NET_ARP /**************************************************************************** diff --git a/nuttx/net/bind.c b/nuttx/net/bind.c index a7d7121e5..12063a975 100644 --- a/nuttx/net/bind.c +++ b/nuttx/net/bind.c @@ -49,6 +49,10 @@ # include <netpacket/packet.h> #endif +#include <nuttx/net/tcp.h> +#include <nuttx/net/udp.h> +#include <nuttx/net/pkt.h> + #include "net.h" #include "tcp/tcp.h" #include "udp/udp.h" diff --git a/nuttx/net/connect.c b/nuttx/net/connect.c index 550751369..e80c83d93 100644 --- a/nuttx/net/connect.c +++ b/nuttx/net/connect.c @@ -49,6 +49,8 @@ #include <arch/irq.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/udp.h> #include "net.h" #include "uip/uip.h" diff --git a/nuttx/net/getsockname.c b/nuttx/net/getsockname.c index 1acb52725..aff79ce90 100644 --- a/nuttx/net/getsockname.c +++ b/nuttx/net/getsockname.c @@ -47,6 +47,8 @@ #include <nuttx/net/net.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/udp.h> #include "net.h" diff --git a/nuttx/net/icmp/icmp_input.c b/nuttx/net/icmp/icmp_input.c index 55557945b..432582b70 100644 --- a/nuttx/net/icmp/icmp_input.c +++ b/nuttx/net/icmp/icmp_input.c @@ -52,6 +52,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "icmp/icmp.h" @@ -107,7 +108,7 @@ void icmp_input(FAR struct uip_driver_s *dev) FAR struct icmp_iphdr_s *picmp = ICMPBUF; #ifdef CONFIG_NET_STATISTICS - uip_stat.icmp.recv++; + g_netstats.icmp.recv++; #endif #ifndef CONFIG_NET_IPv6 @@ -171,8 +172,8 @@ void icmp_input(FAR struct uip_driver_s *dev) dev->d_len, (picmp->len[0] << 8) | picmp->len[1]); #ifdef CONFIG_NET_STATISTICS - uip_stat.icmp.sent++; - uip_stat.ip.sent++; + g_netstats.icmp.sent++; + g_netstats.ip.sent++; #endif } @@ -199,8 +200,8 @@ void icmp_input(FAR struct uip_driver_s *dev) typeerr: #ifdef CONFIG_NET_STATISTICS - uip_stat.icmp.typeerr++; - uip_stat.icmp.drop++; + g_netstats.icmp.typeerr++; + g_netstats.icmp.drop++; #endif dev->d_len = 0; @@ -295,19 +296,19 @@ typeerr: dev->d_len, (picmp->len[0] << 8) | picmp->len[1]); #ifdef CONFIG_NET_STATISTICS - uip_stat.icmp.sent++; - uip_stat.ip.sent++; + g_netstats.icmp.sent++; + g_netstats.ip.sent++; #endif return; typeerr: #ifdef CONFIG_NET_STATISTICS - uip_stat.icmp.typeerr++; + g_netstats.icmp.typeerr++; #endif drop: #ifdef CONFIG_NET_STATISTICS - uip_stat.icmp.drop++; + g_netstats.icmp.drop++; #endif dev->d_len = 0; diff --git a/nuttx/net/icmp/icmp_ping.c b/nuttx/net/icmp/icmp_ping.c index 549266e6a..e99ec944e 100644 --- a/nuttx/net/icmp/icmp_ping.c +++ b/nuttx/net/icmp/icmp_ping.c @@ -52,6 +52,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/icmp.h> #include "uip/uip.h" #include "icmp/icmp.h" diff --git a/nuttx/net/icmp/icmp_poll.c b/nuttx/net/icmp/icmp_poll.c index 208f933a3..2beab639d 100644 --- a/nuttx/net/icmp/icmp_poll.c +++ b/nuttx/net/icmp/icmp_poll.c @@ -45,6 +45,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/icmp.h> #include "uip/uip.h" diff --git a/nuttx/net/icmp/icmp_send.c b/nuttx/net/icmp/icmp_send.c index 0f72b3b3e..a8fe09578 100644 --- a/nuttx/net/icmp/icmp_send.c +++ b/nuttx/net/icmp/icmp_send.c @@ -45,6 +45,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "icmp/icmp.h" @@ -160,8 +161,8 @@ void icmp_send(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *destaddr) dev->d_len, (picmp->len[0] << 8) | picmp->len[1]); #ifdef CONFIG_NET_STATISTICS - uip_stat.icmp.sent++; - uip_stat.ip.sent++; + g_netstats.icmp.sent++; + g_netstats.ip.sent++; #endif } } diff --git a/nuttx/net/igmp/igmp_input.c b/nuttx/net/igmp/igmp_input.c index 05392a6e1..241294d01 100644 --- a/nuttx/net/igmp/igmp_input.c +++ b/nuttx/net/igmp/igmp_input.c @@ -50,6 +50,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/igmp.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "igmp/igmp.h" @@ -125,7 +126,7 @@ void igmp_input(struct uip_driver_s *dev) if (dev->d_len < UIP_LLH_LEN+UIP_IPIGMPH_LEN) { - IGMP_STATINCR(uip_stat.igmp.length_errors); + IGMP_STATINCR(g_netstats.igmp.length_errors); nlldbg("Length error\n"); return; } @@ -134,7 +135,7 @@ void igmp_input(struct uip_driver_s *dev) if (uip_chksum((uint16_t*)&IGMPBUF->type, UIP_IGMPH_LEN) != 0) { - IGMP_STATINCR(uip_stat.igmp.chksum_errors); + IGMP_STATINCR(g_netstats.igmp.chksum_errors); nlldbg("Checksum error\n"); return; } @@ -191,13 +192,13 @@ void igmp_input(struct uip_driver_s *dev) nllvdbg("General multicast query\n"); if (IGMPBUF->maxresp == 0) { - IGMP_STATINCR(uip_stat.igmp.v1_received); + IGMP_STATINCR(g_netstats.igmp.v1_received); IGMPBUF->maxresp = 10; nlldbg("V1 not implemented\n"); } - IGMP_STATINCR(uip_stat.igmp.query_received); + IGMP_STATINCR(g_netstats.igmp.query_received); for (member = (FAR struct igmp_group_s *)dev->grplist.head; member; member = member->next) @@ -224,7 +225,7 @@ void igmp_input(struct uip_driver_s *dev) * Use the incoming IPaddress! */ - IGMP_STATINCR(uip_stat.igmp.ucast_query); + IGMP_STATINCR(g_netstats.igmp.ucast_query); grpaddr = uip_ip4addr_conv(IGMPBUF->grpaddr); group = igmp_grpallocfind(dev, &grpaddr); ticks = igmp_decisec2tick((int)IGMPBUF->maxresp); @@ -241,7 +242,7 @@ void igmp_input(struct uip_driver_s *dev) else if (group->grpaddr != 0) { nllvdbg("Unicast query\n"); - IGMP_STATINCR(uip_stat.igmp.ucast_query); + IGMP_STATINCR(g_netstats.igmp.ucast_query); nlldbg("Query to a specific group with the group address as destination\n"); @@ -258,7 +259,7 @@ void igmp_input(struct uip_driver_s *dev) { nllvdbg("Membership report\n"); - IGMP_STATINCR(uip_stat.igmp.report_received); + IGMP_STATINCR(g_netstats.igmp.report_received); if (!IS_IDLEMEMBER(group->flags)) { /* This is on a specific group we have already looked up */ diff --git a/nuttx/net/igmp/igmp_join.c b/nuttx/net/igmp/igmp_join.c index 9d239dd79..a8d4a19d3 100644 --- a/nuttx/net/igmp/igmp_join.c +++ b/nuttx/net/igmp/igmp_join.c @@ -48,6 +48,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> +#include <nuttx/net/netstats.h> #include <nuttx/net/igmp.h> #include "uip/uip.h" @@ -136,11 +137,11 @@ int igmp_joingroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr) nvdbg("Join to new group: %08x\n", grpaddr->s_addr); group = igmp_grpalloc(dev, &grpaddr->s_addr); - IGMP_STATINCR(uip_stat.igmp.joins); + IGMP_STATINCR(g_netstats.igmp.joins); /* Send the Membership Report */ - IGMP_STATINCR(uip_stat.igmp.report_sched); + IGMP_STATINCR(g_netstats.igmp.report_sched); igmp_waitmsg(group, IGMPv2_MEMBERSHIP_REPORT); /* And start the timer at 10*100 msec */ diff --git a/nuttx/net/igmp/igmp_leave.c b/nuttx/net/igmp/igmp_leave.c index da4155ff1..0665d12e9 100644 --- a/nuttx/net/igmp/igmp_leave.c +++ b/nuttx/net/igmp/igmp_leave.c @@ -49,6 +49,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> +#include <nuttx/net/netstats.h> #include <nuttx/net/igmp.h> #include "uip/uip.h" @@ -153,14 +154,14 @@ int igmp_leavegroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr) CLR_WAITMSG(group->flags); uip_unlock(flags); - IGMP_STATINCR(uip_stat.igmp.leaves); + IGMP_STATINCR(g_netstats.igmp.leaves); /* Send a leave if the flag is set according to the state diagram */ if (IS_LASTREPORT(group->flags)) { ndbg("Schedule Leave Group message\n"); - IGMP_STATINCR(uip_stat.igmp.leave_sched); + IGMP_STATINCR(g_netstats.igmp.leave_sched); igmp_waitmsg(group, IGMP_LEAVE_GROUP); } diff --git a/nuttx/net/igmp/igmp_mcastmac.c b/nuttx/net/igmp/igmp_mcastmac.c index 744a9e29d..b4de341c0 100644 --- a/nuttx/net/igmp/igmp_mcastmac.c +++ b/nuttx/net/igmp/igmp_mcastmac.c @@ -48,6 +48,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> +#include <nuttx/net/igmp.h> #include "uip/uip.h" #include "igmp/igmp.h" diff --git a/nuttx/net/igmp/igmp_poll.c b/nuttx/net/igmp/igmp_poll.c index 2b52349bc..bcc689523 100644 --- a/nuttx/net/igmp/igmp_poll.c +++ b/nuttx/net/igmp/igmp_poll.c @@ -49,6 +49,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "igmp/igmp.h" @@ -91,7 +92,7 @@ static inline void uip_schedsend(FAR struct uip_driver_s *dev, FAR struct igmp_g dest = &group->grpaddr; nllvdbg("Send IGMPv2_MEMBERSHIP_REPORT, dest=%08x flags=%02x\n", *dest, group->flags); - IGMP_STATINCR(uip_stat.igmp.report_sched); + IGMP_STATINCR(g_netstats.igmp.report_sched); SET_LASTREPORT(group->flags); /* Remember we were the last to report */ } else @@ -100,7 +101,7 @@ static inline void uip_schedsend(FAR struct uip_driver_s *dev, FAR struct igmp_g dest = &g_allrouters; nllvdbg("Send IGMP_LEAVE_GROUP, dest=%08x flags=%02x\n", *dest, group->flags); - IGMP_STATINCR(uip_stat.igmp.leave_sched); + IGMP_STATINCR(g_netstats.igmp.leave_sched); } /* Send the message */ diff --git a/nuttx/net/igmp/igmp_send.c b/nuttx/net/igmp/igmp_send.c index 78be0862e..2398215b9 100644 --- a/nuttx/net/igmp/igmp_send.c +++ b/nuttx/net/igmp/igmp_send.c @@ -45,6 +45,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/netstats.h> #include <nuttx/net/ip.h> #include <nuttx/net/igmp.h> @@ -172,8 +173,8 @@ void igmp_send(FAR struct uip_driver_s *dev, FAR struct igmp_group_s *group, IGMPBUF->chksum = 0; IGMPBUF->chksum = ~igmp_chksum(&IGMPBUF->type, UIP_IPIGMPH_LEN); - IGMP_STATINCR(uip_stat.igmp.poll_send); - IGMP_STATINCR(uip_stat.ip.sent); + IGMP_STATINCR(g_netstats.igmp.poll_send); + IGMP_STATINCR(g_netstats.ip.sent); nllvdbg("Outgoing IGMP packet length: %d (%d)\n", dev->d_len, (IGMPBUF->len[0] << 8) | IGMPBUF->len[1]); diff --git a/nuttx/net/igmp/igmp_timer.c b/nuttx/net/igmp/igmp_timer.c index 887978b3a..3b39d5a53 100644 --- a/nuttx/net/igmp/igmp_timer.c +++ b/nuttx/net/igmp/igmp_timer.c @@ -50,6 +50,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> +#include <nuttx/net/netstats.h> #include <nuttx/net/igmp.h> #include "uip/uip.h" @@ -134,7 +135,7 @@ static void igmp_timeout(int argc, uint32_t arg, ...) * for the message to be sent. */ - IGMP_STATINCR(uip_stat.igmp.report_sched); + IGMP_STATINCR(g_netstats.igmp.report_sched); igmp_schedmsg(group, IGMPv2_MEMBERSHIP_REPORT); /* Also note: The Membership Report is sent at most two times becasue diff --git a/nuttx/net/listen.c b/nuttx/net/listen.c index 2c691a93d..eb4e29f34 100644 --- a/nuttx/net/listen.c +++ b/nuttx/net/listen.c @@ -44,6 +44,8 @@ #include <errno.h> #include <debug.h> +#include <nuttx/net/tcp.h> + #include "net.h" /**************************************************************************** diff --git a/nuttx/net/net.h b/nuttx/net/net.h index fdf63ad93..0f9463158 100644 --- a/nuttx/net/net.h +++ b/nuttx/net/net.h @@ -168,6 +168,8 @@ FAR struct socket *sockfd_socket(int sockfd); /* net_connect.c *************************************************************/ #ifdef CONFIG_NET_TCP +struct tcp_conn_s; /* Forward reference */ + int net_startmonitor(FAR struct socket *psock); void net_stopmonitor(FAR struct tcp_conn_s *conn); void net_lostconnection(FAR struct socket *psock, uint16_t flags); diff --git a/nuttx/net/net_clone.c b/nuttx/net/net_clone.c index ff8335517..99dd44739 100644 --- a/nuttx/net/net_clone.c +++ b/nuttx/net/net_clone.c @@ -45,6 +45,8 @@ #include <debug.h> #include <nuttx/arch.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/udp.h> #include "net.h" diff --git a/nuttx/net/net_close.c b/nuttx/net/net_close.c index 6b5fde4c9..ed47f0cf5 100644 --- a/nuttx/net/net_close.c +++ b/nuttx/net/net_close.c @@ -49,6 +49,9 @@ #include <arch/irq.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/udp.h> +#include <nuttx/net/pkt.h> #ifdef CONFIG_NET_SOLINGER # include <nuttx/clock.h> diff --git a/nuttx/net/net_monitor.c b/nuttx/net/net_monitor.c index 59b1c5382..afbe1121c 100644 --- a/nuttx/net/net_monitor.c +++ b/nuttx/net/net_monitor.c @@ -44,6 +44,8 @@ #include <assert.h> #include <debug.h> +#include <nuttx/net/tcp.h> + #include "net.h" #include "uip/uip.h" diff --git a/nuttx/net/net_poll.c b/nuttx/net/net_poll.c index a12b0721b..ca454e182 100644 --- a/nuttx/net/net_poll.c +++ b/nuttx/net/net_poll.c @@ -51,8 +51,10 @@ #include <nuttx/kmalloc.h> #include <nuttx/arch.h> +#include <nuttx/net/iob.h> #include <nuttx/net/uip.h> #include <nuttx/net/net.h> +#include <nuttx/net/tcp.h> #include <uip/uip.h> diff --git a/nuttx/net/pkt/pkt.h b/nuttx/net/pkt/pkt.h index bc51fc1b1..6404fe748 100644 --- a/nuttx/net/pkt/pkt.h +++ b/nuttx/net/pkt/pkt.h @@ -69,12 +69,14 @@ extern "C" /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -struct eth_hdr_s; /* Forward reference */ + + struct eth_hdr_s; /* Forward reference */ +struct pkt_conn_s; /* Forward refernce */ /* Defined in pkt_conn.c ****************************************************/ void pkt_initialize(void); -struct pkt_conn_s *pkt_alloc(void); +FAR struct pkt_conn_s *pkt_alloc(void); void pkt_free(FAR struct pkt_conn_s *conn); struct pkt_conn_s *pkt_active(FAR struct eth_hdr_s *buf); struct pkt_conn_s *uip_nextpktconn(FAR struct pkt_conn_s *conn); diff --git a/nuttx/net/pkt/pkt_callback.c b/nuttx/net/pkt/pkt_callback.c index 7f91152ca..5e3123628 100644 --- a/nuttx/net/pkt/pkt_callback.c +++ b/nuttx/net/pkt/pkt_callback.c @@ -46,6 +46,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/pkt.h> #include "uip/uip.h" #include "pkt/pkt.h" diff --git a/nuttx/net/pkt/pkt_conn.c b/nuttx/net/pkt/pkt_conn.c index 4d0a1420f..c984bb9b0 100644 --- a/nuttx/net/pkt/pkt_conn.c +++ b/nuttx/net/pkt/pkt_conn.c @@ -54,6 +54,7 @@ #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> #include <nuttx/net/arp.h> +#include <nuttx/net/pkt.h> #include "uip/uip.h" #include "pkt/pkt.h" diff --git a/nuttx/net/pkt/pkt_input.c b/nuttx/net/pkt/pkt_input.c index dd9bc07fa..dea9908f1 100644 --- a/nuttx/net/pkt/pkt_input.c +++ b/nuttx/net/pkt/pkt_input.c @@ -51,6 +51,7 @@ #include <nuttx/net/netdev.h> #include <nuttx/net/pkt.h> #include <nuttx/net/arp.h> +#include <nuttx/net/pkt.h> #include "uip/uip.h" #include "pkt/pkt.h" diff --git a/nuttx/net/pkt/pkt_poll.c b/nuttx/net/pkt/pkt_poll.c index 5828261ab..ce6e0ebed 100644 --- a/nuttx/net/pkt/pkt_poll.c +++ b/nuttx/net/pkt/pkt_poll.c @@ -50,6 +50,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/udp.h> #include <nuttx/net/pkt.h> #include "uip/uip.h" diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c index a382b383c..256150624 100644 --- a/nuttx/net/recvfrom.c +++ b/nuttx/net/recvfrom.c @@ -54,7 +54,11 @@ #include <arch/irq.h> #include <nuttx/clock.h> +#include <nuttx/net/iob.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/udp.h> +#include <nuttx/net/pkt.h> #include "net.h" #include "uip/uip.h" diff --git a/nuttx/net/send.c b/nuttx/net/send.c index 8cc4410da..b52194905 100644 --- a/nuttx/net/send.c +++ b/nuttx/net/send.c @@ -43,7 +43,6 @@ #include <sys/types.h> #include <sys/socket.h> -#include <nuttx/net/uip.h> #include <nuttx/net/tcp.h> #include "tcp/tcp.h" diff --git a/nuttx/net/sendto.c b/nuttx/net/sendto.c index 3a33c6f75..54a9beff8 100644 --- a/nuttx/net/sendto.c +++ b/nuttx/net/sendto.c @@ -50,6 +50,7 @@ #include <nuttx/clock.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/udp.h> #include "net.h" #include "uip/uip.h" diff --git a/nuttx/net/socket.c b/nuttx/net/socket.c index 0fbf51ae1..8676875c1 100644 --- a/nuttx/net/socket.c +++ b/nuttx/net/socket.c @@ -45,6 +45,10 @@ #include <assert.h> #include <debug.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/udp.h> +#include <nuttx/net/pkt.h> + #include "net.h" #include "tcp/tcp.h" #include "udp/udp.h" diff --git a/nuttx/net/tcp/tcp.h b/nuttx/net/tcp/tcp.h index 4481774d5..ef75526de 100644 --- a/nuttx/net/tcp/tcp.h +++ b/nuttx/net/tcp/tcp.h @@ -72,6 +72,8 @@ extern "C" /* Defined in tcp_conn.c ****************************************************/ +struct tcp_iphdr_s; /* Forward reference */ + void tcp_initialize(void); struct tcp_conn_s *tcp_active(FAR struct tcp_iphdr_s *buf); struct tcp_conn_s *uip_nexttcpconn(FAR struct tcp_conn_s *conn); diff --git a/nuttx/net/tcp/tcp_appsend.c b/nuttx/net/tcp/tcp_appsend.c index 5493a4de8..eb4214d55 100644 --- a/nuttx/net/tcp/tcp_appsend.c +++ b/nuttx/net/tcp/tcp_appsend.c @@ -51,6 +51,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> #include "uip/uip.h" #include "tcp/tcp.h" diff --git a/nuttx/net/tcp/tcp_callback.c b/nuttx/net/tcp/tcp_callback.c index 49b2947d8..f09bf995f 100644 --- a/nuttx/net/tcp/tcp_callback.c +++ b/nuttx/net/tcp/tcp_callback.c @@ -48,6 +48,8 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "tcp/tcp.h" @@ -116,8 +118,8 @@ uip_dataevent(FAR struct uip_driver_s *dev, FAR struct tcp_conn_s *conn, nllvdbg("Dropped %d bytes\n", dev->d_len); #ifdef CONFIG_NET_STATISTICS - uip_stat.tcp.syndrop++; - uip_stat.tcp.drop++; + g_netstats.tcp.syndrop++; + g_netstats.tcp.drop++; #endif /* Clear the UIP_SNDACK bit so that no ACK will be sent */ diff --git a/nuttx/net/tcp/tcp_conn.c b/nuttx/net/tcp/tcp_conn.c index 53ce386e4..f4f20f714 100644 --- a/nuttx/net/tcp/tcp_conn.c +++ b/nuttx/net/tcp/tcp_conn.c @@ -54,6 +54,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> #include "tcp/tcp.h" #include "uip/uip.h" diff --git a/nuttx/net/tcp/tcp_input.c b/nuttx/net/tcp/tcp_input.c index 68e500a11..634343004 100644 --- a/nuttx/net/tcp/tcp_input.c +++ b/nuttx/net/tcp/tcp_input.c @@ -53,6 +53,8 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "tcp/tcp.h" @@ -111,7 +113,7 @@ void tcp_input(struct uip_driver_s *dev) dev->d_appdata = &dev->d_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN]; #ifdef CONFIG_NET_STATISTICS - uip_stat.tcp.recv++; + g_netstats.tcp.recv++; #endif /* Start of TCP input header processing code. */ @@ -121,8 +123,8 @@ void tcp_input(struct uip_driver_s *dev) /* Compute and check the TCP checksum. */ #ifdef CONFIG_NET_STATISTICS - uip_stat.tcp.drop++; - uip_stat.tcp.chkerr++; + g_netstats.tcp.drop++; + g_netstats.tcp.chkerr++; #endif nlldbg("Bad TCP checksum\n"); goto drop; @@ -202,7 +204,7 @@ void tcp_input(struct uip_driver_s *dev) */ #ifdef CONFIG_NET_STATISTICS - uip_stat.tcp.syndrop++; + g_netstats.tcp.syndrop++; #endif nlldbg("No free TCP connections\n"); goto drop; @@ -282,7 +284,7 @@ reset: } #ifdef CONFIG_NET_STATISTICS - uip_stat.tcp.synrst++; + g_netstats.tcp.synrst++; #endif tcp_reset(dev); return; diff --git a/nuttx/net/tcp/tcp_listen.c b/nuttx/net/tcp/tcp_listen.c index 13583287e..278ce2bcb 100644 --- a/nuttx/net/tcp/tcp_listen.c +++ b/nuttx/net/tcp/tcp_listen.c @@ -49,6 +49,7 @@ #include <debug.h> #include <nuttx/net/netconfig.h> +#include <nuttx/net/tcp.h> #include "uip/uip.h" #include "tcp/tcp.h" diff --git a/nuttx/net/tcp/tcp_poll.c b/nuttx/net/tcp/tcp_poll.c index cc33a00a9..3fc9609d7 100644 --- a/nuttx/net/tcp/tcp_poll.c +++ b/nuttx/net/tcp/tcp_poll.c @@ -51,6 +51,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> #include "uip/uip.h" #include "tcp/tcp.h" diff --git a/nuttx/net/tcp/tcp_send.c b/nuttx/net/tcp/tcp_send.c index 54f10baba..97cf9053f 100644 --- a/nuttx/net/tcp/tcp_send.c +++ b/nuttx/net/tcp/tcp_send.c @@ -51,6 +51,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" @@ -146,8 +147,8 @@ static void tcp_sendcomplete(FAR struct uip_driver_s *dev) dev->d_len, (pbuf->len[0] << 8) | pbuf->len[1]); #ifdef CONFIG_NET_STATISTICS - uip_stat.tcp.sent++; - uip_stat.ip.sent++; + g_netstats.tcp.sent++; + g_netstats.ip.sent++; #endif } @@ -267,7 +268,7 @@ void tcp_reset(FAR struct uip_driver_s *dev) uint8_t seqbyte; #ifdef CONFIG_NET_STATISTICS - uip_stat.tcp.rst++; + g_netstats.tcp.rst++; #endif pbuf->flags = TCP_RST | TCP_ACK; diff --git a/nuttx/net/tcp/tcp_send_buffered.c b/nuttx/net/tcp/tcp_send_buffered.c index 7e0878754..21e5d635b 100644 --- a/nuttx/net/tcp/tcp_send_buffered.c +++ b/nuttx/net/tcp/tcp_send_buffered.c @@ -66,6 +66,7 @@ #include <nuttx/net/arp.h> #include <nuttx/net/iob.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> #include "net.h" #include "tcp/tcp.h" diff --git a/nuttx/net/tcp/tcp_send_unbuffered.c b/nuttx/net/tcp/tcp_send_unbuffered.c index 9feee3b62..97dea655b 100644 --- a/nuttx/net/tcp/tcp_send_unbuffered.c +++ b/nuttx/net/tcp/tcp_send_unbuffered.c @@ -54,6 +54,7 @@ #include <nuttx/clock.h> #include <nuttx/net/arp.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> #include "net.h" #include "uip/uip.h" diff --git a/nuttx/net/tcp/tcp_timer.c b/nuttx/net/tcp/tcp_timer.c index 78b7a29a6..228abf6e3 100644 --- a/nuttx/net/tcp/tcp_timer.c +++ b/nuttx/net/tcp/tcp_timer.c @@ -51,6 +51,8 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/tcp.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "tcp/tcp.h" @@ -200,7 +202,7 @@ void tcp_timer(FAR struct uip_driver_s *dev, FAR struct tcp_conn_s *conn, */ #ifdef CONFIG_NET_STATISTICS - uip_stat.tcp.rexmit++; + g_netstats.tcp.rexmit++; #endif switch(conn->tcpstateflags & UIP_TS_MASK) { diff --git a/nuttx/net/tcp/tcp_wrbuffer.c b/nuttx/net/tcp/tcp_wrbuffer.c index b893a6bd6..902b3bfb7 100644 --- a/nuttx/net/tcp/tcp_wrbuffer.c +++ b/nuttx/net/tcp/tcp_wrbuffer.c @@ -55,7 +55,6 @@ #include <debug.h> #include <nuttx/net/iob.h> -#include <nuttx/net/uip.h> #include <nuttx/net/tcp.h> #include "tcp/tcp.h" diff --git a/nuttx/net/udp/udp.h b/nuttx/net/udp/udp.h index 604285a16..7ebaf19d2 100644 --- a/nuttx/net/udp/udp.h +++ b/nuttx/net/udp/udp.h @@ -72,6 +72,9 @@ extern "C" /* Defined in udp_conn.c ****************************************************/ +struct udp_iphdr_s; /* Forward reference */ +struct udp_conn_s; /* Forward reference */ + void udp_initialize(void); FAR struct udp_conn_s *udp_active(FAR struct udp_iphdr_s *buf); FAR struct udp_conn_s *uip_nextudpconn(FAR struct udp_conn_s *conn); diff --git a/nuttx/net/udp/udp_callback.c b/nuttx/net/udp/udp_callback.c index 9ca9c44f3..85edd388f 100644 --- a/nuttx/net/udp/udp_callback.c +++ b/nuttx/net/udp/udp_callback.c @@ -46,6 +46,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/udp.h> #include "uip/uip.h" #include "udp/udp.h" diff --git a/nuttx/net/udp/udp_conn.c b/nuttx/net/udp/udp_conn.c index ab84d9902..f95e86165 100644 --- a/nuttx/net/udp/udp_conn.c +++ b/nuttx/net/udp/udp_conn.c @@ -59,6 +59,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/udp.h> #include "uip/uip.h" #include "udp/udp.h" diff --git a/nuttx/net/udp/udp_input.c b/nuttx/net/udp/udp_input.c index 13b2e100d..61c1f80ed 100644 --- a/nuttx/net/udp/udp_input.c +++ b/nuttx/net/udp/udp_input.c @@ -50,6 +50,8 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/udp.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "udp/udp.h" @@ -102,7 +104,7 @@ int udp_input(FAR struct uip_driver_s *dev) int ret = OK; #ifdef CONFIG_NET_STATISTICS - uip_stat.udp.recv++; + g_netstats.udp.recv++; #endif /* UDP processing is really just a hack. We don't do anything to the UDP/IP @@ -116,8 +118,8 @@ int udp_input(FAR struct uip_driver_s *dev) if (pbuf->udpchksum != 0 && udp_chksum(dev) != 0xffff) { #ifdef CONFIG_NET_STATISTICS - uip_stat.udp.drop++; - uip_stat.udp.chkerr++; + g_netstats.udp.drop++; + g_netstats.udp.chkerr++; #endif nlldbg("Bad UDP checksum\n"); dev->d_len = 0; diff --git a/nuttx/net/udp/udp_poll.c b/nuttx/net/udp/udp_poll.c index 6159a3c28..cd0360468 100644 --- a/nuttx/net/udp/udp_poll.c +++ b/nuttx/net/udp/udp_poll.c @@ -50,6 +50,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/udp.h> #include "uip/uip.h" #include "udp/udp.h" diff --git a/nuttx/net/udp/udp_send.c b/nuttx/net/udp/udp_send.c index 6608979b9..c7dee9374 100644 --- a/nuttx/net/udp/udp_send.c +++ b/nuttx/net/udp/udp_send.c @@ -49,6 +49,8 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/udp.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "udp/udp.h" @@ -169,8 +171,8 @@ void udp_send(struct uip_driver_s *dev, struct udp_conn_s *conn) dev->d_len, (pudpbuf->len[0] << 8) | pudpbuf->len[1]); #ifdef CONFIG_NET_STATISTICS - uip_stat.udp.sent++; - uip_stat.ip.sent++; + g_netstats.udp.sent++; + g_netstats.ip.sent++; #endif } } diff --git a/nuttx/net/uip/uip_chksum.c b/nuttx/net/uip/uip_chksum.c index f41e7aa67..640fb3548 100644 --- a/nuttx/net/uip/uip_chksum.c +++ b/nuttx/net/uip/uip_chksum.c @@ -46,6 +46,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/icmp.h> #include "uip/uip.h" diff --git a/nuttx/net/uip/uip_initialize.c b/nuttx/net/uip/uip_initialize.c index 93e417099..a4c21134a 100644 --- a/nuttx/net/uip/uip_initialize.c +++ b/nuttx/net/uip/uip_initialize.c @@ -46,6 +46,7 @@ #include <stdint.h> #include <nuttx/net/uip.h> +#include <nuttx/net/netstats.h> #include "uip/uip.h" #include "tcp/tcp.h" @@ -64,7 +65,7 @@ /* IP/TCP/UDP/ICMP statistics for all network interfaces */ #ifdef CONFIG_NET_STATISTICS -struct uip_stats uip_stat; +struct net_stats_s g_netstats; #endif /* Increasing number used for the IP ID field. */ diff --git a/nuttx/net/uip/uip_input.c b/nuttx/net/uip/uip_input.c index cb51cafff..557023202 100644 --- a/nuttx/net/uip/uip_input.c +++ b/nuttx/net/uip/uip_input.c @@ -88,6 +88,7 @@ #include <nuttx/net/netconfig.h> #include <nuttx/net/uip.h> #include <nuttx/net/netdev.h> +#include <nuttx/net/netstats.h> #ifdef CONFIG_NET_IPv6 # include "uip_neighbor.h" @@ -314,7 +315,7 @@ int uip_input(struct uip_driver_s *dev) /* This is where the input processing starts. */ #ifdef CONFIG_NET_STATISTICS - uip_stat.ip.recv++; + g_netstats.ip.recv++; #endif /* Start of IP input header processing code. */ @@ -327,8 +328,8 @@ int uip_input(struct uip_driver_s *dev) /* IP version and header length. */ #ifdef CONFIG_NET_STATISTICS - uip_stat.ip.drop++; - uip_stat.ip.vhlerr++; + g_netstats.ip.drop++; + g_netstats.ip.vhlerr++; #endif nlldbg("Invalid IPv6 version: %d\n", pbuf->vtc >> 4); goto drop; @@ -342,8 +343,8 @@ int uip_input(struct uip_driver_s *dev) /* IP version and header length. */ #ifdef CONFIG_NET_STATISTICS - uip_stat.ip.drop++; - uip_stat.ip.vhlerr++; + g_netstats.ip.drop++; + g_netstats.ip.vhlerr++; #endif nlldbg("Invalid IP version or header length: %02x\n", pbuf->vhl); goto drop; @@ -394,8 +395,8 @@ int uip_input(struct uip_driver_s *dev) } #else /* UIP_REASSEMBLY */ #ifdef CONFIG_NET_STATISTICS - uip_stat.ip.drop++; - uip_stat.ip.fragerr++; + g_netstats.ip.drop++; + g_netstats.ip.fragerr++; #endif nlldbg("IP fragment dropped\n"); goto drop; @@ -464,7 +465,7 @@ int uip_input(struct uip_driver_s *dev) #endif { #ifdef CONFIG_NET_STATISTICS - uip_stat.ip.drop++; + g_netstats.ip.drop++; #endif goto drop; } @@ -482,7 +483,7 @@ int uip_input(struct uip_driver_s *dev) pbuf->destipaddr[0] != 0xff02) { #ifdef CONFIG_NET_STATISTICS - uip_stat.ip.drop++; + g_netstats.ip.drop++; #endif goto drop; } @@ -495,8 +496,8 @@ int uip_input(struct uip_driver_s *dev) /* Compute and check the IP header checksum. */ #ifdef CONFIG_NET_STATISTICS - uip_stat.ip.drop++; - uip_stat.ip.chkerr++; + g_netstats.ip.drop++; + g_netstats.ip.chkerr++; #endif nlldbg("Bad IP checksum\n"); goto drop; @@ -545,8 +546,8 @@ int uip_input(struct uip_driver_s *dev) default: /* Unrecognized/unsupported protocol */ #ifdef CONFIG_NET_STATISTICS - uip_stat.ip.drop++; - uip_stat.ip.protoerr++; + g_netstats.ip.drop++; + g_netstats.ip.protoerr++; #endif nlldbg("Unrecognized IP protocol\n"); |