aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMike Marciniszyn <mike.marciniszyn@qlogic.com>2011-09-23 13:16:29 -0400
committerRoland Dreier <roland@purestorage.com>2011-10-21 12:38:49 -0400
commit2fc109c890f7d9620cfed8d439be071a8b2a8bbd (patch)
tree4d00e76ae4ea129a68321993bdb4190b3c7bca02 /drivers/infiniband
parent53ab1c6498371723c31b18400fab10a902a15a63 (diff)
IB/qib: Optimize RC/UC code by IB operation
The memset for zeroing work completions had been unconditional. This patch removes the memset and moves the zeroing into the work completion with a more explicit field by field set. With this patch, non-ONLY/non-LAST packets will avoid the overhead since they will not generate a completion. Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/qib/qib_rc.c19
-rw-r--r--drivers/infiniband/hw/qib/qib_uc.c14
2 files changed, 24 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/qib/qib_rc.c b/drivers/infiniband/hw/qib/qib_rc.c
index eca0c41f1226..5c1c49b299f1 100644
--- a/drivers/infiniband/hw/qib/qib_rc.c
+++ b/drivers/infiniband/hw/qib/qib_rc.c
@@ -1955,8 +1955,6 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct qib_ib_header *hdr,
1955 break; 1955 break;
1956 } 1956 }
1957 1957
1958 memset(&wc, 0, sizeof wc);
1959
1960 if (qp->state == IB_QPS_RTR && !(qp->r_flags & QIB_R_COMM_EST)) { 1958 if (qp->state == IB_QPS_RTR && !(qp->r_flags & QIB_R_COMM_EST)) {
1961 qp->r_flags |= QIB_R_COMM_EST; 1959 qp->r_flags |= QIB_R_COMM_EST;
1962 if (qp->ibqp.event_handler) { 1960 if (qp->ibqp.event_handler) {
@@ -2009,16 +2007,19 @@ send_middle:
2009 goto rnr_nak; 2007 goto rnr_nak;
2010 qp->r_rcv_len = 0; 2008 qp->r_rcv_len = 0;
2011 if (opcode == OP(SEND_ONLY)) 2009 if (opcode == OP(SEND_ONLY))
2012 goto send_last; 2010 goto no_immediate_data;
2013 /* FALLTHROUGH */ 2011 /* FALLTHROUGH for SEND_ONLY_WITH_IMMEDIATE */
2014 case OP(SEND_LAST_WITH_IMMEDIATE): 2012 case OP(SEND_LAST_WITH_IMMEDIATE):
2015send_last_imm: 2013send_last_imm:
2016 wc.ex.imm_data = ohdr->u.imm_data; 2014 wc.ex.imm_data = ohdr->u.imm_data;
2017 hdrsize += 4; 2015 hdrsize += 4;
2018 wc.wc_flags = IB_WC_WITH_IMM; 2016 wc.wc_flags = IB_WC_WITH_IMM;
2019 /* FALLTHROUGH */ 2017 goto send_last;
2020 case OP(SEND_LAST): 2018 case OP(SEND_LAST):
2021 case OP(RDMA_WRITE_LAST): 2019 case OP(RDMA_WRITE_LAST):
2020no_immediate_data:
2021 wc.wc_flags = 0;
2022 wc.ex.imm_data = 0;
2022send_last: 2023send_last:
2023 /* Get the number of bytes the message was padded by. */ 2024 /* Get the number of bytes the message was padded by. */
2024 pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3; 2025 pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3;
@@ -2051,6 +2052,12 @@ send_last:
2051 wc.src_qp = qp->remote_qpn; 2052 wc.src_qp = qp->remote_qpn;
2052 wc.slid = qp->remote_ah_attr.dlid; 2053 wc.slid = qp->remote_ah_attr.dlid;
2053 wc.sl = qp->remote_ah_attr.sl; 2054 wc.sl = qp->remote_ah_attr.sl;
2055 /* zero fields that are N/A */
2056 wc.vendor_err = 0;
2057 wc.pkey_index = 0;
2058 wc.dlid_path_bits = 0;
2059 wc.port_num = 0;
2060 wc.csum_ok = 0;
2054 /* Signal completion event if the solicited bit is set. */ 2061 /* Signal completion event if the solicited bit is set. */
2055 qib_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 2062 qib_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
2056 (ohdr->bth[0] & 2063 (ohdr->bth[0] &
@@ -2089,7 +2096,7 @@ send_last:
2089 if (opcode == OP(RDMA_WRITE_FIRST)) 2096 if (opcode == OP(RDMA_WRITE_FIRST))
2090 goto send_middle; 2097 goto send_middle;
2091 else if (opcode == OP(RDMA_WRITE_ONLY)) 2098 else if (opcode == OP(RDMA_WRITE_ONLY))
2092 goto send_last; 2099 goto no_immediate_data;
2093 ret = qib_get_rwqe(qp, 1); 2100 ret = qib_get_rwqe(qp, 1);
2094 if (ret < 0) 2101 if (ret < 0)
2095 goto nack_op_err; 2102 goto nack_op_err;
diff --git a/drivers/infiniband/hw/qib/qib_uc.c b/drivers/infiniband/hw/qib/qib_uc.c
index 32ccf3c824ca..d31f33a99887 100644
--- a/drivers/infiniband/hw/qib/qib_uc.c
+++ b/drivers/infiniband/hw/qib/qib_uc.c
@@ -270,7 +270,6 @@ void qib_uc_rcv(struct qib_ibport *ibp, struct qib_ib_header *hdr,
270 270
271 psn = be32_to_cpu(ohdr->bth[2]); 271 psn = be32_to_cpu(ohdr->bth[2]);
272 opcode >>= 24; 272 opcode >>= 24;
273 memset(&wc, 0, sizeof wc);
274 273
275 /* Compare the PSN verses the expected PSN. */ 274 /* Compare the PSN verses the expected PSN. */
276 if (unlikely(qib_cmp24(psn, qp->r_psn) != 0)) { 275 if (unlikely(qib_cmp24(psn, qp->r_psn) != 0)) {
@@ -370,7 +369,7 @@ send_first:
370 } 369 }
371 qp->r_rcv_len = 0; 370 qp->r_rcv_len = 0;
372 if (opcode == OP(SEND_ONLY)) 371 if (opcode == OP(SEND_ONLY))
373 goto send_last; 372 goto no_immediate_data;
374 else if (opcode == OP(SEND_ONLY_WITH_IMMEDIATE)) 373 else if (opcode == OP(SEND_ONLY_WITH_IMMEDIATE))
375 goto send_last_imm; 374 goto send_last_imm;
376 /* FALLTHROUGH */ 375 /* FALLTHROUGH */
@@ -389,8 +388,11 @@ send_last_imm:
389 wc.ex.imm_data = ohdr->u.imm_data; 388 wc.ex.imm_data = ohdr->u.imm_data;
390 hdrsize += 4; 389 hdrsize += 4;
391 wc.wc_flags = IB_WC_WITH_IMM; 390 wc.wc_flags = IB_WC_WITH_IMM;
392 /* FALLTHROUGH */ 391 goto send_last;
393 case OP(SEND_LAST): 392 case OP(SEND_LAST):
393no_immediate_data:
394 wc.ex.imm_data = 0;
395 wc.wc_flags = 0;
394send_last: 396send_last:
395 /* Get the number of bytes the message was padded by. */ 397 /* Get the number of bytes the message was padded by. */
396 pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3; 398 pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3;
@@ -418,6 +420,12 @@ last_imm:
418 wc.src_qp = qp->remote_qpn; 420 wc.src_qp = qp->remote_qpn;
419 wc.slid = qp->remote_ah_attr.dlid; 421 wc.slid = qp->remote_ah_attr.dlid;
420 wc.sl = qp->remote_ah_attr.sl; 422 wc.sl = qp->remote_ah_attr.sl;
423 /* zero fields that are N/A */
424 wc.vendor_err = 0;
425 wc.pkey_index = 0;
426 wc.dlid_path_bits = 0;
427 wc.port_num = 0;
428 wc.csum_ok = 0;
421 /* Signal completion event if the solicited bit is set. */ 429 /* Signal completion event if the solicited bit is set. */
422 qib_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 430 qib_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
423 (ohdr->bth[0] & 431 (ohdr->bth[0] &