On 3/11/2015, at 5:34 AM, Martin Pieuchot wrote:

> 
> Thanks for the report Richard,

You're welcome. 

> I'm ok with the second diff if you remove the printf().

Sure thing, see below. If I find time over the week I'll 
check for other drivers bitten by this. 

best, 
Richard. 

Index: if_tsec.c
===================================================================
RCS file: /cvs/src/sys/arch/socppc/dev/if_tsec.c,v
retrieving revision 1.38
diff -u -p -u -r1.38 if_tsec.c
--- if_tsec.c   25 Oct 2015 13:22:09 -0000      1.38
+++ if_tsec.c   2 Nov 2015 18:36:59 -0000
@@ -514,7 +514,7 @@ tsec_start(struct ifnet *ifp)
 {
        struct tsec_softc *sc = ifp->if_softc;
        struct mbuf *m;
-       int idx;
+       int error, idx;
 
        if (!(ifp->if_flags & IFF_RUNNING))
                return;
@@ -531,9 +531,16 @@ tsec_start(struct ifnet *ifp)
                if (m == NULL)
                        break;
 
-               if (tsec_encap(sc, m, &idx)) {
+               error = tsec_encap(sc, m, &idx);
+               if (error == ENOBUFS) {
                        ifp->if_flags |= IFF_OACTIVE;
                        break;
+               } 
+               if (error == EFBIG) {
+                       IFQ_DEQUEUE(&ifp->if_snd, m);
+                       m_freem(m); /* give up: drop it */
+                       ifp->if_oerrors++;
+                       continue;
                }
 
                /* Now we are committed to transmit the packet. */
@@ -1131,8 +1138,12 @@ tsec_encap(struct tsec_softc *sc, struct
        cur = frag = *idx;
        map = sc->sc_txbuf[cur].tb_map;
 
-       if (bus_dmamap_load_mbuf(sc->sc_dmat, map, m, BUS_DMA_NOWAIT))
-               return (ENOBUFS);
+       if (bus_dmamap_load_mbuf(sc->sc_dmat, map, m, BUS_DMA_NOWAIT)) {
+               if (m_defrag(m, M_DONTWAIT))
+                       return (EFBIG);
+               if (bus_dmamap_load_mbuf(sc->sc_dmat, map, m, BUS_DMA_NOWAIT))
+                       return (EFBIG);
+       }
 
        if (map->dm_nsegs > (TSEC_NTXDESC - sc->sc_tx_cnt - 2)) {
                bus_dmamap_unload(sc->sc_dmat, map);



Reply via email to