aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_ud.c
diff options
context:
space:
mode:
authorRalph Campbell <ralph.campbell@qlogic.com>2008-12-01 23:59:08 -0500
committerRoland Dreier <rolandd@cisco.com>2008-12-01 23:59:08 -0500
commit7c37d74474c8ee8ddcd5a2d2a9571d4a1290c844 (patch)
treed44fb97adfa0b036d0a0db193b3273eff5616246 /drivers/infiniband/hw/ipath/ipath_ud.c
parent64f22fa17c1a531e682ebc882566856ea5718495 (diff)
IB/ipath: Improve UD loopback performance by allocating temp array only once
Receive work queue entries are checked for L_Key validity, and pointers to the memory region structure are saved in an allocated structure. For UD loopback packets, this structure is allocated and freed for each packet. This patch changes that to allocate/free during QP creation and destruction. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_ud.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index 729446f56aa..91c74cc797a 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -70,8 +70,6 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe)
70 goto done; 70 goto done;
71 } 71 }
72 72
73 rsge.sg_list = NULL;
74
75 /* 73 /*
76 * Check that the qkey matches (except for QP0, see 9.6.1.4.1). 74 * Check that the qkey matches (except for QP0, see 9.6.1.4.1).
77 * Qkeys with the high order bit set mean use the 75 * Qkeys with the high order bit set mean use the
@@ -115,21 +113,6 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe)
115 rq = &qp->r_rq; 113 rq = &qp->r_rq;
116 } 114 }
117 115
118 if (rq->max_sge > 1) {
119 /*
120 * XXX We could use GFP_KERNEL if ipath_do_send()
121 * was always called from the tasklet instead of
122 * from ipath_post_send().
123 */
124 rsge.sg_list = kmalloc((rq->max_sge - 1) *
125 sizeof(struct ipath_sge),
126 GFP_ATOMIC);
127 if (!rsge.sg_list) {
128 dev->n_pkt_drops++;
129 goto drop;
130 }
131 }
132
133 /* 116 /*
134 * Get the next work request entry to find where to put the data. 117 * Get the next work request entry to find where to put the data.
135 * Note that it is safe to drop the lock after changing rq->tail 118 * Note that it is safe to drop the lock after changing rq->tail
@@ -147,6 +130,7 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe)
147 goto drop; 130 goto drop;
148 } 131 }
149 wqe = get_rwqe_ptr(rq, tail); 132 wqe = get_rwqe_ptr(rq, tail);
133 rsge.sg_list = qp->r_ud_sg_list;
150 if (!ipath_init_sge(qp, wqe, &rlen, &rsge)) { 134 if (!ipath_init_sge(qp, wqe, &rlen, &rsge)) {
151 spin_unlock_irqrestore(&rq->lock, flags); 135 spin_unlock_irqrestore(&rq->lock, flags);
152 dev->n_pkt_drops++; 136 dev->n_pkt_drops++;
@@ -242,7 +226,6 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe)
242 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 226 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
243 swqe->wr.send_flags & IB_SEND_SOLICITED); 227 swqe->wr.send_flags & IB_SEND_SOLICITED);
244drop: 228drop:
245 kfree(rsge.sg_list);
246 if (atomic_dec_and_test(&qp->refcount)) 229 if (atomic_dec_and_test(&qp->refcount))
247 wake_up(&qp->wait); 230 wake_up(&qp->wait);
248done:; 231done:;