hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/infiniband/sw/rxe/rxe_comp.c
....@@ -1,34 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
12 /*
23 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
34 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
4
- *
5
- * This software is available to you under a choice of one of two
6
- * licenses. You may choose to be licensed under the terms of the GNU
7
- * General Public License (GPL) Version 2, available from the file
8
- * COPYING in the main directory of this source tree, or the
9
- * OpenIB.org BSD license below:
10
- *
11
- * Redistribution and use in source and binary forms, with or
12
- * without modification, are permitted provided that the following
13
- * conditions are met:
14
- *
15
- * - Redistributions of source code must retain the above
16
- * copyright notice, this list of conditions and the following
17
- * disclaimer.
18
- *
19
- * - Redistributions in binary form must reproduce the above
20
- * copyright notice, this list of conditions and the following
21
- * disclaimer in the documentation and/or other materials
22
- * provided with the distribution.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
325 */
336
347 #include <linux/skbuff.h>
....@@ -146,8 +119,7 @@
146119 }
147120 }
148121
149
-void rxe_comp_queue_pkt(struct rxe_dev *rxe, struct rxe_qp *qp,
150
- struct sk_buff *skb)
122
+void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb)
151123 {
152124 int must_sched;
153125
....@@ -155,7 +127,8 @@
155127
156128 must_sched = skb_queue_len(&qp->resp_pkts) > 1;
157129 if (must_sched != 0)
158
- rxe_counter_inc(rxe, RXE_CNT_COMPLETER_SCHED);
130
+ rxe_counter_inc(SKB_TO_PKT(skb)->rxe, RXE_CNT_COMPLETER_SCHED);
131
+
159132 rxe_run_task(&qp->comp.task, must_sched);
160133 }
161134
....@@ -282,7 +255,7 @@
282255 if ((syn & AETH_TYPE_MASK) != AETH_ACK)
283256 return COMPST_ERROR;
284257
285
- /* fall through */
258
+ fallthrough;
286259 /* (IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE doesn't have an AETH)
287260 */
288261 case IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE:
....@@ -439,6 +412,7 @@
439412 */
440413 static void do_complete(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
441414 {
415
+ struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
442416 struct rxe_cqe cqe;
443417
444418 if ((qp->sq_sig_type == IB_SIGNAL_ALL_WR) ||
....@@ -450,6 +424,11 @@
450424 } else {
451425 advance_consumer(qp->sq.queue);
452426 }
427
+
428
+ if (wqe->wr.opcode == IB_WR_SEND ||
429
+ wqe->wr.opcode == IB_WR_SEND_WITH_IMM ||
430
+ wqe->wr.opcode == IB_WR_SEND_WITH_INV)
431
+ rxe_counter_inc(rxe, RXE_CNT_RDMA_SEND);
453432
454433 /*
455434 * we completed something so let req run again
....@@ -552,7 +531,7 @@
552531 {
553532 struct rxe_qp *qp = (struct rxe_qp *)arg;
554533 struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
555
- struct rxe_send_wqe *wqe = wqe;
534
+ struct rxe_send_wqe *wqe = NULL;
556535 struct sk_buff *skb = NULL;
557536 struct rxe_pkt_info *pkt = NULL;
558537 enum comp_state state;
....@@ -684,9 +663,8 @@
684663 */
685664
686665 /* there is nothing to retry in this case */
687
- if (!wqe || (wqe->state == wqe_state_posted)) {
666
+ if (!wqe || (wqe->state == wqe_state_posted))
688667 goto exit;
689
- }
690668
691669 /* if we've started a retry, don't start another
692670 * retry sequence, unless this is a timeout.