lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Xilinx TEMAC and link-layer FIFO bug (lost packets).


From: Roger Cover
Subject: [lwip-users] Xilinx TEMAC and link-layer FIFO bug (lost packets).
Date: Wed, 8 Aug 2007 15:11:02 -0700

Greetings,

I have uncovered the cause of lost packets on systems using the Xilinx
TEMAC with link-layer FIFO. I also have a work-around.

The problem stems from the fact that the TEMAC to link-layer FIFO IP
(ll_temac) does not always place a start of frame marker on the
beginning of the packet. I have a pending webcase with Xilinx to get the
problem resolved at the source, but in the meantime you can use this
patch:

In ll_temac_rcv.c alter the following code:
    //
-----------------------------------------------------------------------
    // IDLE STATE
    //
-----------------------------------------------------------------------
    if( state == C_IDLE ) {     // haven't reached the SOF yet
      // only hang around for so long awaiting an SOF before returning
      if( cw & LL_SOF_MASK ) {
        if( ++sof_counter == SOF_COUNTER_MAX ) {
          *length = 0;
          return SOF_TIMEOUT_ERROR;
        }
      }
      else {
        sof_counter = 0;        // reset watchdog counter
        state = C_HEADER;       // ensure we record the start of a frame
      }
      dw = ll_rx_data_reg;      // ignore the LocalLink Header Words
    }
    //
-----------------------------------------------------------------------
    // HEADER STATE
    //
-----------------------------------------------------------------------
To this:
    //
-----------------------------------------------------------------------
    // IDLE STATE
    //
-----------------------------------------------------------------------
    if( state == C_IDLE ) {     // haven't reached the SOF yet
      //******* RELOCATED THIS SINGLE STATEMENT
      dw = ll_rx_data_reg;      // read the LocalLink Header Words
      // only hang around for so long awaiting an SOF before returning
      if( cw & LL_SOF_MASK ) {
        //******* INSERTED THIS IF BLOCK
        if ( !(cw & LL_SOP_MASK) ) { // start of payload without start
of frame
          state = C_PAYLOAD;
          *((unsigned int *) b) = dw;
          b += sizeof(unsigned int);
          bytes_received += sizeof(unsigned int);
        }
        //******* END OF INSERTION
        if( ++sof_counter == SOF_COUNTER_MAX ) {
          *length = 0;
          return SOF_TIMEOUT_ERROR;
        }
      }
      else {
        sof_counter = 0;        // reset watchdog counter
        state = C_HEADER;       // ensure we record the start of a frame
      }
    }
    //
-----------------------------------------------------------------------
    // HEADER STATE
    //
-----------------------------------------------------------------------

Since I have applied this patch I have not seen even one lost packet.
Prior to this patch my lost packet rate was approximately 1 in 300. I
hope this information is useful to someone out there.

Regards,
Roger W. Cover
Spectral Instruments, Inc.
420 N. Bonita Ave.
Tucson, AZ 85745
Voice: 520-884-8821 ext. 144
FAX: 520-884-8803




reply via email to

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