Author: cem
Date: Tue Jul 12 21:57:05 2016
New Revision: 302686
URL: https://svnweb.freebsd.org/changeset/base/302686

Log:
  ioat(4): Check ring links at grow/shrink in INVARIANTS

Modified:
  head/sys/dev/ioat/ioat.c

Modified: head/sys/dev/ioat/ioat.c
==============================================================================
--- head/sys/dev/ioat/ioat.c    Tue Jul 12 21:57:02 2016        (r302685)
+++ head/sys/dev/ioat/ioat.c    Tue Jul 12 21:57:05 2016        (r302686)
@@ -1591,6 +1591,18 @@ ring_grow(struct ioat_softc *ioat, uint3
                hw->next = next->hw_desc_bus_addr;
        }
 
+#ifdef INVARIANTS
+       for (i = 0; i < newsize; i++) {
+               next = newring[(i + 1) & (newsize - 1)];
+               hw = newring[i & (newsize - 1)]->u.dma;
+
+               KASSERT(hw->next == next->hw_desc_bus_addr,
+                   ("mismatch at i:%u (oldsize:%u); next=%p nextaddr=0x%lx"
+                    " (tail:%u)", i, oldsize, next, next->hw_desc_bus_addr,
+                    tail));
+       }
+#endif
+
        free(ioat->ring, M_IOAT);
        ioat->ring = newring;
        ioat->ring_size_order = oldorder + 1;
@@ -1657,6 +1669,18 @@ ring_shrink(struct ioat_softc *ioat, uin
        next = newring[(ioat->tail + newsize) & (newsize - 1)];
        hw->next = next->hw_desc_bus_addr;
 
+#ifdef INVARIANTS
+       for (i = 0; i < newsize; i++) {
+               next = newring[(i + 1) & (newsize - 1)];
+               hw = newring[i & (newsize - 1)]->u.dma;
+
+               KASSERT(hw->next == next->hw_desc_bus_addr,
+                   ("mismatch at i:%u (newsize:%u); next=%p nextaddr=0x%lx "
+                    "(tail:%u)", i, newsize, next, next->hw_desc_bus_addr,
+                    ioat->tail));
+       }
+#endif
+
        free(ioat->ring, M_IOAT);
        ioat->ring = newring;
        ioat->ring_size_order = oldorder - 1;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to