Changeset 1b70957 in rtems-libbsd


Ignore:
Timestamp:
Sep 14, 2018, 8:21:52 AM (9 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
eeb3fd5d9b07ac9a2e280cff60a1b762bd273a8d, 1e989998de954bef51e6c19cc3d64d39f32100aa
Children:
6103496
Parents:
d101ed8
git-author:
Sebastian Huber <sebastian.huber@…> (09/14/18 08:21:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/21/18 08:29:43)
Message:

if_ffec_mpc8xx: Use M_NOWAIT for incoming frames

Update #3523.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtemsbsd/sys/dev/ffec/if_ffec_mpc8xx.c

    rd101ed8 r1b70957  
    537537  rxBdIndex = 0;
    538538  for (;;) {
     539    struct mbuf *n;
     540
    539541    rxBd = sc->rxBdBase + rxBdIndex;
    540542
     
    570572    if (status & M8xx_BD_LAST) {
    571573      /*
    572        * Pass the packet up the chain.
    573        * FIXME: Packet filtering hook could be done here.
    574        */
    575 
    576       /*
    577        * Invalidate the buffer for this descriptor
    578        */
    579       rtems_cache_invalidate_multiple_data_lines((const void *)rxBd->buffer, rxBd->length);
    580 
    581       m = sc->rxMbuf[rxBdIndex];
    582       m->m_len = m->m_pkthdr.len = rxBd->length - sizeof(uint32_t);
    583       FEC_UNLOCK(sc);
    584       (*sc->ifp->if_input)(sc->ifp, m);
    585       FEC_LOCK(sc);
    586 
    587       /*
    588574       * Allocate a new mbuf
    589575       */
    590       m = m_getcl(M_WAITOK, MT_DATA, M_PKTHDR);
    591       m->m_pkthdr.rcvif = ifp;
    592       sc->rxMbuf[rxBdIndex] = m;
    593       rxBd->buffer = mtod (m, void *);
    594     }
    595     else {
     576      n = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
     577
     578      if (n != NULL) {
     579        /*
     580         * Pass the packet up the chain.
     581         * FIXME: Packet filtering hook could be done here.
     582         */
     583
     584        /*
     585         * Invalidate the buffer for this descriptor
     586         */
     587        rtems_cache_invalidate_multiple_data_lines(rxBd->buffer, rxBd->length);
     588
     589        m = sc->rxMbuf[rxBdIndex];
     590        m->m_len = m->m_pkthdr.len = rxBd->length - ETHER_CRC_LEN;
     591        FEC_UNLOCK(sc);
     592        (*sc->ifp->if_input)(sc->ifp, m);
     593        FEC_LOCK(sc);
     594      } else {
     595        /* Drop incoming frame if no new mbuf is available */
     596        n = m;
     597      }
     598    } else {
     599      /* Reuse mbuf */
     600      n = m;
     601
    596602      /*
    597603       * Something went wrong with the reception
     
    612618        sc->rxCollision++;
    613619    }
     620
     621    n->m_pkthdr.rcvif = ifp;
     622    sc->rxMbuf[rxBdIndex] = n;
     623    rxBd->buffer = mtod (n, void *);
     624
    614625    /*
    615626     * Reenable the buffer descriptor
    616627     */
    617     rxBd->status = (status & M8xx_BD_WRAP) |
    618       M8xx_BD_EMPTY;
     628    rxBd->status = (status & M8xx_BD_WRAP) | M8xx_BD_EMPTY;
    619629    m8xx.fec.r_des_active = 0x1000000;
    620630    /*
Note: See TracChangeset for help on using the changeset viewer.