Export bunch of state variables as sysctls.

This commit is contained in:
mav 2015-10-13 11:02:56 +00:00
parent 61db6983a9
commit 4b45904597
2 changed files with 42 additions and 19 deletions

View File

@ -205,30 +205,55 @@ isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq, int chan)
cam_sim_free(fc->sim, FALSE);
return (ENOMEM);
}
ISP_FC_PC(isp, chan)->num_threads += 1;
fc->num_threads += 1;
#ifdef ISP_INTERNAL_TARGET
ISP_SET_PC(isp, chan, proc_active, 1);
if (THREAD_CREATE(isp_target_thread_fc, fc, &fc->target_proc, 0, 0, "%s: isp_test_tgt%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
ISP_SET_PC(isp, chan, proc_active, 0);
isp_prt(isp, ISP_LOGERR, "cannot create test target thread");
}
ISP_FC_PC(isp, chan)->num_threads += 1;
fc->num_threads += 1;
#endif
if (chan > 0) {
snprintf(name, sizeof(name), "chan%d", chan);
tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(tree),
OID_AUTO, name, CTLFLAG_RW, 0, "Virtual channel");
}
SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "wwnn", CTLFLAG_RD, &FCPARAM(isp, chan)->isp_wwnn, "World Wide Node Name");
SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "wwpn", CTLFLAG_RD, &FCPARAM(isp, chan)->isp_wwpn, "World Wide Port Name");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "loop_down_limit", CTLFLAG_RW, &ISP_FC_PC(isp, chan)->loop_down_limit, 0, "Loop Down Limit");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "gone_device_time", CTLFLAG_RW, &ISP_FC_PC(isp, chan)->gone_device_time, 0, "Gone Device Time");
SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"wwnn", CTLFLAG_RD, &fcp->isp_wwnn,
"World Wide Node Name");
SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"wwpn", CTLFLAG_RD, &fcp->isp_wwpn,
"World Wide Port Name");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"loop_down_limit", CTLFLAG_RW, &fc->loop_down_limit, 0,
"Loop Down Limit");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"gone_device_time", CTLFLAG_RW, &fc->gone_device_time, 0,
"Gone Device Time");
#if defined(ISP_TARGET_MODE) && defined(DEBUG)
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "inject_lost_data_frame", CTLFLAG_RW, &ISP_FC_PC(isp, chan)->inject_lost_data_frame, 0, "Cause a Lost Frame on a Read");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"inject_lost_data_frame", CTLFLAG_RW, &fc->inject_lost_data_frame, 0,
"Cause a Lost Frame on a Read");
#endif
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"role", CTLTYPE_INT | CTLFLAG_RW, isp, chan,
isp_role_sysctl, "I", "Current role");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"speed", CTLFLAG_RD, &fcp->isp_gbspeed, 0,
"Connection speed in gigabits");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"linkstate", CTLFLAG_RD, &fcp->isp_linkstate, 0,
"Link state");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"fwstate", CTLFLAG_RD, &fcp->isp_fwstate, 0,
"Firmware state");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"loopstate", CTLFLAG_RD, &fcp->isp_loopstate, 0,
"Loop state");
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"topo", CTLFLAG_RD, &fcp->isp_topo, 0,
"Connection topology");
}
return (0);
}
@ -5694,7 +5719,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
bus = va_arg(ap, int);
va_end(ap);
FCPARAM(isp, bus)->link_active = 0;
FCPARAM(isp, bus)->isp_linkstate = 0;
fc = ISP_FC_PC(isp, bus);
if (cmd == ISPASYNC_LOOP_DOWN && fc->ready) {
@ -5727,7 +5752,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
* Change Notify before activating the FC cleanup
* thread to look at the state of the loop again.
*/
FCPARAM(isp, bus)->link_active = 1;
FCPARAM(isp, bus)->isp_linkstate = 1;
fc->loop_dead = 0;
fc->loop_down_time = 0;
isp_prt(isp, ISP_LOGINFO, "Chan %d Loop UP", bus);

View File

@ -436,21 +436,19 @@ typedef struct {
*/
typedef struct {
uint32_t
int isp_gbspeed; /* Connection speed */
int isp_linkstate; /* Link state */
int isp_fwstate; /* ISP F/W state */
int isp_loopstate; /* Loop State */
int isp_topo; /* Connection Type */
uint32_t : 3,
fctape_enabled : 1,
link_active : 1,
sendmarker : 1,
loop_seen_once : 1,
role : 2,
isp_gbspeed : 4,
isp_loopstate : 4, /* Current Loop State */
isp_fwstate : 4, /* ISP F/W state */
isp_topo : 3, /* Connection Type */
loop_seen_once : 1;
uint32_t : 8,
isp_portid : 24; /* S_ID */
uint16_t isp_fwoptions;
uint16_t isp_xfwoptions;
uint16_t isp_zfwoptions;