mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
cxgbe(4): Add the ability to dump mailbox commands and replies. It is
enabled/disabled via bit 0 of adapter->debug_flags (which is available at dev.t5nex.<n>.debug_flags). MFC after: 1 week
This commit is contained in:
parent
9ef8328d52
commit
0e4cd4a2e0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=284445
@ -206,6 +206,9 @@ enum {
|
||||
INTR_OFLD_RXQ = (1 << 5), /* All TOE rxq's take interrupts */
|
||||
INTR_NM_RXQ = (1 << 6), /* All netmap rxq's take interrupts */
|
||||
INTR_ALL = (INTR_RXQ | INTR_OFLD_RXQ | INTR_NM_RXQ),
|
||||
|
||||
/* adapter debug_flags */
|
||||
DF_DUMP_MBOX = (1 << 0),
|
||||
};
|
||||
|
||||
#define IS_DOOMED(pi) ((pi)->flags & DOOMED)
|
||||
@ -762,6 +765,7 @@ struct adapter {
|
||||
int active_ulds; /* ULDs activated on this adapter */
|
||||
#endif
|
||||
int flags;
|
||||
int debug_flags;
|
||||
|
||||
char ifp_lockname[16];
|
||||
struct mtx ifp_lock;
|
||||
@ -846,6 +850,24 @@ struct adapter {
|
||||
#define TXQ_LOCK_ASSERT_OWNED(txq) EQ_LOCK_ASSERT_OWNED(&(txq)->eq)
|
||||
#define TXQ_LOCK_ASSERT_NOTOWNED(txq) EQ_LOCK_ASSERT_NOTOWNED(&(txq)->eq)
|
||||
|
||||
#define CH_DUMP_MBOX(sc, mbox, data_reg) \
|
||||
do { \
|
||||
if (sc->debug_flags & DF_DUMP_MBOX) { \
|
||||
log(LOG_NOTICE, \
|
||||
"%s mbox %u: %016llx %016llx %016llx %016llx " \
|
||||
"%016llx %016llx %016llx %016llx\n", \
|
||||
device_get_nameunit(sc->dev), mbox, \
|
||||
(unsigned long long)t4_read_reg64(sc, data_reg), \
|
||||
(unsigned long long)t4_read_reg64(sc, data_reg + 8), \
|
||||
(unsigned long long)t4_read_reg64(sc, data_reg + 16), \
|
||||
(unsigned long long)t4_read_reg64(sc, data_reg + 24), \
|
||||
(unsigned long long)t4_read_reg64(sc, data_reg + 32), \
|
||||
(unsigned long long)t4_read_reg64(sc, data_reg + 40), \
|
||||
(unsigned long long)t4_read_reg64(sc, data_reg + 48), \
|
||||
(unsigned long long)t4_read_reg64(sc, data_reg + 56)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define for_each_txq(pi, iter, q) \
|
||||
for (q = &pi->adapter->sge.txq[pi->first_txq], iter = 0; \
|
||||
iter < pi->ntxq; ++iter, ++q)
|
||||
|
@ -262,6 +262,8 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size,
|
||||
for (i = 0; i < size; i += 8, p++)
|
||||
t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p));
|
||||
|
||||
CH_DUMP_MBOX(adap, mbox, data_reg);
|
||||
|
||||
t4_write_reg(adap, ctl_reg, F_MBMSGVALID | V_MBOWNER(X_MBOWNER_FW));
|
||||
t4_read_reg(adap, ctl_reg); /* flush write */
|
||||
|
||||
@ -287,6 +289,8 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size,
|
||||
continue;
|
||||
}
|
||||
|
||||
CH_DUMP_MBOX(adap, mbox, data_reg);
|
||||
|
||||
res = t4_read_reg64(adap, data_reg);
|
||||
if (G_FW_CMD_OP(res >> 32) == FW_DEBUG_CMD) {
|
||||
fw_asrt(adap, data_reg);
|
||||
|
@ -585,6 +585,9 @@ t4_attach(device_t dev)
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
sc->dev = dev;
|
||||
#ifdef INVARIANTS
|
||||
sc->debug_flags = DF_DUMP_MBOX;
|
||||
#endif
|
||||
|
||||
pci_enable_busmaster(dev);
|
||||
if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) {
|
||||
@ -4603,6 +4606,9 @@ t4_sysctls(struct adapter *sc)
|
||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "lro_timeout", CTLFLAG_RW,
|
||||
&sc->lro_timeout, 0, "lro inactive-flush timeout (in us)");
|
||||
|
||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "debug_flags", CTLFLAG_RW,
|
||||
&sc->debug_flags, 0, "flags to enable runtime debugging");
|
||||
|
||||
#ifdef SBUF_DRAIN
|
||||
/*
|
||||
* dev.t4nex.X.misc. Marked CTLFLAG_SKIP to avoid information overload.
|
||||
|
Loading…
Reference in New Issue
Block a user