From owner-svn-src-head@freebsd.org Thu Mar 9 17:35:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B5FDD04FB3; Thu, 9 Mar 2017 17:35:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 139F3D0F; Thu, 9 Mar 2017 17:35:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v29HZa9f067699; Thu, 9 Mar 2017 17:35:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v29HZa4r067697; Thu, 9 Mar 2017 17:35:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703091735.v29HZa4r067697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 9 Mar 2017 17:35:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314967 - head/sys/dev/mpt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2017 17:35:37 -0000 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;