summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-11-26 05:26:27 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-11-26 05:26:27 +0000
commitb1e43c09bda98ba3caf419e99de6639170ce309a (patch)
tree76b59e2bbd7c8cef1e90e1743984df2cddfc4ab3
parent9ded5b25e4936008603ec842e3121e95a061a6b1 (diff)
downloadnuttx-b1e43c09bda98ba3caf419e99de6639170ce309a.tar.gz
nuttx-b1e43c09bda98ba3caf419e99de6639170ce309a.tar.bz2
nuttx-b1e43c09bda98ba3caf419e99de6639170ce309a.zip
Fix un-acked backlog coordinatin bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3133 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog6
-rw-r--r--nuttx/Documentation/NuttX.html8
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/thttpd/defconfig3
-rw-r--r--nuttx/examples/thttpd/main.c6
-rw-r--r--nuttx/net/send.c2
-rw-r--r--nuttx/net/uip/uip_tcpappsend.c72
6 files changed, 50 insertions, 47 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index d08d9e8aa..113aef0b8 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -1347,6 +1347,12 @@
fixed that is needed by all Cortex-M3 NuttX users.
* configs/olimex-lpc1766stk/thttpd - Add a THTTPD configuration for the
Olimex LPC2766-STK board.
+ * net/uip/uip_tcpappsend.c - Correct an important logic bug in some uIP state
+ data the is used to manage retransmissions. The uIP logic was incompatible
+ with the retransmission logic of net/send.c in one place. The final error
+ was that the final packet in a sequence of packets was too large! In the
+ THTTPD example, this would leave some garbage at the bottom of the display
+ (or worse). I don't know why I haven't see this bug before???
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 8a3ee79c6..06982ae19 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
- <p>Last Updated: November 23, 2010</p>
+ <p>Last Updated: November 25, 2010</p>
</td>
</tr>
</table>
@@ -1996,6 +1996,12 @@ nuttx-5.14 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
fixed that is needed by all Cortex-M3 NuttX users.
* configs/olimex-lpc1766stk/thttpd - Add a THTTPD configuration for the
Olimex LPC2766-STK board.
+ * net/uip/uip_tcpappsend.c - Correct an important logic bug in some uIP state
+ data the is used to manage retransmissions. The uIP logic was incompatible
+ with the retransmission logic of net/send.c in one place. The final error
+ was that the final packet in a sequence of packets was too large! In the
+ THTTPD example, this would leave some garbage at the bottom of the display
+ (or worse). I don't know why I haven't see this bug before???
pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
diff --git a/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig b/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig
index 28fd0a576..4b2b5345e 100755
--- a/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig
+++ b/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig
@@ -206,6 +206,7 @@ CONFIG_PHY_AUTONEG=y
CONFIG_PHY_SPEED100=n
CONFIG_PHY_FDUPLEX=y
CONFIG_NET_REGDEBUG=n
+
#
# General build options
#
@@ -779,7 +780,7 @@ CONFIG_THTTPD_URLPATTERN=n
#
# Additional settings for examples/thttpd
#
-CONFIG_EXAMPLE_THTTPD_NOMAC=n
+CONFIG_EXAMPLE_THTTPD_NOMAC=y
CONFIG_EXAMPLE_THTTPD_DRIPADDR=(10<<24|0<<16|0<<8|1)
CONFIG_EXAMPLE_THTTPD_NETMASK=(255<<24|255<<16|255<<8|0)
diff --git a/nuttx/examples/thttpd/main.c b/nuttx/examples/thttpd/main.c
index 7c0c555c7..9bdc44eac 100644
--- a/nuttx/examples/thttpd/main.c
+++ b/nuttx/examples/thttpd/main.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/thttpd/main.c
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -158,7 +158,7 @@ void user_initialize(void)
int user_start(int argc, char *argv[])
{
struct in_addr addr;
-#ifdef CONFIG_EXAMPLE_UIP_NOMAC
+#ifdef CONFIG_EXAMPLE_THTTPD_NOMAC
uint8_t mac[IFHWADDRLEN];
#endif
char *thttpd_argv = "thttpd";
@@ -166,7 +166,7 @@ int user_start(int argc, char *argv[])
/* Many embedded network interfaces must have a software assigned MAC */
-#ifdef CONFIG_EXAMPLE_UIP_NOMAC
+#ifdef CONFIG_EXAMPLE_THTTPD_NOMAC
message("Assigning MAC\n");
mac[0] = 0x00;
diff --git a/nuttx/net/send.c b/nuttx/net/send.c
index edb3d359a..6aa84d6de 100644
--- a/nuttx/net/send.c
+++ b/nuttx/net/send.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/send.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
diff --git a/nuttx/net/uip/uip_tcpappsend.c b/nuttx/net/uip/uip_tcpappsend.c
index 223735bf4..470c1fe40 100644
--- a/nuttx/net/uip/uip_tcpappsend.c
+++ b/nuttx/net/uip/uip_tcpappsend.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/uip/uip_tcpappsend.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
@@ -77,7 +77,9 @@
* Name: uip_tcpappsend
*
* Description:
- * Handle application response
+ * Handle application or TCP protocol response. If this function is called
+ * with dev->d_sndlen > 0, then this is an application attempting to send
+ * packet.
*
* Parameters:
* dev - The device driver structure to use in the send operation
@@ -97,11 +99,12 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
{
/* Handle the result based on the application response */
- nllvdbg("result: %04x\n", result);
+ nllvdbg("result: %04x d_sndlen: %d conn->len: %d\n",
+ result, dev->d_sndlen, conn->len);
/* Check for connection aborted */
- if (result & UIP_ABORT)
+ if ((result & UIP_ABORT) != 0)
{
dev->d_sndlen = 0;
conn->tcpstateflags = UIP_CLOSED;
@@ -112,10 +115,10 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
/* Check for connection closed */
- else if (result & UIP_CLOSE)
+ else if ((result & UIP_CLOSE) != 0)
{
conn->tcpstateflags = UIP_FIN_WAIT_1;
- conn->len = 1;
+ conn->len = 1;
conn->nrtx = 0;
nllvdbg("TCP state: UIP_FIN_WAIT_1\n");
@@ -131,48 +134,34 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
if (dev->d_sndlen > 0)
{
- /* If the connection has acknowledged data, the contents of
- * the ->len variable should be discarded.
+ /* If the connection has acknowledged data, the conn->len count
+ * should be discarded.
*/
- if (result & UIP_ACKDATA)
+ if ((result & UIP_ACKDATA) != 0)
{
conn->len = 0;
}
- /* If the ->len variable is non-zero the connection has
- * already data in transit and cannot send anymore right
- * now.
+ /* Remember how much data we send out now so that we know
+ * when everything has been acknowledged. No attempt is made
+ * here to keep track of how much outstanding, un-acked data
+ * there is. That is handled in the TCP send() logic. Here
+ * need the conn->len to be the same as the size of the packet
+ * to be sent.
+ *
+ * Just increment the amount of data sent. This will be needed
+ * in sequence number calculations and we know that this is not
+ * a re-tranmission. Retransmissions do not go through this path.
*/
- if (conn->len == 0)
- {
- /* The application cannot send more than what is
- * allowed by the mss (the minumum of the MSS and the
- * available window).
- */
-
- if (dev->d_sndlen > conn->mss)
- {
- dev->d_sndlen = conn->mss;
- }
+ conn->len += dev->d_sndlen;
- /* Remember how much data we send out now so that we
- * know when everything has been acknowledged.
- */
-
- conn->len = dev->d_sndlen;
- }
- else
- {
- /* If the application already had unacknowledged data,
- * we make sure that the application does not send
- * (i.e., retransmit) out more than it previously sent
- * out.
- */
+ /* The application cannot send more than what is allowed by the
+ * MSS (the minumum of the MSS and the available window).
+ */
- dev->d_sndlen = conn->len;
- }
+ DEBUGASSERT(dev->d_sndlen <= conn->mss);
}
/* Then handle the rest of the operation just as for the rexmit case */
@@ -204,7 +193,8 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn,
uint16_t result)
{
- nllvdbg("result: %04x\n", result);
+ nllvdbg("result: %04x d_sndlen: %d conn->len: %d\n",
+ result, dev->d_sndlen, conn->len);
dev->d_appdata = dev->d_snddata;
@@ -218,12 +208,12 @@ void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn,
* the IP and TCP headers.
*/
- uip_tcpsend(dev, conn, TCP_ACK | TCP_PSH, conn->len + UIP_TCPIP_HLEN);
+ uip_tcpsend(dev, conn, TCP_ACK | TCP_PSH, dev->d_sndlen + UIP_TCPIP_HLEN);
}
/* If there is no data to send, just send out a pure ACK if one is requested`. */
- else if (result & UIP_SNDACK)
+ else if ((result & UIP_SNDACK) != 0)
{
uip_tcpsend(dev, conn, TCP_ACK, UIP_TCPIP_HLEN);
}