cxgb(4): Netdump: only reference allocated qsets

SGE_QSETS is an upper bound -- fewer qsets may be allocated depending on
the number of CPUs.

Reviewed by:	markj, np, vangyzen
X-MFC-With:	r333288
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D17274
This commit is contained in:
Conrad Meyer 2019-03-01 01:57:22 +00:00
parent ef30b5a809
commit 3948ad29e9
2 changed files with 6 additions and 3 deletions

View File

@ -363,6 +363,7 @@ struct adapter {
unsigned int slow_intr_mask;
unsigned long irq_stats[IRQ_NUM_STATS];
unsigned nqsets;
struct sge sge;
struct mc7 pmrx;
struct mc7 pmtx;

View File

@ -853,6 +853,8 @@ setup_sge_qsets(adapter_t *sc)
}
}
sc->nqsets = qset_idx;
return (0);
}
@ -3598,7 +3600,7 @@ cxgb_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
pi = if_getsoftc(ifp);
adap = pi->adapter;
ADAPTER_LOCK(adap);
*nrxr = SGE_QSETS;
*nrxr = adap->nqsets;
*ncl = adap->sge.qs[0].fl[1].size;
*clsize = adap->sge.qs[0].fl[1].buf_size;
ADAPTER_UNLOCK(adap);
@ -3613,7 +3615,7 @@ cxgb_netdump_event(struct ifnet *ifp, enum netdump_ev event)
pi = if_getsoftc(ifp);
if (event == NETDUMP_START)
for (i = 0; i < SGE_QSETS; i++) {
for (i = 0; i < pi->adapter->nqsets; i++) {
qs = &pi->adapter->sge.qs[i];
/* Need to reinit after netdump_mbuf_dump(). */
@ -3650,7 +3652,7 @@ cxgb_netdump_poll(struct ifnet *ifp, int count)
return (ENOENT);
adap = pi->adapter;
for (i = 0; i < SGE_QSETS; i++)
for (i = 0; i < adap->nqsets; i++)
(void)cxgb_netdump_poll_rx(adap, &adap->sge.qs[i]);
(void)cxgb_netdump_poll_tx(&adap->sge.qs[pi->first_qset]);
return (0);