FW: RTEMS 4.X.X gen68360 Ethernet Tx Reliability

Eric Norum eric at cls.usask.ca
Fri Feb 4 14:37:22 UTC 2000


Bob Wisdom wrote:
> 
> Hi Tim,
> Its great to hear from you. We think the problem is at the glue/driver
> level - but we are not ruling out our overall port or the hardware, at this
> stage. The previous problem we identified in the driver was the case when a
> chain of MBUFs is sent to the driver where the last MBUF has a zero size
> data buffer. In this case the sendpacket routine gets it wrong. We saw this
> happening while debugging:-
> 
> A MBUF chain is supplied to the txDaemon consisting of say two MBUFs, the
> last one is empty.
> The TXDaemon calls sendpacket which queues the first MBUF in the SCC's Bd
> ok. When it comes to the second (and last) it detects the zero size and
> tosses it. The MBUF pointer "m" will be NULL after the MFREE since the empty
> MBUF was the last one. Since m is NULL the next section of code is triggered
> which fills in the txBD status. However, txBd is pointing at the wrong
> place - it is pointing at the next free Bd, one beyond where it should.
> 
> This blows up the retire routine and txBdActiveCount goes negative.
> 
> The following code is our quick-fix version - this is not an official fix
> you understand!  (note lastusedtxBd variable).
>  if (m->m_len) {
>                         /*
>                          * Fill in the buffer descriptor
>                          */
>                         lastusedtxBd = txBd;
>                         txBd->buffer = mtod (m, void *);
>                         txBd->length = m->m_len;
>                         sc->txMbuf[sc->txBdHead] = m;
>                         nAdded++;
>                         if (++sc->txBdHead == sc->txBdCount) {
>                                 status |= M360_BD_WRAP;
>                                 sc->txBdHead = 0;
>                         }
>                         l = m;
>                         m = m->m_next;
>                 }
>                 else {
>                         /*
>                          * Just toss empty mbufs
>                          */
>                         struct mbuf *n;
>                         MFREE (m, n);
>                         m = n;
>                         if (l != NULL)
>                                 l->m_next = m;
>                         txBd = lastusedtxBd;
>                 }
> 

The January 18th snapshot has a fix for this.
Thanx, and a tip of the hat to Bob Wisdom for diagnosing this problem.

-- 
Eric Norum                                 eric at cls.usask.ca
Canadian Light Source                      Phone: (306) 966-6308
University of Saskatchewan                 FAX:   (306) 966-6058
Saskatoon, Canada.



More information about the users mailing list