aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/qib/qib_driver.c
diff options
context:
space:
mode:
authorMike Marciniszyn <mike.marciniszyn@qlogic.com>2011-09-23 13:16:39 -0400
committerRoland Dreier <roland@purestorage.com>2011-10-21 12:38:52 -0400
commit9e1c0e43257b6df1ef012dd37c3f0f93b1ee47af (patch)
treebe40833860d385491b1ac8fa13dffe414954ee76 /drivers/infiniband/hw/qib/qib_driver.c
parentcc6ea1385b43487f6ef03bdc91416c8366d28311 (diff)
IB/qib: Eliminate divide/mod in converting idx to egr buf pointer
The context init now saves a shift from rcvegrbufs_perchunk rcvegrbufs_perchunk_shift using ilog2. A BUG_ON() protects the power of 2 assumption. Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_driver.c')
-rw-r--r--drivers/infiniband/hw/qib/qib_driver.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/qib/qib_driver.c b/drivers/infiniband/hw/qib/qib_driver.c
index 23e584f4c36c..89264ffc7ee9 100644
--- a/drivers/infiniband/hw/qib/qib_driver.c
+++ b/drivers/infiniband/hw/qib/qib_driver.c
@@ -279,10 +279,10 @@ bail:
279 */ 279 */
280static inline void *qib_get_egrbuf(const struct qib_ctxtdata *rcd, u32 etail) 280static inline void *qib_get_egrbuf(const struct qib_ctxtdata *rcd, u32 etail)
281{ 281{
282 const u32 chunk = etail / rcd->rcvegrbufs_perchunk; 282 const u32 chunk = etail >> rcd->rcvegrbufs_perchunk_shift;
283 const u32 idx = etail % rcd->rcvegrbufs_perchunk; 283 const u32 idx = etail & ((u32)rcd->rcvegrbufs_perchunk - 1);
284 284
285 return rcd->rcvegrbuf[chunk] + idx * rcd->dd->rcvegrbufsize; 285 return rcd->rcvegrbuf[chunk] + (idx << rcd->dd->rcvegrbufsize_shift);
286} 286}
287 287
288/* 288/*