From 348824b6a337dc61920b225be18c657cceea0229 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 14 Apr 2009 20:05:52 +0000 Subject: [PATCH] Add firmware state, loop state, topology and link speed human readable information to procfs. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@777 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla_isp/common/isp.c | 42 +++++++++++++++++++++++++++++--------- qla_isp/common/ispvar.h | 4 ++++ qla_isp/linux/isp_cb_ops.c | 4 ++-- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/qla_isp/common/isp.c b/qla_isp/common/isp.c index 588f24c8f..6c66e0068 100644 --- a/qla_isp/common/isp.c +++ b/qla_isp/common/isp.c @@ -168,7 +168,6 @@ static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *, int); static void isp_dump_chip_portdb(ispsoftc_t *, int, int); static uint64_t isp_get_wwn(ispsoftc_t *, int, int, int); static int isp_fclink_test(ispsoftc_t *, int, int); -static const char *ispfc_fw_statename(int); static int isp_pdb_sync(ispsoftc_t *, int); static int isp_scan_loop(ispsoftc_t *, int); static int isp_gid_ft_sns(ispsoftc_t *, int); @@ -2559,13 +2558,6 @@ isp_get_wwn(ispsoftc_t *isp, int chan, int loopid, int nodename) static int isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay) { - static const char *toponames[] = { - "Private Loop", - "FL Port", - "N-Port to N-Port", - "F Port", - "F Port (no FLOGI_ACC response)" - }; mbreg_t mbs; int count, check_for_fabric, r; uint8_t lwfs; @@ -2841,13 +2833,13 @@ not_on_fabric: */ isp_prt(isp, ISP_LOGSANCFG|ISP_LOGCONFIG, topology, chan, (uint32_t) (fcp->isp_wwpn >> 32), (uint32_t) fcp->isp_wwpn, - fcp->isp_portid, fcp->isp_loopid, toponames[fcp->isp_topo]); + fcp->isp_portid, fcp->isp_loopid, ispfc_toponame(fcp->isp_topo)); isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d FC Link Test Complete", chan); return (0); } -static const char * +const char * ispfc_fw_statename(int state) { switch (state) { @@ -2863,6 +2855,36 @@ ispfc_fw_statename(int state) } } +const char * +ispfc_loop_statename(int state) +{ + switch (state) { + case LOOP_NIL: return "NIL"; + case LOOP_LIP_RCVD: return "LIP Received"; + case LOOP_PDB_RCVD: return "PDB Received"; + case LOOP_SCANNING_LOOP: return "Scanning"; + case LOOP_LSCAN_DONE: return "Loop Scan Done"; + case LOOP_SCANNING_FABRIC: return "Scanning Fabric"; + case LOOP_FSCAN_DONE: return "Fabric Scan Done"; + case LOOP_SYNCING_PDB: return "Syncing PDB"; + case LOOP_READY: return "Ready"; + default: return "?????"; + } +} + +const char * +ispfc_toponame(int topo) +{ + switch (topo) { + case TOPO_NL_PORT: return "Private Loop"; + case TOPO_FL_PORT: return "FL Port"; + case TOPO_N_PORT: return "N-Port to N-Port"; + case TOPO_F_PORT: return "F Port"; + case TOPO_PTP_STUB: return "F Port (no FLOGI_ACC response)"; + default: return "?????"; + } +} + /* * Complete the synchronization of our Port Database. * diff --git a/qla_isp/common/ispvar.h b/qla_isp/common/ispvar.h index 5e9bd0fdd..d5859b527 100644 --- a/qla_isp/common/ispvar.h +++ b/qla_isp/common/ispvar.h @@ -501,6 +501,10 @@ typedef struct { #define TOPO_F_PORT 3 #define TOPO_PTP_STUB 4 +const char *ispfc_fw_statename(int); +const char *ispfc_loop_statename(int); +const char *ispfc_toponame(int); + /* * Soft Structure per host adapter */ diff --git a/qla_isp/linux/isp_cb_ops.c b/qla_isp/linux/isp_cb_ops.c index b2c9b5e1b..423a8ab37 100644 --- a/qla_isp/linux/isp_cb_ops.c +++ b/qla_isp/linux/isp_cb_ops.c @@ -288,8 +288,8 @@ isplinux_proc_info(struct Scsi_Host *shp, char *buf, char **st, off_t off, int l for (chan = 0; chan < isp->isp_nchan; chan++) { fcparam *fcp = FCPARAM(isp, chan); copy_info(&info, - "Self Channel %d:\nHandle ID 0x%x PortID 0x%06x FW State 0x%x Loop State 0x%x\n", chan, - fcp->isp_loopid, fcp->isp_portid, fcp->isp_fwstate, fcp->isp_loopstate); + "Self Channel %d:\nHandle ID 0x%x PortID 0x%06x FW State %s Loop State %s Topology %s Link Speed %dGb\n", chan, + fcp->isp_loopid, fcp->isp_portid, ispfc_fw_statename(fcp->isp_fwstate), ispfc_loop_statename(fcp->isp_loopstate), ispfc_toponame(fcp->isp_topo), fcp->isp_gbspeed); copy_info(&info, "Port WWN 0x%016llx Node WWN 0x%016llx\n\n", (ull) fcp->isp_wwpn, (ull)fcp->isp_wwnn); copy_info(&info, "FC devices in port database:\n"); for (i = 0; i < MAX_FC_TARG; i++) {