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
This commit is contained in:
Navdeep Parhar 2020-02-19 00:48:58 +00:00
parent 98b6844690
commit 02cd773916
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358086
2 changed files with 12 additions and 11 deletions

View File

@ -6781,9 +6781,10 @@ static unsigned int t4_get_mps_bg_map(struct adapter *adap, int idx)
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;

View File

@ -6137,7 +6137,7 @@ vi_refresh_stats(struct adapter *sc, struct vi_info *vi)
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_info *pi)
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);