RDMA/cxgb3: Remove modulo math from build_rdma_recv()
authorSteve Wise <swise@opengridcomputing.com>
Tue, 17 Feb 2009 05:23:32 +0000 (21:23 -0800)
committerRoland Dreier <rolandd@cisco.com>
Tue, 17 Feb 2009 05:23:32 +0000 (21:23 -0800)
Remove modulo usage to avoid a divide in the fast path (not all
gcc versions do strength reduction here).

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/cxgb3/iwch_qp.c

index c84ac5bfb107786f07238ea3c1d985b41e9e7b87..0e18f6fc23e2434af56bec57c903b37005ae89f7 100644 (file)
@@ -263,8 +263,8 @@ static int build_rdma_recv(struct iwch_qp *qhp, union t3_wr *wqe,
                wqe->recv.sgl[i].len = cpu_to_be32(wr->sg_list[i].length);
 
                /* to in the WQE == the offset into the page */
-               wqe->recv.sgl[i].to = cpu_to_be64(((u32) wr->sg_list[i].addr) %
-                               (1UL << (12 + page_size[i])));
+               wqe->recv.sgl[i].to = cpu_to_be64(((u32)wr->sg_list[i].addr) &
+                               ((1UL << (12 + page_size[i])) - 1));
 
                /* pbl_addr is the adapters address in the PBL */
                wqe->recv.pbl_addr[i] = cpu_to_be32(pbl_addr[i]);