Commit 835ee624 authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

IB/srp: Swap two code blocks in srp_add_one()

This patch does not change any functionality but makes the next
patch in this series easier to read.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Tested-by: default avatarLaurence Oberman <loberman@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 9aa8b321
...@@ -3431,17 +3431,6 @@ static void srp_add_one(struct ib_device *device) ...@@ -3431,17 +3431,6 @@ static void srp_add_one(struct ib_device *device)
if (!srp_dev) if (!srp_dev)
return; return;
srp_dev->has_fmr = (device->alloc_fmr && device->dealloc_fmr &&
device->map_phys_fmr && device->unmap_fmr);
srp_dev->has_fr = (device->attrs.device_cap_flags &
IB_DEVICE_MEM_MGT_EXTENSIONS);
if (!srp_dev->has_fmr && !srp_dev->has_fr)
dev_warn(&device->dev, "neither FMR nor FR is supported\n");
srp_dev->use_fast_reg = (srp_dev->has_fr &&
(!srp_dev->has_fmr || prefer_fr));
srp_dev->use_fmr = !srp_dev->use_fast_reg && srp_dev->has_fmr;
/* /*
* Use the smallest page size supported by the HCA, down to a * Use the smallest page size supported by the HCA, down to a
* minimum of 4096 bytes. We're unlikely to build large sglists * minimum of 4096 bytes. We're unlikely to build large sglists
...@@ -3454,6 +3443,18 @@ static void srp_add_one(struct ib_device *device) ...@@ -3454,6 +3443,18 @@ static void srp_add_one(struct ib_device *device)
do_div(max_pages_per_mr, srp_dev->mr_page_size); do_div(max_pages_per_mr, srp_dev->mr_page_size);
srp_dev->max_pages_per_mr = min_t(u64, SRP_MAX_PAGES_PER_MR, srp_dev->max_pages_per_mr = min_t(u64, SRP_MAX_PAGES_PER_MR,
max_pages_per_mr); max_pages_per_mr);
srp_dev->has_fmr = (device->alloc_fmr && device->dealloc_fmr &&
device->map_phys_fmr && device->unmap_fmr);
srp_dev->has_fr = (device->attrs.device_cap_flags &
IB_DEVICE_MEM_MGT_EXTENSIONS);
if (!srp_dev->has_fmr && !srp_dev->has_fr)
dev_warn(&device->dev, "neither FMR nor FR is supported\n");
srp_dev->use_fast_reg = (srp_dev->has_fr &&
(!srp_dev->has_fmr || prefer_fr));
srp_dev->use_fmr = !srp_dev->use_fast_reg && srp_dev->has_fmr;
if (srp_dev->use_fast_reg) { if (srp_dev->use_fast_reg) {
srp_dev->max_pages_per_mr = srp_dev->max_pages_per_mr =
min_t(u32, srp_dev->max_pages_per_mr, min_t(u32, srp_dev->max_pages_per_mr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment