diff options
-rw-r--r-- | apps/nshlib/nsh_netcmds.c | 143 | ||||
-rw-r--r-- | nuttx/include/nuttx/net/ip.h | 32 | ||||
-rw-r--r-- | nuttx/include/nuttx/net/netstats.h | 37 | ||||
-rw-r--r-- | nuttx/net/devif/ipv4_input.c | 20 | ||||
-rw-r--r-- | nuttx/net/devif/ipv6_input.c | 12 | ||||
-rw-r--r-- | nuttx/net/icmp/icmp_input.c | 2 | ||||
-rw-r--r-- | nuttx/net/icmp/icmp_send.c | 2 | ||||
-rw-r--r-- | nuttx/net/icmpv6/icmpv6_input.c | 2 | ||||
-rw-r--r-- | nuttx/net/icmpv6/icmpv6_ping.c | 2 | ||||
-rw-r--r-- | nuttx/net/icmpv6/icmpv6_send.c | 2 | ||||
-rw-r--r-- | nuttx/net/icmpv6/icmpv6_solicit.c | 2 | ||||
-rw-r--r-- | nuttx/net/igmp/igmp_send.c | 4 | ||||
-rw-r--r-- | nuttx/net/tcp/tcp_send.c | 9 | ||||
-rw-r--r-- | nuttx/net/udp/udp_send.c | 9 |
14 files changed, 194 insertions, 84 deletions
diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c index f1ebe6625..11286c367 100644 --- a/apps/nshlib/nsh_netcmds.c +++ b/apps/nshlib/nsh_netcmds.c @@ -273,107 +273,184 @@ errout: #if defined(CONFIG_NET_STATISTICS) && !defined(CONFIG_NSH_DISABLE_IFCONFIG) static inline void net_statistics(FAR struct nsh_vtbl_s *vtbl) { - nsh_output(vtbl, " IP "); + /* Headings */ + + nsh_output(vtbl, " "); +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " IPv4"); +#endif +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " IPv6"); +#endif #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " TCP"); + nsh_output(vtbl, " TCP"); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " UDP"); + nsh_output(vtbl, " UDP"); #endif #ifdef CONFIG_NET_ICMP nsh_output(vtbl, " ICMP"); #endif +#ifdef CONFIG_NET_ICMPv6 + nsh_output(vtbl, " ICMP6"); +#endif nsh_output(vtbl, "\n"); /* Received packets */ - nsh_output(vtbl, "Received %04x", g_netstats.ip.recv); + nsh_output(vtbl, "Received "); +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " %04x", g_netstats.ipv4.recv); +#endif +#ifdef CONFIG_NET_IPv6 + nsh_output(vtbl, " %04x", g_netstats.ipv6.recv); +#endif #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " %04x", g_netstats.tcp.recv); + nsh_output(vtbl, " %04x", g_netstats.tcp.recv); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " %04x", g_netstats.udp.recv); + nsh_output(vtbl, " %04x", g_netstats.udp.recv); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " %04x", g_netstats.icmp.recv); + nsh_output(vtbl, " %04x", g_netstats.icmp.recv); +#endif +#ifdef CONFIG_NET_ICMPv6 + nsh_output(vtbl, " %04x", g_netstats.icmpv6.recv); #endif nsh_output(vtbl, "\n"); /* Dropped packets */ - nsh_output(vtbl, "Dropped %04x", g_netstats.ip.drop); + nsh_output(vtbl, "Dropped "); +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " %04x", g_netstats.ipv4.drop); +#endif +#ifdef CONFIG_NET_IPv6 + nsh_output(vtbl, " %04x", g_netstats.ipv6.drop); +#endif #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " %04x", g_netstats.tcp.drop); + nsh_output(vtbl, " %04x", g_netstats.tcp.drop); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " %04x", g_netstats.udp.drop); + nsh_output(vtbl, " %04x", g_netstats.udp.drop); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " %04x", g_netstats.icmp.drop); + nsh_output(vtbl, " %04x", g_netstats.icmp.drop); +#endif +#ifdef CONFIG_NET_ICMPv6 + nsh_output(vtbl, " %04x", g_netstats.icmpv6.drop); #endif nsh_output(vtbl, "\n"); - nsh_output(vtbl, " IP VHL: %04x HBL: %04x\n", - g_netstats.ip.vhlerr, g_netstats.ip.hblenerr); - nsh_output(vtbl, " LBL: %04x Frg: %04x\n", - g_netstats.ip.lblenerr, g_netstats.ip.fragerr); + /* Dropped IP packets */ + +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " IPv4 VHL: %04x Frg: %04x\n", + g_netstats.ipv4.vhlerr, g_netstats.ipv4.fragerr); +#endif +#ifdef CONFIG_NET_IPv6 + nsh_output(vtbl, " IPv6 VHL: %04x\n", + g_netstats.ipv6.vhlerr); +#endif + + /* Checksum errors */ - nsh_output(vtbl, " Checksum %04x",g_netstats.ip.chkerr); + nsh_output(vtbl, " Checksum "); +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " %04x", g_netstats.ipv4.chkerr); +#endif +#ifdef CONFIG_NET_IPv6 + nsh_output(vtbl, " ----"); +#endif #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " %04x", g_netstats.tcp.chkerr); + nsh_output(vtbl, " %04x", g_netstats.tcp.chkerr); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " %04x", g_netstats.udp.chkerr); + nsh_output(vtbl, " %04x", g_netstats.udp.chkerr); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " ----"); + nsh_output(vtbl, " ----"); +#endif +#ifdef CONFIG_NET_ICMPv6 + nsh_output(vtbl, " ----"); #endif nsh_output(vtbl, "\n"); #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " TCP ACK: %04x SYN: %04x\n", + nsh_output(vtbl, " TCP ACK: %04x SYN: %04x\n", g_netstats.tcp.ackerr, g_netstats.tcp.syndrop); - nsh_output(vtbl, " RST: %04x %04x\n", + nsh_output(vtbl, " RST: %04x %04x\n", g_netstats.tcp.rst, g_netstats.tcp.synrst); #endif - nsh_output(vtbl, " Type %04x", g_netstats.ip.protoerr); + /* Prototype errors */ + + nsh_output(vtbl, " Type "); +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " %04x", g_netstats.ipv4.protoerr); +#endif +#ifdef CONFIG_NET_IPv6 + nsh_output(vtbl, " %04x", g_netstats.ipv6.protoerr); +#endif #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " ----"); + nsh_output(vtbl, " ----"); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " ----"); + nsh_output(vtbl, " ----"); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " %04x", g_netstats.icmp.typeerr); + nsh_output(vtbl, " %04x", g_netstats.icmp.typeerr); +#endif +#ifdef CONFIG_NET_ICMPv6 + nsh_output(vtbl, " %04x", g_netstats.icmpv6.typeerr); #endif nsh_output(vtbl, "\n"); /* Sent packets */ - nsh_output(vtbl, "Sent ----", g_netstats.ip.sent); + nsh_output(vtbl, "Sent "); +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " %04x", g_netstats.ipv4.sent); +#endif +#ifdef CONFIG_NET_IPv6 + nsh_output(vtbl, " %04x", g_netstats.ipv6.sent); +#endif #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " %04x", g_netstats.tcp.sent); + nsh_output(vtbl, " %04x", g_netstats.tcp.sent); #endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " %04x", g_netstats.udp.sent); + nsh_output(vtbl, " %04x", g_netstats.udp.sent); #endif #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " %04x", g_netstats.icmp.sent); + nsh_output(vtbl, " %04x", g_netstats.icmp.sent); +#endif +#ifdef CONFIG_NET_ICMPv6 + nsh_output(vtbl, " %04x", g_netstats.icmpv6.sent); #endif nsh_output(vtbl, "\n"); + /* TCP retransmissions */ + #ifdef CONFIG_NET_TCP - nsh_output(vtbl, " Rexmit ---- %04x", g_netstats.tcp.rexmit); + nsh_output(vtbl, " Rexmit "); +#ifdef CONFIG_NET_IPv4 + nsh_output(vtbl, " ----"); +#endif +#ifdef CONFIG_NET_IPv6 + nsh_output(vtbl, " ----"); +#endif #ifdef CONFIG_NET_UDP - nsh_output(vtbl, " ----"); + nsh_output(vtbl, " ----"); #endif + nsh_output(vtbl, " %04x", g_netstats.tcp.rexmit); #ifdef CONFIG_NET_ICMP - nsh_output(vtbl, " ----"); + nsh_output(vtbl, " ----"); #endif - nsh_output(vtbl, "\n"); +#ifdef CONFIG_NET_ICMPv6 + nsh_output(vtbl, " ----"); #endif nsh_output(vtbl, "\n"); +#endif /* CONFIG_NET_TCP */ } #else # define net_statistics(vtbl) diff --git a/nuttx/include/nuttx/net/ip.h b/nuttx/include/nuttx/net/ip.h index 795ce0478..b3a5e29dd 100644 --- a/nuttx/include/nuttx/net/ip.h +++ b/nuttx/include/nuttx/net/ip.h @@ -174,6 +174,38 @@ struct ipv6_hdr_s }; #endif /* CONFIG_NET_IPv6 */ +#ifdef CONFIG_NET_STATISTICS +#ifdef CONFIG_NET_IPv6 +struct ipv4_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 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 */ +}; +#endif /* CONFIG_NET_IPv6 */ + +#ifdef CONFIG_NET_IPv6 +struct ipv6_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 protoerr; /* Number of packets dropped since they + were neither ICMP, UDP nor TCP */ +}; +#endif /* CONFIG_NET_IPv6 */ +#endif /* CONFIG_NET_STATISTICS */ + /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/nuttx/include/nuttx/net/netstats.h b/nuttx/include/nuttx/net/netstats.h index 76f428756..3af439c96 100644 --- a/nuttx/include/nuttx/net/netstats.h +++ b/nuttx/include/nuttx/net/netstats.h @@ -50,6 +50,7 @@ #include <nuttx/net/netconfig.h> +#include <nuttx/net/ip.h> #ifdef CONFIG_NET_TCP # include <nuttx/net/tcp.h> #endif @@ -66,6 +67,8 @@ # include <nuttx/net/igmp.h> #endif +#ifdef CONFIG_NET_STATISTICS + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -74,33 +77,19 @@ * Public Type Definitions ****************************************************************************/ -/* The structure holding the uIP statistics that are gathered if +/* The structure holding the networking 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_IPv4 + struct ipv4_stats_s ipv4; /* IPv4 statistics */ +#endif + +#ifdef CONFIG_NET_IPv6 + struct ipv6_stats_s ipv6; /* IPv6 statistics */ +#endif #ifdef CONFIG_NET_ICMP struct icmp_stats_s icmp; /* ICMP statistics */ @@ -122,7 +111,6 @@ struct net_stats_s struct udp_stats_s udp; /* UDP statistics */ #endif }; -#endif /* CONFIG_NET_STATISTICS */ /**************************************************************************** * Public Data @@ -130,12 +118,11 @@ struct net_stats_s /* 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 /* CONFIG_NET_STATISTICS */ #endif /* __INCLUDE_NUTTX_NET_NETSTATS_H */ diff --git a/nuttx/net/devif/ipv4_input.c b/nuttx/net/devif/ipv4_input.c index fcdf1efd3..badd16546 100644 --- a/nuttx/net/devif/ipv4_input.c +++ b/nuttx/net/devif/ipv4_input.c @@ -321,7 +321,7 @@ int ipv4_input(FAR struct net_driver_s *dev) /* This is where the input processing starts. */ #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.recv++; + g_netstats.ipv4.recv++; #endif /* Start of IP input header processing code. */ @@ -332,8 +332,8 @@ int ipv4_input(FAR struct net_driver_s *dev) /* IP version and header length. */ #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.drop++; - g_netstats.ip.vhlerr++; + g_netstats.ipv4.drop++; + g_netstats.ipv4.vhlerr++; #endif nlldbg("Invalid IP version or header length: %02x\n", pbuf->vhl); goto drop; @@ -369,8 +369,8 @@ int ipv4_input(FAR struct net_driver_s *dev) } #else /* CONFIG_NET_TCP_REASSEMBLY */ #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.drop++; - g_netstats.ip.fragerr++; + g_netstats.ipv4.drop++; + g_netstats.ipv4.fragerr++; #endif nlldbg("IP fragment dropped\n"); goto drop; @@ -435,7 +435,7 @@ int ipv4_input(FAR struct net_driver_s *dev) #endif { #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.drop++; + g_netstats.ipv4.drop++; #endif goto drop; } @@ -447,8 +447,8 @@ int ipv4_input(FAR struct net_driver_s *dev) /* Compute and check the IP header checksum. */ #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.drop++; - g_netstats.ip.chkerr++; + g_netstats.ipv4.drop++; + g_netstats.ipv4.chkerr++; #endif nlldbg("Bad IP checksum\n"); goto drop; @@ -494,8 +494,8 @@ int ipv4_input(FAR struct net_driver_s *dev) default: /* Unrecognized/unsupported protocol */ #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.drop++; - g_netstats.ip.protoerr++; + g_netstats.ipv4.drop++; + g_netstats.ipv4.protoerr++; #endif nlldbg("Unrecognized IP protocol\n"); diff --git a/nuttx/net/devif/ipv6_input.c b/nuttx/net/devif/ipv6_input.c index a613f1975..680a54371 100644 --- a/nuttx/net/devif/ipv6_input.c +++ b/nuttx/net/devif/ipv6_input.c @@ -147,7 +147,7 @@ int ipv6_input(FAR struct net_driver_s *dev) /* This is where the input processing starts. */ #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.recv++; + g_netstats.ipv6.recv++; #endif /* Start of IP input header processing code. */ @@ -158,8 +158,8 @@ int ipv6_input(FAR struct net_driver_s *dev) /* IP version and header length. */ #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.drop++; - g_netstats.ip.vhlerr++; + g_netstats.ipv6.drop++; + g_netstats.ipv6.vhlerr++; #endif nlldbg("Invalid IPv6 version: %d\n", ipv6->vtc >> 4); @@ -245,7 +245,7 @@ int ipv6_input(FAR struct net_driver_s *dev) ipv6->destipaddr[0] != HTONS(0xff02)) { #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.drop++; + g_netstats.ipv6.drop++; #endif goto drop; } @@ -283,8 +283,8 @@ int ipv6_input(FAR struct net_driver_s *dev) default: /* Unrecognized/unsupported protocol */ #ifdef CONFIG_NET_STATISTICS - g_netstats.ip.drop++; - g_netstats.ip.protoerr++; + g_netstats.ipv6.drop++; + g_netstats.ipv6.protoerr++; #endif nlldbg("Unrecognized IP protocol: %04x\n", ipv6->proto); diff --git a/nuttx/net/icmp/icmp_input.c b/nuttx/net/icmp/icmp_input.c index ada65595f..db39e8356 100644 --- a/nuttx/net/icmp/icmp_input.c +++ b/nuttx/net/icmp/icmp_input.c @@ -173,7 +173,7 @@ void icmp_input(FAR struct net_driver_s *dev) #ifdef CONFIG_NET_STATISTICS g_netstats.icmp.sent++; - g_netstats.ip.sent++; + g_netstats.ipv4.sent++; #endif } diff --git a/nuttx/net/icmp/icmp_send.c b/nuttx/net/icmp/icmp_send.c index 520fb9035..e96624274 100644 --- a/nuttx/net/icmp/icmp_send.c +++ b/nuttx/net/icmp/icmp_send.c @@ -148,7 +148,7 @@ void icmp_send(FAR struct net_driver_s *dev, FAR in_addr_t *destaddr) #ifdef CONFIG_NET_STATISTICS g_netstats.icmp.sent++; - g_netstats.ip.sent++; + g_netstats.ipv4.sent++; #endif } } diff --git a/nuttx/net/icmpv6/icmpv6_input.c b/nuttx/net/icmpv6/icmpv6_input.c index db808a5ce..99ec16783 100644 --- a/nuttx/net/icmpv6/icmpv6_input.c +++ b/nuttx/net/icmpv6/icmpv6_input.c @@ -326,7 +326,7 @@ void icmpv6_input(FAR struct net_driver_s *dev) #ifdef CONFIG_NET_STATISTICS g_netstats.icmpv6.sent++; - g_netstats.ip.sent++; + g_netstats.ipv6.sent++; #endif return; diff --git a/nuttx/net/icmpv6/icmpv6_ping.c b/nuttx/net/icmpv6/icmpv6_ping.c index f389bcca1..22dea3b69 100644 --- a/nuttx/net/icmpv6/icmpv6_ping.c +++ b/nuttx/net/icmpv6/icmpv6_ping.c @@ -229,7 +229,7 @@ static void icmpv6_echo_request(FAR struct net_driver_s *dev, #ifdef CONFIG_NET_STATISTICS g_netstats.icmpv6.sent++; - g_netstats.ip.sent++; + g_netstats.ipv6.sent++; #endif } diff --git a/nuttx/net/icmpv6/icmpv6_send.c b/nuttx/net/icmpv6/icmpv6_send.c index 0464aa274..1f39e7614 100644 --- a/nuttx/net/icmpv6/icmpv6_send.c +++ b/nuttx/net/icmpv6/icmpv6_send.c @@ -137,7 +137,7 @@ void icmpv6_send(FAR struct net_driver_s *dev, FAR net_ipv6addr_t *destaddr) #ifdef CONFIG_NET_STATISTICS g_netstats.icmpv6.sent++; - g_netstats.ip.sent++; + g_netstats.ipv6.sent++; #endif } } diff --git a/nuttx/net/icmpv6/icmpv6_solicit.c b/nuttx/net/icmpv6/icmpv6_solicit.c index 6e23119e0..01afa1953 100644 --- a/nuttx/net/icmpv6/icmpv6_solicit.c +++ b/nuttx/net/icmpv6/icmpv6_solicit.c @@ -223,7 +223,7 @@ void icmpv6_solicit(FAR struct net_driver_s *dev, #ifdef CONFIG_NET_STATISTICS g_netstats.icmpv6.sent++; - g_netstats.ip.sent++; + g_netstats.ipv6.sent++; #endif } diff --git a/nuttx/net/igmp/igmp_send.c b/nuttx/net/igmp/igmp_send.c index 4ec191b5d..ad1fe8f8e 100644 --- a/nuttx/net/igmp/igmp_send.c +++ b/nuttx/net/igmp/igmp_send.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/igmp/igmp_send.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -175,7 +175,7 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group, IGMPBUF->chksum = ~igmp_chksum(&IGMPBUF->type, IPIGMP_HDRLEN); IGMP_STATINCR(g_netstats.igmp.poll_send); - IGMP_STATINCR(g_netstats.ip.sent); + IGMP_STATINCR(g_netstats.ipv4.sent); nllvdbg("Outgoing IGMP packet length: %d (%d)\n", dev->d_len, (IGMPBUF->len[0] << 8) | IGMPBUF->len[1]); diff --git a/nuttx/net/tcp/tcp_send.c b/nuttx/net/tcp/tcp_send.c index 4d96dc4c0..536cf2dc4 100644 --- a/nuttx/net/tcp/tcp_send.c +++ b/nuttx/net/tcp/tcp_send.c @@ -176,6 +176,10 @@ static inline void tcp_ipv4_sendcomplete(FAR struct net_driver_s *dev, ipv4->ipchksum = ~ipv4_chksum(dev); nllvdbg("IPv4 length: %d\n", ((int)ipv4->len[0] << 8) + ipv4->len[1]); + +#ifdef CONFIG_NET_STATISTICS + g_netstats.ipv4.sent++; +#endif } #endif /* CONFIG_NET_IPv4 */ @@ -235,6 +239,10 @@ static inline void tcp_ipv6_sendcomplete(FAR struct net_driver_s *dev, ipv6->flow = 0x00; nllvdbg("IPv6 length: %d\n", ((int)ipv6->len[0] << 8) + ipv6->len[1]); + +#ifdef CONFIG_NET_STATISTICS + g_netstats.ipv6.sent++; +#endif } #endif /* CONFIG_NET_IPv6 */ @@ -281,7 +289,6 @@ static void tcp_sendcomplete(FAR struct net_driver_s *dev, #ifdef CONFIG_NET_STATISTICS g_netstats.tcp.sent++; - g_netstats.ip.sent++; #endif } diff --git a/nuttx/net/udp/udp_send.c b/nuttx/net/udp/udp_send.c index b6ef3bd76..249986bb7 100644 --- a/nuttx/net/udp/udp_send.c +++ b/nuttx/net/udp/udp_send.c @@ -156,6 +156,10 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) ipv4->ipchksum = 0; ipv4->ipchksum = ~ipv4_chksum(dev); + +#ifdef CONFIG_NET_STATISTICS + g_netstats.ipv4.sent++; +#endif } #endif /* CONFIG_NET_IPv4 */ @@ -198,6 +202,10 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) */ dev->d_len += IPv6_HDRLEN; + +#ifdef CONFIG_NET_STATISTICS + g_netstats.ipv6.sent++; +#endif } #endif /* CONFIG_NET_IPv6 */ @@ -239,7 +247,6 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) #ifdef CONFIG_NET_STATISTICS g_netstats.udp.sent++; - g_netstats.ip.sent++; #endif } } |