mirror of
https://github.com/opnsense/src.git
synced 2026-06-03 13:58:30 -04:00
nvme: Remove NVME_MAX_XFER_SIZE, replace inline calculation
NVME_MAX_XFER_SIZE used to be a constant (back when MAXPHYS was a constant) to denote the smaller of MAXPHYS or the largest PRP we could encode with our prealloation scheme. However, it's no longer constant since MAXPHYS varies at runtime. In addition, the actual maximum is now based on the drive's currently in use page_size, which is also a runtime expression. As such, remove the define and expand it inline in the one place its used still in the tree. Sponsored by: Netflix Reviewed by: chuck Differential Revision: https://reviews.freebsd.org/D34870
This commit is contained in:
parent
3a468f2010
commit
3086efe895
2 changed files with 2 additions and 4 deletions
|
|
@ -59,9 +59,6 @@
|
|||
*/
|
||||
#define NVME_GLOBAL_NAMESPACE_TAG ((uint32_t)0xFFFFFFFF)
|
||||
|
||||
/* Cap transfers by the maximum addressable by page-sized PRP (4KB -> 2MB). */
|
||||
#define NVME_MAX_XFER_SIZE MIN(maxphys, (PAGE_SIZE/8*PAGE_SIZE))
|
||||
|
||||
/* Host memory buffer sizes are always in 4096 byte chunks */
|
||||
#define NVME_HMB_UNITS 4096
|
||||
|
||||
|
|
|
|||
|
|
@ -1454,7 +1454,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
|
|||
ctrlr->enable_aborts = 0;
|
||||
TUNABLE_INT_FETCH("hw.nvme.enable_aborts", &ctrlr->enable_aborts);
|
||||
|
||||
ctrlr->max_xfer_size = NVME_MAX_XFER_SIZE;
|
||||
/* Cap transfers by the maximum addressable by page-sized PRP (4KB pages -> 2MB). */
|
||||
ctrlr->max_xfer_size = MIN(maxphys, (ctrlr->page_size / 8 * ctrlr->page_size));
|
||||
if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0)
|
||||
return (ENXIO);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue