Date: Thu, 9 Mar 2017 17:35:36 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314967 - head/sys/dev/mpt Message-ID: <201703091735.v29HZa4r067697@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Mar 9 17:35:35 2017 New Revision: 314967 URL: https://svnweb.freebsd.org/changeset/base/314967 Log: Add support for XPT_GET_SIM_KNOB in FC mode. MFC after: 2 weeks Modified: head/sys/dev/mpt/mpt.h head/sys/dev/mpt/mpt_cam.c Modified: head/sys/dev/mpt/mpt.h ============================================================================== --- head/sys/dev/mpt/mpt.h Thu Mar 9 17:06:34 2017 (r314966) +++ head/sys/dev/mpt/mpt.h Thu Mar 9 17:35:35 2017 (r314967) @@ -612,8 +612,8 @@ struct mpt_softc { unsigned int initiator_id; } spi; struct { - char wwnn[19]; - char wwpn[19]; + uint64_t wwnn; + uint64_t wwpn; } fc; } scinfo; Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Thu Mar 9 17:06:34 2017 (r314966) +++ head/sys/dev/mpt/mpt_cam.c Thu Mar 9 17:35:35 2017 (r314967) @@ -475,32 +475,26 @@ mpt_read_config_info_fc(struct mpt_softc break; } + mpt->scinfo.fc.wwnn = ((uint64_t)mpt->mpt_fcport_page0.WWNN.High << 32) + | mpt->mpt_fcport_page0.WWNN.Low; + mpt->scinfo.fc.wwpn = ((uint64_t)mpt->mpt_fcport_page0.WWPN.High << 32) + | mpt->mpt_fcport_page0.WWPN.Low; + mpt_lprt(mpt, MPT_PRT_INFO, - "FC Port Page 0: Topology <%s> WWNN 0x%08x%08x WWPN 0x%08x%08x " + "FC Port Page 0: Topology <%s> WWNN 0x%16jx WWPN 0x%16jx " "Speed %u-Gbit\n", topology, - mpt->mpt_fcport_page0.WWNN.High, - mpt->mpt_fcport_page0.WWNN.Low, - mpt->mpt_fcport_page0.WWPN.High, - mpt->mpt_fcport_page0.WWPN.Low, + (uintmax_t)mpt->scinfo.fc.wwnn, (uintmax_t)mpt->scinfo.fc.wwpn, mpt->mpt_fcport_speed); MPT_UNLOCK(mpt); ctx = device_get_sysctl_ctx(mpt->dev); tree = device_get_sysctl_tree(mpt->dev); - snprintf(mpt->scinfo.fc.wwnn, sizeof (mpt->scinfo.fc.wwnn), - "0x%08x%08x", mpt->mpt_fcport_page0.WWNN.High, - mpt->mpt_fcport_page0.WWNN.Low); - - snprintf(mpt->scinfo.fc.wwpn, sizeof (mpt->scinfo.fc.wwpn), - "0x%08x%08x", mpt->mpt_fcport_page0.WWPN.High, - mpt->mpt_fcport_page0.WWPN.Low); - - SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, - "wwnn", CTLFLAG_RD, mpt->scinfo.fc.wwnn, 0, + SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "wwnn", CTLFLAG_RD, &mpt->scinfo.fc.wwnn, "World Wide Node Name"); - SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, - "wwpn", CTLFLAG_RD, mpt->scinfo.fc.wwpn, 0, + SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "wwpn", CTLFLAG_RD, &mpt->scinfo.fc.wwpn, "World Wide Port Name"); MPT_LOCK(mpt); @@ -3522,6 +3516,36 @@ mpt_action(struct cam_sim *sim, union cc KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); break; } + case XPT_GET_SIM_KNOB: + { + struct ccb_sim_knob *kp = &ccb->knob; + + if (mpt->is_fc) { + kp->xport_specific.fc.wwnn = mpt->scinfo.fc.wwnn; + kp->xport_specific.fc.wwpn = mpt->scinfo.fc.wwpn; + switch (mpt->role) { + case MPT_ROLE_NONE: + kp->xport_specific.fc.role = KNOB_ROLE_NONE; + break; + case MPT_ROLE_INITIATOR: + kp->xport_specific.fc.role = KNOB_ROLE_INITIATOR; + break; + case MPT_ROLE_TARGET: + kp->xport_specific.fc.role = KNOB_ROLE_TARGET; + break; + case MPT_ROLE_BOTH: + kp->xport_specific.fc.role = KNOB_ROLE_BOTH; + break; + } + kp->xport_specific.fc.valid = + KNOB_VALID_ADDRESS | KNOB_VALID_ROLE; + ccb->ccb_h.status = CAM_REQ_CMP; + } else { + ccb->ccb_h.status = CAM_REQ_INVALID; + } + xpt_done(ccb); + break; + } case XPT_PATH_INQ: /* Path routing inquiry */ { struct ccb_pathinq *cpi = &ccb->cpi;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703091735.v29HZa4r067697>