NetBSD-Bugs archive

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

Re: kern/52211: vioif stops on dmamap load error




  Oops. The above patch is broken. Don't use it.
  Please wait a little.

New one:

Index: if_vioif.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_vioif.c,v
retrieving revision 1.34
diff -u -p -r1.34 if_vioif.c
--- if_vioif.c    28 Mar 2017 04:10:33 -0000    1.34
+++ if_vioif.c    11 May 2017 09:20:00 -0000
@@ -812,6 +812,7 @@ vioif_start(struct ifnet *ifp)

      for (;;) {
          int slot, r;
+        struct mbuf *newm;

          IFQ_DEQUEUE(&ifp->if_snd, m);

@@ -833,7 +834,23 @@ retry:
          r = bus_dmamap_load_mbuf(virtio_dmat(vsc),
                       sc->sc_tx_dmamaps[slot],
                       m, BUS_DMA_WRITE|BUS_DMA_NOWAIT);
-        if (r != 0) {
+        switch (r) {
+        case 0:
+            break;
+        case EFBIG:
+            printf("%s: loadup_mbuf() returned EFBIG (%d segs)\n",
+                device_xname(sc->sc_dev),
+                sc->sc_tx_dmamaps[slot]->dm_nsegs);
+            newm = m_defrag(m, M_NOWAIT);
+            if ((newm != NULL) &&
+                (bus_dmamap_load_mbuf(virtio_dmat(vsc),
+                sc->sc_tx_dmamaps[slot],
+                newm, BUS_DMA_WRITE|BUS_DMA_NOWAIT) == 0)) {
+                m = newm;
+                break;
+            }
+            /* FALLTHROUGH */
+        default:
              virtio_enqueue_abort(vsc, vq, slot);
              aprint_error_dev(sc->sc_dev,
                  "tx dmamap load failed, error code %d\n", r);



BTW, what hypervisor are you using?

Once again... (not tested)

Index: if_vioif.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_vioif.c,v
retrieving revision 1.34
diff -u -p -r1.34 if_vioif.c
--- if_vioif.c	28 Mar 2017 04:10:33 -0000	1.34
+++ if_vioif.c	11 May 2017 09:51:02 -0000
@@ -833,7 +833,20 @@ retry:
 		r = bus_dmamap_load_mbuf(virtio_dmat(vsc),
 					 sc->sc_tx_dmamaps[slot],
 					 m, BUS_DMA_WRITE|BUS_DMA_NOWAIT);
-		if (r != 0) {
+		switch (r) {
+		case 0:
+			break;
+		case EFBIG:
+			printf("%s: loadup_mbuf() returned EFBIG (%d segs)\n",
+			    device_xname(sc->sc_dev),
+			    sc->sc_tx_dmamaps[slot]->dm_nsegs);
+			if (((m = m_defrag(m, M_NOWAIT)) != NULL) &&
+			    (bus_dmamap_load_mbuf(virtio_dmat(vsc),
+			     sc->sc_tx_dmamaps[slot], m,
+			     BUS_DMA_WRITE|BUS_DMA_NOWAIT) == 0))
+				break;
+			/* FALLTHROUGH */
+		default:
 			virtio_enqueue_abort(vsc, vq, slot);
 			aprint_error_dev(sc->sc_dev,
 			    "tx dmamap load failed, error code %d\n", r);



--
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index