[RFC] Fix NVMe's use of XPT_GDEV_TYPE
Chuck Tuffli
chuck at tuffli.net
Sun Apr 23 17:51:11 UTC 2017
There is a patch up on Phabricator[1] which changes the way
XPT_GDEV_TYPE works for NVMe. The current ccb_getdev structure
includes pointers to the NVMe Identify Controller and Namespace
structures, but these are kernel virtual addresses which are not
accessible from user space.
As an alternative, the patch removes these pointers from ccb_getdev
and adds two new types to ccb_dev_advinfo to retrieve the Identify
Controller (CDAI_TYPE_NVME_CNTRL) and Namespace (CDAI_TYPE_NVME_NS)
data structures. To retrieve the Identify Controller data structure,
applications would do something similar to:
struct nvme_controller_data cd;
struct ccb_dev_advinfo *cdai = &ccb->cdai;
CCB_CLEAR_ALL_EXCEPT_HDR(cdai);
cdai->ccb_h.func_code = XPT_DEV_ADVINFO;
cdai->ccb_h.flags = CAM_DIR_IN;
cdai->flags = CDAI_FLAG_NONE;
cdai->buftype = CDAI_TYPE_NVME_CNTRL;
cdai->bufsiz = sizeof(struct nvme_controller_data);
cdai->buf = (uint8_t *)&cd;
cam_send_ccb(camdev, ccb);
[1] https://reviews.freebsd.org/D10466
More information about the freebsd-scsi
mailing list