]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
RDMA/i40iw: Correct STag mask to min of 14 bits
authorChien Tin Tung <Chien.Tin.Tung@intel.com>
Fri, 22 Apr 2016 19:14:24 +0000 (14:14 -0500)
committerDoug Ledford <dledford@redhat.com>
Thu, 28 Apr 2016 20:32:54 +0000 (16:32 -0400)
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>
drivers/infiniband/hw/i40iw/i40iw_hw.c

index 615e115247b0dc8284172f7a7988c152c1e9cb30..3ee0cad96bc688457475a1f727969e7f05336e62 100644 (file)
@@ -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;
 }