From: Joshua Wise Date: Sun, 14 Dec 2008 01:32:49 +0000 (-0500) Subject: Merge nyus.joshuawise.com:/storage/git/netwatch X-Git-Url: http://git.joshuawise.com/netwatch.git/commitdiff_plain/4f171920f824ffca9a27eb5d25a4547ae0a5465a?hp=6b91f09cf683c29989ab259f4a433fb7d1427b36 Merge nyus.joshuawise.com:/storage/git/netwatch --- diff --git a/lwip/src/core/stats.c b/lwip/src/core/stats.c index 0604468..2d5c1e3 100644 --- a/lwip/src/core/stats.c +++ b/lwip/src/core/stats.c @@ -52,45 +52,45 @@ struct stats_ lwip_stats; void stats_display_proto(struct stats_proto *proto, char *name) { - 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)); - LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", proto->chkerr)); - LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", proto->lenerr)); - LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", proto->memerr)); - LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F"\n\t", proto->rterr)); - LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", proto->proterr)); - LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F"\n\t", proto->opterr)); - LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n\t", proto->err)); - LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit)); + LWIP_PLATFORM_DIAG(("%s", name)); + LWIP_PLATFORM_DIAG((" xmit: %"STAT_COUNTER_F, proto->xmit)); + LWIP_PLATFORM_DIAG((" rexmit: %"STAT_COUNTER_F, proto->rexmit)); + LWIP_PLATFORM_DIAG((" recv: %"STAT_COUNTER_F, proto->recv)); + LWIP_PLATFORM_DIAG((" fw: %"STAT_COUNTER_F, proto->fw)); + LWIP_PLATFORM_DIAG((" drop: %"STAT_COUNTER_F, proto->drop)); + LWIP_PLATFORM_DIAG((" chkerr: %"STAT_COUNTER_F, proto->chkerr)); + LWIP_PLATFORM_DIAG((" lenerr: %"STAT_COUNTER_F, proto->lenerr)); + LWIP_PLATFORM_DIAG((" memerr: %"STAT_COUNTER_F, proto->memerr)); + LWIP_PLATFORM_DIAG((" rterr: %"STAT_COUNTER_F, proto->rterr)); + LWIP_PLATFORM_DIAG((" proterr: %"STAT_COUNTER_F, proto->proterr)); + LWIP_PLATFORM_DIAG((" opterr: %"STAT_COUNTER_F, proto->opterr)); + LWIP_PLATFORM_DIAG((" err: %"STAT_COUNTER_F, proto->err)); + LWIP_PLATFORM_DIAG((" cachehit: %"STAT_COUNTER_F, proto->cachehit)); } void stats_display_igmp(struct stats_igmp *igmp) { - LWIP_PLATFORM_DIAG(("\nIGMP\n\t")); - LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", igmp->lenerr)); - LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", igmp->chkerr)); - LWIP_PLATFORM_DIAG(("v1_rxed: %"STAT_COUNTER_F"\n\t", igmp->v1_rxed)); - LWIP_PLATFORM_DIAG(("join_sent: %"STAT_COUNTER_F"\n\t", igmp->join_sent)); - LWIP_PLATFORM_DIAG(("leave_sent: %"STAT_COUNTER_F"\n\t", igmp->leave_sent)); - LWIP_PLATFORM_DIAG(("unicast_query: %"STAT_COUNTER_F"\n\t", igmp->unicast_query)); - LWIP_PLATFORM_DIAG(("report_sent: %"STAT_COUNTER_F"\n\t", igmp->report_sent)); - 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)); + LWIP_PLATFORM_DIAG(("IGMP")); + LWIP_PLATFORM_DIAG((" lenerr: %"STAT_COUNTER_F, igmp->lenerr)); + LWIP_PLATFORM_DIAG((" chkerr: %"STAT_COUNTER_F, igmp->chkerr)); + LWIP_PLATFORM_DIAG((" v1_rxed: %"STAT_COUNTER_F, igmp->v1_rxed)); + LWIP_PLATFORM_DIAG((" join_sent: %"STAT_COUNTER_F, igmp->join_sent)); + LWIP_PLATFORM_DIAG((" leave_sent: %"STAT_COUNTER_F, igmp->leave_sent)); + LWIP_PLATFORM_DIAG((" unicast_query: %"STAT_COUNTER_F, igmp->unicast_query)); + LWIP_PLATFORM_DIAG((" report_sent: %"STAT_COUNTER_F, igmp->report_sent)); + LWIP_PLATFORM_DIAG((" report_rxed: %"STAT_COUNTER_F, igmp->report_rxed)); + LWIP_PLATFORM_DIAG((" group_query_rxed: %"STAT_COUNTER_F, igmp->group_query_rxed)); } void stats_display_mem(struct stats_mem *mem, char *name) { - LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name)); - LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail)); - LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used)); - LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max)); - LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err)); + LWIP_PLATFORM_DIAG(("MEM %s", name)); + LWIP_PLATFORM_DIAG((" avail: %"U32_F, (u32_t)mem->avail)); + LWIP_PLATFORM_DIAG((" used: %"U32_F, (u32_t)mem->used)); + LWIP_PLATFORM_DIAG((" max: %"U32_F, (u32_t)mem->max)); + LWIP_PLATFORM_DIAG((" err: %"U32_F, (u32_t)mem->err)); } void diff --git a/lwip/src/include/arch/cc.h b/lwip/src/include/arch/cc.h index df50e8d..7878080 100644 --- a/lwip/src/include/arch/cc.h +++ b/lwip/src/include/arch/cc.h @@ -3,6 +3,7 @@ #include #include +#include #include typedef uint8_t u8_t; @@ -28,7 +29,7 @@ typedef uint32_t mem_ptr_t; #define LWIP_PLATFORM_HTONS(x) htons(x) #define LWIP_PLATFORM_HTONL(x) htonl(x) -#define LWIP_PLATFORM_DIAG(x) dolog(x) +#define LWIP_PLATFORM_DIAG(x) outputf x #define LWIP_PLATFORM_ASSERT(x) dologf("ASSERT FAILED: %s\n", (x)); #endif diff --git a/lwip/src/include/lwipopts.h b/lwip/src/include/lwipopts.h index ec5a614..368bf86 100644 --- a/lwip/src/include/lwipopts.h +++ b/lwip/src/include/lwipopts.h @@ -23,7 +23,13 @@ extern void _memcpy(void *dest, const void *src, int bytes); #define TCP_SND_BUF (16 * TCP_MSS) #define TCP_SND_QUEUELEN 16 -#define MEMP_NUM_PBUF 128 -#define PBUF_POOL_SIZE 96 +#define MEMP_NUM_PBUF 256 +#define PBUF_POOL_SIZE 128 +#define PBUF_POOL_BUFSIZE 512 + +#define LWIP_STATS 1 +#define LWIP_STATS_DISPLAY 1 +#define U16_F "d" +#define U32_F "d" #endif diff --git a/net/rfb.c b/net/rfb.c index 5fe1a11..70d2c05 100644 --- a/net/rfb.c +++ b/net/rfb.c @@ -6,6 +6,7 @@ #include "../aseg-paging/keyboard.h" #include "lwip/tcp.h" +#include "lwip/stats.h" #include "rfb.h" @@ -322,6 +323,13 @@ static err_t rfb_sent(void *arg, struct tcp_pcb *pcb, uint16_t len) { return ERR_OK; } +static err_t rfb_poll(void *arg, struct tcp_pcb *pcb) { + struct rfb_state *state = arg; + send_fsm(pcb, state); + stats_display(); + return ERR_OK; +} + static void close_conn(struct tcp_pcb *pcb, struct rfb_state *state) { tcp_arg(pcb, NULL); tcp_sent(pcb, NULL); @@ -591,9 +599,9 @@ static err_t rfb_accept(void *arg, struct tcp_pcb *pcb, err_t err) { tcp_arg(pcb, state); tcp_recv(pcb, rfb_recv); tcp_sent(pcb, rfb_sent); + tcp_poll(pcb, rfb_poll, 1); /* tcp_err(pcb, rfb_err); - tcp_poll(pcb, rfb_poll, 2); */ tcp_write(pcb, "RFB 003.008\n", 12, 0); tcp_output(pcb);