Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2020 00:48:59 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
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
Message-ID:  <202002190048.01J0mx4a092619@repo.freebsd.org>

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



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