lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] cs8900 lost packets bug


From: Paul
Subject: [lwip-users] cs8900 lost packets bug
Date: Sat, 01 Nov 2003 22:05:35 +1030
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030508

Hi All,

I have found a bug in the CS8900 ethernet output code.

The error is that if the transmit routine cannot send a frame
the CS890 chip retains the TX reference to its internal memory
buffer. This results in  poor performance as there is less memory for
incoming packets and thus lost packets.

(Does this sound familar to anyone?)

The fix is described in the Crystal application notes
OR In pseudo-ish code.

* @return error code
* - ERR_OK: packet transferred to hardware
* - ERR_CONN: no link or link failure
* - ERR_IF: could not transfer to link (hardware buffer full?)
*/
static err_t cs8900_output(struct netif *netif, struct pbuf *p)
{
<<<< SNIP>>>
 /* issue 'transmit' command to CS8900 */
 TXCMD = 0x00C9U;
 /* send length (in bytes) of packet to send */
 TXLENGTH = p->tot_len;

<<<< The CS8900 has now assigned an internal memory buffer >>>>

// not ready for transmission and still within 100 retries?
 while (((PPDATA & 0x0100U/*Rdy4TxNOW*/) == 0) && (tries++ < 100))
 {
   // throw away the last committed received frame
 <<< SNIP >>>>
 }
 // ready to transmit?
 if ((PPDATA & 0x0100U/*Rdy4TxNOW*/) != 0)
 {
<< Do the transmit >>
 }
else
 {
   // { not ready to transmit!? }

   <<< SET THE TRANSMIT BUFFER SIZE TO ZERO TO DEALLOCATE  MEMORY
 TXLENGTH = 0;
   <<<  USE THE FORCE TRANSMIT COMMAND TO FREE THE MEMORY
 TXCMD = 0x01C9U;
   /* return not connected */
   result = ERR_IF;
 }
:


Cheers

Paul





reply via email to

[Prev in Thread] Current Thread [Next in Thread]