Commit 937488a8 authored by Kaike Wan's avatar Kaike Wan Committed by Jason Gunthorpe

IB/hfi1: Dump pio info for non-user send contexts

This patch dumps the pio info for non-user send contexts to assist
debugging in the field.
Reviewed-by: default avatarMike Marciniczyn <mike.marciniszyn@intel.com>
Reviewed-by: default avatarMike Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: default avatarKaike Wan <kaike.wan@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 81fce629
......@@ -935,6 +935,10 @@
#define SEND_CTXT_CREDIT_CTRL_THRESHOLD_MASK 0x7FFull
#define SEND_CTXT_CREDIT_CTRL_THRESHOLD_SHIFT 0
#define SEND_CTXT_CREDIT_CTRL_THRESHOLD_SMASK 0x7FFull
#define SEND_CTXT_CREDIT_STATUS (TXE + 0x000000100018)
#define SEND_CTXT_CREDIT_STATUS_CURRENT_FREE_COUNTER_MASK 0x7FFull
#define SEND_CTXT_CREDIT_STATUS_CURRENT_FREE_COUNTER_SHIFT 32
#define SEND_CTXT_CREDIT_STATUS_LAST_RETURNED_COUNTER_SMASK 0x7FFull
#define SEND_CTXT_CREDIT_FORCE (TXE + 0x000000100028)
#define SEND_CTXT_CREDIT_FORCE_FORCE_RETURN_SMASK 0x1ull
#define SEND_CTXT_CREDIT_RETURN_ADDR (TXE + 0x000000100020)
......
......@@ -407,6 +407,54 @@ DEBUGFS_SEQ_FILE_OPS(rcds);
DEBUGFS_SEQ_FILE_OPEN(rcds)
DEBUGFS_FILE_OPS(rcds);
static void *_pios_seq_start(struct seq_file *s, loff_t *pos)
{
struct hfi1_ibdev *ibd;
struct hfi1_devdata *dd;
ibd = (struct hfi1_ibdev *)s->private;
dd = dd_from_dev(ibd);
if (!dd->send_contexts || *pos >= dd->num_send_contexts)
return NULL;
return pos;
}
static void *_pios_seq_next(struct seq_file *s, void *v, loff_t *pos)
{
struct hfi1_ibdev *ibd = (struct hfi1_ibdev *)s->private;
struct hfi1_devdata *dd = dd_from_dev(ibd);
++*pos;
if (!dd->send_contexts || *pos >= dd->num_send_contexts)
return NULL;
return pos;
}
static void _pios_seq_stop(struct seq_file *s, void *v)
{
}
static int _pios_seq_show(struct seq_file *s, void *v)
{
struct hfi1_ibdev *ibd = (struct hfi1_ibdev *)s->private;
struct hfi1_devdata *dd = dd_from_dev(ibd);
struct send_context_info *sci;
loff_t *spos = v;
loff_t i = *spos;
unsigned long flags;
spin_lock_irqsave(&dd->sc_lock, flags);
sci = &dd->send_contexts[i];
if (sci && sci->type != SC_USER && sci->allocated && sci->sc)
seqfile_dump_sci(s, i, sci);
spin_unlock_irqrestore(&dd->sc_lock, flags);
return 0;
}
DEBUGFS_SEQ_FILE_OPS(pios);
DEBUGFS_SEQ_FILE_OPEN(pios)
DEBUGFS_FILE_OPS(pios);
/* read the per-device counters */
static ssize_t dev_counters_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
......@@ -1143,6 +1191,7 @@ void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd)
DEBUGFS_SEQ_FILE_CREATE(qp_stats, ibd->hfi1_ibdev_dbg, ibd);
DEBUGFS_SEQ_FILE_CREATE(sdes, ibd->hfi1_ibdev_dbg, ibd);
DEBUGFS_SEQ_FILE_CREATE(rcds, ibd->hfi1_ibdev_dbg, ibd);
DEBUGFS_SEQ_FILE_CREATE(pios, ibd->hfi1_ibdev_dbg, ibd);
DEBUGFS_SEQ_FILE_CREATE(sdma_cpu_list, ibd->hfi1_ibdev_dbg, ibd);
/* dev counter files */
for (i = 0; i < ARRAY_SIZE(cntr_ops); i++)
......
......@@ -2137,3 +2137,28 @@ void free_credit_return(struct hfi1_devdata *dd)
kfree(dd->cr_base);
dd->cr_base = NULL;
}
void seqfile_dump_sci(struct seq_file *s, u32 i,
struct send_context_info *sci)
{
struct send_context *sc = sci->sc;
u64 reg;
seq_printf(s, "SCI %u: type %u base %u credits %u\n",
i, sci->type, sci->base, sci->credits);
seq_printf(s, " flags 0x%x sw_inx %u hw_ctxt %u grp %u\n",
sc->flags, sc->sw_index, sc->hw_context, sc->group);
seq_printf(s, " sr_size %u credits %u sr_head %u sr_tail %u\n",
sc->sr_size, sc->credits, sc->sr_head, sc->sr_tail);
seq_printf(s, " fill %lu free %lu fill_wrap %u alloc_free %lu\n",
sc->fill, sc->free, sc->fill_wrap, sc->alloc_free);
seq_printf(s, " credit_intr_count %u credit_ctrl 0x%llx\n",
sc->credit_intr_count, sc->credit_ctrl);
reg = read_kctxt_csr(sc->dd, sc->hw_context, SC(CREDIT_STATUS));
seq_printf(s, " *hw_free %llu CurrentFree %llu LastReturned %llu\n",
(le64_to_cpu(*sc->hw_free) & CR_COUNTER_SMASK) >>
CR_COUNTER_SHIFT,
(reg >> SC(CREDIT_STATUS_CURRENT_FREE_COUNTER_SHIFT)) &
SC(CREDIT_STATUS_CURRENT_FREE_COUNTER_MASK),
reg & SC(CREDIT_STATUS_LAST_RETURNED_COUNTER_SMASK));
}
......@@ -329,4 +329,7 @@ void seg_pio_copy_start(struct pio_buf *pbuf, u64 pbc,
void seg_pio_copy_mid(struct pio_buf *pbuf, const void *from, size_t nbytes);
void seg_pio_copy_end(struct pio_buf *pbuf);
void seqfile_dump_sci(struct seq_file *s, u32 i,
struct send_context_info *sci);
#endif /* _PIO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment