1 // SPDX-License-Identifier: GPL-2.0
3 * Shared Memory Communications over RDMA (SMC-R) and RoCE
5 * Work Requests exploiting Infiniband API
7 * Work requests (WR) of type ib_post_send or ib_post_recv respectively
8 * are submitted to either RC SQ or RC RQ respectively
9 * (reliably connected send/receive queue)
10 * and become work queue entries (WQEs).
11 * While an SQ WR/WQE is pending, we track it until transmission completion.
12 * Through a send or receive completion queue (CQ) respectively,
13 * we get completion queue entries (CQEs) [aka work completions (WCs)].
14 * Since the CQ callback is called from IRQ context, we split work by using
15 * bottom halves implemented by tasklets.
17 * SMC uses this to exchange LLC (link layer control)
18 * and CDC (connection data control) messages.
20 * Copyright IBM Corp. 2016
22 * Author(s): Steffen Maier <maier@linux.vnet.ibm.com>
25 #include <linux/atomic.h>
26 #include <linux/hashtable.h>
27 #include <linux/wait.h>
28 #include <rdma/ib_verbs.h>
29 #include <asm/div64.h>
34 #define SMC_WR_MAX_POLL_CQE 10 /* max. # of compl. queue elements in 1 poll */
36 #define SMC_WR_RX_HASH_BITS 4
37 static DEFINE_HASHTABLE(smc_wr_rx_hash
, SMC_WR_RX_HASH_BITS
);
38 static DEFINE_SPINLOCK(smc_wr_rx_hash_lock
);
40 struct smc_wr_tx_pend
{ /* control data for a pending send request */
41 u64 wr_id
; /* work request id sent */
42 smc_wr_tx_handler handler
;
43 enum ib_wc_status wc_status
; /* CQE status */
44 struct smc_link
*link
;
46 struct smc_wr_tx_pend_priv priv
;
49 /******************************** send queue *********************************/
51 /*------------------------------- completion --------------------------------*/
53 static inline int smc_wr_tx_find_pending_index(struct smc_link
*link
, u64 wr_id
)
57 for (i
= 0; i
< link
->wr_tx_cnt
; i
++) {
58 if (link
->wr_tx_pends
[i
].wr_id
== wr_id
)
61 return link
->wr_tx_cnt
;
64 static inline void smc_wr_tx_process_cqe(struct ib_wc
*wc
)
66 struct smc_wr_tx_pend pnd_snd
;
67 struct smc_link
*link
;
71 link
= wc
->qp
->qp_context
;
73 if (wc
->opcode
== IB_WC_REG_MR
) {
75 link
->wr_reg_state
= FAILED
;
77 link
->wr_reg_state
= CONFIRMED
;
78 wake_up(&link
->wr_reg_wait
);
82 pnd_snd_idx
= smc_wr_tx_find_pending_index(link
, wc
->wr_id
);
83 if (pnd_snd_idx
== link
->wr_tx_cnt
)
85 link
->wr_tx_pends
[pnd_snd_idx
].wc_status
= wc
->status
;
86 memcpy(&pnd_snd
, &link
->wr_tx_pends
[pnd_snd_idx
], sizeof(pnd_snd
));
87 /* clear the full struct smc_wr_tx_pend including .priv */
88 memset(&link
->wr_tx_pends
[pnd_snd_idx
], 0,
89 sizeof(link
->wr_tx_pends
[pnd_snd_idx
]));
90 memset(&link
->wr_tx_bufs
[pnd_snd_idx
], 0,
91 sizeof(link
->wr_tx_bufs
[pnd_snd_idx
]));
92 if (!test_and_clear_bit(pnd_snd_idx
, link
->wr_tx_mask
))
95 struct smc_link_group
*lgr
;
97 for_each_set_bit(i
, link
->wr_tx_mask
, link
->wr_tx_cnt
) {
98 /* clear full struct smc_wr_tx_pend including .priv */
99 memset(&link
->wr_tx_pends
[i
], 0,
100 sizeof(link
->wr_tx_pends
[i
]));
101 memset(&link
->wr_tx_bufs
[i
], 0,
102 sizeof(link
->wr_tx_bufs
[i
]));
103 clear_bit(i
, link
->wr_tx_mask
);
105 /* terminate connections of this link group abnormally */
106 lgr
= container_of(link
, struct smc_link_group
,
107 lnk
[SMC_SINGLE_LINK
]);
108 smc_lgr_terminate(lgr
);
111 pnd_snd
.handler(&pnd_snd
.priv
, link
, wc
->status
);
112 wake_up(&link
->wr_tx_wait
);
115 static void smc_wr_tx_tasklet_fn(unsigned long data
)
117 struct smc_ib_device
*dev
= (struct smc_ib_device
*)data
;
118 struct ib_wc wc
[SMC_WR_MAX_POLL_CQE
];
125 memset(&wc
, 0, sizeof(wc
));
126 rc
= ib_poll_cq(dev
->roce_cq_send
, SMC_WR_MAX_POLL_CQE
, wc
);
128 ib_req_notify_cq(dev
->roce_cq_send
,
130 IB_CQ_REPORT_MISSED_EVENTS
);
134 for (i
= 0; i
< rc
; i
++)
135 smc_wr_tx_process_cqe(&wc
[i
]);
141 void smc_wr_tx_cq_handler(struct ib_cq
*ib_cq
, void *cq_context
)
143 struct smc_ib_device
*dev
= (struct smc_ib_device
*)cq_context
;
145 tasklet_schedule(&dev
->send_tasklet
);
148 /*---------------------------- request submission ---------------------------*/
150 static inline int smc_wr_tx_get_free_slot_index(struct smc_link
*link
, u32
*idx
)
152 *idx
= link
->wr_tx_cnt
;
153 for_each_clear_bit(*idx
, link
->wr_tx_mask
, link
->wr_tx_cnt
) {
154 if (!test_and_set_bit(*idx
, link
->wr_tx_mask
))
157 *idx
= link
->wr_tx_cnt
;
162 * smc_wr_tx_get_free_slot() - returns buffer for message assembly,
163 * and sets info for pending transmit tracking
164 * @link: Pointer to smc_link used to later send the message.
165 * @handler: Send completion handler function pointer.
166 * @wr_buf: Out value returns pointer to message buffer.
167 * @wr_pend_priv: Out value returns pointer serving as handler context.
169 * Return: 0 on success, or -errno on error.
171 int smc_wr_tx_get_free_slot(struct smc_link
*link
,
172 smc_wr_tx_handler handler
,
173 struct smc_wr_buf
**wr_buf
,
174 struct smc_wr_tx_pend_priv
**wr_pend_priv
)
176 struct smc_wr_tx_pend
*wr_pend
;
177 u32 idx
= link
->wr_tx_cnt
;
178 struct ib_send_wr
*wr_ib
;
183 *wr_pend_priv
= NULL
;
185 rc
= smc_wr_tx_get_free_slot_index(link
, &idx
);
189 struct smc_link_group
*lgr
;
191 lgr
= container_of(link
, struct smc_link_group
,
192 lnk
[SMC_SINGLE_LINK
]);
193 rc
= wait_event_timeout(
195 list_empty(&lgr
->list
) || /* lgr terminated */
196 (smc_wr_tx_get_free_slot_index(link
, &idx
) != -EBUSY
),
197 SMC_WR_TX_WAIT_FREE_SLOT_TIME
);
199 /* timeout - terminate connections */
200 smc_lgr_terminate(lgr
);
203 if (idx
== link
->wr_tx_cnt
)
206 wr_id
= smc_wr_tx_get_next_wr_id(link
);
207 wr_pend
= &link
->wr_tx_pends
[idx
];
208 wr_pend
->wr_id
= wr_id
;
209 wr_pend
->handler
= handler
;
210 wr_pend
->link
= link
;
212 wr_ib
= &link
->wr_tx_ibs
[idx
];
213 wr_ib
->wr_id
= wr_id
;
214 *wr_buf
= &link
->wr_tx_bufs
[idx
];
215 *wr_pend_priv
= &wr_pend
->priv
;
219 int smc_wr_tx_put_slot(struct smc_link
*link
,
220 struct smc_wr_tx_pend_priv
*wr_pend_priv
)
222 struct smc_wr_tx_pend
*pend
;
224 pend
= container_of(wr_pend_priv
, struct smc_wr_tx_pend
, priv
);
225 if (pend
->idx
< link
->wr_tx_cnt
) {
226 /* clear the full struct smc_wr_tx_pend including .priv */
227 memset(&link
->wr_tx_pends
[pend
->idx
], 0,
228 sizeof(link
->wr_tx_pends
[pend
->idx
]));
229 memset(&link
->wr_tx_bufs
[pend
->idx
], 0,
230 sizeof(link
->wr_tx_bufs
[pend
->idx
]));
231 test_and_clear_bit(pend
->idx
, link
->wr_tx_mask
);
238 /* Send prepared WR slot via ib_post_send.
239 * @priv: pointer to smc_wr_tx_pend_priv identifying prepared message buffer
241 int smc_wr_tx_send(struct smc_link
*link
, struct smc_wr_tx_pend_priv
*priv
)
243 struct ib_send_wr
*failed_wr
= NULL
;
244 struct smc_wr_tx_pend
*pend
;
247 ib_req_notify_cq(link
->smcibdev
->roce_cq_send
,
248 IB_CQ_NEXT_COMP
| IB_CQ_REPORT_MISSED_EVENTS
);
249 pend
= container_of(priv
, struct smc_wr_tx_pend
, priv
);
250 rc
= ib_post_send(link
->roce_qp
, &link
->wr_tx_ibs
[pend
->idx
],
253 struct smc_link_group
*lgr
=
254 container_of(link
, struct smc_link_group
,
255 lnk
[SMC_SINGLE_LINK
]);
257 smc_wr_tx_put_slot(link
, priv
);
258 smc_lgr_terminate(lgr
);
263 /* Register a memory region and wait for result. */
264 int smc_wr_reg_send(struct smc_link
*link
, struct ib_mr
*mr
)
266 struct ib_send_wr
*failed_wr
= NULL
;
269 ib_req_notify_cq(link
->smcibdev
->roce_cq_send
,
270 IB_CQ_NEXT_COMP
| IB_CQ_REPORT_MISSED_EVENTS
);
271 link
->wr_reg_state
= POSTED
;
272 link
->wr_reg
.wr
.wr_id
= (u64
)(uintptr_t)mr
;
273 link
->wr_reg
.mr
= mr
;
274 link
->wr_reg
.key
= mr
->rkey
;
275 failed_wr
= &link
->wr_reg
.wr
;
276 rc
= ib_post_send(link
->roce_qp
, &link
->wr_reg
.wr
, &failed_wr
);
277 WARN_ON(failed_wr
!= &link
->wr_reg
.wr
);
281 rc
= wait_event_interruptible_timeout(link
->wr_reg_wait
,
282 (link
->wr_reg_state
!= POSTED
),
283 SMC_WR_REG_MR_WAIT_TIME
);
285 /* timeout - terminate connections */
286 struct smc_link_group
*lgr
;
288 lgr
= container_of(link
, struct smc_link_group
,
289 lnk
[SMC_SINGLE_LINK
]);
290 smc_lgr_terminate(lgr
);
293 if (rc
== -ERESTARTSYS
)
295 switch (link
->wr_reg_state
) {
309 void smc_wr_tx_dismiss_slots(struct smc_link
*link
, u8 wr_tx_hdr_type
,
310 smc_wr_tx_filter filter
,
311 smc_wr_tx_dismisser dismisser
,
314 struct smc_wr_tx_pend_priv
*tx_pend
;
315 struct smc_wr_rx_hdr
*wr_tx
;
318 for_each_set_bit(i
, link
->wr_tx_mask
, link
->wr_tx_cnt
) {
319 wr_tx
= (struct smc_wr_rx_hdr
*)&link
->wr_tx_bufs
[i
];
320 if (wr_tx
->type
!= wr_tx_hdr_type
)
322 tx_pend
= &link
->wr_tx_pends
[i
].priv
;
323 if (filter(tx_pend
, data
))
328 /****************************** receive queue ********************************/
330 int smc_wr_rx_register_handler(struct smc_wr_rx_handler
*handler
)
332 struct smc_wr_rx_handler
*h_iter
;
335 spin_lock(&smc_wr_rx_hash_lock
);
336 hash_for_each_possible(smc_wr_rx_hash
, h_iter
, list
, handler
->type
) {
337 if (h_iter
->type
== handler
->type
) {
342 hash_add(smc_wr_rx_hash
, &handler
->list
, handler
->type
);
344 spin_unlock(&smc_wr_rx_hash_lock
);
348 /* Demultiplex a received work request based on the message type to its handler.
349 * Relies on smc_wr_rx_hash having been completely filled before any IB WRs,
350 * and not being modified any more afterwards so we don't need to lock it.
352 static inline void smc_wr_rx_demultiplex(struct ib_wc
*wc
)
354 struct smc_link
*link
= (struct smc_link
*)wc
->qp
->qp_context
;
355 struct smc_wr_rx_handler
*handler
;
356 struct smc_wr_rx_hdr
*wr_rx
;
360 if (wc
->byte_len
< sizeof(*wr_rx
))
361 return; /* short message */
362 temp_wr_id
= wc
->wr_id
;
363 index
= do_div(temp_wr_id
, link
->wr_rx_cnt
);
364 wr_rx
= (struct smc_wr_rx_hdr
*)&link
->wr_rx_bufs
[index
];
365 hash_for_each_possible(smc_wr_rx_hash
, handler
, list
, wr_rx
->type
) {
366 if (handler
->type
== wr_rx
->type
)
367 handler
->handler(wc
, wr_rx
);
371 static inline void smc_wr_rx_process_cqes(struct ib_wc wc
[], int num
)
373 struct smc_link
*link
;
376 for (i
= 0; i
< num
; i
++) {
377 link
= wc
[i
].qp
->qp_context
;
378 if (wc
[i
].status
== IB_WC_SUCCESS
) {
379 smc_wr_rx_demultiplex(&wc
[i
]);
380 smc_wr_rx_post(link
); /* refill WR RX */
382 struct smc_link_group
*lgr
;
384 /* handle status errors */
385 switch (wc
[i
].status
) {
386 case IB_WC_RETRY_EXC_ERR
:
387 case IB_WC_RNR_RETRY_EXC_ERR
:
388 case IB_WC_WR_FLUSH_ERR
:
389 /* terminate connections of this link group
392 lgr
= container_of(link
, struct smc_link_group
,
393 lnk
[SMC_SINGLE_LINK
]);
394 smc_lgr_terminate(lgr
);
397 smc_wr_rx_post(link
); /* refill WR RX */
404 static void smc_wr_rx_tasklet_fn(unsigned long data
)
406 struct smc_ib_device
*dev
= (struct smc_ib_device
*)data
;
407 struct ib_wc wc
[SMC_WR_MAX_POLL_CQE
];
414 memset(&wc
, 0, sizeof(wc
));
415 rc
= ib_poll_cq(dev
->roce_cq_recv
, SMC_WR_MAX_POLL_CQE
, wc
);
417 ib_req_notify_cq(dev
->roce_cq_recv
,
419 | IB_CQ_REPORT_MISSED_EVENTS
);
423 smc_wr_rx_process_cqes(&wc
[0], rc
);
429 void smc_wr_rx_cq_handler(struct ib_cq
*ib_cq
, void *cq_context
)
431 struct smc_ib_device
*dev
= (struct smc_ib_device
*)cq_context
;
433 tasklet_schedule(&dev
->recv_tasklet
);
436 int smc_wr_rx_post_init(struct smc_link
*link
)
441 for (i
= 0; i
< link
->wr_rx_cnt
; i
++)
442 rc
= smc_wr_rx_post(link
);
446 /***************************** init, exit, misc ******************************/
448 void smc_wr_remember_qp_attr(struct smc_link
*lnk
)
450 struct ib_qp_attr
*attr
= &lnk
->qp_attr
;
451 struct ib_qp_init_attr init_attr
;
453 memset(attr
, 0, sizeof(*attr
));
454 memset(&init_attr
, 0, sizeof(init_attr
));
455 ib_query_qp(lnk
->roce_qp
, attr
,
468 IB_QP_MIN_RNR_TIMER
|
470 IB_QP_PATH_MIG_STATE
|
475 lnk
->wr_tx_cnt
= min_t(size_t, SMC_WR_BUF_CNT
,
476 lnk
->qp_attr
.cap
.max_send_wr
);
477 lnk
->wr_rx_cnt
= min_t(size_t, SMC_WR_BUF_CNT
* 3,
478 lnk
->qp_attr
.cap
.max_recv_wr
);
481 static void smc_wr_init_sge(struct smc_link
*lnk
)
485 for (i
= 0; i
< lnk
->wr_tx_cnt
; i
++) {
486 lnk
->wr_tx_sges
[i
].addr
=
487 lnk
->wr_tx_dma_addr
+ i
* SMC_WR_BUF_SIZE
;
488 lnk
->wr_tx_sges
[i
].length
= SMC_WR_TX_SIZE
;
489 lnk
->wr_tx_sges
[i
].lkey
= lnk
->roce_pd
->local_dma_lkey
;
490 lnk
->wr_tx_ibs
[i
].next
= NULL
;
491 lnk
->wr_tx_ibs
[i
].sg_list
= &lnk
->wr_tx_sges
[i
];
492 lnk
->wr_tx_ibs
[i
].num_sge
= 1;
493 lnk
->wr_tx_ibs
[i
].opcode
= IB_WR_SEND
;
494 lnk
->wr_tx_ibs
[i
].send_flags
=
495 IB_SEND_SIGNALED
| IB_SEND_SOLICITED
;
497 for (i
= 0; i
< lnk
->wr_rx_cnt
; i
++) {
498 lnk
->wr_rx_sges
[i
].addr
=
499 lnk
->wr_rx_dma_addr
+ i
* SMC_WR_BUF_SIZE
;
500 lnk
->wr_rx_sges
[i
].length
= SMC_WR_BUF_SIZE
;
501 lnk
->wr_rx_sges
[i
].lkey
= lnk
->roce_pd
->local_dma_lkey
;
502 lnk
->wr_rx_ibs
[i
].next
= NULL
;
503 lnk
->wr_rx_ibs
[i
].sg_list
= &lnk
->wr_rx_sges
[i
];
504 lnk
->wr_rx_ibs
[i
].num_sge
= 1;
506 lnk
->wr_reg
.wr
.next
= NULL
;
507 lnk
->wr_reg
.wr
.num_sge
= 0;
508 lnk
->wr_reg
.wr
.send_flags
= IB_SEND_SIGNALED
;
509 lnk
->wr_reg
.wr
.opcode
= IB_WR_REG_MR
;
510 lnk
->wr_reg
.access
= IB_ACCESS_LOCAL_WRITE
| IB_ACCESS_REMOTE_WRITE
;
513 void smc_wr_free_link(struct smc_link
*lnk
)
515 struct ib_device
*ibdev
;
517 memset(lnk
->wr_tx_mask
, 0,
518 BITS_TO_LONGS(SMC_WR_BUF_CNT
) * sizeof(*lnk
->wr_tx_mask
));
522 ibdev
= lnk
->smcibdev
->ibdev
;
524 if (lnk
->wr_rx_dma_addr
) {
525 ib_dma_unmap_single(ibdev
, lnk
->wr_rx_dma_addr
,
526 SMC_WR_BUF_SIZE
* lnk
->wr_rx_cnt
,
528 lnk
->wr_rx_dma_addr
= 0;
530 if (lnk
->wr_tx_dma_addr
) {
531 ib_dma_unmap_single(ibdev
, lnk
->wr_tx_dma_addr
,
532 SMC_WR_BUF_SIZE
* lnk
->wr_tx_cnt
,
534 lnk
->wr_tx_dma_addr
= 0;
538 void smc_wr_free_link_mem(struct smc_link
*lnk
)
540 kfree(lnk
->wr_tx_pends
);
541 lnk
->wr_tx_pends
= NULL
;
542 kfree(lnk
->wr_tx_mask
);
543 lnk
->wr_tx_mask
= NULL
;
544 kfree(lnk
->wr_tx_sges
);
545 lnk
->wr_tx_sges
= NULL
;
546 kfree(lnk
->wr_rx_sges
);
547 lnk
->wr_rx_sges
= NULL
;
548 kfree(lnk
->wr_rx_ibs
);
549 lnk
->wr_rx_ibs
= NULL
;
550 kfree(lnk
->wr_tx_ibs
);
551 lnk
->wr_tx_ibs
= NULL
;
552 kfree(lnk
->wr_tx_bufs
);
553 lnk
->wr_tx_bufs
= NULL
;
554 kfree(lnk
->wr_rx_bufs
);
555 lnk
->wr_rx_bufs
= NULL
;
558 int smc_wr_alloc_link_mem(struct smc_link
*link
)
560 /* allocate link related memory */
561 link
->wr_tx_bufs
= kcalloc(SMC_WR_BUF_CNT
, SMC_WR_BUF_SIZE
, GFP_KERNEL
);
562 if (!link
->wr_tx_bufs
)
564 link
->wr_rx_bufs
= kcalloc(SMC_WR_BUF_CNT
* 3, SMC_WR_BUF_SIZE
,
566 if (!link
->wr_rx_bufs
)
567 goto no_mem_wr_tx_bufs
;
568 link
->wr_tx_ibs
= kcalloc(SMC_WR_BUF_CNT
, sizeof(link
->wr_tx_ibs
[0]),
570 if (!link
->wr_tx_ibs
)
571 goto no_mem_wr_rx_bufs
;
572 link
->wr_rx_ibs
= kcalloc(SMC_WR_BUF_CNT
* 3,
573 sizeof(link
->wr_rx_ibs
[0]),
575 if (!link
->wr_rx_ibs
)
576 goto no_mem_wr_tx_ibs
;
577 link
->wr_tx_sges
= kcalloc(SMC_WR_BUF_CNT
, sizeof(link
->wr_tx_sges
[0]),
579 if (!link
->wr_tx_sges
)
580 goto no_mem_wr_rx_ibs
;
581 link
->wr_rx_sges
= kcalloc(SMC_WR_BUF_CNT
* 3,
582 sizeof(link
->wr_rx_sges
[0]),
584 if (!link
->wr_rx_sges
)
585 goto no_mem_wr_tx_sges
;
586 link
->wr_tx_mask
= kzalloc(
587 BITS_TO_LONGS(SMC_WR_BUF_CNT
) * sizeof(*link
->wr_tx_mask
),
589 if (!link
->wr_tx_mask
)
590 goto no_mem_wr_rx_sges
;
591 link
->wr_tx_pends
= kcalloc(SMC_WR_BUF_CNT
,
592 sizeof(link
->wr_tx_pends
[0]),
594 if (!link
->wr_tx_pends
)
595 goto no_mem_wr_tx_mask
;
599 kfree(link
->wr_tx_mask
);
601 kfree(link
->wr_rx_sges
);
603 kfree(link
->wr_tx_sges
);
605 kfree(link
->wr_rx_ibs
);
607 kfree(link
->wr_tx_ibs
);
609 kfree(link
->wr_rx_bufs
);
611 kfree(link
->wr_tx_bufs
);
616 void smc_wr_remove_dev(struct smc_ib_device
*smcibdev
)
618 tasklet_kill(&smcibdev
->recv_tasklet
);
619 tasklet_kill(&smcibdev
->send_tasklet
);
622 void smc_wr_add_dev(struct smc_ib_device
*smcibdev
)
624 tasklet_init(&smcibdev
->recv_tasklet
, smc_wr_rx_tasklet_fn
,
625 (unsigned long)smcibdev
);
626 tasklet_init(&smcibdev
->send_tasklet
, smc_wr_tx_tasklet_fn
,
627 (unsigned long)smcibdev
);
630 int smc_wr_create_link(struct smc_link
*lnk
)
632 struct ib_device
*ibdev
= lnk
->smcibdev
->ibdev
;
635 smc_wr_tx_set_wr_id(&lnk
->wr_tx_id
, 0);
637 lnk
->wr_rx_dma_addr
= ib_dma_map_single(
638 ibdev
, lnk
->wr_rx_bufs
, SMC_WR_BUF_SIZE
* lnk
->wr_rx_cnt
,
640 if (ib_dma_mapping_error(ibdev
, lnk
->wr_rx_dma_addr
)) {
641 lnk
->wr_rx_dma_addr
= 0;
645 lnk
->wr_tx_dma_addr
= ib_dma_map_single(
646 ibdev
, lnk
->wr_tx_bufs
, SMC_WR_BUF_SIZE
* lnk
->wr_tx_cnt
,
648 if (ib_dma_mapping_error(ibdev
, lnk
->wr_tx_dma_addr
)) {
652 smc_wr_init_sge(lnk
);
653 memset(lnk
->wr_tx_mask
, 0,
654 BITS_TO_LONGS(SMC_WR_BUF_CNT
) * sizeof(*lnk
->wr_tx_mask
));
655 init_waitqueue_head(&lnk
->wr_tx_wait
);
656 init_waitqueue_head(&lnk
->wr_reg_wait
);
660 ib_dma_unmap_single(ibdev
, lnk
->wr_rx_dma_addr
,
661 SMC_WR_BUF_SIZE
* lnk
->wr_rx_cnt
,
663 lnk
->wr_rx_dma_addr
= 0;