Free (GPLv2) TCP/IP stack developed by TASS Belgium
Dependents: lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more
PicoTCP. Copyright (c) 2013 TASS Belgium NV.
Released under the GNU General Public License, version 2.
Different licensing models may exist, at the sole discretion of the Copyright holders.
Official homepage: http://www.picotcp.com
Bug tracker: https://github.com/tass-belgium/picotcp/issues
Development steps:
initial integration with mbed RTOSgeneric mbed Ethernet driverhigh performance NXP LPC1768 specific Ethernet driverMulti-threading support for mbed RTOSBerkeley sockets and integration with the New Socket APIFork of the apps running on top of the New Socket APIScheduling optimizations- Debugging/benchmarking/testing
Demo application (measuring TCP sender performance):
Import programlpc1768-picotcp-demo
A PicoTCP demo app testing the ethernet throughput on the lpc1768 mbed board.
Diff: modules/pico_tcp.c
- Revision:
- 111:4003cf17bc15
- Parent:
- 110:0ece1bbbd36e
- Child:
- 115:c8bcc739ed53
- Child:
- 116:34b8859c5537
--- a/modules/pico_tcp.c Fri Nov 01 06:52:32 2013 +0000 +++ b/modules/pico_tcp.c Mon Nov 04 07:54:12 2013 +0000 @@ -133,6 +133,7 @@ uint32_t max_size; uint32_t size; uint32_t frames; + uint16_t overhead; }; static void tcp_discard_all_segments(struct pico_tcp_queue *tq); static void *peek_segment(struct pico_tcp_queue *tq, uint32_t seq) @@ -178,8 +179,8 @@ { int32_t ret = -1; uint16_t payload_len = (uint16_t)(IS_INPUT_QUEUE(tq) ? - ((struct tcp_input_segment *)f)->payload_len + TCP_INPUT_OVERHEAD: - ((struct pico_frame *)f)->payload_len); + ((struct tcp_input_segment *)f)->payload_len: + ((struct pico_frame *)f)->buffer_len); if (payload_len <= 0) { tcp_dbg("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! TRIED TO ENQUEUE INVALID SEGMENT!\n"); @@ -197,7 +198,7 @@ ret = 0; goto out; } - tq->size += payload_len; + tq->size += (uint16_t)(payload_len + tq->overhead); if (payload_len > 0) tq->frames++; ret = (int32_t)payload_len; @@ -211,12 +212,12 @@ { void *f1; uint16_t payload_len = (uint16_t)(IS_INPUT_QUEUE(tq)? - ((struct tcp_input_segment *)f)->payload_len + TCP_INPUT_OVERHEAD: - ((struct pico_frame *)f)->payload_len); + ((struct tcp_input_segment *)f)->payload_len: + ((struct pico_frame *)f)->buffer_len); LOCK(Mutex); f1 = pico_tree_delete(&tq->pool,f); if (f1) { - tq->size -= payload_len; + tq->size -= (uint16_t)(payload_len + tq->overhead); if (payload_len > 0) tq->frames--; } @@ -780,7 +781,8 @@ t->tcpq_in.max_size = PICO_DEFAULT_SOCKETQ; t->tcpq_out.max_size = PICO_DEFAULT_SOCKETQ; t->tcpq_hold.max_size = 2*PICO_TCP_DEFAULT_MSS; - + t->tcpq_in.overhead=(sizeof(struct tcp_input_segment)+sizeof(struct pico_tree_node)); + t->tcpq_out.overhead=t->tcpq_hold.overhead=sizeof(struct pico_frame)+sizeof(struct pico_tree_node); /* disable Nagle by default */ //t->sock.opt_flags |= (1 << PICO_SOCKET_OPT_TCPNODELAY); /* Nagle is enabled by default */ @@ -1777,6 +1779,8 @@ new->tcpq_in.max_size = PICO_DEFAULT_SOCKETQ; new->tcpq_out.max_size = PICO_DEFAULT_SOCKETQ; new->tcpq_hold.max_size = 2*PICO_TCP_DEFAULT_MSS; + new->tcpq_in.overhead=(sizeof(struct tcp_input_segment)+sizeof(struct pico_tree_node)); + new->tcpq_out.overhead=new->tcpq_hold.overhead=sizeof(struct pico_frame)+sizeof(struct pico_tree_node); f->sock = &new->sock; tcp_parse_options(f);