? core/Kopie von netif.c
Index: core/mem.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/mem.c,v
retrieving revision 1.60
diff -u -r1.60 mem.c
--- core/mem.c	27 Mar 2008 19:29:36 -0000	1.60
+++ core/mem.c	19 Jun 2008 17:36:10 -0000
@@ -277,9 +277,7 @@
   /* initialize the lowest-free pointer to the start of the heap */
   lfree = (struct mem *)ram;
 
-#if MEM_STATS
-  lwip_stats.mem.avail = MEM_SIZE_ALIGNED;
-#endif /* MEM_STATS */
+  MEM_STATS_AVAIL(avail, MEM_SIZE_ALIGNED);
 }
 
 /**
@@ -308,9 +306,7 @@
 
   if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) {
     LWIP_DEBUGF(MEM_DEBUG | 3, ("mem_free: illegal memory\n"));
-#if MEM_STATS
-    ++lwip_stats.mem.err;
-#endif /* MEM_STATS */
+    MEM_STATS_INC(err);
     LWIP_MEM_UNPROTECT();
     return;
   }
@@ -326,9 +322,7 @@
     lfree = mem;
   }
 
-#if MEM_STATS
-  lwip_stats.mem.used -= mem->next - ((u8_t *)mem - ram);
-#endif /* MEM_STATS */
+  MEM_STATS_DEC_USED(used, mem->next - ((u8_t *)mem - ram));
 
   /* finally, see if prev or next are free also */
   plug_holes(mem);
@@ -392,9 +386,7 @@
   /* protect the heap from concurrent access */
   LWIP_MEM_PROTECT();
 
-#if MEM_STATS
-  lwip_stats.mem.used -= (size - newsize);
-#endif /* MEM_STATS */
+  MEM_STATS_DEC_USED(used, (size - newsize));
 
   mem2 = (struct mem *)&ram[mem->next];
   if(mem2->used == 0) {
@@ -526,12 +518,7 @@
         if (mem2->next != MEM_SIZE_ALIGNED) {
           ((struct mem *)&ram[mem2->next])->prev = ptr2;
         }
-#if MEM_STATS
-        lwip_stats.mem.used += (size + SIZEOF_STRUCT_MEM);
-        if (lwip_stats.mem.max < lwip_stats.mem.used) {
-          lwip_stats.mem.max = lwip_stats.mem.used;
-        }
-#endif /* MEM_STATS */
+        MEM_STATS_INC_USED(used, (size + SIZEOF_STRUCT_MEM));
       } else {
         /* (a mem2 struct does no fit into the user data space of mem and mem->next will always
          * be used at this point: if not we have 2 unused structs in a row, plug_holes should have
@@ -541,12 +528,7 @@
          * will always be used at this point!
          */
         mem->used = 1;
-#if MEM_STATS
-        lwip_stats.mem.used += mem->next - ((u8_t *)mem - ram);
-        if (lwip_stats.mem.max < lwip_stats.mem.used) {
-          lwip_stats.mem.max = lwip_stats.mem.used;
-        }
-#endif /* MEM_STATS */
+        MEM_STATS_INC_USED(used, mem->next - ((u8_t *)mem - ram));
       }
 
       if (mem == lfree) {
@@ -568,9 +550,7 @@
     }
   }
   LWIP_DEBUGF(MEM_DEBUG | 2, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size));
-#if MEM_STATS
-  ++lwip_stats.mem.err;
-#endif /* MEM_STATS */
+  MEM_STATS_INC(err);
   LWIP_MEM_UNPROTECT();
   return NULL;
 }
Index: core/memp.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/memp.c,v
retrieving revision 1.55
diff -u -r1.55 memp.c
--- core/memp.c	25 Nov 2007 10:43:28 -0000	1.55
+++ core/memp.c	19 Jun 2008 17:44:12 -0000
@@ -252,13 +252,12 @@
   struct memp *memp;
   u16_t i, j;
 
-#if MEMP_STATS
   for (i = 0; i < MEMP_MAX; ++i) {
-    lwip_stats.memp[i].used = lwip_stats.memp[i].max =
-      lwip_stats.memp[i].err = 0;
-    lwip_stats.memp[i].avail = memp_num[i];
+    MEMP_STATS_AVAIL(used, i, 0);
+    MEMP_STATS_AVAIL(max, i, 0);
+    MEMP_STATS_AVAIL(err, i, 0);
+    MEMP_STATS_AVAIL(avail, i, memp_num[i]);
   }
-#endif /* MEMP_STATS */
 
   memp = LWIP_MEM_ALIGN(memp_memory);
   /* for every pool: */
@@ -315,20 +314,13 @@
     memp->file = file;
     memp->line = line;
 #endif /* MEMP_OVERFLOW_CHECK */
-#if MEMP_STATS
-    ++lwip_stats.memp[type].used;
-    if (lwip_stats.memp[type].used > lwip_stats.memp[type].max) {
-      lwip_stats.memp[type].max = lwip_stats.memp[type].used;
-    }
-#endif /* MEMP_STATS */
+    MEMP_STATS_INC_USED(used, type);
     LWIP_ASSERT("memp_malloc: memp properly aligned",
                 ((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
     memp = (struct memp*)((u8_t*)memp + MEMP_SIZE);
   } else {
     LWIP_DEBUGF(MEMP_DEBUG | 2, ("memp_malloc: out of memory in pool %s\n", memp_desc[type]));
-#if MEMP_STATS
-    ++lwip_stats.memp[type].err;
-#endif /* MEMP_STATS */
+    MEMP_STATS_INC(err, type);
   }
 
   SYS_ARCH_UNPROTECT(old_level);
@@ -365,9 +357,7 @@
 #endif /* MEMP_OVERFLOW_CHECK >= 2 */
 #endif /* MEMP_OVERFLOW_CHECK */
 
-#if MEMP_STATS
-  lwip_stats.memp[type].used--; 
-#endif /* MEMP_STATS */
+  MEMP_STATS_DEC(used, type); 
   
   memp->next = memp_tab[type]; 
   memp_tab[type] = memp;
Index: core/stats.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/stats.c,v
retrieving revision 1.27
diff -u -r1.27 stats.c
--- core/stats.c	4 Mar 2008 16:31:32 -0000	1.27
+++ core/stats.c	19 Jun 2008 17:48:57 -0000
@@ -54,7 +54,6 @@
 {
   LWIP_PLATFORM_DIAG(("\n%s\n\t", name));
   LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit)); 
-  LWIP_PLATFORM_DIAG(("rexmit: %"STAT_COUNTER_F"\n\t", proto->rexmit)); 
   LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv)); 
   LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw)); 
   LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop)); 
@@ -68,6 +67,7 @@
   LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit)); 
 }
 
+#if IGMP_STATS
 void
 stats_display_igmp(struct stats_igmp *igmp)
 {
@@ -82,7 +82,9 @@
   LWIP_PLATFORM_DIAG(("report_rxed: %"STAT_COUNTER_F"\n\t", igmp->report_rxed)); 
   LWIP_PLATFORM_DIAG(("group_query_rxed: %"STAT_COUNTER_F"\n", igmp->group_query_rxed));
 }
+#endif /* IGMP_STATS */
 
+#if MEM_STATS || MEMP_STATS
 void
 stats_display_mem(struct stats_mem *mem, char *name)
 {
@@ -93,48 +95,53 @@
   LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err));
 }
 
+#if MEMP_STATS
 void
-stats_display(void)
+stats_display_memp(struct stats_mem *mem, int index)
 {
-#if MEMP_STATS
-  s16_t i;
   char * memp_names[] = {
 #define LWIP_MEMPOOL(name,num,size,desc) desc,
 #include "lwip/memp_std.h"
   };
-#endif
-#if LINK_STATS
-  stats_display_proto(&lwip_stats.link, "LINK");
-#endif
-#if ETHARP_STATS
-  stats_display_proto(&lwip_stats.etharp, "ETHARP");
-#endif
-#if IPFRAG_STATS
-  stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG");
-#endif
-#if IP_STATS
-  stats_display_proto(&lwip_stats.ip, "IP");
-#endif
-#if ICMP_STATS
-  stats_display_proto(&lwip_stats.icmp, "ICMP");
-#endif
-#if IGMP_STATS
-  stats_display_igmp(&lwip_stats.igmp);
-#endif
-#if UDP_STATS
-  stats_display_proto(&lwip_stats.udp, "UDP");
-#endif
-#if TCP_STATS
-  stats_display_proto(&lwip_stats.tcp, "TCP");
-#endif
-#if MEM_STATS
-  stats_display_mem(&lwip_stats.mem, "HEAP");
-#endif
-#if MEMP_STATS
+  if(index < MEMP_MAX) {
+    stats_display_mem(mem, memp_names[index]);
+  }
+}
+#endif /* MEMP_STATS */
+#endif /* MEM_STATS || MEMP_STATS */
+
+#if SYS_STATS
+void
+stats_display_sys(struct stats_sys *sys)
+{
+  LWIP_PLATFORM_DIAG(("\nSYS\n\t"));
+  LWIP_PLATFORM_DIAG(("sem.used: %"U32_F"\n\t", (u32_t)sys->sem.used)); 
+  LWIP_PLATFORM_DIAG(("sem.max:  %"U32_F"\n\t", (u32_t)sys->sem.max)); 
+  LWIP_PLATFORM_DIAG(("sem.err:  %"U32_F"\n\t", (u32_t)sys->sem.err)); 
+  LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F"\n\t", (u32_t)sys->mbox.used)); 
+  LWIP_PLATFORM_DIAG(("mbox.max:  %"U32_F"\n\t", (u32_t)sys->mbox.max)); 
+  LWIP_PLATFORM_DIAG(("mbox.err:  %"U32_F"\n\t", (u32_t)sys->mbox.err)); 
+}
+#endif /* SYS_STATS */
+
+void
+stats_display(void)
+{
+  s16_t i;
+
+  LINK_STATS_DISPLAY();
+  ETHARP_STATS_DISPLAY();
+  IPFRAG_STATS_DISPLAY();
+  IP_STATS_DISPLAY();
+  IGMP_STATS_DISPLAY();
+  ICMP_STATS_DISPLAY();
+  UDP_STATS_DISPLAY();
+  TCP_STATS_DISPLAY();
+  MEM_STATS_DISPLAY();
   for (i = 0; i < MEMP_MAX; i++) {
-    stats_display_mem(&lwip_stats.memp[i], memp_names[i]);
+    MEMP_STATS_DISPLAY(i);
   }
-#endif
+  SYS_STATS_DISPLAY();
 }
 #endif /* LWIP_STATS_DISPLAY */
 
Index: core/tcp_in.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/tcp_in.c,v
retrieving revision 1.99
diff -u -r1.99 tcp_in.c
--- core/tcp_in.c	30 May 2008 12:21:29 -0000	1.99
+++ core/tcp_in.c	19 Jun 2008 16:59:49 -0000
@@ -99,7 +99,7 @@
 
   PERF_START;
 
-  TCP_STATS_INC(tcp.recv);
+  TCP_STATS_INC(recv);
   snmp_inc_tcpinsegs();
 
   iphdr = p->payload;
@@ -113,8 +113,8 @@
   if (pbuf_header(p, -((s16_t)(IPH_HL(iphdr) * 4))) || (p->tot_len < sizeof(struct tcp_hdr))) {
     /* drop short packets */
     LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: short packet (%"U16_F" bytes) discarded\n", p->tot_len));
-    TCP_STATS_INC(tcp.lenerr);
-    TCP_STATS_INC(tcp.drop);
+    TCP_STATS_INC(lenerr);
+    TCP_STATS_INC(drop);
     snmp_inc_tcpinerrs();
     pbuf_free(p);
     return;
@@ -123,8 +123,8 @@
   /* Don't even process incoming broadcasts/multicasts. */
   if (ip_addr_isbroadcast(&(iphdr->dest), inp) ||
       ip_addr_ismulticast(&(iphdr->dest))) {
-    TCP_STATS_INC(tcp.proterr);
-    TCP_STATS_INC(tcp.drop);
+    TCP_STATS_INC(proterr);
+    TCP_STATS_INC(drop);
     snmp_inc_tcpinerrs();
     pbuf_free(p);
     return;
@@ -141,8 +141,8 @@
 #if TCP_DEBUG
     tcp_debug_print(tcphdr);
 #endif /* TCP_DEBUG */
-    TCP_STATS_INC(tcp.chkerr);
-    TCP_STATS_INC(tcp.drop);
+    TCP_STATS_INC(chkerr);
+    TCP_STATS_INC(drop);
     snmp_inc_tcpinerrs();
     pbuf_free(p);
     return;
@@ -155,8 +155,8 @@
   if(pbuf_header(p, -(hdrlen * 4))){
     /* drop short packets */
     LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: short packet\n"));
-    TCP_STATS_INC(tcp.lenerr);
-    TCP_STATS_INC(tcp.drop);
+    TCP_STATS_INC(lenerr);
+    TCP_STATS_INC(drop);
     snmp_inc_tcpinerrs();
     pbuf_free(p);
     return;
@@ -282,7 +282,7 @@
       } else {
         /* drop incoming packets, because pcb is "full" */
         LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: drop incoming packets, because pcb is \"full\"\n"));
-        TCP_STATS_INC(tcp.drop);
+        TCP_STATS_INC(drop);
         snmp_inc_tcpinerrs();
         pbuf_free(p);
         return;
@@ -364,8 +364,8 @@
        sender. */
     LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_input: no PCB match found, resetting.\n"));
     if (!(TCPH_FLAGS(tcphdr) & TCP_RST)) {
-      TCP_STATS_INC(tcp.proterr);
-      TCP_STATS_INC(tcp.drop);
+      TCP_STATS_INC(proterr);
+      TCP_STATS_INC(drop);
       tcp_rst(ackno, seqno + tcplen,
         &(iphdr->dest), &(iphdr->src),
         tcphdr->dest, tcphdr->src);
@@ -417,7 +417,7 @@
        SYN at a time when we have more memory available. */
     if (npcb == NULL) {
       LWIP_DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n"));
-      TCP_STATS_INC(tcp.memerr);
+      TCP_STATS_INC(memerr);
       return ERR_MEM;
     }
 #if TCP_LISTEN_BACKLOG
Index: core/tcp_out.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/tcp_out.c,v
retrieving revision 1.72
diff -u -r1.72 tcp_out.c
--- core/tcp_out.c	15 Jan 2008 13:00:51 -0000	1.72
+++ core/tcp_out.c	19 Jun 2008 16:59:49 -0000
@@ -165,7 +165,7 @@
   /* check for configured max queuelen and possible overflow */
   if ((queuelen >= TCP_SND_QUEUELEN) || (queuelen > TCP_SNDQUEUELEN_OVERFLOW)) {
     LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_enqueue: too long queue %"U16_F" (max %"U16_F")\n", queuelen, TCP_SND_QUEUELEN));
-    TCP_STATS_INC(tcp.memerr);
+    TCP_STATS_INC(memerr);
     pcb->flags |= TF_NAGLEMEMERR;
     return ERR_MEM;
   }
@@ -281,7 +281,7 @@
     /* build TCP header */
     if (pbuf_header(seg->p, TCP_HLEN)) {
       LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: no room for TCP header in pbuf.\n"));
-      TCP_STATS_INC(tcp.err);
+      TCP_STATS_INC(err);
       goto memerr;
     }
     seg->tcphdr = seg->p->payload;
@@ -336,7 +336,7 @@
     if(pbuf_header(queue->p, -TCP_HLEN)) {
       /* Can we cope with this failing?  Just assert for now */
       LWIP_ASSERT("pbuf_header failed\n", 0);
-      TCP_STATS_INC(tcp.err);
+      TCP_STATS_INC(err);
       goto memerr;
     }
     pbuf_cat(useg->p, queue->p);
@@ -387,7 +387,7 @@
   return ERR_OK;
 memerr:
   pcb->flags |= TF_NAGLEMEMERR;
-  TCP_STATS_INC(tcp.memerr);
+  TCP_STATS_INC(memerr);
 
   if (queue != NULL) {
     tcp_segs_free(queue);
@@ -647,7 +647,7 @@
              &(pcb->remote_ip),
              IP_PROTO_TCP, seg->p->tot_len);
 #endif
-  TCP_STATS_INC(tcp.xmit);
+  TCP_STATS_INC(xmit);
 
 #if LWIP_NETIF_HWADDRHINT
   {
@@ -716,7 +716,7 @@
   tcphdr->chksum = inet_chksum_pseudo(p, local_ip, remote_ip,
               IP_PROTO_TCP, p->tot_len);
 #endif
-  TCP_STATS_INC(tcp.xmit);
+  TCP_STATS_INC(xmit);
   snmp_inc_tcpoutrsts();
    /* Send output with hardcoded TTL since we have no access to the pcb */
   ip_output(p, local_ip, remote_ip, TCP_TTL, 0, IP_PROTO_TCP);
@@ -840,7 +840,7 @@
   tcphdr->chksum = inet_chksum_pseudo(p, &pcb->local_ip, &pcb->remote_ip,
                                       IP_PROTO_TCP, p->tot_len);
 #endif
-  TCP_STATS_INC(tcp.xmit);
+  TCP_STATS_INC(xmit);
 
   /* Send output to IP */
 #if LWIP_NETIF_HWADDRHINT
@@ -926,7 +926,7 @@
   tcphdr->chksum = inet_chksum_pseudo(p, &pcb->local_ip, &pcb->remote_ip,
                                       IP_PROTO_TCP, p->tot_len);
 #endif
-  TCP_STATS_INC(tcp.xmit);
+  TCP_STATS_INC(xmit);
 
   /* Send output to IP */
 #if LWIP_NETIF_HWADDRHINT
Index: core/udp.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/udp.c,v
retrieving revision 1.106
diff -u -r1.106 udp.c
--- core/udp.c	11 Jan 2008 14:28:58 -0000	1.106
+++ core/udp.c	19 Jun 2008 16:59:49 -0000
@@ -93,7 +93,7 @@
 
   PERF_START;
 
-  UDP_STATS_INC(udp.recv);
+  UDP_STATS_INC(recv);
 
   iphdr = p->payload;
 
@@ -103,8 +103,8 @@
     /* drop short packets */
     LWIP_DEBUGF(UDP_DEBUG,
                 ("udp_input: short UDP datagram (%"U16_F" bytes) discarded\n", p->tot_len));
-    UDP_STATS_INC(udp.lenerr);
-    UDP_STATS_INC(udp.drop);
+    UDP_STATS_INC(lenerr);
+    UDP_STATS_INC(drop);
     snmp_inc_udpinerrors();
     pbuf_free(p);
     goto end;
@@ -195,7 +195,7 @@
           pcb->next = udp_pcbs;
           udp_pcbs = pcb;
         } else {
-          UDP_STATS_INC(udp.cachehit);
+          UDP_STATS_INC(cachehit);
         }
         break;
       }
@@ -223,8 +223,8 @@
         } else {
           /* At least the UDP-Lite header must be covered by the
              checksum! (Again, see RFC 3828 chap. 3.1) */
-          UDP_STATS_INC(udp.chkerr);
-          UDP_STATS_INC(udp.drop);
+          UDP_STATS_INC(chkerr);
+          UDP_STATS_INC(drop);
           snmp_inc_udpinerrors();
           pbuf_free(p);
           goto end;
@@ -235,8 +235,8 @@
                              IP_PROTO_UDPLITE, p->tot_len, chklen) != 0) {
         LWIP_DEBUGF(UDP_DEBUG | 2,
                     ("udp_input: UDP Lite datagram discarded due to failing checksum\n"));
-        UDP_STATS_INC(udp.chkerr);
-        UDP_STATS_INC(udp.drop);
+        UDP_STATS_INC(chkerr);
+        UDP_STATS_INC(drop);
         snmp_inc_udpinerrors();
         pbuf_free(p);
         goto end;
@@ -252,8 +252,8 @@
                                IP_PROTO_UDP, p->tot_len) != 0) {
           LWIP_DEBUGF(UDP_DEBUG | 2,
                       ("udp_input: UDP datagram discarded due to failing checksum\n"));
-          UDP_STATS_INC(udp.chkerr);
-          UDP_STATS_INC(udp.drop);
+          UDP_STATS_INC(chkerr);
+          UDP_STATS_INC(drop);
           snmp_inc_udpinerrors();
           pbuf_free(p);
           goto end;
@@ -264,7 +264,7 @@
     if(pbuf_header(p, -UDP_HLEN)) {
       /* Can we cope with this failing? Just assert for now */
       LWIP_ASSERT("pbuf_header failed\n", 0);
-      UDP_STATS_INC(udp.drop);
+      UDP_STATS_INC(drop);
       snmp_inc_udpinerrors();
       pbuf_free(p);
       goto end;
@@ -294,8 +294,8 @@
         icmp_dest_unreach(p, ICMP_DUR_PORT);
       }
 #endif /* LWIP_ICMP */
-      UDP_STATS_INC(udp.proterr);
-      UDP_STATS_INC(udp.drop);
+      UDP_STATS_INC(proterr);
+      UDP_STATS_INC(drop);
       snmp_inc_udpnoports();
       pbuf_free(p);
     }
@@ -366,7 +366,7 @@
   /* no outgoing network interface could be found? */
   if (netif == NULL) {
     LWIP_DEBUGF(UDP_DEBUG | 1, ("udp_send: No route to 0x%"X32_F"\n", dst_ip->addr));
-    UDP_STATS_INC(udp.rterr);
+    UDP_STATS_INC(rterr);
     return ERR_RTE;
   }
   return udp_sendto_if(pcb, p, dst_ip, dst_port, netif);
@@ -535,7 +535,7 @@
     /* p is still referenced by the caller, and will live on */
   }
 
-  UDP_STATS_INC(udp.xmit);
+  UDP_STATS_INC(xmit);
   return err;
 }
 
@@ -680,7 +680,7 @@
 
     if ((netif = ip_route(&(pcb->remote_ip))) == NULL) {
       LWIP_DEBUGF(UDP_DEBUG, ("udp_connect: No route to 0x%lx\n", pcb->remote_ip.addr));
-      UDP_STATS_INC(udp.rterr);
+      UDP_STATS_INC(rterr);
       return ERR_RTE;
     }
     /** TODO: this will bind the udp pcb locally, to the interface which
Index: core/ipv4/icmp.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/ipv4/icmp.c,v
retrieving revision 1.43
diff -u -r1.43 icmp.c
--- core/ipv4/icmp.c	27 Jan 2008 11:22:14 -0000	1.43
+++ core/ipv4/icmp.c	19 Jun 2008 16:59:49 -0000
@@ -77,7 +77,7 @@
   struct ip_addr tmpaddr;
   s16_t hlen;
 
-  ICMP_STATS_INC(icmp.recv);
+  ICMP_STATS_INC(recv);
   snmp_inc_icmpinmsgs();
 
 
@@ -97,7 +97,7 @@
     /* broadcast or multicast destination address? */
     if (ip_addr_isbroadcast(&iphdr->dest, inp) || ip_addr_ismulticast(&iphdr->dest)) {
       LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: Not echoing to multicast or broadcast pings\n"));
-      ICMP_STATS_INC(icmp.err);
+      ICMP_STATS_INC(err);
       pbuf_free(p);
       return;
     }
@@ -109,7 +109,7 @@
     if (inet_chksum_pbuf(p) != 0) {
       LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo\n"));
       pbuf_free(p);
-      ICMP_STATS_INC(icmp.chkerr);
+      ICMP_STATS_INC(chkerr);
       snmp_inc_icmpinerrors();
       return;
     }
@@ -175,7 +175,7 @@
     IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN));
 #endif /* CHECKSUM_GEN_IP */
 
-    ICMP_STATS_INC(icmp.xmit);
+    ICMP_STATS_INC(xmit);
     /* increase number of messages attempted to send */
     snmp_inc_icmpoutmsgs();
     /* increase number of echo replies attempted to send */
@@ -195,19 +195,19 @@
   default:
     LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %"S16_F" code %"S16_F" not supported.\n", 
                 (s16_t)type, (s16_t)code));
-    ICMP_STATS_INC(icmp.proterr);
-    ICMP_STATS_INC(icmp.drop);
+    ICMP_STATS_INC(proterr);
+    ICMP_STATS_INC(drop);
   }
   pbuf_free(p);
   return;
 lenerr:
   pbuf_free(p);
-  ICMP_STATS_INC(icmp.lenerr);
+  ICMP_STATS_INC(lenerr);
   snmp_inc_icmpinerrors();
   return;
 memerr:
   pbuf_free(p);
-  ICMP_STATS_INC(icmp.err);
+  ICMP_STATS_INC(err);
   snmp_inc_icmpinerrors();
   return;
 }
@@ -250,7 +250,7 @@
   /* calculate checksum */
   idur->chksum = 0;
   idur->chksum = inet_chksum(idur, q->len);
-  ICMP_STATS_INC(icmp.xmit);
+  ICMP_STATS_INC(xmit);
   /* increase number of messages attempted to send */
   snmp_inc_icmpoutmsgs();
   /* increase number of destination unreachable messages attempted to send */
@@ -303,7 +303,7 @@
   /* calculate checksum */
   tehdr->chksum = 0;
   tehdr->chksum = inet_chksum(tehdr, q->len);
-  ICMP_STATS_INC(icmp.xmit);
+  ICMP_STATS_INC(xmit);
   /* increase number of messages attempted to send */
   snmp_inc_icmpoutmsgs();
   /* increase number of destination unreachable messages attempted to send */
Index: core/ipv4/igmp.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/ipv4/igmp.c,v
retrieving revision 1.26
diff -u -r1.26 igmp.c
--- core/ipv4/igmp.c	17 Mar 2008 13:40:01 -0000	1.26
+++ core/ipv4/igmp.c	19 Jun 2008 16:58:50 -0000
@@ -352,7 +352,7 @@
   iphdr = p->payload;
   if (pbuf_header(p, -(s16_t)(IPH_HL(iphdr) * 4)) || (p->len < IGMP_MINLEN)) {
     pbuf_free(p);
-    IGMP_STATS_INC(igmp.lenerr);
+    IGMP_STATS_INC(lenerr);
     LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: length error\n"));
     return;
   }
@@ -367,7 +367,7 @@
   igmp = (struct igmp_msg *)p->payload;
   if (inet_chksum(igmp, p->len)) {
     pbuf_free(p);
-    IGMP_STATS_INC(igmp.chkerr);
+    IGMP_STATS_INC(chkerr);
     LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: checksum error\n"));
     return;
   }
@@ -391,12 +391,12 @@
        LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: General IGMP_MEMB_QUERY on \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp)));
 
        if (igmp->igmp_maxresp == 0) {
-         IGMP_STATS_INC(igmp.v1_rxed);
+         IGMP_STATS_INC(v1_rxed);
          LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: got an all hosts query with time== 0 - this is V1 and not implemented - treat as v2\n"));
          igmp->igmp_maxresp = IGMP_V1_DELAYING_MEMBER_TMR;
        }
 
-       IGMP_STATS_INC(igmp.group_query_rxed);
+       IGMP_STATS_INC(group_query_rxed);
        groupref = igmp_group_list;
        while (groupref) {
          /* Do not send messages on the all systems group address! */
@@ -419,7 +419,7 @@
          }
 
          if (group != NULL) {
-           IGMP_STATS_INC(igmp.unicast_query);
+           IGMP_STATS_INC(unicast_query);
            igmp_delaying_member( group, igmp->igmp_maxresp);
          }
        }
@@ -429,7 +429,7 @@
    case IGMP_V2_MEMB_REPORT: {
      LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_V2_MEMB_REPORT\n"));
 
-     IGMP_STATS_INC(igmp.report_rxed);
+     IGMP_STATS_INC(report_rxed);
      if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) {
        /* This is on a specific group we have already looked up */
        group->timer = 0; /* stopped */
@@ -492,7 +492,7 @@
             netif->igmp_mac_filter(netif, groupaddr, IGMP_ADD_MAC_FILTER);
           }
 
-          IGMP_STATS_INC(igmp.join_sent);
+          IGMP_STATS_INC(join_sent);
           igmp_send(group, IGMP_V2_MEMB_REPORT);
 
           igmp_start_timer(group, IGMP_JOIN_DELAYING_MEMBER_TMR);
@@ -555,7 +555,7 @@
           /* If we are the last reporter for this group */
           if (group->last_reporter_flag) {
             LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: sending leaving group\n"));
-            IGMP_STATS_INC(igmp.leave_sent);
+            IGMP_STATS_INC(leave_sent);
             igmp_send(group, IGMP_LEAVE_GROUP);
           }
           
@@ -780,7 +780,7 @@
      
     if (type == IGMP_V2_MEMB_REPORT) {
       dest = &(group->group_address);
-      IGMP_STATS_INC(igmp.report_sent);
+      IGMP_STATS_INC(report_sent);
       ip_addr_set(&(igmp->igmp_group_address), &(group->group_address));
       group->last_reporter_flag = 1; /* Remember we were the last to report */
     } else {
Index: core/ipv4/ip.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/ipv4/ip.c,v
retrieving revision 1.68
diff -u -r1.68 ip.c
--- core/ipv4/ip.c	17 Jun 2008 19:39:22 -0000	1.68
+++ core/ipv4/ip.c	19 Jun 2008 16:59:49 -0000
@@ -82,7 +82,7 @@
   }
   if ((netif_default == NULL) || (!netif_is_up(netif_default))) {
     LWIP_DEBUGF(IP_DEBUG | 2, ("ip_route: No route to 0x%"X32_F"\n", dest->addr));
-    IP_STATS_INC(ip.rterr);
+    IP_STATS_INC(rterr);
     snmp_inc_ipoutnoroutes();
     return NULL;
   }
@@ -147,8 +147,8 @@
   LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to 0x%"X32_F"\n",
                     iphdr->dest.addr));
 
-  IP_STATS_INC(ip.fw);
-  IP_STATS_INC(ip.xmit);
+  IP_STATS_INC(fw);
+  IP_STATS_INC(xmit);
   snmp_inc_ipforwdatagrams();
 
   PERF_STOP("ip_forward");
@@ -183,7 +183,7 @@
   int check_ip_src=1;
 #endif /* LWIP_DHCP */
 
-  IP_STATS_INC(ip.recv);
+  IP_STATS_INC(recv);
   snmp_inc_ipinreceives();
 
   /* identify the IP header */
@@ -192,8 +192,8 @@
     LWIP_DEBUGF(IP_DEBUG | 1, ("IP packet dropped due to bad version number %"U16_F"\n", IPH_V(iphdr)));
     ip_debug_print(p);
     pbuf_free(p);
-    IP_STATS_INC(ip.err);
-    IP_STATS_INC(ip.drop);
+    IP_STATS_INC(err);
+    IP_STATS_INC(drop);
     snmp_inc_ipinhdrerrors();
     return ERR_OK;
   }
@@ -216,8 +216,8 @@
                                iphdr_len, p->tot_len));
     /* free (drop) packet pbufs */
     pbuf_free(p);
-    IP_STATS_INC(ip.lenerr);
-    IP_STATS_INC(ip.drop);
+    IP_STATS_INC(lenerr);
+    IP_STATS_INC(drop);
     snmp_inc_ipindiscards();
     return ERR_OK;
   }
@@ -229,8 +229,8 @@
     LWIP_DEBUGF(IP_DEBUG | 2, ("Checksum (0x%"X16_F") failed, IP packet dropped.\n", inet_chksum(iphdr, iphdr_hlen)));
     ip_debug_print(p);
     pbuf_free(p);
-    IP_STATS_INC(ip.chkerr);
-    IP_STATS_INC(ip.drop);
+    IP_STATS_INC(chkerr);
+    IP_STATS_INC(drop);
     snmp_inc_ipinhdrerrors();
     return ERR_OK;
   }
@@ -316,7 +316,7 @@
       LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE | 1, ("ip_input: packet source is not valid.\n"));
       /* free (drop) packet pbufs */
       pbuf_free(p);
-      IP_STATS_INC(ip.drop);
+      IP_STATS_INC(drop);
       snmp_inc_ipinaddrerrors();
       snmp_inc_ipindiscards();
       return ERR_OK;
@@ -357,8 +357,8 @@
     pbuf_free(p);
     LWIP_DEBUGF(IP_DEBUG | 2, ("IP packet dropped since it was fragmented (0x%"X16_F") (while IP_REASSEMBLY == 0).\n",
       ntohs(IPH_OFFSET(iphdr))));
-    IP_STATS_INC(ip.opterr);
-    IP_STATS_INC(ip.drop);
+    IP_STATS_INC(opterr);
+    IP_STATS_INC(drop);
     /* unsupported protocol feature */
     snmp_inc_ipinunknownprotos();
     return ERR_OK;
@@ -375,8 +375,8 @@
 #endif /* LWIP_IGMP */
     LWIP_DEBUGF(IP_DEBUG | 2, ("IP packet dropped since there were IP options (while IP_OPTIONS_ALLOWED == 0).\n"));
     pbuf_free(p);
-    IP_STATS_INC(ip.opterr);
-    IP_STATS_INC(ip.drop);
+    IP_STATS_INC(opterr);
+    IP_STATS_INC(drop);
     /* unsupported protocol feature */
     snmp_inc_ipinunknownprotos();
     return ERR_OK;
@@ -434,8 +434,8 @@
 
       LWIP_DEBUGF(IP_DEBUG | 2, ("Unsupported transport protocol %"U16_F"\n", IPH_PROTO(iphdr)));
 
-      IP_STATS_INC(ip.proterr);
-      IP_STATS_INC(ip.drop);
+      IP_STATS_INC(proterr);
+      IP_STATS_INC(drop);
       snmp_inc_ipinunknownprotos();
     }
   }
@@ -484,7 +484,7 @@
     if (pbuf_header(p, IP_HLEN)) {
       LWIP_DEBUGF(IP_DEBUG | 2, ("ip_output: not enough room for IP header in pbuf\n"));
 
-      IP_STATS_INC(ip.err);
+      IP_STATS_INC(err);
       snmp_inc_ipoutdiscards();
       return ERR_BUF;
     }
@@ -526,7 +526,7 @@
     return ip_frag(p,netif,dest);
 #endif
 
-  IP_STATS_INC(ip.xmit);
+  IP_STATS_INC(xmit);
 
   LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c%"U16_F"\n", netif->name[0], netif->name[1], netif->num));
   ip_debug_print(p);
Index: core/ipv4/ip_frag.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/ipv4/ip_frag.c,v
retrieving revision 1.47
diff -u -r1.47 ip_frag.c
--- core/ipv4/ip_frag.c	22 Jan 2008 18:56:40 -0000	1.47
+++ core/ipv4/ip_frag.c	19 Jun 2008 16:59:49 -0000
@@ -263,7 +263,7 @@
     if (ipr == NULL)
 #endif /* IP_REASS_FREE_OLDEST */
     {
-      IPFRAG_STATS_INC(ip_frag.memerr);
+      IPFRAG_STATS_INC(memerr);
       LWIP_DEBUGF(IP_REASS_DEBUG,("Failed to alloc reassdata struct\n"));
       return NULL;
     }
@@ -467,14 +467,14 @@
   u8_t clen;
   struct ip_reassdata *ipr_prev = NULL;
 
-  IPFRAG_STATS_INC(ip_frag.recv);
+  IPFRAG_STATS_INC(recv);
   snmp_inc_ipreasmreqds();
 
   fraghdr = (struct ip_hdr*)p->payload;
 
   if ((IPH_HL(fraghdr) * 4) != IP_HLEN) {
     LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: IP options currently not supported!\n"));
-    IPFRAG_STATS_INC(ip_frag.err);
+    IPFRAG_STATS_INC(err);
     goto nullreturn;
   }
 
@@ -492,7 +492,7 @@
       /* No datagram could be freed and still too many pbufs enqueued */
       LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: Overflow condition: pbufct=%d, clen=%d, MAX=%d\n",
         ip_reass_pbufcount, clen, IP_REASS_MAX_PBUFS));
-      IPFRAG_STATS_INC(ip_frag.memerr);
+      IPFRAG_STATS_INC(memerr);
       /* @todo: send ICMP time exceeded here? */
       /* drop this pbuf */
       goto nullreturn;
@@ -508,7 +508,7 @@
     if (IP_ADDRESSES_AND_ID_MATCH(&ipr->iphdr, fraghdr)) {
       LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: matching previous fragment ID=%"X16_F"\n",
         ntohs(IPH_ID(fraghdr))));
-      IPFRAG_STATS_INC(ip_frag.cachehit);
+      IPFRAG_STATS_INC(cachehit);
       break;
     }
     ipr_prev = ipr;
@@ -591,7 +591,7 @@
 
 nullreturn:
   LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: nullreturn\n"));
-  IPFRAG_STATS_INC(ip_frag.drop);
+  IPFRAG_STATS_INC(drop);
   pbuf_free(p);
   return NULL;
 }
@@ -747,7 +747,7 @@
     if (header != NULL) {
       pbuf_chain(header, rambuf);
       netif->output(netif, header, dest);
-      IPFRAG_STATS_INC(ip_frag.xmit);
+      IPFRAG_STATS_INC(xmit);
       snmp_inc_ipfragcreates();
       pbuf_free(header);
     } else {
@@ -760,7 +760,7 @@
      * when allocated.
      */
     netif->output(netif, rambuf, dest);
-    IPFRAG_STATS_INC(ip_frag.xmit);
+    IPFRAG_STATS_INC(xmit);
 
     /* Unfortunately we can't reuse rambuf - the hardware may still be
      * using the buffer. Instead we free it (and the ensuing chain) and
Index: include/lwip/stats.h
===================================================================
RCS file: /sources/lwip/lwip/src/include/lwip/stats.h,v
retrieving revision 1.19
diff -u -r1.19 stats.h
--- include/lwip/stats.h	28 Nov 2007 21:25:07 -0000	1.19
+++ include/lwip/stats.h	19 Jun 2008 17:43:09 -0000
@@ -57,7 +57,6 @@
 
 struct stats_proto {
   STAT_COUNTER xmit;             /* Transmitted packets. */
-  STAT_COUNTER rexmit;           /* Retransmitted packets. */
   STAT_COUNTER recv;             /* Received packets. */
   STAT_COUNTER fw;               /* Forwarded packets. */
   STAT_COUNTER drop;             /* Dropped packets. */
@@ -142,64 +141,137 @@
 #define stats_init() /* Compatibility define, not init needed. */
 
 #define STATS_INC(x) ++lwip_stats.x
+#define STATS_DEC(x) --lwip_stats.x
 #else
 #define stats_init()
 #define STATS_INC(x)
+#define STATS_DEC(x)
 #endif /* LWIP_STATS */
 
 #if TCP_STATS
-#define TCP_STATS_INC(x) STATS_INC(x)
+#define TCP_STATS_INC(x) STATS_INC(tcp.x)
+#define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP")
 #else
 #define TCP_STATS_INC(x)
 #endif
 
 #if UDP_STATS
-#define UDP_STATS_INC(x) STATS_INC(x)
+#define UDP_STATS_INC(x) STATS_INC(udp.x)
+#define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP")
 #else
 #define UDP_STATS_INC(x)
+#define UDP_STATS_DISPLAY()
 #endif
 
 #if ICMP_STATS
-#define ICMP_STATS_INC(x) STATS_INC(x)
+#define ICMP_STATS_INC(x) STATS_INC(icmp.x)
+#define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP")
 #else
 #define ICMP_STATS_INC(x)
+#define ICMP_STATS_DISPLAY()
 #endif
 
 #if IGMP_STATS
-#define IGMP_STATS_INC(x) STATS_INC(x)
+#define IGMP_STATS_INC(x) STATS_INC(igmp.x)
+#define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp)
 #else
 #define IGMP_STATS_INC(x)
+#define IGMP_STATS_DISPLAY()
 #endif
 
 #if IP_STATS
-#define IP_STATS_INC(x) STATS_INC(x)
+#define IP_STATS_INC(x) STATS_INC(ip.x)
+#define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP")
 #else
 #define IP_STATS_INC(x)
+#define IP_STATS_DISPLAY()
 #endif
 
 #if IPFRAG_STATS
-#define IPFRAG_STATS_INC(x) STATS_INC(x)
+#define IPFRAG_STATS_INC(x) STATS_INC(ip_frag.x)
+#define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG")
 #else
 #define IPFRAG_STATS_INC(x)
+#define IPFRAG_STATS_DISPLAY()
 #endif
 
 #if ETHARP_STATS
-#define ETHARP_STATS_INC(x) STATS_INC(x)
+#define ETHARP_STATS_INC(x) STATS_INC(etharp.x)
+#define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP")
 #else
 #define ETHARP_STATS_INC(x)
+#define ETHARP_STATS_DISPLAY()
 #endif
 
 #if LINK_STATS
-#define LINK_STATS_INC(x) STATS_INC(x)
+#define LINK_STATS_INC(x) STATS_INC(link.x)
+#define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK")
 #else
 #define LINK_STATS_INC(x)
+#define LINK_STATS_DISPLAY()
+#endif
+
+#if MEM_STATS
+#define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y
+#define MEM_STATS_INC(x) STATS_INC(mem.x)
+#define MEM_STATS_INC_USED(x, y) do { lwip_stats.mem.used += y; \
+                                    if (lwip_stats.mem.max < lwip_stats.mem.used) { \
+                                        lwip_stats.mem.max = lwip_stats.mem.used; \
+                                    } \
+                                 } while(0)
+#define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x -= y
+#define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP")
+#else
+#define MEM_STATS_AVAIL(x)
+#define MEM_STATS_INC(x)
+#define MEM_STATS_INC_USED(x)
+#define MEM_STATS_DEC_USED(x)
+#define MEM_STATS_DISPLAY()
+#endif
+
+#if MEMP_STATS
+#define MEMP_STATS_AVAIL(x, i, y) lwip_stats.memp[i].x = y
+#define MEMP_STATS_INC(x, i) STATS_INC(memp[i].x)
+#define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i].x)
+#define MEMP_STATS_INC_USED(x, i) do { ++lwip_stats.memp[i].used; \
+                                    if (lwip_stats.memp[i].max < lwip_stats.memp[i].used) { \
+                                        lwip_stats.memp[i].max = lwip_stats.memp[i].used; \
+                                    } \
+                                 } while(0)
+#define MEMP_STATS_DISPLAY(i) stats_display_memp(&lwip_stats.memp[i], i)
+#else
+#define MEMP_STATS_AVAIL(x)
+#define MEMP_STATS_INC(x)
+#define MEMP_STATS_DEC(x)
+#define MEMP_STATS_INC_USED(x)
+#define MEMP_STATS_DISPLAY()
+#endif
+
+#if SYS_STATS
+#define SYS_STATS_INC(x) STATS_INC(sys.x)
+#define SYS_STATS_DEC(x) STATS_DEC(sys.x)
+#define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys)
+#else
+#define SYS_STATS_INC(x)
+#define SYS_STATS_DEC(x)
+#define SYS_STATS_DISPLAY()
 #endif
 
 /* Display of statistics */
 #if LWIP_STATS_DISPLAY
 void stats_display(void);
+void stats_display_proto(struct stats_proto *proto, char *name);
+void stats_display_igmp(struct stats_igmp *igmp);
+void stats_display_mem(struct stats_mem *mem, char *name);
+void stats_display_memp(struct stats_mem *mem, int index);
+void stats_display_sys(struct stats_sys *sys);
 #else
 #define stats_display()
+#define stats_display_proto(proto, name)
+#define stats_display_igmp(igmp)
+#define stats_display_mem(mem, name)
+#define stats_display_memp(mem, int index)
+#define stats_display_sys(sys)
 #endif /* LWIP_STATS_DISPLAY */
 
 #ifdef __cplusplus
Index: netif/etharp.c
===================================================================
RCS file: /sources/lwip/lwip/src/netif/etharp.c,v
retrieving revision 1.148
diff -u -r1.148 etharp.c
--- netif/etharp.c	19 Jun 2008 16:40:59 -0000	1.148
+++ netif/etharp.c	19 Jun 2008 17:00:37 -0000
@@ -253,7 +253,7 @@
         /* the per-pcb-cached entry is stable */
         if (ip_addr_cmp(ipaddr, &arp_table[per_pcb_cache].ipaddr)) {
           /* per-pcb cached entry was the right one! */
-          ETHARP_STATS_INC(etharp.cachehit);
+          ETHARP_STATS_INC(cachehit);
           return per_pcb_cache;
         }
       }
@@ -263,7 +263,7 @@
       /* the cached entry is stable */
       if (ip_addr_cmp(ipaddr, &arp_table[etharp_cached_entry].ipaddr)) {
         /* cached entry was the right one! */
-        ETHARP_STATS_INC(etharp.cachehit);
+        ETHARP_STATS_INC(cachehit);
         return etharp_cached_entry;
       }
     }
@@ -632,8 +632,8 @@
      since a struct etharp_hdr is pointed to p->payload, so it musn't be chained! */
   if (p->len < sizeof(struct etharp_hdr)) {
     LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | 1, ("etharp_arp_input: packet dropped, too short (%"S16_F"/%"S16_F")\n", p->tot_len, (s16_t)sizeof(struct etharp_hdr)));
-    ETHARP_STATS_INC(etharp.lenerr);
-    ETHARP_STATS_INC(etharp.drop);
+    ETHARP_STATS_INC(lenerr);
+    ETHARP_STATS_INC(drop);
     pbuf_free(p);
     return;
   }
@@ -648,12 +648,12 @@
     LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | 1,
       ("etharp_arp_input: packet dropped, wrong hw type, hwlen, proto, protolen or ethernet type (%"U16_F"/%"U16_F"/%"U16_F"/%"U16_F"/%"U16_F")\n",
       hdr->hwtype, ARPH_HWLEN(hdr), hdr->proto, ARPH_PROTOLEN(hdr), hdr->ethhdr.type));
-    ETHARP_STATS_INC(etharp.proterr);
-    ETHARP_STATS_INC(etharp.drop);
+    ETHARP_STATS_INC(proterr);
+    ETHARP_STATS_INC(drop);
     pbuf_free(p);
     return;
   }
-  ETHARP_STATS_INC(etharp.recv);
+  ETHARP_STATS_INC(recv);
 
 #if LWIP_AUTOIP
   /* We have to check if a host already has configured our random
@@ -756,7 +756,7 @@
     break;
   default:
     LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_arp_input: ARP unknown opcode type %"S16_F"\n", htons(hdr->opcode)));
-    ETHARP_STATS_INC(etharp.err);
+    ETHARP_STATS_INC(err);
     break;
   }
   /* free ARP packet */
@@ -790,7 +790,7 @@
   if (pbuf_header(q, sizeof(struct eth_hdr)) != 0) {
     /* bail out */
     LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | 2, ("etharp_output: could not allocate room for header.\n"));
-    LINK_STATS_INC(link.lenerr);
+    LINK_STATS_INC(lenerr);
     return ERR_BUF;
   }
 
@@ -898,7 +898,7 @@
     LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: could not create ARP entry\n"));
     if (q) {
       LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: packet dropped\n"));
-      ETHARP_STATS_INC(etharp.memerr);
+      ETHARP_STATS_INC(memerr);
     }
     return (err_t)i;
   }
@@ -993,7 +993,7 @@
           /* { result == ERR_MEM } through initialization */
         }
       } else {
-        ETHARP_STATS_INC(etharp.memerr);
+        ETHARP_STATS_INC(memerr);
         LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: could not queue a copy of PBUF_REF packet %p (out of memory)\n", (void *)q));
         /* { result == ERR_MEM } through initialization */
       }
@@ -1045,7 +1045,7 @@
   /* could allocate a pbuf for an ARP request? */
   if (p == NULL) {
     LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | 2, ("etharp_raw: could not allocate pbuf for ARP request.\n"));
-    ETHARP_STATS_INC(etharp.memerr);
+    ETHARP_STATS_INC(memerr);
     return ERR_MEM;
   }
   LWIP_ASSERT("check that first pbuf can hold struct etharp_hdr",
@@ -1088,7 +1088,7 @@
   hdr->ethhdr.type = htons(ETHTYPE_ARP);
   /* send ARP query */
   result = netif->linkoutput(netif, p);
-  ETHARP_STATS_INC(etharp.xmit);
+  ETHARP_STATS_INC(xmit);
   /* free ARP query packet */
   pbuf_free(p);
   p = NULL;
@@ -1172,8 +1172,8 @@
 #endif /* PPPOE_SUPPORT */
 
     default:
-      ETHARP_STATS_INC(etharp.proterr);
-      ETHARP_STATS_INC(etharp.drop);
+      ETHARP_STATS_INC(proterr);
+      ETHARP_STATS_INC(drop);
       pbuf_free(p);
       p = NULL;
       break;
Index: netif/ethernetif.c
===================================================================
RCS file: /sources/lwip/lwip/src/netif/ethernetif.c,v
retrieving revision 1.49
diff -u -r1.49 ethernetif.c
--- netif/ethernetif.c	28 Nov 2007 21:15:55 -0000	1.49
+++ netif/ethernetif.c	19 Jun 2008 17:00:37 -0000
@@ -145,7 +145,7 @@
   pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
 #endif
   
-  LINK_STATS_INC(link.xmit);
+  LINK_STATS_INC(xmit);
 
   return ERR_OK;
 }
@@ -196,11 +196,11 @@
     pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
 #endif
 
-    LINK_STATS_INC(link.recv);
+    LINK_STATS_INC(recv);
   } else {
     drop packet();
-    LINK_STATS_INC(link.memerr);
-    LINK_STATS_INC(link.drop);
+    LINK_STATS_INC(memerr);
+    LINK_STATS_INC(drop);
   }
 
   return p;  
Index: netif/slipif.c
===================================================================
RCS file: /sources/lwip/lwip/src/netif/slipif.c,v
retrieving revision 1.30
diff -u -r1.30 slipif.c
--- netif/slipif.c	17 Jun 2008 20:14:05 -0000	1.30
+++ netif/slipif.c	19 Jun 2008 17:00:37 -0000
@@ -142,7 +142,7 @@
         /* Trim the pbuf to the size of the received packet. */
         pbuf_realloc(q, recved);
         
-        LINK_STATS_INC(link.recv);
+        LINK_STATS_INC(recv);
         
         LWIP_DEBUGF(SLIP_DEBUG, ("slipif: Got packet\n"));
         return q;
@@ -169,7 +169,7 @@
         p = pbuf_alloc(PBUF_LINK, PBUF_POOL_BUFSIZE, PBUF_POOL);
 
         if (p == NULL) {
-          LINK_STATS_INC(link.drop);
+          LINK_STATS_INC(drop);
           LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: no new pbuf! (DROP)\n"));
           /* don't process any further since we got no pbuf to receive to */
           break;
Index: netif/ppp/ppp.c
===================================================================
RCS file: /sources/lwip/lwip/src/netif/ppp/ppp.c,v
retrieving revision 1.24
diff -u -r1.24 ppp.c
--- netif/ppp/ppp.c	16 Mar 2008 08:53:58 -0000	1.24
+++ netif/ppp/ppp.c	19 Jun 2008 17:00:37 -0000
@@ -734,14 +734,14 @@
     if((c = sio_write(pc->fd, b->payload, b->len)) != b->len) {
       PPPDEBUG((LOG_WARNING,
                "PPP nPut: incomplete sio_write(%d,, %u) = %d\n", pc->fd, b->len, c));
-      LINK_STATS_INC(link.err);
+      LINK_STATS_INC(err);
       pc->lastXMit = 0; /* prepend PPP_FLAG to next packet */
       break;
     }
   }
 
   pbuf_free(nb);
-  LINK_STATS_INC(link.xmit);
+  LINK_STATS_INC(xmit);
 }
 
 /* 
@@ -764,7 +764,7 @@
     if (tb) {
       nb->next = tb;
     } else {
-      LINK_STATS_INC(link.memerr);
+      LINK_STATS_INC(memerr);
     }
     nb = tb;
   }
@@ -793,8 +793,8 @@
 
   pb = pbuf_alloc(PBUF_LINK, pppoe_hdrlen + sizeof(protocol), PBUF_RAM);
   if(!pb) {
-    LINK_STATS_INC(link.memerr);
-    LINK_STATS_INC(link.proterr);
+    LINK_STATS_INC(memerr);
+    LINK_STATS_INC(proterr);
     return ERR_MEM;
   }
 
@@ -810,11 +810,11 @@
   pbuf_chain(pb, p);
 
   if(pppoe_xmit(pc->pppoe_sc, pb) != ERR_OK) {
-    LINK_STATS_INC(link.err);
+    LINK_STATS_INC(err);
     return PPPERR_DEVICE;
   }
 
-  LINK_STATS_INC(link.xmit);
+  LINK_STATS_INC(xmit);
   return ERR_OK;
 }
 #endif /* PPPOE_SUPPORT */
@@ -840,16 +840,16 @@
   if (pd < 0 || pd >= NUM_PPP || !pc->openFlag || !pb) {
     PPPDEBUG((LOG_WARNING, "pppifOutput[%d]: bad parms prot=%d pb=%p\n",
               pd, protocol, pb));
-    LINK_STATS_INC(link.opterr);
-    LINK_STATS_INC(link.drop);
+    LINK_STATS_INC(opterr);
+    LINK_STATS_INC(drop);
     return ERR_ARG;
   }
 
   /* Check that the link is up. */
   if (lcp_phase[pd] == PHASE_DEAD) {
     PPPDEBUG((LOG_ERR, "pppifOutput[%d]: link not up\n", pd));
-    LINK_STATS_INC(link.rterr);
-    LINK_STATS_INC(link.drop);
+    LINK_STATS_INC(rterr);
+    LINK_STATS_INC(drop);
     return ERR_RTE;
   }
 
@@ -864,8 +864,8 @@
   headMB = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
   if (headMB == NULL) {
     PPPDEBUG((LOG_WARNING, "pppifOutput[%d]: first alloc fail\n", pd));
-    LINK_STATS_INC(link.memerr);
-    LINK_STATS_INC(link.drop);
+    LINK_STATS_INC(memerr);
+    LINK_STATS_INC(drop);
     return ERR_MEM;
   }
 
@@ -888,8 +888,8 @@
         break;
       default:
         PPPDEBUG((LOG_WARNING, "pppifOutput[%d]: bad IP packet\n", pd));
-        LINK_STATS_INC(link.proterr);
-        LINK_STATS_INC(link.drop);
+        LINK_STATS_INC(proterr);
+        LINK_STATS_INC(drop);
         pbuf_free(headMB);
         return ERR_VAL;
     }
@@ -950,8 +950,8 @@
              "pppifOutput[%d]: Alloc err - dropping proto=%d\n", 
               pd, protocol));
     pbuf_free(headMB);
-    LINK_STATS_INC(link.memerr);
-    LINK_STATS_INC(link.drop);
+    LINK_STATS_INC(memerr);
+    LINK_STATS_INC(drop);
     return ERR_MEM;
   }
 
@@ -1047,8 +1047,8 @@
 
   pb = pbuf_alloc(PBUF_LINK, pppoe_hdrlen + n, PBUF_RAM);
   if(!pb) {
-    LINK_STATS_INC(link.memerr);
-    LINK_STATS_INC(link.proterr);
+    LINK_STATS_INC(memerr);
+    LINK_STATS_INC(proterr);
     return PPPERR_ALLOC;
   }
 
@@ -1059,11 +1059,11 @@
   SMEMCPY(pb->payload, s, n);
 
   if(pppoe_xmit(pc->pppoe_sc, pb) != ERR_OK) {
-    LINK_STATS_INC(link.err);
+    LINK_STATS_INC(err);
     return PPPERR_DEVICE;
   }
 
-  LINK_STATS_INC(link.xmit);
+  LINK_STATS_INC(xmit);
   return PPPERR_NONE;
 }
 #endif /* PPPOE_SUPPORT */
@@ -1092,8 +1092,8 @@
 #if PPPOS_SUPPORT
   headMB = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
   if (headMB == NULL) {
-    LINK_STATS_INC(link.memerr);
-    LINK_STATS_INC(link.proterr);
+    LINK_STATS_INC(memerr);
+    LINK_STATS_INC(proterr);
     return PPPERR_ALLOC;
   }
 
@@ -1132,8 +1132,8 @@
              "pppWrite[%d]: Alloc err - dropping pbuf len=%d\n", pd, headMB->len));
            /*"pppWrite[%d]: Alloc err - dropping %d:%.*H", pd, headMB->len, LWIP_MIN(headMB->len * 2, 40), headMB->payload)); */
     pbuf_free(headMB);
-    LINK_STATS_INC(link.memerr);
-    LINK_STATS_INC(link.proterr);
+    LINK_STATS_INC(memerr);
+    LINK_STATS_INC(proterr);
     return PPPERR_ALLOC;
   }
 
@@ -1645,7 +1645,7 @@
     goto drop;
   }
 
-  LINK_STATS_INC(link.recv);
+  LINK_STATS_INC(recv);
 
   /*
    * Toss all non-LCP packets unless LCP is OPEN.
@@ -1741,7 +1741,7 @@
   }
 
 drop:
-  LINK_STATS_INC(link.drop);
+  LINK_STATS_INC(drop);
 
 out:
   pbuf_free(nb);
@@ -1771,7 +1771,7 @@
   vj_uncompress_err(&pc->vjComp);
 #endif /* VJ_SUPPORT */
 
-  LINK_STATS_INC(link.drop);
+  LINK_STATS_INC(drop);
 }
 
 /**
@@ -1807,14 +1807,14 @@
            PPPDEBUG((LOG_WARNING,
                     "pppInProc[%d]: Dropping incomplete packet %d\n", 
                      pd, pc->inState));
-           LINK_STATS_INC(link.lenerr);
+           LINK_STATS_INC(lenerr);
            pppDrop(pc);
          /* If the fcs is invalid, drop the packet. */
          } else if (pc->inFCS != PPP_GOODFCS) {
            PPPDEBUG((LOG_INFO,
                     "pppInProc[%d]: Dropping bad fcs 0x%04X proto=0x%04X\n", 
                      pd, pc->inFCS, pc->inProtocol));
-           LINK_STATS_INC(link.chkerr);
+           LINK_STATS_INC(chkerr);
            pppDrop(pc);
          /* Otherwise it's a good packet so pass it on. */
          } else {
@@ -1839,7 +1839,7 @@
            if(tcpip_callback(pppInput, pc->inHead) != ERR_OK) {
              PPPDEBUG((LOG_ERR, "pppInProc[%d]: tcpip_callback() failed, dropping packet\n", pd));
              pbuf_free(pc->inHead);
-             LINK_STATS_INC(link.drop);
+             LINK_STATS_INC(drop);
            }
            pc->inHead = NULL;
            pc->inTail = NULL;
@@ -1929,7 +1929,7 @@
                * higher layers deal with it.  Continue processing
                * the received pbuf chain in case a new packet starts. */
               PPPDEBUG((LOG_ERR, "pppInProc[%d]: NO FREE MBUFS!\n", pd));
-              LINK_STATS_INC(link.memerr);
+              LINK_STATS_INC(memerr);
               pppDrop(pc);
               pc->inState = PDSTART;  /* Wait for flag sequence. */
               break;
@@ -1994,7 +1994,7 @@
   return;
 
 drop:
-  LINK_STATS_INC(link.drop);
+  LINK_STATS_INC(drop);
   pbuf_free(pb);
   return;
 }
