From owner-svn-src-all@freebsd.org Sun Sep 11 17:57:54 2016 Return-Path: Delivered-To: svn-src-all@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 CE360BD778F; Sun, 11 Sep 2016 17:57:54 +0000 (UTC) (envelope-from np@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 82076ABB; Sun, 11 Sep 2016 17:57:54 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8BHvrnb099655; Sun, 11 Sep 2016 17:57:53 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8BHvrr7099654; Sun, 11 Sep 2016 17:57:53 GMT (envelope-from np@FreeBSD.org) Message-Id: <201609111757.u8BHvrr7099654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 11 Sep 2016 17:57:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305703 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2016 17:57:54 -0000 Author: np Date: Sun Sep 11 17:57:53 2016 New Revision: 305703 URL: https://svnweb.freebsd.org/changeset/base/305703 Log: cxgbe(4): Deal with the slightly different SGE_STAT_CFG in T6. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sun Sep 11 17:51:17 2016 (r305702) +++ head/sys/dev/cxgbe/t4_main.c Sun Sep 11 17:57:53 2016 (r305703) @@ -2027,11 +2027,11 @@ t4_map_bar_2(struct adapter *sc) } sc->udbs_base = rman_get_virtual(sc->udbs_res); - if (is_t5(sc)) { + if (chip_id(sc) >= CHELSIO_T5) { setbit(&sc->doorbells, DOORBELL_UDB); #if defined(__i386__) || defined(__amd64__) if (t5_write_combine) { - int rc; + int rc, mode; /* * Enable write combining on BAR2. This is the @@ -2054,8 +2054,9 @@ t4_map_bar_2(struct adapter *sc) rc); } + mode = is_t5(sc) ? V_STATMODE(0) : V_T6_STATMODE(0); t4_write_reg(sc, A_SGE_STAT_CFG, - V_STATSOURCE_T5(7) | V_STATMODE(0)); + V_STATSOURCE_T5(7) | mode); } #endif } @@ -7472,6 +7473,8 @@ sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS) struct sbuf *sb; int rc, v; + MPASS(chip_id(sc) >= CHELSIO_T5); + rc = sysctl_wire_old_buffer(req, 0); if (rc != 0) return (rc); @@ -7482,14 +7485,19 @@ sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS) v = t4_read_reg(sc, A_SGE_STAT_CFG); if (G_STATSOURCE_T5(v) == 7) { - if (G_STATMODE(v) == 0) { + int mode; + + mode = is_t5(sc) ? G_STATMODE(v) : G_T6_STATMODE(v); + if (mode == 0) { sbuf_printf(sb, "total %d, incomplete %d", t4_read_reg(sc, A_SGE_STAT_TOTAL), t4_read_reg(sc, A_SGE_STAT_MATCH)); - } else if (G_STATMODE(v) == 1) { + } else if (mode == 1) { sbuf_printf(sb, "total %d, data overflow %d", t4_read_reg(sc, A_SGE_STAT_TOTAL), t4_read_reg(sc, A_SGE_STAT_MATCH)); + } else { + sbuf_printf(sb, "unknown mode %d", mode); } } rc = sbuf_finish(sb);