mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-02 18:17:50 -04:00
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>
This commit is contained in:
committed by
Roland Dreier
parent
cc6ea1385b
commit
9e1c0e4325
@@ -279,10 +279,10 @@ bail:
|
||||
*/
|
||||
static inline void *qib_get_egrbuf(const struct qib_ctxtdata *rcd, u32 etail)
|
||||
{
|
||||
const u32 chunk = etail / rcd->rcvegrbufs_perchunk;
|
||||
const u32 idx = etail % rcd->rcvegrbufs_perchunk;
|
||||
const u32 chunk = etail >> rcd->rcvegrbufs_perchunk_shift;
|
||||
const u32 idx = etail & ((u32)rcd->rcvegrbufs_perchunk - 1);
|
||||
|
||||
return rcd->rcvegrbuf[chunk] + idx * rcd->dd->rcvegrbufsize;
|
||||
return rcd->rcvegrbuf[chunk] + (idx << rcd->dd->rcvegrbufsize_shift);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user