Fix DM90x0 driver problem that caused TX overruns

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@384 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-11-17 14:28:10 +00:00
parent 8c0dd44a5e
commit dd0e40bbed
6 changed files with 48 additions and 37 deletions

View File

@ -224,6 +224,4 @@
recv() in place but the packet was being ACKed. There are still TCP recv() in place but the packet was being ACKed. There are still TCP
recv buffering issues, but this is part of a larger buffering issue. recv buffering issues, but this is part of a larger buffering issue.
* Basic server functionality verified: listen(), accept() * Basic server functionality verified: listen(), accept()
* Fix DM90x0 driver problem that caused TX overruns

View File

@ -680,6 +680,7 @@ Other memory:
recv() in place but the packet was being ACKed. There are still TCP recv() in place but the packet was being ACKed. There are still TCP
recv buffering issues, but this is part of a larger buffering issue. recv buffering issues, but this is part of a larger buffering issue.
* Basic server functionality verified: listen(), accept() * Basic server functionality verified: listen(), accept()
* Fix DM90x0 driver problem that caused TX overruns
</pre></ul> </pre></ul>
<table width ="100%"> <table width ="100%">

View File

@ -763,6 +763,12 @@ static inline boolean dm9x_rxchecksumready(uint8 rxbyte)
static int dm9x_transmit(struct dm9x_driver_s *dm9x) static int dm9x_transmit(struct dm9x_driver_s *dm9x)
{ {
/* Check if there is room in the DM90x0 to hold another packet. In 100M mode,
* that can be 2 packets, otherwise it is a single packet.
*/
if (dm9x->dm_ntxpending < 1 || (dm9x->dm_b100M && dm9x->dm_ntxpending < 2))
{
/* Increment count of packets transmitted */ /* Increment count of packets transmitted */
dm9x->dm_ntxpending++; dm9x->dm_ntxpending++;
@ -803,6 +809,8 @@ static int dm9x_transmit(struct dm9x_driver_s *dm9x)
(void)wd_start(dm9x->dm_txtimeout, DM6X_TXTIMEOUT, dm9x_txtimeout, 1, (uint32)dm9x); (void)wd_start(dm9x->dm_txtimeout, DM6X_TXTIMEOUT, dm9x_txtimeout, 1, (uint32)dm9x);
return OK; return OK;
}
return -EBUSY;
} }
/**************************************************************************** /****************************************************************************
@ -978,9 +986,8 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
uip_arp_ipin(); uip_arp_ipin();
uip_input(&dm9x->dm_dev); uip_input(&dm9x->dm_dev);
/* If the above function invocation resulted in data that /* If the above function invocation resulted in data that should be
* should be sent out on the network, the global variable * sent out on the network, the field d_len will set to a value > 0.
* d_len is set to a value > 0.
*/ */
if (dm9x->dm_dev.d_len > 0) if (dm9x->dm_dev.d_len > 0)
@ -993,9 +1000,8 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
{ {
uip_arp_arpin(&dm9x->dm_dev); uip_arp_arpin(&dm9x->dm_dev);
/* If the above function invocation resulted in data that /* If the above function invocation resulted in data that should be
* should be sent out on the network, the global variable * sent out on the network, the field d_len will set to a value > 0.
* d_len is set to a value > 0.
*/ */
if (dm9x->dm_dev.d_len > 0) if (dm9x->dm_dev.d_len > 0)

View File

@ -207,6 +207,7 @@ void recv_server(void)
/* Then send the same data back to the client */ /* Then send the same data back to the client */
message("server: Sending %d bytes\n", totalbytesread);
nbytessent = send(acceptsd, buffer, totalbytesread, 0); nbytessent = send(acceptsd, buffer, totalbytesread, 0);
if (nbytessent <= 0) if (nbytessent <= 0)
{ {

View File

@ -41,7 +41,10 @@
#if defined(CONFIG_NET) && defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) #if defined(CONFIG_NET) && defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
#include <sys/types.h> #include <sys/types.h>
#include <debug.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include "net-internal.h" #include "net-internal.h"
/**************************************************************************** /****************************************************************************
@ -70,6 +73,7 @@ int net_timeo(uint32 start_time, socktimeo_t timeo)
{ {
uint32 timeo_ticks = DSEC2TICK(timeo); uint32 timeo_ticks = DSEC2TICK(timeo);
uint32 elapsed = g_system_timer - start_time; uint32 elapsed = g_system_timer - start_time;
if (elapsed >= timeo_ticks) if (elapsed >= timeo_ticks)
{ {
return TRUE; return TRUE;
@ -78,3 +82,4 @@ int net_timeo(uint32 start_time, socktimeo_t timeo)
} }
#endif /* CONFIG_NET && CONFIG_NET_SOCKOPTS && !CONFIG_DISABLE_CLOCK */ #endif /* CONFIG_NET && CONFIG_NET_SOCKOPTS && !CONFIG_DISABLE_CLOCK */

View File

@ -276,7 +276,7 @@ found:
if (BUF->flags & TCP_RST) if (BUF->flags & TCP_RST)
{ {
conn->tcpstateflags = UIP_CLOSED; conn->tcpstateflags = UIP_CLOSED;
dbg("Recvd reset - TCP state: UIP_CLOSED\n"); dbg("RESET - TCP state: UIP_CLOSED\n");
(void)uip_tcpcallback(dev, conn, UIP_ABORT); (void)uip_tcpcallback(dev, conn, UIP_ABORT);
goto drop; goto drop;
@ -496,7 +496,7 @@ found:
/* The connection is closed after we send the RST */ /* The connection is closed after we send the RST */
conn->tcpstateflags = UIP_CLOSED; conn->tcpstateflags = UIP_CLOSED;
vdbg("TCP state: UIP_CLOSED\n"); vdbg("Connection failed - TCP state: UIP_CLOSED\n");
/* We do not send resets in response to resets. */ /* We do not send resets in response to resets. */
@ -643,7 +643,7 @@ found:
if (flags & UIP_ACKDATA) if (flags & UIP_ACKDATA)
{ {
conn->tcpstateflags = UIP_CLOSED; conn->tcpstateflags = UIP_CLOSED;
vdbg("TCP state: UIP_CLOSED\n"); vdbg("UIP_LAST_ACK TCP state: UIP_CLOSED\n");
(void)uip_tcpcallback(dev, conn, UIP_CLOSE); (void)uip_tcpcallback(dev, conn, UIP_CLOSE);
} }