38 #define OP(x) IB_OPCODE_UC_##x
70 wqe = get_swqe_ptr(qp, qp->
s_last);
75 ohdr = &qp->
s_hdr->u.oth;
77 ohdr = &qp->
s_hdr->u.l.oth;
84 wqe = get_swqe_ptr(qp, qp->
s_cur);
101 qp->
s_sge.num_sge = wqe->
wr.num_sge;
105 switch (wqe->
wr.opcode) {
117 OP(SEND_ONLY_WITH_IMMEDIATE);
131 ohdr->
u.
rc.reth.vaddr =
133 ohdr->
u.
rc.reth.rkey =
136 hwords +=
sizeof(
struct ib_reth) / 4;
146 OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE);
148 ohdr->
u.
rc.imm_data = wqe->
wr.ex.imm_data;
166 case OP(SEND_MIDDLE):
175 qp->
s_state =
OP(SEND_LAST_WITH_IMMEDIATE);
187 case OP(RDMA_WRITE_FIRST):
190 case OP(RDMA_WRITE_MIDDLE):
200 OP(RDMA_WRITE_LAST_WITH_IMMEDIATE);
225 spin_unlock_irqrestore(&qp->s_lock, flags);
260 ohdr = &hdr->
u.
l.oth;
261 hdrsize = 8 + 40 + 12;
282 qp->
r_sge.num_sge = 0;
284 qib_put_ss(&qp->
r_sge);
289 case OP(SEND_ONLY_WITH_IMMEDIATE):
292 case OP(RDMA_WRITE_FIRST):
293 case OP(RDMA_WRITE_ONLY):
294 case OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE):
305 case OP(SEND_MIDDLE):
306 if (opcode ==
OP(SEND_MIDDLE) ||
307 opcode ==
OP(SEND_LAST) ||
308 opcode ==
OP(SEND_LAST_WITH_IMMEDIATE))
312 case OP(RDMA_WRITE_FIRST):
313 case OP(RDMA_WRITE_MIDDLE):
314 if (opcode ==
OP(RDMA_WRITE_MIDDLE) ||
315 opcode ==
OP(RDMA_WRITE_LAST) ||
316 opcode ==
OP(RDMA_WRITE_LAST_WITH_IMMEDIATE))
321 if (opcode ==
OP(SEND_FIRST) ||
322 opcode ==
OP(SEND_ONLY) ||
323 opcode ==
OP(SEND_ONLY_WITH_IMMEDIATE) ||
324 opcode ==
OP(RDMA_WRITE_FIRST) ||
325 opcode ==
OP(RDMA_WRITE_ONLY) ||
326 opcode ==
OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE))
333 if (qp->
ibqp.event_handler) {
339 qp->
ibqp.event_handler(&ev, qp->
ibqp.qp_context);
347 case OP(SEND_ONLY_WITH_IMMEDIATE):
364 if (opcode ==
OP(SEND_ONLY))
365 goto no_immediate_data;
366 else if (opcode ==
OP(SEND_ONLY_WITH_IMMEDIATE))
369 case OP(SEND_MIDDLE):
371 if (
unlikely(tlen != (hdrsize + pmtu + 4)))
379 case OP(SEND_LAST_WITH_IMMEDIATE):
394 if (
unlikely(tlen < (hdrsize + pad + 4)))
397 tlen -= (hdrsize + pad + 4);
422 case OP(RDMA_WRITE_FIRST):
423 case OP(RDMA_WRITE_ONLY):
424 case OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE):
430 reth = &ohdr->
u.
rc.reth;
431 hdrsize +=
sizeof(*reth);
435 if (qp->
r_len != 0) {
445 qp->
r_sge.num_sge = 1;
447 qp->
r_sge.num_sge = 0;
450 qp->
r_sge.sge.length = 0;
451 qp->
r_sge.sge.sge_length = 0;
453 if (opcode ==
OP(RDMA_WRITE_ONLY))
455 else if (opcode ==
OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE)) {
460 case OP(RDMA_WRITE_MIDDLE):
462 if (
unlikely(tlen != (hdrsize + pmtu + 4)))
470 case OP(RDMA_WRITE_LAST_WITH_IMMEDIATE):
480 if (
unlikely(tlen < (hdrsize + pad + 4)))
483 tlen -= (hdrsize + pad + 4);
498 qib_put_ss(&qp->
r_sge);
501 case OP(RDMA_WRITE_LAST):
507 if (
unlikely(tlen < (hdrsize + pad + 4)))
510 tlen -= (hdrsize + pad + 4);
514 qib_put_ss(&qp->
r_sge);
527 qp->
r_sge.num_sge = 0;