tech-kern archive

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

re: rbuf starvation in the iwn driver



would you try this variant?  it handles the case where MEXTMALLOC()
would fail to allocate external storage, and seems to work on my 
iwn(4).  i'll commit this if you confirm it works.

thanks.


.mrg.

Index: if_iwn.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_iwn.c,v
retrieving revision 1.38
diff -p -r1.38 if_iwn.c
*** if_iwn.c    5 Apr 2010 07:20:26 -0000       1.38
--- if_iwn.c    10 Apr 2010 02:48:10 -0000
*************** iwn_rx_done(struct iwn_softc *sc, struct
*** 1939,1955 ****
                ifp->if_ierrors++;
                return;
        }
!       if (sc->rxq.nb_free_entries <= 0) {
!               ic->ic_stats.is_rx_nobuf++;
!               ifp->if_ierrors++;
!               m_freem(m1);
!               return;
        }
!       rbuf = iwn_alloc_rbuf(sc);
!       /* Attach RX buffer to mbuf header. */
!       MEXTADD(m1, rbuf->vaddr, IWN_RBUF_SIZE, 0, iwn_free_rbuf,
!           rbuf);
!       m1->m_flags |= M_EXT_RW;
        bus_dmamap_unload(sc->sc_dmat, data->map);
  
        error = bus_dmamap_load(sc->sc_dmat, data->map, m1->m_ext.ext_buf,
--- 1939,1959 ----
                ifp->if_ierrors++;
                return;
        }
!       if ((rbuf = iwn_alloc_rbuf(sc)) == NULL) {
!               MEXTMALLOC(m1, IWN_RBUF_SIZE, M_DONTWAIT);
!               if (!(m1->m_flags & M_EXT)) {
!                       ic->ic_stats.is_rx_nobuf++;
!                       ifp->if_ierrors++;
!                       m_freem(m1);
!                       return;
!               }
!       } else {
!               /* Attach RX buffer to mbuf header. */
!               MEXTADD(m1, rbuf->vaddr, IWN_RBUF_SIZE, 0, iwn_free_rbuf,
!                   rbuf);
!               m1->m_flags |= M_EXT_RW;
        }
! 
        bus_dmamap_unload(sc->sc_dmat, data->map);
  
        error = bus_dmamap_load(sc->sc_dmat, data->map, m1->m_ext.ext_buf,


Home | Main Index | Thread Index | Old Index