Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Apr 2017 10:51:09 -0700
From:      Chuck Tuffli <chuck@tuffli.net>
To:        freebsd-scsi <freebsd-scsi@freebsd.org>
Subject:   [RFC] Fix NVMe's use of XPT_GDEV_TYPE
Message-ID:  <CAM0tzX0gCQ0epT%2BXe5nQThTX%2BzRgSXNQnd3Y5_hA9WRq58jnoQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM0tzX0gCQ0epT%2BXe5nQThTX%2BzRgSXNQnd3Y5_hA9WRq58jnoQ>