diff --git a/configs/clicker2-stm32/README.txt b/configs/clicker2-stm32/README.txt index ae090f760c..af3cdcf38c 100644 --- a/configs/clicker2-stm32/README.txt +++ b/configs/clicker2-stm32/README.txt @@ -513,11 +513,8 @@ Configurations logic. A major redesign was done to better handle ACKs and retransmissions, and to work with TCP dynamic windowing. - 2017-05-25: TCP w/HC06 currently sends on packet than hangs. That - one packet is 1220 bytes long (of 4096 byte total message length). - It is received by the server application correctly. The hang is - probably due to remaining ACK-related problems. One retransmission - is recorded in network stastics. + 2017-05-25: After some rather extensive debug, the TCP test was made + to with (HC06 and short addressing). Test Matrix: The following configurations have been tested: @@ -525,7 +522,7 @@ Configurations TEST DATE COMPRESSION ADDRESSING UDP TCP ----------- ---------- ---- ---- - hc06 short 6/21 --- + hc06 short 6/21 6/25 extended 6/22 --- hc1 short 6/23 --- extended 6/23 --- @@ -597,10 +594,10 @@ Configurations emptied and dumped to the system logging device (USART3 in this configuration): - CONFIG_USBDEV_TRACE=y : Enable USB trace feature - CONFIG_USBDEV_TRACE_NRECORDS=128 : Buffer 128 records in memory - CONFIG_NSH_USBDEV_TRACE=n : No builtin tracing from NSH - CONFIG_NSH_ARCHINIT=y : Automatically start the USB monitor + CONFIG_USBDEV_TRACE=y : Enable USB trace feature + CONFIG_USBDEV_TRACE_NRECORDS=128 : Buffer 128 records in memory + CONFIG_NSH_USBDEV_TRACE=n : No builtin tracing from NSH + CONFIG_NSH_ARCHINIT=y : Automatically start the USB monitor CONFIG_USBMONITOR=y : Enable the USB monitor daemon CONFIG_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size CONFIG_USBMONITOR_PRIORITY=50 : USB monitor daemon priority diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index d79a1f8a65..4e3701e6fe 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -477,8 +477,6 @@ static uint16_t tcp_send_interrupt(FAR struct net_driver_s *dev, uint16_t winleft; uint16_t sndlen; - DEBUGASSERT((flags & WPAN_POLL) != 0); - /* Get the amount of TCP payload data that we can send in the next * packet. */ @@ -537,15 +535,32 @@ static uint16_t tcp_send_interrupt(FAR struct net_driver_s *dev, goto end_wait; } - /* Increment the count of bytes sent and count of packets sent */ + /* Increment the count of bytes sent, the number of unacked bytes, + * and the total count of TCP packets sent. + * + * NOTE: tcp_appsend() normally increments conn->unacked based on + * the value of dev->d_sndlen. However, dev->d_len is always + * zero for 6LoWPAN since it does no send via the dev->d_bufuse + * but, rather, uses a backdoor frame interface with the IEEE + * 802.15.4 MAC. + */ + + sinfo->s_sent += sndlen; + conn->unacked += sndlen; + +#ifdef CONFIG_NET_TCP_WRITE_BUFFERS + /* For compability with buffered send logic */ + + conn->sndseq_max = tcp_addsequence(conn->sndseq, conn->unacked); +#endif - sinfo->s_sent += sndlen; #ifdef CONFIG_NET_STATISTICS g_netstats.tcp.sent++; #endif - ninfo("Sent: acked=%d sent=%d buflen=%d\n", - sinfo->s_acked, sinfo->s_sent, sinfo->s_buflen); + ninfo("Sent: acked=%d sent=%d buflen=%d unacked=%d\n", + sinfo->s_acked, sinfo->s_sent, sinfo->s_buflen, + conn->unacked); } } @@ -642,7 +657,7 @@ static int sixlowpan_send_packet(FAR struct socket *psock, * device related events, no connect-related events. */ - sinfo.s_cb = devif_callback_alloc(dev, &conn->list); + sinfo.s_cb = tcp_callback_alloc(conn); if (sinfo.s_cb != NULL) { int ret; @@ -666,7 +681,8 @@ static int sixlowpan_send_packet(FAR struct socket *psock, /* Set up the callback in the connection */ - sinfo.s_cb->flags = (NETDEV_DOWN | WPAN_POLL); + sinfo.s_cb->flags = (NETDEV_DOWN | TCP_ACKDATA | TCP_REXMIT | + TCP_DISCONN_EVENTS | WPAN_POLL); sinfo.s_cb->priv = (FAR void *)&sinfo; sinfo.s_cb->event = tcp_send_interrupt; @@ -696,7 +712,7 @@ static int sixlowpan_send_packet(FAR struct socket *psock, /* Make sure that no further interrupts are processed */ - devif_conn_callback_free(dev, sinfo.s_cb, &conn->list); + tcp_callback_free(conn, sinfo.s_cb); } } diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index 10be0edc78..8b34988401 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -451,8 +451,10 @@ found: if ((conn->tcpstateflags & TCP_STATE_MASK) == TCP_ESTABLISHED) { - nwarn("WARNING: conn->sndseq %d, conn->unacked %d\n", - tcp_getsequence(conn->sndseq), conn->unacked); + nwarn("WARNING: ackseq > unackseq\n"); + nwarn(" sndseq=%u unacked=%u unackseq=%u ackseq=%u\n", + tcp_getsequence(conn->sndseq), conn->unacked, unackseq, + ackseq); goto reset; } }