summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/i40iw/i40iw_hw.c
diff options
context:
space:
mode:
authorChien Tin Tung <Chien.Tin.Tung@intel.com>2016-04-22 22:14:24 +0300
committerDoug Ledford <dledford@redhat.com>2016-04-28 23:32:54 +0300
commit8e9f04a7c744bb18c193779d04cc5d8d4c21dd11 (patch)
tree2d85d4d91c8f6e4fb79d9e159eacfa72589451f0 /drivers/infiniband/hw/i40iw/i40iw_hw.c
parent9510b0666eaeda032de89a54f112cb3e9f41b2c5 (diff)
downloadlinux-8e9f04a7c744bb18c193779d04cc5d8d4c21dd11.tar.xz
RDMA/i40iw: Correct STag mask to min of 14 bits
STag index mask is calculated incorrectly, missing the 14 bits minimum requirement. Add max macro to use either # of MRs or 14 bits in the mask size calculation. Signed-off-by: Tatyana Nikolova <Tatyana.E.Nikolova@intel.com> Signed-off-by: Faisal Latif <faisal.latif@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/i40iw/i40iw_hw.c')
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_hw.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/i40iw/i40iw_hw.c b/drivers/infiniband/hw/i40iw/i40iw_hw.c
index 615e115247b0..3ee0cad96bc6 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_hw.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_hw.c
@@ -107,7 +107,8 @@ u32 i40iw_initialize_hw_resources(struct i40iw_device *iwdev)
spin_lock_init(&iwdev->resource_lock);
spin_lock_init(&iwdev->qptable_lock);
- mrdrvbits = 24 - get_count_order(iwdev->max_mr);
+ /* stag index mask has a minimum of 14 bits */
+ mrdrvbits = 24 - max(get_count_order(iwdev->max_mr), 14);
iwdev->mr_stagmask = ~(((1 << mrdrvbits) - 1) << (32 - mrdrvbits));
return 0;
}