NET: Move statistcs from uip.h to new netstats.h to remove nasty circular inclusion problem.

This commit is contained in:
Gregory Nutt
2014-06-26 09:32:39 -06:00
parent 7bc244ec72
commit e1091251e6
60 changed files with 307 additions and 162 deletions
+1 -1
View File
@@ -384,7 +384,7 @@ o Kernel Build
ps sched_foreach() ps sched_foreach()
ifup netdev_foreach() ifup netdev_foreach()
ifdown netdev_foreach() ifdown netdev_foreach()
ifconfig netdev_foreach(), uip_stat() ifconfig netdev_foreach(), g_netstats
ping uip_ping() ping uip_ping()
Status: Open Status: Open
+4 -4
View File
@@ -180,10 +180,10 @@ struct icmp_iphdr_s
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
struct icmp_stats_s struct icmp_stats_s
{ {
uip_stats_t drop; /* Number of dropped ICMP packets */ net_stats_t drop; /* Number of dropped ICMP packets */
uip_stats_t recv; /* Number of received ICMP packets */ net_stats_t recv; /* Number of received ICMP packets */
uip_stats_t sent; /* Number of sent ICMP packets */ net_stats_t sent; /* Number of sent ICMP packets */
uip_stats_t typeerr; /* Number of ICMP packets with a wrong type */ net_stats_t typeerr; /* Number of ICMP packets with a wrong type */
}; };
#endif #endif
+12 -11
View File
@@ -56,6 +56,7 @@
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/netconfig.h>
#ifdef CONFIG_NET_IGMP #ifdef CONFIG_NET_IGMP
@@ -180,17 +181,17 @@ struct igmp_iphdr_s
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
struct igmp_stats_s struct igmp_stats_s
{ {
uint32_t length_errors; net_stats_t length_errors;
uint32_t chksum_errors; net_stats_t chksum_errors;
uint32_t v1_received; net_stats_t v1_received;
uint32_t joins; net_stats_t joins;
uint32_t leaves; net_stats_t leaves;
uint32_t leave_sched; net_stats_t leave_sched;
uint32_t report_sched; net_stats_t report_sched;
uint32_t poll_send; net_stats_t poll_send;
uint32_t ucast_query; net_stats_t ucast_query;
uint32_t query_received; net_stats_t query_received;
uint32_t report_received; net_stats_t report_received;
}; };
# define IGMP_STATINCR(p) ((p)++) # define IGMP_STATINCR(p) ((p)++)
+1 -1
View File
@@ -302,6 +302,6 @@
* uIP. * uIP.
*/ */
typedef uint16_t uip_stats_t; typedef uint16_t net_stats_t;
#endif /* __INCLUDE_NUTTX_NET_NETCONFG_H */ #endif /* __INCLUDE_NUTTX_NET_NETCONFG_H */
+137
View File
@@ -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 */
+9 -9
View File
@@ -316,16 +316,16 @@ struct tcp_backlog_s
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
struct tcp_stats_s struct tcp_stats_s
{ {
uip_stats_t drop; /* Number of dropped TCP segments */ net_stats_t drop; /* Number of dropped TCP segments */
uip_stats_t recv; /* Number of received TCP segments */ net_stats_t recv; /* Number of received TCP segments */
uip_stats_t sent; /* Number of sent TCP segments */ net_stats_t sent; /* Number of sent TCP segments */
uip_stats_t chkerr; /* Number of TCP segments with a bad checksum */ net_stats_t chkerr; /* Number of TCP segments with a bad checksum */
uip_stats_t ackerr; /* Number of TCP segments with a bad ACK number */ net_stats_t ackerr; /* Number of TCP segments with a bad ACK number */
uip_stats_t rst; /* Number of received TCP RST (reset) segments */ net_stats_t rst; /* Number of received TCP RST (reset) segments */
uip_stats_t rexmit; /* Number of retransmitted TCP segments */ net_stats_t rexmit; /* Number of retransmitted TCP segments */
uip_stats_t syndrop; /* Number of dropped SYNs due to too few net_stats_t syndrop; /* Number of dropped SYNs due to too few
available connections */ 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 #endif
+4 -4
View File
@@ -134,10 +134,10 @@ struct udp_iphdr_s
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
struct udp_stats_s struct udp_stats_s
{ {
uip_stats_t drop; /* Number of dropped UDP segments */ net_stats_t drop; /* Number of dropped UDP segments */
uip_stats_t recv; /* Number of recived UDP segments */ net_stats_t recv; /* Number of recived UDP segments */
uip_stats_t sent; /* Number of sent UDP segments */ net_stats_t sent; /* Number of sent UDP segments */
uip_stats_t chkerr; /* Number of UDP segments with a bad checksum */ net_stats_t chkerr; /* Number of UDP segments with a bad checksum */
}; };
#endif #endif
+1 -71
View File
@@ -226,80 +226,10 @@ struct uip_callback_s
uint16_t flags; 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 * 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 * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
@@ -308,7 +238,7 @@ extern struct uip_stats uip_stat;
* *
* The uIP initialization functions are used for booting uIP. * 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. * TCP/IP stack.
*/ */
+2
View File
@@ -51,6 +51,8 @@
#include <arch/irq.h> #include <arch/irq.h>
#include <nuttx/net/tcp.h>
#include "net.h" #include "net.h"
/**************************************************************************** /****************************************************************************
+2
View File
@@ -67,6 +67,8 @@
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/arp.h> #include <nuttx/net/arp.h>
#include "net_route.h"
#ifdef CONFIG_NET_ARP #ifdef CONFIG_NET_ARP
/**************************************************************************** /****************************************************************************
+4
View File
@@ -49,6 +49,10 @@
# include <netpacket/packet.h> # include <netpacket/packet.h>
#endif #endif
#include <nuttx/net/tcp.h>
#include <nuttx/net/udp.h>
#include <nuttx/net/pkt.h>
#include "net.h" #include "net.h"
#include "tcp/tcp.h" #include "tcp/tcp.h"
#include "udp/udp.h" #include "udp/udp.h"
+2
View File
@@ -49,6 +49,8 @@
#include <arch/irq.h> #include <arch/irq.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include <nuttx/net/udp.h>
#include "net.h" #include "net.h"
#include "uip/uip.h" #include "uip/uip.h"
+2
View File
@@ -47,6 +47,8 @@
#include <nuttx/net/net.h> #include <nuttx/net/net.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include <nuttx/net/udp.h>
#include "net.h" #include "net.h"
+10 -9
View File
@@ -52,6 +52,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/netstats.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "icmp/icmp.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; FAR struct icmp_iphdr_s *picmp = ICMPBUF;
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.icmp.recv++; g_netstats.icmp.recv++;
#endif #endif
#ifndef CONFIG_NET_IPv6 #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]); dev->d_len, (picmp->len[0] << 8) | picmp->len[1]);
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.icmp.sent++; g_netstats.icmp.sent++;
uip_stat.ip.sent++; g_netstats.ip.sent++;
#endif #endif
} }
@@ -199,8 +200,8 @@ void icmp_input(FAR struct uip_driver_s *dev)
typeerr: typeerr:
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.icmp.typeerr++; g_netstats.icmp.typeerr++;
uip_stat.icmp.drop++; g_netstats.icmp.drop++;
#endif #endif
dev->d_len = 0; dev->d_len = 0;
@@ -295,19 +296,19 @@ typeerr:
dev->d_len, (picmp->len[0] << 8) | picmp->len[1]); dev->d_len, (picmp->len[0] << 8) | picmp->len[1]);
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.icmp.sent++; g_netstats.icmp.sent++;
uip_stat.ip.sent++; g_netstats.ip.sent++;
#endif #endif
return; return;
typeerr: typeerr:
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.icmp.typeerr++; g_netstats.icmp.typeerr++;
#endif #endif
drop: drop:
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.icmp.drop++; g_netstats.icmp.drop++;
#endif #endif
dev->d_len = 0; dev->d_len = 0;
+1
View File
@@ -52,6 +52,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/icmp.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "icmp/icmp.h" #include "icmp/icmp.h"
+1
View File
@@ -45,6 +45,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/icmp.h>
#include "uip/uip.h" #include "uip/uip.h"
+3 -2
View File
@@ -45,6 +45,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/netstats.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "icmp/icmp.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]); dev->d_len, (picmp->len[0] << 8) | picmp->len[1]);
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.icmp.sent++; g_netstats.icmp.sent++;
uip_stat.ip.sent++; g_netstats.ip.sent++;
#endif #endif
} }
} }
+8 -7
View File
@@ -50,6 +50,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/igmp.h> #include <nuttx/net/igmp.h>
#include <nuttx/net/netstats.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "igmp/igmp.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) 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"); nlldbg("Length error\n");
return; return;
} }
@@ -134,7 +135,7 @@ void igmp_input(struct uip_driver_s *dev)
if (uip_chksum((uint16_t*)&IGMPBUF->type, UIP_IGMPH_LEN) != 0) 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"); nlldbg("Checksum error\n");
return; return;
} }
@@ -191,13 +192,13 @@ void igmp_input(struct uip_driver_s *dev)
nllvdbg("General multicast query\n"); nllvdbg("General multicast query\n");
if (IGMPBUF->maxresp == 0) if (IGMPBUF->maxresp == 0)
{ {
IGMP_STATINCR(uip_stat.igmp.v1_received); IGMP_STATINCR(g_netstats.igmp.v1_received);
IGMPBUF->maxresp = 10; IGMPBUF->maxresp = 10;
nlldbg("V1 not implemented\n"); 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; for (member = (FAR struct igmp_group_s *)dev->grplist.head;
member; member;
member = member->next) member = member->next)
@@ -224,7 +225,7 @@ void igmp_input(struct uip_driver_s *dev)
* Use the incoming IPaddress! * Use the incoming IPaddress!
*/ */
IGMP_STATINCR(uip_stat.igmp.ucast_query); IGMP_STATINCR(g_netstats.igmp.ucast_query);
grpaddr = uip_ip4addr_conv(IGMPBUF->grpaddr); grpaddr = uip_ip4addr_conv(IGMPBUF->grpaddr);
group = igmp_grpallocfind(dev, &grpaddr); group = igmp_grpallocfind(dev, &grpaddr);
ticks = igmp_decisec2tick((int)IGMPBUF->maxresp); ticks = igmp_decisec2tick((int)IGMPBUF->maxresp);
@@ -241,7 +242,7 @@ void igmp_input(struct uip_driver_s *dev)
else if (group->grpaddr != 0) else if (group->grpaddr != 0)
{ {
nllvdbg("Unicast query\n"); 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"); 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"); nllvdbg("Membership report\n");
IGMP_STATINCR(uip_stat.igmp.report_received); IGMP_STATINCR(g_netstats.igmp.report_received);
if (!IS_IDLEMEMBER(group->flags)) if (!IS_IDLEMEMBER(group->flags))
{ {
/* This is on a specific group we have already looked up */ /* This is on a specific group we have already looked up */
+3 -2
View File
@@ -48,6 +48,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netstats.h>
#include <nuttx/net/igmp.h> #include <nuttx/net/igmp.h>
#include "uip/uip.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); nvdbg("Join to new group: %08x\n", grpaddr->s_addr);
group = igmp_grpalloc(dev, &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 */ /* Send the Membership Report */
IGMP_STATINCR(uip_stat.igmp.report_sched); IGMP_STATINCR(g_netstats.igmp.report_sched);
igmp_waitmsg(group, IGMPv2_MEMBERSHIP_REPORT); igmp_waitmsg(group, IGMPv2_MEMBERSHIP_REPORT);
/* And start the timer at 10*100 msec */ /* And start the timer at 10*100 msec */
+3 -2
View File
@@ -49,6 +49,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netstats.h>
#include <nuttx/net/igmp.h> #include <nuttx/net/igmp.h>
#include "uip/uip.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); CLR_WAITMSG(group->flags);
uip_unlock(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 */ /* Send a leave if the flag is set according to the state diagram */
if (IS_LASTREPORT(group->flags)) if (IS_LASTREPORT(group->flags))
{ {
ndbg("Schedule Leave Group message\n"); 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); igmp_waitmsg(group, IGMP_LEAVE_GROUP);
} }
+1
View File
@@ -48,6 +48,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/igmp.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "igmp/igmp.h" #include "igmp/igmp.h"
+3 -2
View File
@@ -49,6 +49,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/netstats.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "igmp/igmp.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; dest = &group->grpaddr;
nllvdbg("Send IGMPv2_MEMBERSHIP_REPORT, dest=%08x flags=%02x\n", nllvdbg("Send IGMPv2_MEMBERSHIP_REPORT, dest=%08x flags=%02x\n",
*dest, group->flags); *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 */ SET_LASTREPORT(group->flags); /* Remember we were the last to report */
} }
else else
@@ -100,7 +101,7 @@ static inline void uip_schedsend(FAR struct uip_driver_s *dev, FAR struct igmp_g
dest = &g_allrouters; dest = &g_allrouters;
nllvdbg("Send IGMP_LEAVE_GROUP, dest=%08x flags=%02x\n", nllvdbg("Send IGMP_LEAVE_GROUP, dest=%08x flags=%02x\n",
*dest, group->flags); *dest, group->flags);
IGMP_STATINCR(uip_stat.igmp.leave_sched); IGMP_STATINCR(g_netstats.igmp.leave_sched);
} }
/* Send the message */ /* Send the message */
+3 -2
View File
@@ -45,6 +45,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/netstats.h>
#include <nuttx/net/ip.h> #include <nuttx/net/ip.h>
#include <nuttx/net/igmp.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 = 0;
IGMPBUF->chksum = ~igmp_chksum(&IGMPBUF->type, UIP_IPIGMPH_LEN); IGMPBUF->chksum = ~igmp_chksum(&IGMPBUF->type, UIP_IPIGMPH_LEN);
IGMP_STATINCR(uip_stat.igmp.poll_send); IGMP_STATINCR(g_netstats.igmp.poll_send);
IGMP_STATINCR(uip_stat.ip.sent); IGMP_STATINCR(g_netstats.ip.sent);
nllvdbg("Outgoing IGMP packet length: %d (%d)\n", nllvdbg("Outgoing IGMP packet length: %d (%d)\n",
dev->d_len, (IGMPBUF->len[0] << 8) | IGMPBUF->len[1]); dev->d_len, (IGMPBUF->len[0] << 8) | IGMPBUF->len[1]);
+2 -1
View File
@@ -50,6 +50,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netstats.h>
#include <nuttx/net/igmp.h> #include <nuttx/net/igmp.h>
#include "uip/uip.h" #include "uip/uip.h"
@@ -134,7 +135,7 @@ static void igmp_timeout(int argc, uint32_t arg, ...)
* for the message to be sent. * 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); igmp_schedmsg(group, IGMPv2_MEMBERSHIP_REPORT);
/* Also note: The Membership Report is sent at most two times becasue /* Also note: The Membership Report is sent at most two times becasue
+2
View File
@@ -44,6 +44,8 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/net/tcp.h>
#include "net.h" #include "net.h"
/**************************************************************************** /****************************************************************************
+2
View File
@@ -168,6 +168,8 @@ FAR struct socket *sockfd_socket(int sockfd);
/* net_connect.c *************************************************************/ /* net_connect.c *************************************************************/
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
struct tcp_conn_s; /* Forward reference */
int net_startmonitor(FAR struct socket *psock); int net_startmonitor(FAR struct socket *psock);
void net_stopmonitor(FAR struct tcp_conn_s *conn); void net_stopmonitor(FAR struct tcp_conn_s *conn);
void net_lostconnection(FAR struct socket *psock, uint16_t flags); void net_lostconnection(FAR struct socket *psock, uint16_t flags);
+2
View File
@@ -45,6 +45,8 @@
#include <debug.h> #include <debug.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/net/tcp.h>
#include <nuttx/net/udp.h>
#include "net.h" #include "net.h"
+3
View File
@@ -49,6 +49,9 @@
#include <arch/irq.h> #include <arch/irq.h>
#include <nuttx/net/netdev.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 #ifdef CONFIG_NET_SOLINGER
# include <nuttx/clock.h> # include <nuttx/clock.h>
+2
View File
@@ -44,6 +44,8 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/net/tcp.h>
#include "net.h" #include "net.h"
#include "uip/uip.h" #include "uip/uip.h"
+2
View File
@@ -51,8 +51,10 @@
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/net/iob.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/net.h> #include <nuttx/net/net.h>
#include <nuttx/net/tcp.h>
#include <uip/uip.h> #include <uip/uip.h>
+4 -2
View File
@@ -69,12 +69,14 @@ extern "C"
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * 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 ****************************************************/ /* Defined in pkt_conn.c ****************************************************/
void pkt_initialize(void); 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); 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 *pkt_active(FAR struct eth_hdr_s *buf);
struct pkt_conn_s *uip_nextpktconn(FAR struct pkt_conn_s *conn); struct pkt_conn_s *uip_nextpktconn(FAR struct pkt_conn_s *conn);
+1
View File
@@ -46,6 +46,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/pkt.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "pkt/pkt.h" #include "pkt/pkt.h"
+1
View File
@@ -54,6 +54,7 @@
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/arp.h> #include <nuttx/net/arp.h>
#include <nuttx/net/pkt.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "pkt/pkt.h" #include "pkt/pkt.h"
+1
View File
@@ -51,6 +51,7 @@
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/pkt.h> #include <nuttx/net/pkt.h>
#include <nuttx/net/arp.h> #include <nuttx/net/arp.h>
#include <nuttx/net/pkt.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "pkt/pkt.h" #include "pkt/pkt.h"
+1
View File
@@ -50,6 +50,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/udp.h>
#include <nuttx/net/pkt.h> #include <nuttx/net/pkt.h>
#include "uip/uip.h" #include "uip/uip.h"
+4
View File
@@ -54,7 +54,11 @@
#include <arch/irq.h> #include <arch/irq.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/net/iob.h>
#include <nuttx/net/netdev.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 "net.h"
#include "uip/uip.h" #include "uip/uip.h"
-1
View File
@@ -43,7 +43,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <nuttx/net/uip.h>
#include <nuttx/net/tcp.h> #include <nuttx/net/tcp.h>
#include "tcp/tcp.h" #include "tcp/tcp.h"
+1
View File
@@ -50,6 +50,7 @@
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/udp.h>
#include "net.h" #include "net.h"
#include "uip/uip.h" #include "uip/uip.h"
+4
View File
@@ -45,6 +45,10 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/net/tcp.h>
#include <nuttx/net/udp.h>
#include <nuttx/net/pkt.h>
#include "net.h" #include "net.h"
#include "tcp/tcp.h" #include "tcp/tcp.h"
#include "udp/udp.h" #include "udp/udp.h"
+2
View File
@@ -72,6 +72,8 @@ extern "C"
/* Defined in tcp_conn.c ****************************************************/ /* Defined in tcp_conn.c ****************************************************/
struct tcp_iphdr_s; /* Forward reference */
void tcp_initialize(void); void tcp_initialize(void);
struct tcp_conn_s *tcp_active(FAR struct tcp_iphdr_s *buf); struct tcp_conn_s *tcp_active(FAR struct tcp_iphdr_s *buf);
struct tcp_conn_s *uip_nexttcpconn(FAR struct tcp_conn_s *conn); struct tcp_conn_s *uip_nexttcpconn(FAR struct tcp_conn_s *conn);
+1
View File
@@ -51,6 +51,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "tcp/tcp.h" #include "tcp/tcp.h"
+4 -2
View File
@@ -48,6 +48,8 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include <nuttx/net/netstats.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "tcp/tcp.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); nllvdbg("Dropped %d bytes\n", dev->d_len);
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.syndrop++; g_netstats.tcp.syndrop++;
uip_stat.tcp.drop++; g_netstats.tcp.drop++;
#endif #endif
/* Clear the UIP_SNDACK bit so that no ACK will be sent */ /* Clear the UIP_SNDACK bit so that no ACK will be sent */
+1
View File
@@ -54,6 +54,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include "tcp/tcp.h" #include "tcp/tcp.h"
#include "uip/uip.h" #include "uip/uip.h"
+7 -5
View File
@@ -53,6 +53,8 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include <nuttx/net/netstats.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "tcp/tcp.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]; dev->d_appdata = &dev->d_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.recv++; g_netstats.tcp.recv++;
#endif #endif
/* Start of TCP input header processing code. */ /* 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. */ /* Compute and check the TCP checksum. */
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.drop++; g_netstats.tcp.drop++;
uip_stat.tcp.chkerr++; g_netstats.tcp.chkerr++;
#endif #endif
nlldbg("Bad TCP checksum\n"); nlldbg("Bad TCP checksum\n");
goto drop; goto drop;
@@ -202,7 +204,7 @@ void tcp_input(struct uip_driver_s *dev)
*/ */
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.syndrop++; g_netstats.tcp.syndrop++;
#endif #endif
nlldbg("No free TCP connections\n"); nlldbg("No free TCP connections\n");
goto drop; goto drop;
@@ -282,7 +284,7 @@ reset:
} }
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.synrst++; g_netstats.tcp.synrst++;
#endif #endif
tcp_reset(dev); tcp_reset(dev);
return; return;
+1
View File
@@ -49,6 +49,7 @@
#include <debug.h> #include <debug.h>
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/tcp.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "tcp/tcp.h" #include "tcp/tcp.h"
+1
View File
@@ -51,6 +51,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "tcp/tcp.h" #include "tcp/tcp.h"
+4 -3
View File
@@ -51,6 +51,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/netstats.h>
#include "uip/uip.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]); dev->d_len, (pbuf->len[0] << 8) | pbuf->len[1]);
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.sent++; g_netstats.tcp.sent++;
uip_stat.ip.sent++; g_netstats.ip.sent++;
#endif #endif
} }
@@ -267,7 +268,7 @@ void tcp_reset(FAR struct uip_driver_s *dev)
uint8_t seqbyte; uint8_t seqbyte;
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.rst++; g_netstats.tcp.rst++;
#endif #endif
pbuf->flags = TCP_RST | TCP_ACK; pbuf->flags = TCP_RST | TCP_ACK;
+1
View File
@@ -66,6 +66,7 @@
#include <nuttx/net/arp.h> #include <nuttx/net/arp.h>
#include <nuttx/net/iob.h> #include <nuttx/net/iob.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include "net.h" #include "net.h"
#include "tcp/tcp.h" #include "tcp/tcp.h"
+1
View File
@@ -54,6 +54,7 @@
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/net/arp.h> #include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include "net.h" #include "net.h"
#include "uip/uip.h" #include "uip/uip.h"
+3 -1
View File
@@ -51,6 +51,8 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/uip.h> #include <nuttx/net/uip.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/tcp.h>
#include <nuttx/net/netstats.h>
#include "uip/uip.h" #include "uip/uip.h"
#include "tcp/tcp.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 #ifdef CONFIG_NET_STATISTICS
uip_stat.tcp.rexmit++; g_netstats.tcp.rexmit++;
#endif #endif
switch(conn->tcpstateflags & UIP_TS_MASK) switch(conn->tcpstateflags & UIP_TS_MASK)
{ {

Some files were not shown because too many files have changed in this diff Show More