aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2008-04-17 00:09:28 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-17 00:09:28 -0400
commitf438000f7a31fad7cfd27f33ad324a250f4cd2df (patch)
treea838a17ddabf53c01c1115f33b3ab0c0c8ed1d75 /drivers/infiniband/hw
parentb832be1e4007f4a54954ec68bd865ff05d6babca (diff)
IB/mlx4: Micro-optimize mlx4_ib_post_send()
Rather than have build_mlx_header() return a negative value on failure and the length of the segments it builds on success, add a pointer parameter to return the length and return 0 on success. This matches the calling convention used for build_lso_seg() and generates slightly smaller code -- eg, on 64-bit x86: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-22 (-22) function old new delta mlx4_ib_post_send 2023 2001 -22 Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 2ba243084089..f5210c17e312 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1200,7 +1200,7 @@ out:
1200} 1200}
1201 1201
1202static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, 1202static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr,
1203 void *wqe) 1203 void *wqe, unsigned *mlx_seg_len)
1204{ 1204{
1205 struct ib_device *ib_dev = &to_mdev(sqp->qp.ibqp.device)->ib_dev; 1205 struct ib_device *ib_dev = &to_mdev(sqp->qp.ibqp.device)->ib_dev;
1206 struct mlx4_wqe_mlx_seg *mlx = wqe; 1206 struct mlx4_wqe_mlx_seg *mlx = wqe;
@@ -1321,7 +1321,9 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr,
1321 i = 2; 1321 i = 2;
1322 } 1322 }
1323 1323
1324 return ALIGN(i * sizeof (struct mlx4_wqe_inline_seg) + header_size, 16); 1324 *mlx_seg_len =
1325 ALIGN(i * sizeof (struct mlx4_wqe_inline_seg) + header_size, 16);
1326 return 0;
1325} 1327}
1326 1328
1327static int mlx4_wq_overflow(struct mlx4_ib_wq *wq, int nreq, struct ib_cq *ib_cq) 1329static int mlx4_wq_overflow(struct mlx4_ib_wq *wq, int nreq, struct ib_cq *ib_cq)
@@ -1548,15 +1550,13 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1548 1550
1549 case IB_QPT_SMI: 1551 case IB_QPT_SMI:
1550 case IB_QPT_GSI: 1552 case IB_QPT_GSI:
1551 err = build_mlx_header(to_msqp(qp), wr, ctrl); 1553 err = build_mlx_header(to_msqp(qp), wr, ctrl, &seglen);
1552 if (err < 0) { 1554 if (unlikely(err)) {
1553 *bad_wr = wr; 1555 *bad_wr = wr;
1554 goto out; 1556 goto out;
1555 } 1557 }
1556 wqe += err; 1558 wqe += seglen;
1557 size += err / 16; 1559 size += seglen / 16;
1558
1559 err = 0;
1560 break; 1560 break;
1561 1561
1562 default: 1562 default: