Date: Fri, 4 Jan 2019 21:05:40 +0000 (UTC) From: Chuck Tuffli <chuck@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r342777 - in stable/12/sys: cam/nvme dev/nvme Message-ID: <201901042105.x04L5e02054650@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: chuck Date: Fri Jan 4 21:05:40 2019 New Revision: 342777 URL: https://svnweb.freebsd.org/changeset/base/342777 Log: MFC r342046: nda(4) fix check for Dataset Management support Reported by: yuripv@yuripv.net Reviewed by: imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D18746 Modified: stable/12/sys/cam/nvme/nvme_da.c stable/12/sys/dev/nvme/nvme.h stable/12/sys/dev/nvme/nvme_ns.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/12/sys/cam/nvme/nvme_da.c Fri Jan 4 19:20:19 2019 (r342776) +++ stable/12/sys/cam/nvme/nvme_da.c Fri Jan 4 21:05:40 2019 (r342777) @@ -787,7 +787,7 @@ ndaregister(struct cam_periph *periph, void *arg) disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze); disk->d_delmaxsize = disk->d_mediasize; disk->d_flags = DISKFLAG_DIRECT_COMPLETION; -// if (cd->oncs.dsm) // XXX broken? + if (nvme_ctrlr_has_dataset_mgmt(cd)) disk->d_flags |= DISKFLAG_CANDELETE; vwc_present = (cd->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) & NVME_CTRLR_DATA_VWC_PRESENT_MASK; Modified: stable/12/sys/dev/nvme/nvme.h ============================================================================== --- stable/12/sys/dev/nvme/nvme.h Fri Jan 4 19:20:19 2019 (r342776) +++ stable/12/sys/dev/nvme/nvme.h Fri Jan 4 21:05:40 2019 (r342777) @@ -1259,6 +1259,13 @@ void nvme_unregister_consumer(struct nvme_consumer *c device_t nvme_ctrlr_get_device(struct nvme_controller *ctrlr); const struct nvme_controller_data * nvme_ctrlr_get_data(struct nvme_controller *ctrlr); +static inline bool +nvme_ctrlr_has_dataset_mgmt(const struct nvme_controller_data *cd) +{ + /* Assumes cd was byte swapped by nvme_controller_data_swapbytes() */ + return ((cd->oncs >> NVME_CTRLR_DATA_ONCS_DSM_SHIFT) & + NVME_CTRLR_DATA_ONCS_DSM_MASK); +} /* Namespace helper functions */ uint32_t nvme_ns_get_max_io_xfer_size(struct nvme_namespace *ns); Modified: stable/12/sys/dev/nvme/nvme_ns.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_ns.c Fri Jan 4 19:20:19 2019 (r342776) +++ stable/12/sys/dev/nvme/nvme_ns.c Fri Jan 4 21:05:40 2019 (r342777) @@ -498,8 +498,6 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t struct nvme_completion_poll_status status; int res; int unit; - uint16_t oncs; - uint8_t dsm; uint8_t flbas_fmt; uint8_t vwc_present; @@ -569,9 +567,7 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t return (ENXIO); } - oncs = ctrlr->cdata.oncs; - dsm = (oncs >> NVME_CTRLR_DATA_ONCS_DSM_SHIFT) & NVME_CTRLR_DATA_ONCS_DSM_MASK; - if (dsm) + if (nvme_ctrlr_has_dataset_mgmt(&ctrlr->cdata)) ns->flags |= NVME_NS_DEALLOCATE_SUPPORTED; vwc_present = (ctrlr->cdata.vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901042105.x04L5e02054650>