Changeset b9478fc6 in rtems


Ignore:
Timestamp:
Jan 21, 2000, 1:47:22 AM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
e570c761
Parents:
54b99a2
Message:

Patch from Eric Norum <eric@…>:

Some excellent sleuthing by Bob Wisdom <bobwis@…> revealed
that an empty mbuf at the end of a packet chain would cause the `retire'
function to blow up. Moving the line of code which bumps the transmit
buffer descriptor pointer fixes the problem. Some additional cleanup of
the sendpacket function was also completed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/gen68360/network/network.c

    r54b99a2 rb9478fc6  
    564564         * since the hardware is capable of scatter/gather DMA.
    565565         */
     566        status = 0;
    566567        nAdded = 0;
    567568        txBd = firstTxBd = sc->txBdBase + sc->txBdHead;
    568         for (;;) {
     569        while (m) {
    569570                /*
    570571                 * Wait for buffer descriptor to become available.
     
    579580                         * Wait for buffer descriptor to become available.
    580581                         * Note that the buffer descriptors are checked
    581                          * *before* * entering the wait loop -- this catches
     582                         * *before* entering the wait loop -- this catches
    582583                         * the possibility that a buffer descriptor became
    583584                         * available between the `if' above, and the clearing
     
    606607
    607608                /*
    608                  * Don't set the READY flag till the
    609                  * whole packet has been readied.
    610                  */
    611                 status = nAdded ? M360_BD_READY : 0;
    612 
    613                 /*
    614                  *  FIXME: Why not deal with empty mbufs at at higher level?
    615609                 * The IP fragmentation routine in ip_output
    616610                 * can produce packet fragments with zero length.
    617                  * I think that ip_output should be changed to get
    618                  * rid of these zero-length mbufs, but for now,
    619                  * I'll deal with them here.
    620611                 */
    621612                if (m->m_len) {
    622613                        /*
    623                          * Fill in the buffer descriptor
    624                          */
     614                         * Fill in the buffer descriptor.
     615                         * Don't set the READY flag in the first buffer
     616                         * descriptor till the whole packet has been readied.
     617                         */
     618                        txBd = sc->txBdBase + sc->txBdHead;
    625619                        txBd->buffer = mtod (m, void *);
    626620                        txBd->length = m->m_len;
    627621                        sc->txMbuf[sc->txBdHead] = m;
    628                         nAdded++;
     622                        status = nAdded ? M360_BD_READY : 0;
    629623                        if (++sc->txBdHead == sc->txBdCount) {
    630624                                status |= M360_BD_WRAP;
    631625                                sc->txBdHead = 0;
    632626                        }
     627                        txBd->status = status;
    633628                        l = m;
    634629                        m = m->m_next;
     630                        nAdded++;
    635631                }
    636632                else {
     
    644640                                l->m_next = m;
    645641                }
    646 
    647                 /*
    648                  * Set the transmit buffer status.
    649                  * Break out of the loop if this mbuf is the last in the frame.
    650                  */
    651                 if (m == NULL) {
    652                         if (nAdded) {
    653                                 status |= M360_BD_PAD | M360_BD_LAST | M360_BD_TX_CRC | M360_BD_INTERRUPT;
    654                                 txBd->status = status;
    655                                 firstTxBd->status |= M360_BD_READY;
    656                                 sc->txBdActiveCount += nAdded;
    657                         }
    658                         break;
    659                 }
    660                 txBd->status = status;
    661                 txBd = sc->txBdBase + sc->txBdHead;
     642        }
     643        if (nAdded) {
     644                /*
     645                 * Send the packet
     646                 */
     647                txBd->status = status | M360_BD_PAD | M360_BD_LAST | M360_BD_TX_CRC | M360_BD_INTERRUPT;
     648                firstTxBd->status |= M360_BD_READY;
     649                sc->txBdActiveCount += nAdded;
    662650        }
    663651}
Note: See TracChangeset for help on using the changeset viewer.