diff options
author | Roland Dreier <rolandd@cisco.com> | 2008-01-03 19:59:05 -0800 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-01-03 19:59:05 -0800 |
commit | e6a3ccdffb36f94ee72b2bc97944a50777ff72e0 (patch) | |
tree | 61b62f533714e4a25f657c00783ff7528fa973b6 | |
parent | b2b26f8a73108f971ade988fac3eb9d0446bbbb6 (diff) | |
download | libmlx4-e6a3ccdffb36f94ee72b2bc97944a50777ff72e0.tar.gz |
Micro-optimize mlx4_poll_one()
Rather than byte-swapping cqe->g_mlpath_rqpn each time we extract a
field from it, byte-swap it once into a temporary variable. This
results in smaller, better code.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | src/cq.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -196,6 +196,7 @@ static int mlx4_poll_one(struct mlx4_cq *cq, struct mlx4_cqe *cqe; struct mlx4_srq *srq; uint32_t qpn; + uint32_t g_mlpath_rqpn; uint16_t wqe_index; int is_error; int is_send; @@ -314,11 +315,11 @@ static int mlx4_poll_one(struct mlx4_cq *cq, wc->slid = ntohs(cqe->rlid); wc->sl = cqe->sl >> 4; - wc->src_qp = ntohl(cqe->g_mlpath_rqpn) & 0xffffff; - wc->dlid_path_bits = (ntohl(cqe->g_mlpath_rqpn) >> 24) & 0x7f; + g_mlpath_rqpn = ntohl(cqe->g_mlpath_rqpn); + wc->src_qp = g_mlpath_rqpn & 0xffffff; + wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; + wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IBV_WC_GRH : 0; wc->pkey_index = ntohl(cqe->immed_rss_invalid) >> 16; - wc->wc_flags |= ntohl(cqe->g_mlpath_rqpn) & 0x80000000 ? - IBV_WC_GRH : 0; } return CQ_OK; |