Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2016 21:57:05 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302686 - head/sys/dev/ioat
Message-ID:  <201607122157.u6CLv57r029060@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607122157.u6CLv57r029060>