mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
Fix un-acked backlog coordinatin bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3133 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1347,6 +1347,12 @@
|
|||||||
fixed that is needed by all Cortex-M3 NuttX users.
|
fixed that is needed by all Cortex-M3 NuttX users.
|
||||||
* configs/olimex-lpc1766stk/thttpd - Add a THTTPD configuration for the
|
* configs/olimex-lpc1766stk/thttpd - Add a THTTPD configuration for the
|
||||||
Olimex LPC2766-STK board.
|
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???
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<tr align="center" bgcolor="#e4e4e4">
|
<tr align="center" bgcolor="#e4e4e4">
|
||||||
<td>
|
<td>
|
||||||
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -1996,6 +1996,12 @@ nuttx-5.14 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
|||||||
fixed that is needed by all Cortex-M3 NuttX users.
|
fixed that is needed by all Cortex-M3 NuttX users.
|
||||||
* configs/olimex-lpc1766stk/thttpd - Add a THTTPD configuration for the
|
* configs/olimex-lpc1766stk/thttpd - Add a THTTPD configuration for the
|
||||||
Olimex LPC2766-STK board.
|
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 <spudmonkey@racsa.co.cr>
|
pascal-2.1 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ CONFIG_PHY_AUTONEG=y
|
|||||||
CONFIG_PHY_SPEED100=n
|
CONFIG_PHY_SPEED100=n
|
||||||
CONFIG_PHY_FDUPLEX=y
|
CONFIG_PHY_FDUPLEX=y
|
||||||
CONFIG_NET_REGDEBUG=n
|
CONFIG_NET_REGDEBUG=n
|
||||||
|
|
||||||
#
|
#
|
||||||
# General build options
|
# General build options
|
||||||
#
|
#
|
||||||
@@ -779,7 +780,7 @@ CONFIG_THTTPD_URLPATTERN=n
|
|||||||
#
|
#
|
||||||
# Additional settings for examples/thttpd
|
# 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_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||||
CONFIG_EXAMPLE_THTTPD_NETMASK=(255<<24|255<<16|255<<8|0)
|
CONFIG_EXAMPLE_THTTPD_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/thttpd/main.c
|
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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[])
|
int user_start(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
#ifdef CONFIG_EXAMPLE_UIP_NOMAC
|
#ifdef CONFIG_EXAMPLE_THTTPD_NOMAC
|
||||||
uint8_t mac[IFHWADDRLEN];
|
uint8_t mac[IFHWADDRLEN];
|
||||||
#endif
|
#endif
|
||||||
char *thttpd_argv = "thttpd";
|
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 */
|
/* Many embedded network interfaces must have a software assigned MAC */
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLE_UIP_NOMAC
|
#ifdef CONFIG_EXAMPLE_THTTPD_NOMAC
|
||||||
message("Assigning MAC\n");
|
message("Assigning MAC\n");
|
||||||
|
|
||||||
mac[0] = 0x00;
|
mac[0] = 0x00;
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/send.c
|
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
+31
-41
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/uip/uip_tcpappsend.c
|
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
|
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
|
||||||
@@ -77,7 +77,9 @@
|
|||||||
* Name: uip_tcpappsend
|
* Name: uip_tcpappsend
|
||||||
*
|
*
|
||||||
* Description:
|
* 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:
|
* Parameters:
|
||||||
* dev - The device driver structure to use in the send operation
|
* 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 */
|
/* 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 */
|
/* Check for connection aborted */
|
||||||
|
|
||||||
if (result & UIP_ABORT)
|
if ((result & UIP_ABORT) != 0)
|
||||||
{
|
{
|
||||||
dev->d_sndlen = 0;
|
dev->d_sndlen = 0;
|
||||||
conn->tcpstateflags = UIP_CLOSED;
|
conn->tcpstateflags = UIP_CLOSED;
|
||||||
@@ -112,10 +115,10 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
|
|||||||
|
|
||||||
/* Check for connection closed */
|
/* Check for connection closed */
|
||||||
|
|
||||||
else if (result & UIP_CLOSE)
|
else if ((result & UIP_CLOSE) != 0)
|
||||||
{
|
{
|
||||||
conn->tcpstateflags = UIP_FIN_WAIT_1;
|
conn->tcpstateflags = UIP_FIN_WAIT_1;
|
||||||
conn->len = 1;
|
conn->len = 1;
|
||||||
conn->nrtx = 0;
|
conn->nrtx = 0;
|
||||||
nllvdbg("TCP state: UIP_FIN_WAIT_1\n");
|
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 (dev->d_sndlen > 0)
|
||||||
{
|
{
|
||||||
/* If the connection has acknowledged data, the contents of
|
/* If the connection has acknowledged data, the conn->len count
|
||||||
* the ->len variable should be discarded.
|
* should be discarded.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (result & UIP_ACKDATA)
|
if ((result & UIP_ACKDATA) != 0)
|
||||||
{
|
{
|
||||||
conn->len = 0;
|
conn->len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the ->len variable is non-zero the connection has
|
/* Remember how much data we send out now so that we know
|
||||||
* already data in transit and cannot send anymore right
|
* when everything has been acknowledged. No attempt is made
|
||||||
* now.
|
* 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)
|
conn->len += dev->d_sndlen;
|
||||||
{
|
|
||||||
/* 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)
|
/* 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->mss;
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
/* Remember how much data we send out now so that we
|
DEBUGASSERT(dev->d_sndlen <= conn->mss);
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
dev->d_sndlen = conn->len;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then handle the rest of the operation just as for the rexmit case */
|
/* 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,
|
void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn,
|
||||||
uint16_t result)
|
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;
|
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.
|
* 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`. */
|
/* 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);
|
uip_tcpsend(dev, conn, TCP_ACK, UIP_TCPIP_HLEN);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user