From owner-svn-src-head@freebsd.org Tue Jul 12 21:57:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D752EB93608; Tue, 12 Jul 2016 21:57:06 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A3C1151B; Tue, 12 Jul 2016 21:57:06 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLv56D029061; Tue, 12 Jul 2016 21:57:05 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLv57r029060; Tue, 12 Jul 2016 21:57:05 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122157.u6CLv57r029060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:57:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302686 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:57:07 -0000 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;