Ensure the controller's MDTS is accounted for in max_xfer_size.
The controller's IDENTIFY data contains MDTS (Max Data Transfer Size) to allow the controller to specify the maximum I/O data transfer size. nvme(4) already provides a default maximum, but make sure it does not exceed what MDTS reports. Sponsored by: Intel Reviewed by: carl
This commit is contained in:
parent
cb5b7c1304
commit
02e3348484
@ -457,6 +457,14 @@ nvme_ctrlr_identify(struct nvme_controller *ctrlr)
|
||||
nvme_chatham_populate_cdata(ctrlr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use MDTS to ensure our default max_xfer_size doesn't exceed what the
|
||||
* controller supports.
|
||||
*/
|
||||
if (ctrlr->cdata.mdts > 0)
|
||||
ctrlr->max_xfer_size = min(ctrlr->max_xfer_size,
|
||||
ctrlr->min_page_size * (1 << (ctrlr->cdata.mdts)));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -923,6 +931,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
|
||||
if (cap_hi.bits.dstrd != 0)
|
||||
return (ENXIO);
|
||||
|
||||
ctrlr->min_page_size = 1 << (12 + cap_hi.bits.mpsmin);
|
||||
|
||||
/* Get ready timeout value from controller, in units of 500ms. */
|
||||
cap_lo.raw = nvme_mmio_read_4(ctrlr, cap_lo);
|
||||
ctrlr->ready_timeout_in_ms = cap_lo.bits.to * 500;
|
||||
|
@ -265,6 +265,9 @@ struct nvme_controller {
|
||||
/** maximum i/o size in bytes */
|
||||
uint32_t max_xfer_size;
|
||||
|
||||
/** minimum page size supported by this controller in bytes */
|
||||
uint32_t min_page_size;
|
||||
|
||||
/** interrupt coalescing time period (in microseconds) */
|
||||
uint32_t int_coal_time;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user