From owner-svn-src-all@freebsd.org Wed Feb 19 00:49:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3250E24AAF4; Wed, 19 Feb 2020 00:49:00 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48MfHJ0Dcbz3HMn; Wed, 19 Feb 2020 00:49:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D276C96E; Wed, 19 Feb 2020 00:48:59 +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 01J0mxDE092620; Wed, 19 Feb 2020 00:48:59 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01J0mx4a092619; Wed, 19 Feb 2020 00:48:59 GMT (envelope-from np@FreeBSD.org) Message-Id: <202002190048.01J0mx4a092619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 19 Feb 2020 00:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358086 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 358086 X-SVN-Commit-Repository: base 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.29 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: Wed, 19 Feb 2020 00:49:00 -0000 Author: np Date: Wed Feb 19 00:48:58 2020 New Revision: 358086 URL: https://svnweb.freebsd.org/changeset/base/358086 Log: cxgbe(4): Congestion drops are maintained per E-channel and not per buffer group. This fixes a bug where congestion drops on port 1 of a T6 card would incorrectly be counted as drops on port 0. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Tue Feb 18 23:56:23 2020 (r358085) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed Feb 19 00:48:58 2020 (r358086) @@ -6781,9 +6781,10 @@ static unsigned int t4_get_mps_bg_map(struct adapter * static unsigned int t4_get_rx_e_chan_map(struct adapter *adap, int idx) { u32 n = G_NUMPORTS(t4_read_reg(adap, A_MPS_CMN_CTL)); + const u32 all_chan = (1 << adap->chip_params->nchan) - 1; if (n == 0) - return idx == 0 ? 0xf : 0; + return idx == 0 ? all_chan : 0; if (n == 1 && chip_id(adap) <= CHELSIO_T5) return idx < 2 ? (3 << (2 * idx)) : 0; return 1 << idx; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Feb 18 23:56:23 2020 (r358085) +++ head/sys/dev/cxgbe/t4_main.c Wed Feb 19 00:48:58 2020 (r358086) @@ -6137,7 +6137,7 @@ vi_refresh_stats(struct adapter *sc, struct vi_info *v static void cxgbe_refresh_stats(struct adapter *sc, struct port_info *pi) { - u_int i, v, tnl_cong_drops, bg_map; + u_int i, v, tnl_cong_drops, chan_map; struct timeval tv; const struct timeval interval = {0, 250000}; /* 250ms */ @@ -6148,15 +6148,15 @@ cxgbe_refresh_stats(struct adapter *sc, struct port_in tnl_cong_drops = 0; t4_get_port_stats(sc, pi->tx_chan, &pi->stats); - bg_map = pi->mps_bg_map; - while (bg_map) { - i = ffs(bg_map) - 1; + chan_map = pi->rx_e_chan_map; + while (chan_map) { + i = ffs(chan_map) - 1; mtx_lock(&sc->reg_lock); t4_read_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, 1, A_TP_MIB_TNL_CNG_DROP_0 + i); mtx_unlock(&sc->reg_lock); tnl_cong_drops += v; - bg_map &= ~(1 << i); + chan_map &= ~(1 << i); } pi->tnl_cong_drops = tnl_cong_drops; getmicrotime(&pi->last_refreshed); @@ -10292,7 +10292,7 @@ read_i2c(struct adapter *sc, struct t4_i2c_data *i2cd) static int clear_stats(struct adapter *sc, u_int port_id) { - int i, v, bg_map; + int i, v, chan_map; struct port_info *pi; struct vi_info *vi; struct sge_rxq *rxq; @@ -10317,13 +10317,13 @@ clear_stats(struct adapter *sc, u_int port_id) if (vi->flags & VI_INIT_DONE) t4_clr_vi_stats(sc, vi->vin); } - bg_map = pi->mps_bg_map; + chan_map = pi->rx_e_chan_map; v = 0; /* reuse */ - while (bg_map) { - i = ffs(bg_map) - 1; + while (chan_map) { + i = ffs(chan_map) - 1; t4_write_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, 1, A_TP_MIB_TNL_CNG_DROP_0 + i); - bg_map &= ~(1 << i); + chan_map &= ~(1 << i); } mtx_unlock(&sc->reg_lock);