diff --git a/proj/minimal/mintapif.c b/proj/minimal/mintapif.c index 38cad399..d86ae03f 100644 --- a/proj/minimal/mintapif.c +++ b/proj/minimal/mintapif.c @@ -260,7 +260,7 @@ mintapif_input(struct netif *netif) if(p != NULL) { #ifdef LINK_STATS - stats.link.recv++; + lwip_stats.link.recv++; #endif /* LINK_STATS */ ethhdr = p->payload; diff --git a/proj/msvc6/pktif.c b/proj/msvc6/pktif.c index 527e95dc..084c22dd 100644 --- a/proj/msvc6/pktif.c +++ b/proj/msvc6/pktif.c @@ -294,7 +294,7 @@ low_level_output(struct netif *ethernetif, struct pbuf *p) PacketFreePacket(lpPacket); #ifdef LINK_STATS - stats.link.xmit++; + lwip_stats.link.xmit++; #endif /* LINK_STATS */ return ERR_OK; } @@ -346,14 +346,14 @@ low_level_input(struct netif *ethernetif) /* acknowledge that packet has been read(); */ cur_length=0; #ifdef LINK_STATS - stats.link.recv++; + lwip_stats.link.recv++; #endif /* LINK_STATS */ } else { /* drop packet(); */ cur_length=0; #ifdef LINK_STATS - stats.link.memerr++; - stats.link.drop++; + lwip_stats.link.memerr++; + lwip_stats.link.drop++; #endif /* LINK_STATS */ } @@ -405,7 +405,7 @@ ethernetif_input(struct netif *netif) if(p != NULL) { #ifdef LINK_STATS - stats.link.recv++; + lwip_stats.link.recv++; #endif /* LINK_STATS */ ethhdr = p->payload; diff --git a/proj/unixsim/apps/shell.c b/proj/unixsim/apps/shell.c index 207c9cc3..af13a0fd 100644 --- a/proj/unixsim/apps/shell.c +++ b/proj/unixsim/apps/shell.c @@ -441,7 +441,7 @@ com_stat(struct command *com) u16_t len; for(i = 0; i < sizeof(struct stats_) / 2; i++) { - len = sprintf(buf, "%d", ((u16_t *)&stats)[i]); + len = sprintf(buf, "%d", ((u16_t *)&lwip_stats)[i]); sendstr(stat_msgs[i], com->conn); netconn_write(com->conn, buf, len, NETCONN_COPY); sendstr("\n", com->conn); diff --git a/src/arch/unix/netif/unixif.c b/src/arch/unix/netif/unixif.c index 43ea14a2..ea8dd0c9 100644 --- a/src/arch/unix/netif/unixif.c +++ b/src/arch/unix/netif/unixif.c @@ -225,7 +225,7 @@ unixif_input_handler(void *data) } pbuf_realloc(p, len); #ifdef LINK_STATS - stats.link.recv++; + lwip_stats.link.recv++; #endif /* LINK_STATS */ tcpdump(p); netif->input(p, netif); @@ -319,7 +319,7 @@ unixif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) #endif /* UNIXIF_DROP_FIRST */ #ifdef LINK_STATS - stats.link.drop++; + lwip_stats.link.drop++; #endif /* LINK_STATS */ } else { @@ -393,7 +393,7 @@ unixif_output_timeout(void *arg) } tcpdump(p); #ifdef LINK_STATS - stats.link.xmit++; + lwip_stats.link.xmit++; #endif /* LINK_STATS */ free(data); diff --git a/src/arch/unix/sys_arch.c b/src/arch/unix/sys_arch.c index b6af5ab7..2756a6b4 100644 --- a/src/arch/unix/sys_arch.c +++ b/src/arch/unix/sys_arch.c @@ -183,9 +183,9 @@ sys_mbox_new() mbox->wait_send = 0; #ifdef SYS_STATS - stats.sys.mbox.used++; - if(stats.sys.mbox.used > stats.sys.mbox.max) { - stats.sys.mbox.max = stats.sys.mbox.used; + lwip_stats.sys.mbox.used++; + if(lwip_stats.sys.mbox.used > lwip_stats.sys.mbox.max) { + lwip_stats.sys.mbox.max = lwip_stats.sys.mbox.used; } #endif /* SYS_STATS */ @@ -197,7 +197,7 @@ sys_mbox_free(struct sys_mbox *mbox) { if(mbox != SYS_MBOX_NULL) { #ifdef SYS_STATS - stats.sys.mbox.used--; + lwip_stats.sys.mbox.used--; #endif /* SYS_STATS */ sys_sem_wait(mbox->mutex); @@ -293,9 +293,9 @@ struct sys_sem * sys_sem_new(u8_t count) { #ifdef SYS_STATS - stats.sys.sem.used++; - if(stats.sys.sem.used > stats.sys.sem.max) { - stats.sys.sem.max = stats.sys.sem.used; + lwip_stats.sys.sem.used++; + if(lwip_stats.sys.sem.used > lwip_stats.sys.sem.max) { + lwip_stats.sys.sem.max = lwip_stats.sys.sem.used; } #endif /* SYS_STATS */ return sys_sem_new_(count); @@ -404,7 +404,7 @@ sys_sem_free(struct sys_sem *sem) { if(sem != SYS_SEM_NULL) { #ifdef SYS_STATS - stats.sys.sem.used--; + lwip_stats.sys.sem.used--; #endif /* SYS_STATS */ sys_sem_free_(sem); } diff --git a/src/arch/v2pro/netif/xemacif.c b/src/arch/v2pro/netif/xemacif.c index 07656f82..58a84448 100755 --- a/src/arch/v2pro/netif/xemacif.c +++ b/src/arch/v2pro/netif/xemacif.c @@ -303,7 +303,7 @@ static err_t low_level_output(struct xemacif *xemacif_ptr, struct pbuf *p) if (Result != XST_SUCCESS) return ERR_MEM; #ifdef LINK_STATS - stats.link.xmit++; + lwip_stats.link.xmit++; #endif /* LINK_STATS */ return ERR_OK; @@ -365,14 +365,14 @@ static struct pbuf * low_level_input(struct xemacif *xemacif_ptr) } #ifdef LINK_STATS - stats.link.recv++; + lwip_stats.link.recv++; #endif /* LINK_STATS */ } else { #ifdef LINK_STATS - stats.link.memerr++; - stats.link.drop++; + lwip_stats.link.memerr++; + lwip_stats.link.drop++; #endif /* LINK_STATS */ ; } diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index efa7c476..b45ce86b 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -56,7 +56,7 @@ icmp_input(struct pbuf *p, struct netif *inp) u16_t hlen; #ifdef ICMP_STATS - ++stats.icmp.recv; + ++lwip_stats.icmp.recv; #endif /* ICMP_STATS */ #if LWIP_SNMP > 0 snmp_inc_icmpinmsgs(); @@ -75,7 +75,7 @@ icmp_input(struct pbuf *p, struct netif *inp) ip_addr_ismulticast(&iphdr->dest)) { DEBUGF(ICMP_DEBUG, ("Smurf.\n")); #ifdef ICMP_STATS - ++stats.icmp.err; + ++lwip_stats.icmp.err; #endif /* ICMP_STATS */ pbuf_free(p); return; @@ -86,7 +86,7 @@ icmp_input(struct pbuf *p, struct netif *inp) DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n")); pbuf_free(p); #ifdef ICMP_STATS - ++stats.icmp.lenerr; + ++lwip_stats.icmp.lenerr; #endif /* ICMP_STATS */ #if LWIP_SNMP > 0 snmp_inc_icmpinerrors(); @@ -99,7 +99,7 @@ icmp_input(struct pbuf *p, struct netif *inp) DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo\n")); pbuf_free(p); #ifdef ICMP_STATS - ++stats.icmp.chkerr; + ++lwip_stats.icmp.chkerr; #endif /* ICMP_STATS */ #if LWIP_SNMP > 0 snmp_inc_icmpinerrors(); @@ -117,7 +117,7 @@ icmp_input(struct pbuf *p, struct netif *inp) iecho->chksum += htons(ICMP_ECHO << 8); } #ifdef ICMP_STATS - ++stats.icmp.xmit; + ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ #if LWIP_SNMP > 0 /* increase number of messages attempted to send */ @@ -133,8 +133,8 @@ icmp_input(struct pbuf *p, struct netif *inp) default: DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type not supported.\n")); #ifdef ICMP_STATS - ++stats.icmp.proterr; - ++stats.icmp.drop; + ++lwip_stats.icmp.proterr; + ++lwip_stats.icmp.drop; #endif /* ICMP_STATS */ } pbuf_free(p); @@ -162,7 +162,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t) idur->chksum = 0; idur->chksum = inet_chksum(idur, q->len); #ifdef ICMP_STATS - ++stats.icmp.xmit; + ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ #if LWIP_SNMP > 0 /* increase number of messages attempted to send */ @@ -206,7 +206,7 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t) tehdr->chksum = 0; tehdr->chksum = inet_chksum(tehdr, q->len); #ifdef ICMP_STATS - ++stats.icmp.xmit; + ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ #if LWIP_SNMP > 0 /* increase number of messages attempted to send */ diff --git a/src/core/ipv4/ip.c b/src/core/ipv4/ip.c index 01b01e3b..807e6f6e 100644 --- a/src/core/ipv4/ip.c +++ b/src/core/ipv4/ip.c @@ -208,8 +208,8 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp) iphdr->dest.addr)); #ifdef IP_STATS - ++stats.ip.fw; - ++stats.ip.xmit; + ++lwip_stats.ip.fw; + ++lwip_stats.ip.xmit; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipforwdatagrams(); @@ -241,7 +241,7 @@ ip_input(struct pbuf *p, struct netif *inp) { #ifdef IP_STATS - ++stats.ip.recv; + ++lwip_stats.ip.recv; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipinreceives(); @@ -256,8 +256,8 @@ ip_input(struct pbuf *p, struct netif *inp) { #endif /* IP_DEBUG */ pbuf_free(p); #ifdef IP_STATS - ++stats.ip.err; - ++stats.ip.drop; + ++lwip_stats.ip.err; + ++lwip_stats.ip.drop; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipunknownprotos(); @@ -272,8 +272,8 @@ ip_input(struct pbuf *p, struct netif *inp) { pbuf_free(p); #ifdef IP_STATS - ++stats.ip.lenerr; - ++stats.ip.drop; + ++lwip_stats.ip.lenerr; + ++lwip_stats.ip.drop; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipindiscards(); @@ -290,8 +290,8 @@ ip_input(struct pbuf *p, struct netif *inp) { #endif /* IP_DEBUG */ pbuf_free(p); #ifdef IP_STATS - ++stats.ip.chkerr; - ++stats.ip.drop; + ++lwip_stats.ip.chkerr; + ++lwip_stats.ip.drop; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipindiscards(); @@ -370,8 +370,8 @@ ip_input(struct pbuf *p, struct netif *inp) { DEBUGF(IP_DEBUG, ("IP packet dropped since it was fragmented (0x%x).\n", ntohs(IPH_OFFSET(iphdr)))); #ifdef IP_STATS - ++stats.ip.opterr; - ++stats.ip.drop; + ++lwip_stats.ip.opterr; + ++lwip_stats.ip.drop; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipunknownprotos(); @@ -386,8 +386,8 @@ ip_input(struct pbuf *p, struct netif *inp) { pbuf_free(p); #ifdef IP_STATS - ++stats.ip.opterr; - ++stats.ip.drop; + ++lwip_stats.ip.opterr; + ++lwip_stats.ip.drop; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipunknownprotos(); @@ -439,8 +439,8 @@ ip_input(struct pbuf *p, struct netif *inp) { DEBUGF(IP_DEBUG, ("Unsupported transportation protocol %d\n", IPH_PROTO(iphdr))); #ifdef IP_STATS - ++stats.ip.proterr; - ++stats.ip.drop; + ++lwip_stats.ip.proterr; + ++lwip_stats.ip.drop; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipunknownprotos(); @@ -477,7 +477,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n")); #ifdef IP_STATS - ++stats.ip.err; + ++lwip_stats.ip.err; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipoutdiscards(); @@ -517,7 +517,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, #endif #ifdef IP_STATS - stats.ip.xmit++; + lwip_stats.ip.xmit++; #endif /* IP_STATS */ DEBUGF(IP_DEBUG, ("ip_output_if: %c%c ", netif->name[0], netif->name[1])); #if IP_DEBUG @@ -545,7 +545,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%lx\n", dest->addr)); #ifdef IP_STATS - ++stats.ip.rterr; + ++lwip_stats.ip.rterr; #endif /* IP_STATS */ #if LWIP_SNMP > 0 snmp_inc_ipoutdiscards(); diff --git a/src/core/ipv6/icmp6.c b/src/core/ipv6/icmp6.c index e9f62c55..746e8da0 100644 --- a/src/core/ipv6/icmp6.c +++ b/src/core/ipv6/icmp6.c @@ -53,7 +53,7 @@ icmp_input(struct pbuf *p, struct netif *inp) #ifdef ICMP_STATS - ++stats.icmp.recv; + ++lwip_stats.icmp.recv; #endif /* ICMP_STATS */ type = ((char *)p->payload)[0]; @@ -67,7 +67,7 @@ icmp_input(struct pbuf *p, struct netif *inp) pbuf_free(p); #ifdef ICMP_STATS - ++stats.icmp.lenerr; + ++lwip_stats.icmp.lenerr; #endif /* ICMP_STATS */ return; @@ -78,7 +78,7 @@ icmp_input(struct pbuf *p, struct netif *inp) DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%x)\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len))); #ifdef ICMP_STATS - ++stats.icmp.chkerr; + ++lwip_stats.icmp.chkerr; #endif /* ICMP_STATS */ /* return;*/ } @@ -95,7 +95,7 @@ icmp_input(struct pbuf *p, struct netif *inp) } DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%x)\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len))); #ifdef ICMP_STATS - ++stats.icmp.xmit; + ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ /* DEBUGF("icmp: p->len %d p->tot_len %d\n", p->len, p->tot_len);*/ @@ -106,8 +106,8 @@ icmp_input(struct pbuf *p, struct netif *inp) DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type not supported.\n")); #ifdef ICMP_STATS - ++stats.icmp.proterr; - ++stats.icmp.drop; + ++lwip_stats.icmp.proterr; + ++lwip_stats.icmp.drop; #endif /* ICMP_STATS */ } @@ -136,7 +136,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t) idur->chksum = 0; idur->chksum = inet_chksum(idur, q->len); #ifdef ICMP_STATS - ++stats.icmp.xmit; + ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ ip_output(q, NULL, @@ -168,7 +168,7 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t) tehdr->chksum = 0; tehdr->chksum = inet_chksum(tehdr, q->len); #ifdef ICMP_STATS - ++stats.icmp.xmit; + ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ ip_output(q, NULL, (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP); diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index 60d93901..6d88bdf5 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -134,8 +134,8 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr) DEBUGF(IP_DEBUG, ("\n")); #ifdef IP_STATS - ++stats.ip.fw; - ++stats.ip.xmit; + ++lwip_stats.ip.fw; + ++lwip_stats.ip.xmit; #endif /* IP_STATS */ PERF_STOP("ip_forward"); @@ -167,7 +167,7 @@ ip_input(struct pbuf *p, struct netif *inp) { #ifdef IP_STATS - ++stats.ip.recv; + ++lwip_stats.ip.recv; #endif /* IP_STATS */ /* identify the IP header */ @@ -181,8 +181,8 @@ ip_input(struct pbuf *p, struct netif *inp) { #endif /* IP_DEBUG */ pbuf_free(p); #ifdef IP_STATS - ++stats.ip.err; - ++stats.ip.drop; + ++lwip_stats.ip.err; + ++lwip_stats.ip.drop; #endif /* IP_STATS */ return; } @@ -241,8 +241,8 @@ ip_input(struct pbuf *p, struct netif *inp) { iphdr->nexthdr)); #ifdef IP_STATS - ++stats.ip.proterr; - ++stats.ip.drop; + ++lwip_stats.ip.proterr; + ++lwip_stats.ip.drop; #endif /* IP_STATS */ } @@ -270,7 +270,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, if(pbuf_header(p, IP_HLEN)) { DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n")); #ifdef IP_STATS - ++stats.ip.err; + ++lwip_stats.ip.err; #endif /* IP_STATS */ return ERR_BUF; @@ -300,7 +300,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, } #ifdef IP_STATS - ++stats.ip.xmit; + ++lwip_stats.ip.xmit; #endif /* IP_STATS */ DEBUGF(IP_DEBUG, ("ip_output_if: %c%c (len %d)\n", netif->name[0], netif->name[1], p->tot_len)); @@ -326,7 +326,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, if((netif = ip_route(dest)) == NULL) { DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%lx\n", dest->addr)); #ifdef IP_STATS - ++stats.ip.rterr; + ++lwip_stats.ip.rterr; #endif /* IP_STATS */ return ERR_RTE; } diff --git a/src/core/mem.c b/src/core/mem.c index 2dc00ac2..ff1dcda2 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -130,7 +130,7 @@ mem_init(void) lfree = (struct mem *)ram; #ifdef MEM_STATS - stats.mem.avail = MEM_SIZE; + lwip_stats.mem.avail = MEM_SIZE; #endif /* MEM_STATS */ } /*-----------------------------------------------------------------------------------*/ @@ -173,12 +173,12 @@ mem_malloc(mem_size_t size) mem2->used = 0; mem->used = 1; #ifdef MEM_STATS - stats.mem.used += size; - /* if(stats.mem.max < stats.mem.used) { - stats.mem.max = stats.mem.used; + lwip_stats.mem.used += size; + /* if(lwip_stats.mem.max < lwip_stats.mem.used) { + lwip_stats.mem.max = lwip_stats.mem.used; } */ - if(stats.mem.max < ptr2) { - stats.mem.max = ptr2; + if(lwip_stats.mem.max < ptr2) { + lwip_stats.mem.max = ptr2; } #endif /* MEM_STATS */ @@ -199,7 +199,7 @@ mem_malloc(mem_size_t size) } DEBUGF(MEM_DEBUG, ("mem_malloc: could not allocate %d bytes\n", (int)size)); #ifdef MEM_STATS - ++stats.mem.err; + ++lwip_stats.mem.err; #endif /* MEM_STATS */ sys_sem_signal(mem_sem); return NULL; @@ -223,7 +223,7 @@ mem_free(void *rmem) if((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { DEBUGF(MEM_DEBUG, ("mem_free: illegal memory\n")); #ifdef MEM_STATS - ++stats.mem.err; + ++lwip_stats.mem.err; #endif /* MEM_STATS */ return; } @@ -238,7 +238,7 @@ mem_free(void *rmem) } #ifdef MEM_STATS - stats.mem.used -= mem->next - ((u8_t *)mem - ram) - SIZEOF_STRUCT_MEM; + lwip_stats.mem.used -= mem->next - ((u8_t *)mem - ram) - SIZEOF_STRUCT_MEM; #endif /* MEM_STATS */ plug_holes(mem); @@ -280,7 +280,7 @@ mem_realloc(void *rmem, mem_size_t newsize) size = mem->next - ptr - SIZEOF_STRUCT_MEM; #ifdef MEM_STATS - stats.mem.used -= (size - newsize); + lwip_stats.mem.used -= (size - newsize); #endif /* MEM_STATS */ if(newsize + SIZEOF_STRUCT_MEM + MIN_SIZE < size) { diff --git a/src/core/memp.c b/src/core/memp.c index 5082828f..34dc8079 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -143,9 +143,9 @@ memp_init(void) #ifdef MEMP_STATS for(i = 0; i < MEMP_MAX; ++i) { - stats.memp[i].used = stats.memp[i].max = - stats.memp[i].err = 0; - stats.memp[i].avail = memp_num[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]; } #endif /* MEMP_STATS */ @@ -187,9 +187,9 @@ memp_malloc(memp_t type) memp_tab[type] = memp->next; memp->next = NULL; #ifdef MEMP_STATS - ++stats.memp[type].used; - if(stats.memp[type].used > stats.memp[type].max) { - stats.memp[type].max = stats.memp[type].used; + ++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 */ ASSERT("memp_malloc: memp properly aligned", @@ -202,7 +202,7 @@ memp_malloc(memp_t type) } else { DEBUGF(MEMP_DEBUG, ("memp_malloc: out of memory in pool %d\n", type)); #ifdef MEMP_STATS - ++stats.memp[type].err; + ++lwip_stats.memp[type].err; #endif /* MEMP_STATS */ return NULL; } @@ -253,7 +253,7 @@ memp_free(memp_t type, void *mem) memp = (struct memp *)((u8_t *)mem - sizeof(struct memp)); #ifdef MEMP_STATS - stats.memp[type].used--; + lwip_stats.memp[type].used--; #endif /* MEMP_STATS */ memp->next = memp_tab[type]; diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 1b18f80d..6bb37b87 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -81,7 +81,7 @@ pbuf_init(void) ASSERT("pbuf_init: pool aligned", (long)pbuf_pool % MEM_ALIGNMENT == 0); #ifdef PBUF_STATS - stats.pbuf.avail = PBUF_POOL_SIZE; + lwip_stats.pbuf.avail = PBUF_POOL_SIZE; #endif /* PBUF_STATS */ /* Set up ->next pointers to link the pbufs of the pool together. */ @@ -123,7 +123,7 @@ pbuf_pool_alloc(void) pretend to be out of buffers and return NULL. */ if(pbuf_pool_free_lock) { #ifdef PBUF_STATS - ++stats.pbuf.alloc_locked; + ++lwip_stats.pbuf.alloc_locked; #endif /* PBUF_STATS */ return NULL; } @@ -135,7 +135,7 @@ pbuf_pool_alloc(void) } #ifdef PBUF_STATS } else { - ++stats.pbuf.alloc_locked; + ++lwip_stats.pbuf.alloc_locked; #endif /* PBUF_STATS */ } pbuf_pool_alloc_lock = 0; @@ -143,9 +143,9 @@ pbuf_pool_alloc(void) #ifdef PBUF_STATS if(p != NULL) { - ++stats.pbuf.used; - if(stats.pbuf.used > stats.pbuf.max) { - stats.pbuf.max = stats.pbuf.used; + ++lwip_stats.pbuf.used; + if(lwip_stats.pbuf.used > lwip_stats.pbuf.max) { + lwip_stats.pbuf.max = lwip_stats.pbuf.used; } } #endif /* PBUF_STATS */ @@ -160,7 +160,7 @@ pbuf_pool_free(struct pbuf *p) #ifdef PBUF_STATS for(q = p; q != NULL; q = q->next) { - --stats.pbuf.used; + --lwip_stats.pbuf.used; } #endif /* PBUF_STATS */ @@ -221,7 +221,7 @@ pbuf_alloc(pbuf_layer l, u16_t size, pbuf_flag flag) p = pbuf_pool_alloc(); if(p == NULL) { #ifdef PBUF_STATS - ++stats.pbuf.err; + ++lwip_stats.pbuf.err; #endif /* PBUF_STATS */ return NULL; } @@ -247,7 +247,7 @@ pbuf_alloc(pbuf_layer l, u16_t size, pbuf_flag flag) if(q == NULL) { DEBUGF(PBUF_DEBUG, ("pbuf_alloc: Out of pbufs in pool,\n")); #ifdef PBUF_STATS - ++stats.pbuf.err; + ++lwip_stats.pbuf.err; #endif /* PBUF_STATS */ pbuf_pool_free(p); return NULL; @@ -328,7 +328,7 @@ pbuf_refresh(void) pbuf_pool_free_cache = NULL; #ifdef PBUF_STATS } else { - ++stats.pbuf.refresh_locked; + ++lwip_stats.pbuf.refresh_locked; #endif /* PBUF_STATS */ } @@ -390,7 +390,7 @@ pbuf_realloc(struct pbuf *p, u16_t size) r = q->next; PBUF_POOL_FREE(q); #ifdef PBUF_STATS - --stats.pbuf.used; + --lwip_stats.pbuf.used; #endif /* PBUF_STATS */ q = r; } @@ -502,7 +502,7 @@ pbuf_free(struct pbuf *p) q = p->next; PBUF_POOL_FREE(p); #ifdef PBUF_STATS - --stats.pbuf.used; + --lwip_stats.pbuf.used; #endif /* PBUF_STATS */ } else if(p->flags == PBUF_FLAG_ROM) { q = p->next; diff --git a/src/core/stats.c b/src/core/stats.c index 157d3ed9..d01e5fb7 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -41,14 +41,14 @@ #ifdef STATS -struct stats_ stats; +struct stats_ lwip_stats; #endif /* STATS */ /*-----------------------------------------------------------------------------------*/ void stats_init(void) { #ifdef STATS - memset(&stats, 0, sizeof(struct stats_)); + memset(&lwip_stats, 0, sizeof(struct stats_)); #endif /* STATS */ } /*-----------------------------------------------------------------------------------*/ diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 35bec0d2..f67e4b26 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -102,7 +102,7 @@ tcp_input(struct pbuf *p, struct netif *inp) #ifdef TCP_STATS - ++stats.tcp.recv; + ++lwip_stats.tcp.recv; #endif /* TCP_STATS */ iphdr = p->payload; @@ -129,8 +129,8 @@ tcp_input(struct pbuf *p, struct netif *inp) tcp_debug_print(tcphdr); #endif /* TCP_DEBUG */ #ifdef TCP_STATS - ++stats.tcp.chkerr; - ++stats.tcp.drop; + ++lwip_stats.tcp.chkerr; + ++lwip_stats.tcp.drop; #endif /* TCP_STATS */ pbuf_free(p); @@ -316,8 +316,8 @@ tcp_input(struct pbuf *p, struct netif *inp) DEBUGF(TCP_RST_DEBUG, ("tcp_input: no PCB match found, resetting.\n")); if(!(TCPH_FLAGS(tcphdr) & TCP_RST)) { #ifdef TCP_STATS - ++stats.tcp.proterr; - ++stats.tcp.drop; + ++lwip_stats.tcp.proterr; + ++lwip_stats.tcp.drop; #endif /* TCP_STATS */ tcp_rst(ackno, seqno + tcplen, &(iphdr->dest), &(iphdr->src), @@ -360,7 +360,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb) if(npcb == NULL) { DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n")); #ifdef TCP_STATS - ++stats.tcp.memerr; + ++lwip_stats.tcp.memerr; #endif /* TCP_STATS */ return ERR_MEM; } diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 555eafab..36bb7462 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -203,7 +203,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: no room for TCP header in pbuf.\n")); #ifdef TCP_STATS - ++stats.tcp.err; + ++lwip_stats.tcp.err; #endif /* TCP_STATS */ goto memerr; } @@ -292,7 +292,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, return ERR_OK; memerr: #ifdef TCP_STATS - ++stats.tcp.memerr; + ++lwip_stats.tcp.memerr; #endif /* TCP_STATS */ if(queue != NULL) { @@ -354,7 +354,7 @@ tcp_output(struct tcp_pcb *pcb) DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: (ACK) no room for TCP header in pbuf.\n")); #ifdef TCP_STATS - ++stats.tcp.err; + ++lwip_stats.tcp.err; #endif /* TCP_STATS */ pbuf_free(p); return ERR_BUF; @@ -495,7 +495,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb) &(pcb->remote_ip), IP_PROTO_TCP, seg->p->tot_len); #ifdef TCP_STATS - ++stats.tcp.xmit; + ++lwip_stats.tcp.xmit; #endif /* TCP_STATS */ ip_output(seg->p, &(pcb->local_ip), &(pcb->remote_ip), TCP_TTL, @@ -520,7 +520,7 @@ tcp_rst(u32_t seqno, u32_t ackno, DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_rst: no room for TCP header in pbuf.\n")); #ifdef TCP_STATS - ++stats.tcp.err; + ++lwip_stats.tcp.err; #endif /* TCP_STATS */ return; } @@ -540,7 +540,7 @@ tcp_rst(u32_t seqno, u32_t ackno, IP_PROTO_TCP, p->tot_len); #ifdef TCP_STATS - ++stats.tcp.xmit; + ++lwip_stats.tcp.xmit; #endif /* TCP_STATS */ ip_output(p, local_ip, remote_ip, TCP_TTL, IP_PROTO_TCP); pbuf_free(p); diff --git a/src/core/udp.c b/src/core/udp.c index 67679b3f..ad37d475 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -28,7 +28,7 @@ * * Author: Adam Dunkels * - * $Id: udp.c,v 1.4 2002/12/18 10:40:01 jani Exp $ + * $Id: udp.c,v 1.5 2002/12/18 12:49:02 jani Exp $ */ /*-----------------------------------------------------------------------------------*/ @@ -156,7 +156,7 @@ udp_input(struct pbuf *p, struct netif *inp) PERF_START; #ifdef UDP_STATS - ++stats.udp.recv; + ++lwip_stats.udp.recv; #endif /* UDP_STATS */ iphdr = p->payload; @@ -220,8 +220,8 @@ udp_input(struct pbuf *p, struct netif *inp) IP_PROTO_UDPLITE, ntohs(udphdr->len)) != 0) { DEBUGF(UDP_DEBUG, ("udp_input: UDP Lite datagram discarded due to failing checksum\n")); #ifdef UDP_STATS - ++stats.udp.chkerr; - ++stats.udp.drop; + ++lwip_stats.udp.chkerr; + ++lwip_stats.udp.drop; #endif /* UDP_STATS */ #if LWIP_SNMP > 0 snmp_inc_udpinerrors(); @@ -237,8 +237,8 @@ udp_input(struct pbuf *p, struct netif *inp) DEBUGF(UDP_DEBUG, ("udp_input: UDP datagram discarded due to failing checksum\n")); #ifdef UDP_STATS - ++stats.udp.chkerr; - ++stats.udp.drop; + ++lwip_stats.udp.chkerr; + ++lwip_stats.udp.drop; #endif /* UDP_STATS */ #if LWIP_SNMP > 0 snmp_inc_udpinerrors(); @@ -272,8 +272,8 @@ udp_input(struct pbuf *p, struct netif *inp) icmp_dest_unreach(p, ICMP_DUR_PORT); } #ifdef UDP_STATS - ++stats.udp.proterr; - ++stats.udp.drop; + ++lwip_stats.udp.proterr; + ++lwip_stats.udp.drop; #endif /* UDP_STATS */ #if LWIP_SNMP > 0 snmp_inc_udpnoports(); @@ -321,7 +321,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p) if((netif = ip_route(&(pcb->remote_ip))) == NULL) { DEBUGF(UDP_DEBUG, ("udp_send: No route to 0x%lx\n", pcb->remote_ip.addr)); #ifdef UDP_STATS - ++stats.udp.rterr; + ++lwip_stats.udp.rterr; #endif /* UDP_STATS */ return ERR_RTE; } @@ -372,7 +372,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p) } #ifdef UDP_STATS - ++stats.udp.xmit; + ++lwip_stats.udp.xmit; #endif /* UDP_STATS */ return err; } diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h index 0d1d7acf..a5e97e50 100644 --- a/src/include/lwip/stats.h +++ b/src/include/lwip/stats.h @@ -96,7 +96,7 @@ struct stats_ { struct stats_sys sys; }; -extern struct stats_ stats; +extern struct stats_ lwip_stats; #endif /* STATS */ diff --git a/src/netif/etharp.c b/src/netif/etharp.c index b4443e08..e84ba39c 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -3,6 +3,9 @@ * Address Resolution Protocol module for IP over Ethernet * * $Log: etharp.c,v $ + * Revision 1.17 2002/12/18 12:49:02 jani + * renamed (hopefully everywhere) stats to lwip_stats.closes bug #1901 + * * Revision 1.16 2002/12/17 09:41:16 jani * Use C style comments.In debug stataments cast various struct pointers to void* to * avoid printf warnings.misc warnings in etharp. @@ -548,7 +551,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q) out if it does.. */ DEBUGF(ETHARP_DEBUG, ("etharp_output: could not allocate room for header.\n")); #ifdef LINK_STATS - ++stats.link.lenerr; + ++lwip_stats.link.lenerr; #endif /* LINK_STATS */ return NULL; } diff --git a/src/netif/ethernetif.c b/src/netif/ethernetif.c index 40a6ffd2..7b4e0cf1 100644 --- a/src/netif/ethernetif.c +++ b/src/netif/ethernetif.c @@ -108,7 +108,7 @@ low_level_output(struct ethernetif *ethernetif, struct pbuf *p) signal that packet should be sent(); #ifdef LINK_STATS - stats.link.xmit++; + lwip_stats.link.xmit++; #endif /* LINK_STATS */ return ERR_OK; @@ -146,13 +146,13 @@ low_level_input(struct ethernetif *ethernetif) } acknowledge that packet has been read(); #ifdef LINK_STATS - stats.link.recv++; + lwip_stats.link.recv++; #endif /* LINK_STATS */ } else { drop packet(); #ifdef LINK_STATS - stats.link.memerr++; - stats.link.drop++; + lwip_stats.link.memerr++; + lwip_stats.link.drop++; #endif /* LINK_STATS */ } @@ -189,8 +189,8 @@ ethernetif_output(struct netif *netif, struct pbuf *p, q = pbuf_alloc(PBUF_LINK, 14, PBUF_RAM); if(q == NULL) { #ifdef LINK_STATS - stats.link.drop++; - stats.link.memerr++; + lwip_stats.link.drop++; + lwip_stats.link.memerr++; #endif /* LINK_STATS */ return ERR_MEM; } @@ -240,8 +240,8 @@ ethernetif_output(struct netif *netif, struct pbuf *p, return err; } #ifdef LINK_STATS - stats.link.drop++; - stats.link.memerr++; + lwip_stats.link.drop++; + lwip_stats.link.memerr++; #endif /* LINK_STATS */ return ERR_MEM; } @@ -283,7 +283,7 @@ ethernetif_input(struct netif *netif) if(p != NULL) { #ifdef LINK_STATS - stats.link.recv++; + lwip_stats.link.recv++; #endif /* LINK_STATS */ ethhdr = p->payload; diff --git a/src/netif/slipif.c b/src/netif/slipif.c index 5dd5ff7d..7f360f51 100644 --- a/src/netif/slipif.c +++ b/src/netif/slipif.c @@ -120,7 +120,7 @@ slipif_input( struct netif * netif ) pbuf_realloc(q, recved); #ifdef LINK_STATS - ++stats.link.recv; + ++lwip_stats.link.recv; #endif /* LINK_STATS */ DEBUGF(SLIP_DEBUG, ("slipif: Got packet\n")); @@ -147,7 +147,7 @@ slipif_input( struct netif * netif ) #ifdef LINK_STATS if(p == NULL) { - ++stats.link.drop; + ++lwip_stats.link.drop; DEBUGF(SLIP_DEBUG, ("slipif_input: no new pbuf! (DROP)\n")); } #endif /* LINK_STATS */