svn commit: r358985 - in stable/12/sys/dev/cxgbe: . common

Navdeep Parhar np at FreeBSD.org
Sat Mar 14 02:20:56 UTC 2020


Author: np
Date: Sat Mar 14 02:20:53 2020
New Revision: 358985
URL: https://svnweb.freebsd.org/changeset/base/358985

Log:
  MFC r358086:
  
  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.
  
  Sponsored by:	Chelsio Communications

Modified:
  stable/12/sys/dev/cxgbe/common/t4_hw.c
  stable/12/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- stable/12/sys/dev/cxgbe/common/t4_hw.c	Sat Mar 14 02:15:21 2020	(r358984)
+++ stable/12/sys/dev/cxgbe/common/t4_hw.c	Sat Mar 14 02:20:53 2020	(r358985)
@@ -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: stable/12/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/12/sys/dev/cxgbe/t4_main.c	Sat Mar 14 02:15:21 2020	(r358984)
+++ stable/12/sys/dev/cxgbe/t4_main.c	Sat Mar 14 02:20:53 2020	(r358985)
@@ -5875,7 +5875,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 */
 
@@ -5886,15 +5886,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);
@@ -10004,7 +10004,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;
@@ -10029,13 +10029,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);
 


More information about the svn-src-all mailing list