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:
parent
8bc8539cad
commit
8c9fbe1199
@ -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???
|
||||
|
||||
|
||||
|
||||
|
@ -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 <spudmonkey@racsa.co.cr>
|
||||
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 <spudmonkey@racsa.co.cr>
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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).
|
||||
*/
|
||||
conn->len += dev->d_sndlen;
|
||||
|
||||
if (dev->d_sndlen > conn->mss)
|
||||
{
|
||||
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).
|
||||
*/
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user