hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/infiniband/hw/qib/qib_ud.c
....@@ -1,4 +1,5 @@
11 /*
2
+ * Copyright (c) 2012 - 2019 Intel Corporation. All rights reserved.
23 * Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
34 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
45 *
....@@ -63,7 +64,7 @@
6364 enum ib_qp_type sqptype, dqptype;
6465
6566 rcu_read_lock();
66
- qp = rvt_lookup_qpn(rdi, &ibp->rvp, swqe->ud_wr.remote_qpn);
67
+ qp = rvt_lookup_qpn(rdi, &ibp->rvp, rvt_get_swqe_remote_qpn(swqe));
6768 if (!qp) {
6869 ibp->rvp.n_pkt_drops++;
6970 goto drop;
....@@ -80,7 +81,7 @@
8081 goto drop;
8182 }
8283
83
- ah_attr = &ibah_to_rvtah(swqe->ud_wr.ah)->attr;
84
+ ah_attr = rvt_get_swqe_ah_attr(swqe);
8485 ppd = ppd_from_ibp(ibp);
8586
8687 if (qp->ibqp.qp_num > 1) {
....@@ -110,8 +111,8 @@
110111 if (qp->ibqp.qp_num) {
111112 u32 qkey;
112113
113
- qkey = (int)swqe->ud_wr.remote_qkey < 0 ?
114
- sqp->qkey : swqe->ud_wr.remote_qkey;
114
+ qkey = (int)rvt_get_swqe_remote_qkey(swqe) < 0 ?
115
+ sqp->qkey : rvt_get_swqe_remote_qkey(swqe);
115116 if (unlikely(qkey != qp->qkey))
116117 goto drop;
117118 }
....@@ -162,8 +163,8 @@
162163 const struct ib_global_route *grd = rdma_ah_read_grh(ah_attr);
163164
164165 qib_make_grh(ibp, &grh, grd, 0, 0);
165
- qib_copy_sge(&qp->r_sge, &grh,
166
- sizeof(grh), 1);
166
+ rvt_copy_sge(qp, &qp->r_sge, &grh,
167
+ sizeof(grh), true, false);
167168 wc.wc_flags |= IB_WC_GRH;
168169 } else
169170 rvt_skip_sge(&qp->r_sge, sizeof(struct ib_grh), true);
....@@ -172,14 +173,9 @@
172173 ssge.num_sge = swqe->wr.num_sge;
173174 sge = &ssge.sge;
174175 while (length) {
175
- u32 len = sge->length;
176
+ u32 len = rvt_get_sge_length(sge, length);
176177
177
- if (len > length)
178
- len = length;
179
- if (len > sge->sge_length)
180
- len = sge->sge_length;
181
- BUG_ON(len == 0);
182
- qib_copy_sge(&qp->r_sge, sge->vaddr, len, 1);
178
+ rvt_copy_sge(qp, &qp->r_sge, sge->vaddr, len, true, false);
183179 sge->vaddr += len;
184180 sge->length -= len;
185181 sge->sge_length -= len;
....@@ -208,15 +204,14 @@
208204 wc.qp = &qp->ibqp;
209205 wc.src_qp = sqp->ibqp.qp_num;
210206 wc.pkey_index = qp->ibqp.qp_type == IB_QPT_GSI ?
211
- swqe->ud_wr.pkey_index : 0;
207
+ rvt_get_swqe_pkey_index(swqe) : 0;
212208 wc.slid = ppd->lid | (rdma_ah_get_path_bits(ah_attr) &
213209 ((1 << ppd->lmc) - 1));
214210 wc.sl = rdma_ah_get_sl(ah_attr);
215211 wc.dlid_path_bits = rdma_ah_get_dlid(ah_attr) & ((1 << ppd->lmc) - 1);
216212 wc.port_num = qp->port_num;
217213 /* Signal completion event if the solicited bit is set. */
218
- rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
219
- swqe->wr.send_flags & IB_SEND_SOLICITED);
214
+ rvt_recv_cq(qp, &wc, swqe->wr.send_flags & IB_SEND_SOLICITED);
220215 ibp->rvp.n_loop_pkts++;
221216 bail_unlock:
222217 spin_unlock_irqrestore(&qp->r_lock, flags);
....@@ -260,7 +255,7 @@
260255 goto bail;
261256 }
262257 wqe = rvt_get_swqe_ptr(qp, qp->s_last);
263
- qib_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR);
258
+ rvt_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR);
264259 goto done;
265260 }
266261
....@@ -276,7 +271,7 @@
276271 /* Construct the header. */
277272 ibp = to_iport(qp->ibqp.device, qp->port_num);
278273 ppd = ppd_from_ibp(ibp);
279
- ah_attr = &ibah_to_rvtah(wqe->ud_wr.ah)->attr;
274
+ ah_attr = rvt_get_swqe_ah_attr(wqe);
280275 if (rdma_ah_get_dlid(ah_attr) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) {
281276 if (rdma_ah_get_dlid(ah_attr) !=
282277 be16_to_cpu(IB_LID_PERMISSIVE))
....@@ -304,7 +299,7 @@
304299 qib_ud_loopback(qp, wqe);
305300 spin_lock_irqsave(&qp->s_lock, tflags);
306301 *flags = tflags;
307
- qib_send_complete(qp, wqe, IB_WC_SUCCESS);
302
+ rvt_send_complete(qp, wqe, IB_WC_SUCCESS);
308303 goto done;
309304 }
310305 }
....@@ -368,7 +363,7 @@
368363 bth0 |= extra_bytes << 20;
369364 bth0 |= qp->ibqp.qp_type == IB_QPT_SMI ? QIB_DEFAULT_P_KEY :
370365 qib_get_pkey(ibp, qp->ibqp.qp_type == IB_QPT_GSI ?
371
- wqe->ud_wr.pkey_index : qp->s_pkey_index);
366
+ rvt_get_swqe_pkey_index(wqe) : qp->s_pkey_index);
372367 ohdr->bth[0] = cpu_to_be32(bth0);
373368 /*
374369 * Use the multicast QP if the destination LID is a multicast LID.
....@@ -377,14 +372,15 @@
377372 be16_to_cpu(IB_MULTICAST_LID_BASE) &&
378373 rdma_ah_get_dlid(ah_attr) != be16_to_cpu(IB_LID_PERMISSIVE) ?
379374 cpu_to_be32(QIB_MULTICAST_QPN) :
380
- cpu_to_be32(wqe->ud_wr.remote_qpn);
375
+ cpu_to_be32(rvt_get_swqe_remote_qpn(wqe));
381376 ohdr->bth[2] = cpu_to_be32(wqe->psn & QIB_PSN_MASK);
382377 /*
383378 * Qkeys with the high order bit set mean use the
384379 * qkey from the QP context instead of the WR (see 10.2.5).
385380 */
386
- ohdr->u.ud.deth[0] = cpu_to_be32((int)wqe->ud_wr.remote_qkey < 0 ?
387
- qp->qkey : wqe->ud_wr.remote_qkey);
381
+ ohdr->u.ud.deth[0] =
382
+ cpu_to_be32((int)rvt_get_swqe_remote_qkey(wqe) < 0 ? qp->qkey :
383
+ rvt_get_swqe_remote_qkey(wqe));
388384 ohdr->u.ud.deth[1] = cpu_to_be32(qp->ibqp.qp_num);
389385
390386 done:
....@@ -550,12 +546,13 @@
550546 goto drop;
551547 }
552548 if (has_grh) {
553
- qib_copy_sge(&qp->r_sge, &hdr->u.l.grh,
554
- sizeof(struct ib_grh), 1);
549
+ rvt_copy_sge(qp, &qp->r_sge, &hdr->u.l.grh,
550
+ sizeof(struct ib_grh), true, false);
555551 wc.wc_flags |= IB_WC_GRH;
556552 } else
557553 rvt_skip_sge(&qp->r_sge, sizeof(struct ib_grh), true);
558
- qib_copy_sge(&qp->r_sge, data, wc.byte_len - sizeof(struct ib_grh), 1);
554
+ rvt_copy_sge(qp, &qp->r_sge, data, wc.byte_len - sizeof(struct ib_grh),
555
+ true, false);
559556 rvt_put_ss(&qp->r_sge);
560557 if (!test_and_clear_bit(RVT_R_WRID_VALID, &qp->r_aflags))
561558 return;
....@@ -577,8 +574,7 @@
577574 dlid & ((1 << ppd_from_ibp(ibp)->lmc) - 1);
578575 wc.port_num = qp->port_num;
579576 /* Signal completion event if the solicited bit is set. */
580
- rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
581
- ib_bth_is_solicited(ohdr));
577
+ rvt_recv_cq(qp, &wc, ib_bth_is_solicited(ohdr));
582578 return;
583579
584580 drop: