Commit 1d9d5a98 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: refactor debugfs queue dump routines

Create common wq, cq, eq, rq dump functions
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 07bcd98e
...@@ -4555,31 +4555,31 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport) ...@@ -4555,31 +4555,31 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
void void
lpfc_debug_dump_all_queues(struct lpfc_hba *phba) lpfc_debug_dump_all_queues(struct lpfc_hba *phba)
{ {
int fcp_wqidx; int idx;
/* /*
* Dump Work Queues (WQs) * Dump Work Queues (WQs)
*/ */
lpfc_debug_dump_mbx_wq(phba); lpfc_debug_dump_wq(phba, DUMP_MBX, 0);
lpfc_debug_dump_els_wq(phba); lpfc_debug_dump_wq(phba, DUMP_ELS, 0);
for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_io_channel; fcp_wqidx++) for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++)
lpfc_debug_dump_fcp_wq(phba, fcp_wqidx); lpfc_debug_dump_wq(phba, DUMP_FCP, idx);
lpfc_debug_dump_hdr_rq(phba); lpfc_debug_dump_hdr_rq(phba);
lpfc_debug_dump_dat_rq(phba); lpfc_debug_dump_dat_rq(phba);
/* /*
* Dump Complete Queues (CQs) * Dump Complete Queues (CQs)
*/ */
lpfc_debug_dump_mbx_cq(phba); lpfc_debug_dump_cq(phba, DUMP_MBX, 0);
lpfc_debug_dump_els_cq(phba); lpfc_debug_dump_cq(phba, DUMP_ELS, 0);
for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_io_channel; fcp_wqidx++) for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++)
lpfc_debug_dump_fcp_cq(phba, fcp_wqidx); lpfc_debug_dump_cq(phba, DUMP_FCP, idx);
/* /*
* Dump Event Queues (EQs) * Dump Event Queues (EQs)
*/ */
for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_io_channel; fcp_wqidx++) for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++)
lpfc_debug_dump_hba_eq(phba, fcp_wqidx); lpfc_debug_dump_hba_eq(phba, idx);
} }
...@@ -42,6 +42,12 @@ ...@@ -42,6 +42,12 @@
/* hbqinfo output buffer size */ /* hbqinfo output buffer size */
#define LPFC_HBQINFO_SIZE 8192 #define LPFC_HBQINFO_SIZE 8192
enum {
DUMP_FCP,
DUMP_MBX,
DUMP_ELS,
};
/* /*
* For SLI4 iDiag debugfs diagnostics tool * For SLI4 iDiag debugfs diagnostics tool
*/ */
...@@ -358,58 +364,97 @@ lpfc_debug_dump_q(struct lpfc_queue *q) ...@@ -358,58 +364,97 @@ lpfc_debug_dump_q(struct lpfc_queue *q)
} }
/** /**
* lpfc_debug_dump_fcp_wq - dump all entries from a fcp work queue * lpfc_debug_dump_wq - dump all entries from the fcp work queue
* @phba: Pointer to HBA context object. * @phba: Pointer to HBA context object.
* @fcp_wqidx: Index to a FCP work queue. * @wqidx: Index to a FCP work queue.
* *
* This function dumps all entries from a FCP work queue specified by the * This function dumps all entries from a FCP work queue specified
* @fcp_wqidx. * by the wqidx.
**/ **/
static inline void static inline void
lpfc_debug_dump_fcp_wq(struct lpfc_hba *phba, int fcp_wqidx) lpfc_debug_dump_wq(struct lpfc_hba *phba, int qtype, int wqidx)
{ {
/* sanity check */ struct lpfc_queue *wq;
if (fcp_wqidx >= phba->cfg_fcp_io_channel) char *qtypestr;
if (qtype == DUMP_FCP) {
wq = phba->sli4_hba.fcp_wq[wqidx];
qtypestr = "FCP";
} else if (qtype == DUMP_MBX) {
wq = phba->sli4_hba.mbx_wq;
qtypestr = "MBX";
} else if (qtype == DUMP_ELS) {
wq = phba->sli4_hba.els_wq;
qtypestr = "ELS";
} else
return; return;
printk(KERN_ERR "FCP WQ: WQ[Idx:%d|Qid:%d]\n", if (qtype == DUMP_FCP)
fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id); pr_err("%s WQ: WQ[Idx:%d|Qid:%d]\n",
lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[fcp_wqidx]); qtypestr, wqidx, wq->queue_id);
else
pr_err("%s WQ: WQ[Qid:%d]\n",
qtypestr, wq->queue_id);
lpfc_debug_dump_q(wq);
} }
/** /**
* lpfc_debug_dump_fcp_cq - dump all entries from a fcp work queue's cmpl queue * lpfc_debug_dump_cq - dump all entries from a fcp work queue's
* cmpl queue
* @phba: Pointer to HBA context object. * @phba: Pointer to HBA context object.
* @fcp_wqidx: Index to a FCP work queue. * @wqidx: Index to a FCP work queue.
* *
* This function dumps all entries from a FCP complete queue which is * This function dumps all entries from a FCP completion queue
* associated to the FCP work queue specified by the @fcp_wqidx. * which is associated to the work queue specified by the @wqidx.
**/ **/
static inline void static inline void
lpfc_debug_dump_fcp_cq(struct lpfc_hba *phba, int fcp_wqidx) lpfc_debug_dump_cq(struct lpfc_hba *phba, int qtype, int wqidx)
{ {
int fcp_cqidx, fcp_cqid; struct lpfc_queue *wq, *cq, *eq;
char *qtypestr;
/* sanity check */ int eqidx;
if (fcp_wqidx >= phba->cfg_fcp_io_channel)
/* fcp wq and cq are 1:1, thus same indexes */
if (qtype == DUMP_FCP) {
wq = phba->sli4_hba.fcp_wq[wqidx];
cq = phba->sli4_hba.fcp_cq[wqidx];
qtypestr = "FCP";
} else if (qtype == DUMP_MBX) {
wq = phba->sli4_hba.mbx_wq;
cq = phba->sli4_hba.mbx_cq;
qtypestr = "MBX";
} else if (qtype == DUMP_ELS) {
wq = phba->sli4_hba.els_wq;
cq = phba->sli4_hba.els_cq;
qtypestr = "ELS";
} else
return; return;
fcp_cqid = phba->sli4_hba.fcp_wq[fcp_wqidx]->assoc_qid; for (eqidx = 0; eqidx < phba->cfg_fcp_io_channel; eqidx++) {
for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_io_channel; fcp_cqidx++) eq = phba->sli4_hba.hba_eq[eqidx];
if (phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id == fcp_cqid) if (cq->assoc_qid == eq->queue_id)
break; break;
if (phba->intr_type == MSIX) { }
if (fcp_cqidx >= phba->cfg_fcp_io_channel) if (eqidx == phba->cfg_fcp_io_channel) {
return; pr_err("Couldn't find EQ for CQ. Using EQ[0]\n");
} else { eqidx = 0;
if (fcp_cqidx > 0) eq = phba->sli4_hba.hba_eq[0];
return;
} }
printk(KERN_ERR "FCP CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]:\n", if (qtype == DUMP_FCP)
fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id, pr_err("%s CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]"
fcp_cqidx, fcp_cqid); "->EQ[Idx:%d|Qid:%d]:\n",
lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[fcp_cqidx]); qtypestr, wqidx, wq->queue_id, wqidx, cq->queue_id,
eqidx, eq->queue_id);
else
pr_err("%s CQ: WQ[Qid:%d]->CQ[Qid:%d]"
"->EQ[Idx:%d|Qid:%d]:\n",
qtypestr, wq->queue_id, cq->queue_id,
eqidx, eq->queue_id);
lpfc_debug_dump_q(cq);
} }
/** /**
...@@ -421,64 +466,15 @@ lpfc_debug_dump_fcp_cq(struct lpfc_hba *phba, int fcp_wqidx) ...@@ -421,64 +466,15 @@ lpfc_debug_dump_fcp_cq(struct lpfc_hba *phba, int fcp_wqidx)
* associated to the FCP work queue specified by the @fcp_wqidx. * associated to the FCP work queue specified by the @fcp_wqidx.
**/ **/
static inline void static inline void
lpfc_debug_dump_hba_eq(struct lpfc_hba *phba, int fcp_wqidx) lpfc_debug_dump_hba_eq(struct lpfc_hba *phba, int qidx)
{ {
struct lpfc_queue *qdesc; struct lpfc_queue *qp;
int fcp_eqidx, fcp_eqid;
int fcp_cqidx, fcp_cqid;
/* sanity check */
if (fcp_wqidx >= phba->cfg_fcp_io_channel)
return;
fcp_cqid = phba->sli4_hba.fcp_wq[fcp_wqidx]->assoc_qid;
for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_io_channel; fcp_cqidx++)
if (phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id == fcp_cqid)
break;
if (phba->intr_type == MSIX) {
if (fcp_cqidx >= phba->cfg_fcp_io_channel)
return;
} else {
if (fcp_cqidx > 0)
return;
}
fcp_eqidx = fcp_cqidx; qp = phba->sli4_hba.hba_eq[qidx];
fcp_eqid = phba->sli4_hba.hba_eq[fcp_eqidx]->queue_id;
qdesc = phba->sli4_hba.hba_eq[fcp_eqidx];
printk(KERN_ERR "FCP EQ: WQ[Idx:%d|Qid:%d]->CQ[Idx:%d|Qid:%d]->" pr_err("EQ[Idx:%d|Qid:%d]\n", qidx, qp->queue_id);
"EQ[Idx:%d|Qid:%d]\n",
fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id,
fcp_cqidx, fcp_cqid, fcp_eqidx, fcp_eqid);
lpfc_debug_dump_q(qdesc);
}
/** lpfc_debug_dump_q(qp);
* lpfc_debug_dump_els_wq - dump all entries from the els work queue
* @phba: Pointer to HBA context object.
*
* This function dumps all entries from the ELS work queue.
**/
static inline void
lpfc_debug_dump_els_wq(struct lpfc_hba *phba)
{
printk(KERN_ERR "ELS WQ: WQ[Qid:%d]:\n",
phba->sli4_hba.els_wq->queue_id);
lpfc_debug_dump_q(phba->sli4_hba.els_wq);
}
/**
* lpfc_debug_dump_mbx_wq - dump all entries from the mbox work queue
* @phba: Pointer to HBA context object.
*
* This function dumps all entries from the MBOX work queue.
**/
static inline void
lpfc_debug_dump_mbx_wq(struct lpfc_hba *phba)
{
printk(KERN_ERR "MBX WQ: WQ[Qid:%d]\n",
phba->sli4_hba.mbx_wq->queue_id);
lpfc_debug_dump_q(phba->sli4_hba.mbx_wq);
} }
/** /**
...@@ -509,36 +505,6 @@ lpfc_debug_dump_hdr_rq(struct lpfc_hba *phba) ...@@ -509,36 +505,6 @@ lpfc_debug_dump_hdr_rq(struct lpfc_hba *phba)
lpfc_debug_dump_q(phba->sli4_hba.hdr_rq); lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
} }
/**
* lpfc_debug_dump_els_cq - dump all entries from the els complete queue
* @phba: Pointer to HBA context object.
*
* This function dumps all entries from the els complete queue.
**/
static inline void
lpfc_debug_dump_els_cq(struct lpfc_hba *phba)
{
printk(KERN_ERR "ELS CQ: WQ[Qid:%d]->CQ[Qid:%d]\n",
phba->sli4_hba.els_wq->queue_id,
phba->sli4_hba.els_cq->queue_id);
lpfc_debug_dump_q(phba->sli4_hba.els_cq);
}
/**
* lpfc_debug_dump_mbx_cq - dump all entries from the mbox complete queue
* @phba: Pointer to HBA context object.
*
* This function dumps all entries from the mbox complete queue.
**/
static inline void
lpfc_debug_dump_mbx_cq(struct lpfc_hba *phba)
{
printk(KERN_ERR "MBX CQ: WQ[Qid:%d]->CQ[Qid:%d]\n",
phba->sli4_hba.mbx_wq->queue_id,
phba->sli4_hba.mbx_cq->queue_id);
lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
}
/** /**
* lpfc_debug_dump_wq_by_id - dump all entries from a work queue by queue id * lpfc_debug_dump_wq_by_id - dump all entries from a work queue by queue id
* @phba: Pointer to HBA context object. * @phba: Pointer to HBA context object.
...@@ -556,14 +522,15 @@ lpfc_debug_dump_wq_by_id(struct lpfc_hba *phba, int qid) ...@@ -556,14 +522,15 @@ lpfc_debug_dump_wq_by_id(struct lpfc_hba *phba, int qid)
if (phba->sli4_hba.fcp_wq[wq_idx]->queue_id == qid) if (phba->sli4_hba.fcp_wq[wq_idx]->queue_id == qid)
break; break;
if (wq_idx < phba->cfg_fcp_io_channel) { if (wq_idx < phba->cfg_fcp_io_channel) {
printk(KERN_ERR "FCP WQ[Idx:%d|Qid:%d]\n", wq_idx, qid); pr_err("FCP WQ[Idx:%d|Qid:%d]\n", wq_idx, qid);
lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[wq_idx]); lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[wq_idx]);
return; return;
} }
if (phba->sli4_hba.els_wq->queue_id == qid) { if (phba->sli4_hba.els_wq->queue_id == qid) {
printk(KERN_ERR "ELS WQ[Qid:%d]\n", qid); pr_err("ELS WQ[Qid:%d]\n", qid);
lpfc_debug_dump_q(phba->sli4_hba.els_wq); lpfc_debug_dump_q(phba->sli4_hba.els_wq);
return;
} }
} }
...@@ -617,27 +584,26 @@ lpfc_debug_dump_rq_by_id(struct lpfc_hba *phba, int qid) ...@@ -617,27 +584,26 @@ lpfc_debug_dump_rq_by_id(struct lpfc_hba *phba, int qid)
static inline void static inline void
lpfc_debug_dump_cq_by_id(struct lpfc_hba *phba, int qid) lpfc_debug_dump_cq_by_id(struct lpfc_hba *phba, int qid)
{ {
int cq_idx = 0; int cq_idx;
do { for (cq_idx = 0; cq_idx < phba->cfg_fcp_io_channel; cq_idx++)
if (phba->sli4_hba.fcp_cq[cq_idx]->queue_id == qid) if (phba->sli4_hba.fcp_cq[cq_idx]->queue_id == qid)
break; break;
} while (++cq_idx < phba->cfg_fcp_io_channel);
if (cq_idx < phba->cfg_fcp_io_channel) { if (cq_idx < phba->cfg_fcp_io_channel) {
printk(KERN_ERR "FCP CQ[Idx:%d|Qid:%d]\n", cq_idx, qid); pr_err("FCP CQ[Idx:%d|Qid:%d]\n", cq_idx, qid);
lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[cq_idx]); lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[cq_idx]);
return; return;
} }
if (phba->sli4_hba.els_cq->queue_id == qid) { if (phba->sli4_hba.els_cq->queue_id == qid) {
printk(KERN_ERR "ELS CQ[Qid:%d]\n", qid); pr_err("ELS CQ[Qid:%d]\n", qid);
lpfc_debug_dump_q(phba->sli4_hba.els_cq); lpfc_debug_dump_q(phba->sli4_hba.els_cq);
return; return;
} }
if (phba->sli4_hba.mbx_cq->queue_id == qid) { if (phba->sli4_hba.mbx_cq->queue_id == qid) {
printk(KERN_ERR "MBX CQ[Qid:%d]\n", qid); pr_err("MBX CQ[Qid:%d]\n", qid);
lpfc_debug_dump_q(phba->sli4_hba.mbx_cq); lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
} }
} }
......
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