1 // SPDX-License-Identifier: GPL-2.0
3 * Shared Memory Communications over RDMA (SMC-R) and RoCE
5 * Link Layer Control (LLC)
7 * Copyright IBM Corp. 2016
14 #include <rdma/ib_verbs.h>
21 #define SMC_LLC_DATA_LEN 40
24 struct smc_wr_rx_hdr common;
26 #if defined(__BIG_ENDIAN_BITFIELD)
29 #elif defined(__LITTLE_ENDIAN_BITFIELD)
30 u8 add_link_rej_rsn:4,
36 #define SMC_LLC_FLAG_NO_RMBE_EYEC 0x03
38 struct smc_llc_msg_confirm_link { /* type 0x01 */
39 struct smc_llc_hdr hd;
40 u8 sender_mac[ETH_ALEN];
41 u8 sender_gid[SMC_GID_SIZE];
44 u8 link_uid[SMC_LGR_ID_SIZE];
49 #define SMC_LLC_FLAG_ADD_LNK_REJ 0x40
50 #define SMC_LLC_REJ_RSN_NO_ALT_PATH 1
52 #define SMC_LLC_ADD_LNK_MAX_LINKS 2
54 struct smc_llc_msg_add_link { /* type 0x02 */
55 struct smc_llc_hdr hd;
56 u8 sender_mac[ETH_ALEN];
58 u8 sender_gid[SMC_GID_SIZE];
61 u8 flags2; /* QP mtu */
66 #define SMC_LLC_FLAG_DEL_LINK_ALL 0x40
67 #define SMC_LLC_FLAG_DEL_LINK_ORDERLY 0x20
69 struct smc_llc_msg_del_link { /* type 0x04 */
70 struct smc_llc_hdr hd;
74 } __packed; /* format defined in RFC7609 */
76 struct smc_llc_msg_test_link { /* type 0x07 */
77 struct smc_llc_hdr hd;
82 struct smc_rmb_rtoken {
84 u8 num_rkeys; /* first rtoken byte of CONFIRM LINK msg */
85 /* is actually the num of rtokens, first */
86 /* rtoken is always for the current link */
87 u8 link_id; /* link id of the rtoken */
91 } __packed; /* format defined in RFC7609 */
93 #define SMC_LLC_RKEYS_PER_MSG 3
95 struct smc_llc_msg_confirm_rkey { /* type 0x06 */
96 struct smc_llc_hdr hd;
97 struct smc_rmb_rtoken rtoken[SMC_LLC_RKEYS_PER_MSG];
101 struct smc_llc_msg_confirm_rkey_cont { /* type 0x08 */
102 struct smc_llc_hdr hd;
104 struct smc_rmb_rtoken rtoken[SMC_LLC_RKEYS_PER_MSG];
107 #define SMC_LLC_DEL_RKEY_MAX 8
108 #define SMC_LLC_FLAG_RKEY_NEG 0x20
110 struct smc_llc_msg_delete_rkey { /* type 0x09 */
111 struct smc_llc_hdr hd;
120 struct smc_llc_msg_confirm_link confirm_link;
121 struct smc_llc_msg_add_link add_link;
122 struct smc_llc_msg_del_link delete_link;
124 struct smc_llc_msg_confirm_rkey confirm_rkey;
125 struct smc_llc_msg_confirm_rkey_cont confirm_rkey_cont;
126 struct smc_llc_msg_delete_rkey delete_rkey;
128 struct smc_llc_msg_test_link test_link;
130 struct smc_llc_hdr hdr;
131 u8 data[SMC_LLC_DATA_LEN];
135 #define SMC_LLC_FLAG_RESP 0x80
137 /********************************** send *************************************/
139 struct smc_llc_tx_pend {
142 /* handler for send/transmission completion of an LLC msg */
143 static void smc_llc_tx_handler(struct smc_wr_tx_pend_priv *pend,
144 struct smc_link *link,
145 enum ib_wc_status wc_status)
147 /* future work: handle wc_status error for recovery and failover */
151 * smc_llc_add_pending_send() - add LLC control message to pending WQE transmits
152 * @link: Pointer to SMC link used for sending LLC control message.
153 * @wr_buf: Out variable returning pointer to work request payload buffer.
154 * @pend: Out variable returning pointer to private pending WR tracking.
155 * It's the context the transmit complete handler will get.
157 * Reserves and pre-fills an entry for a pending work request send/tx.
158 * Used by mid-level smc_llc_send_msg() to prepare for later actual send/tx.
159 * Can sleep due to smc_get_ctrl_buf (if not in softirq context).
161 * Return: 0 on success, otherwise an error value.
163 static int smc_llc_add_pending_send(struct smc_link *link,
164 struct smc_wr_buf **wr_buf,
165 struct smc_wr_tx_pend_priv **pend)
169 rc = smc_wr_tx_get_free_slot(link, smc_llc_tx_handler, wr_buf, NULL,
174 sizeof(union smc_llc_msg) > SMC_WR_BUF_SIZE,
175 "must increase SMC_WR_BUF_SIZE to at least sizeof(struct smc_llc_msg)");
177 sizeof(union smc_llc_msg) != SMC_WR_TX_SIZE,
178 "must adapt SMC_WR_TX_SIZE to sizeof(struct smc_llc_msg); if not all smc_wr upper layer protocols use the same message size any more, must start to set link->wr_tx_sges[i].length on each individual smc_wr_tx_send()");
180 sizeof(struct smc_llc_tx_pend) > SMC_WR_TX_PEND_PRIV_SIZE,
181 "must increase SMC_WR_TX_PEND_PRIV_SIZE to at least sizeof(struct smc_llc_tx_pend)");
185 /* high-level API to send LLC confirm link */
186 int smc_llc_send_confirm_link(struct smc_link *link,
187 enum smc_llc_reqresp reqresp)
189 struct smc_link_group *lgr = smc_get_lgr(link);
190 struct smc_llc_msg_confirm_link *confllc;
191 struct smc_wr_tx_pend_priv *pend;
192 struct smc_wr_buf *wr_buf;
195 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
198 confllc = (struct smc_llc_msg_confirm_link *)wr_buf;
199 memset(confllc, 0, sizeof(*confllc));
200 confllc->hd.common.type = SMC_LLC_CONFIRM_LINK;
201 confllc->hd.length = sizeof(struct smc_llc_msg_confirm_link);
202 confllc->hd.flags |= SMC_LLC_FLAG_NO_RMBE_EYEC;
203 if (reqresp == SMC_LLC_RESP)
204 confllc->hd.flags |= SMC_LLC_FLAG_RESP;
205 memcpy(confllc->sender_mac, link->smcibdev->mac[link->ibport - 1],
207 memcpy(confllc->sender_gid, link->gid, SMC_GID_SIZE);
208 hton24(confllc->sender_qp_num, link->roce_qp->qp_num);
209 confllc->link_num = link->link_id;
210 memcpy(confllc->link_uid, lgr->id, SMC_LGR_ID_SIZE);
211 confllc->max_links = SMC_LLC_ADD_LNK_MAX_LINKS; /* enforce peer resp. */
212 /* send llc message */
213 rc = smc_wr_tx_send(link, pend);
217 /* send LLC confirm rkey request */
218 static int smc_llc_send_confirm_rkey(struct smc_link *link,
219 struct smc_buf_desc *rmb_desc)
221 struct smc_llc_msg_confirm_rkey *rkeyllc;
222 struct smc_wr_tx_pend_priv *pend;
223 struct smc_wr_buf *wr_buf;
226 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
229 rkeyllc = (struct smc_llc_msg_confirm_rkey *)wr_buf;
230 memset(rkeyllc, 0, sizeof(*rkeyllc));
231 rkeyllc->hd.common.type = SMC_LLC_CONFIRM_RKEY;
232 rkeyllc->hd.length = sizeof(struct smc_llc_msg_confirm_rkey);
233 rkeyllc->rtoken[0].rmb_key =
234 htonl(rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey);
235 rkeyllc->rtoken[0].rmb_vaddr = cpu_to_be64(
236 (u64)sg_dma_address(rmb_desc->sgt[SMC_SINGLE_LINK].sgl));
237 /* send llc message */
238 rc = smc_wr_tx_send(link, pend);
242 /* send LLC delete rkey request */
243 static int smc_llc_send_delete_rkey(struct smc_link *link,
244 struct smc_buf_desc *rmb_desc)
246 struct smc_llc_msg_delete_rkey *rkeyllc;
247 struct smc_wr_tx_pend_priv *pend;
248 struct smc_wr_buf *wr_buf;
251 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
254 rkeyllc = (struct smc_llc_msg_delete_rkey *)wr_buf;
255 memset(rkeyllc, 0, sizeof(*rkeyllc));
256 rkeyllc->hd.common.type = SMC_LLC_DELETE_RKEY;
257 rkeyllc->hd.length = sizeof(struct smc_llc_msg_delete_rkey);
258 rkeyllc->num_rkeys = 1;
259 rkeyllc->rkey[0] = htonl(rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey);
260 /* send llc message */
261 rc = smc_wr_tx_send(link, pend);
265 /* prepare an add link message */
266 static void smc_llc_prep_add_link(struct smc_llc_msg_add_link *addllc,
267 struct smc_link *link, u8 mac[], u8 gid[],
268 enum smc_llc_reqresp reqresp)
270 memset(addllc, 0, sizeof(*addllc));
271 addllc->hd.common.type = SMC_LLC_ADD_LINK;
272 addllc->hd.length = sizeof(struct smc_llc_msg_add_link);
273 if (reqresp == SMC_LLC_RESP) {
274 addllc->hd.flags |= SMC_LLC_FLAG_RESP;
275 /* always reject more links for now */
276 addllc->hd.flags |= SMC_LLC_FLAG_ADD_LNK_REJ;
277 addllc->hd.add_link_rej_rsn = SMC_LLC_REJ_RSN_NO_ALT_PATH;
279 memcpy(addllc->sender_mac, mac, ETH_ALEN);
280 memcpy(addllc->sender_gid, gid, SMC_GID_SIZE);
283 /* send ADD LINK request or response */
284 int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[],
285 enum smc_llc_reqresp reqresp)
287 struct smc_llc_msg_add_link *addllc;
288 struct smc_wr_tx_pend_priv *pend;
289 struct smc_wr_buf *wr_buf;
292 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
295 addllc = (struct smc_llc_msg_add_link *)wr_buf;
296 smc_llc_prep_add_link(addllc, link, mac, gid, reqresp);
297 /* send llc message */
298 rc = smc_wr_tx_send(link, pend);
302 /* prepare a delete link message */
303 static void smc_llc_prep_delete_link(struct smc_llc_msg_del_link *delllc,
304 struct smc_link *link,
305 enum smc_llc_reqresp reqresp, bool orderly)
307 memset(delllc, 0, sizeof(*delllc));
308 delllc->hd.common.type = SMC_LLC_DELETE_LINK;
309 delllc->hd.length = sizeof(struct smc_llc_msg_add_link);
310 if (reqresp == SMC_LLC_RESP)
311 delllc->hd.flags |= SMC_LLC_FLAG_RESP;
312 /* DEL_LINK_ALL because only 1 link supported */
313 delllc->hd.flags |= SMC_LLC_FLAG_DEL_LINK_ALL;
315 delllc->hd.flags |= SMC_LLC_FLAG_DEL_LINK_ORDERLY;
316 delllc->link_num = link->link_id;
319 /* send DELETE LINK request or response */
320 int smc_llc_send_delete_link(struct smc_link *link,
321 enum smc_llc_reqresp reqresp, bool orderly)
323 struct smc_llc_msg_del_link *delllc;
324 struct smc_wr_tx_pend_priv *pend;
325 struct smc_wr_buf *wr_buf;
328 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
331 delllc = (struct smc_llc_msg_del_link *)wr_buf;
332 smc_llc_prep_delete_link(delllc, link, reqresp, orderly);
333 /* send llc message */
334 rc = smc_wr_tx_send(link, pend);
338 /* send LLC test link request */
339 static int smc_llc_send_test_link(struct smc_link *link, u8 user_data[16])
341 struct smc_llc_msg_test_link *testllc;
342 struct smc_wr_tx_pend_priv *pend;
343 struct smc_wr_buf *wr_buf;
346 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
349 testllc = (struct smc_llc_msg_test_link *)wr_buf;
350 memset(testllc, 0, sizeof(*testllc));
351 testllc->hd.common.type = SMC_LLC_TEST_LINK;
352 testllc->hd.length = sizeof(struct smc_llc_msg_test_link);
353 memcpy(testllc->user_data, user_data, sizeof(testllc->user_data));
354 /* send llc message */
355 rc = smc_wr_tx_send(link, pend);
359 struct smc_llc_send_work {
360 struct work_struct work;
361 struct smc_link *link;
363 union smc_llc_msg llcbuf;
366 /* worker that sends a prepared message */
367 static void smc_llc_send_message_work(struct work_struct *work)
369 struct smc_llc_send_work *llcwrk = container_of(work,
370 struct smc_llc_send_work, work);
371 struct smc_wr_tx_pend_priv *pend;
372 struct smc_wr_buf *wr_buf;
375 if (llcwrk->link->state == SMC_LNK_INACTIVE)
377 rc = smc_llc_add_pending_send(llcwrk->link, &wr_buf, &pend);
380 memcpy(wr_buf, &llcwrk->llcbuf, llcwrk->llclen);
381 smc_wr_tx_send(llcwrk->link, pend);
386 /* copy llcbuf and schedule an llc send on link */
387 static int smc_llc_send_message(struct smc_link *link, void *llcbuf, int llclen)
389 struct smc_llc_send_work *wrk = kmalloc(sizeof(*wrk), GFP_ATOMIC);
393 INIT_WORK(&wrk->work, smc_llc_send_message_work);
395 wrk->llclen = llclen;
396 memcpy(&wrk->llcbuf, llcbuf, llclen);
397 queue_work(link->llc_wq, &wrk->work);
401 /********************************* receive ***********************************/
403 static void smc_llc_rx_confirm_link(struct smc_link *link,
404 struct smc_llc_msg_confirm_link *llc)
406 struct smc_link_group *lgr = smc_get_lgr(link);
409 /* RMBE eyecatchers are not supported */
410 if (llc->hd.flags & SMC_LLC_FLAG_NO_RMBE_EYEC)
415 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
416 if (lgr->role == SMC_SERV &&
417 link->state == SMC_LNK_ACTIVATING) {
418 link->llc_confirm_resp_rc = conf_rc;
419 complete(&link->llc_confirm_resp);
422 if (lgr->role == SMC_CLNT &&
423 link->state == SMC_LNK_ACTIVATING) {
424 link->llc_confirm_rc = conf_rc;
425 link->link_id = llc->link_num;
426 complete(&link->llc_confirm);
431 static void smc_llc_rx_add_link(struct smc_link *link,
432 struct smc_llc_msg_add_link *llc)
434 struct smc_link_group *lgr = smc_get_lgr(link);
436 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
437 if (link->state == SMC_LNK_ACTIVATING)
438 complete(&link->llc_add_resp);
440 if (link->state == SMC_LNK_ACTIVATING) {
441 complete(&link->llc_add);
445 if (lgr->role == SMC_SERV) {
446 smc_llc_prep_add_link(llc, link,
447 link->smcibdev->mac[link->ibport - 1],
448 link->gid, SMC_LLC_REQ);
451 smc_llc_prep_add_link(llc, link,
452 link->smcibdev->mac[link->ibport - 1],
453 link->gid, SMC_LLC_RESP);
455 smc_llc_send_message(link, llc, sizeof(*llc));
459 static void smc_llc_rx_delete_link(struct smc_link *link,
460 struct smc_llc_msg_del_link *llc)
462 struct smc_link_group *lgr = smc_get_lgr(link);
464 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
465 if (lgr->role == SMC_SERV)
466 smc_lgr_schedule_free_work_fast(lgr);
469 smc_llc_link_deleting(link);
470 if (lgr->role == SMC_SERV) {
471 /* client asks to delete this link, send request */
472 smc_llc_prep_delete_link(llc, link, SMC_LLC_REQ, true);
474 /* server requests to delete this link, send response */
475 smc_llc_prep_delete_link(llc, link, SMC_LLC_RESP, true);
477 smc_llc_send_message(link, llc, sizeof(*llc));
478 smc_lgr_terminate_sched(lgr);
482 static void smc_llc_rx_test_link(struct smc_link *link,
483 struct smc_llc_msg_test_link *llc)
485 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
486 if (link->state == SMC_LNK_ACTIVE)
487 complete(&link->llc_testlink_resp);
489 llc->hd.flags |= SMC_LLC_FLAG_RESP;
490 smc_llc_send_message(link, llc, sizeof(*llc));
494 static void smc_llc_rx_confirm_rkey(struct smc_link *link,
495 struct smc_llc_msg_confirm_rkey *llc)
499 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
500 link->llc_confirm_rkey_rc = llc->hd.flags &
501 SMC_LLC_FLAG_RKEY_NEG;
502 complete(&link->llc_confirm_rkey);
504 rc = smc_rtoken_add(smc_get_lgr(link),
505 llc->rtoken[0].rmb_vaddr,
506 llc->rtoken[0].rmb_key);
508 /* ignore rtokens for other links, we have only one link */
510 llc->hd.flags |= SMC_LLC_FLAG_RESP;
512 llc->hd.flags |= SMC_LLC_FLAG_RKEY_NEG;
513 smc_llc_send_message(link, llc, sizeof(*llc));
517 static void smc_llc_rx_confirm_rkey_cont(struct smc_link *link,
518 struct smc_llc_msg_confirm_rkey_cont *llc)
520 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
521 /* unused as long as we don't send this type of msg */
523 /* ignore rtokens for other links, we have only one link */
524 llc->hd.flags |= SMC_LLC_FLAG_RESP;
525 smc_llc_send_message(link, llc, sizeof(*llc));
529 static void smc_llc_rx_delete_rkey(struct smc_link *link,
530 struct smc_llc_msg_delete_rkey *llc)
535 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
536 link->llc_delete_rkey_rc = llc->hd.flags &
537 SMC_LLC_FLAG_RKEY_NEG;
538 complete(&link->llc_delete_rkey);
540 max = min_t(u8, llc->num_rkeys, SMC_LLC_DEL_RKEY_MAX);
541 for (i = 0; i < max; i++) {
542 if (smc_rtoken_delete(smc_get_lgr(link), llc->rkey[i]))
543 err_mask |= 1 << (SMC_LLC_DEL_RKEY_MAX - 1 - i);
547 llc->hd.flags |= SMC_LLC_FLAG_RKEY_NEG;
548 llc->err_mask = err_mask;
551 llc->hd.flags |= SMC_LLC_FLAG_RESP;
552 smc_llc_send_message(link, llc, sizeof(*llc));
556 static void smc_llc_rx_handler(struct ib_wc *wc, void *buf)
558 struct smc_link *link = (struct smc_link *)wc->qp->qp_context;
559 union smc_llc_msg *llc = buf;
561 if (wc->byte_len < sizeof(*llc))
562 return; /* short message */
563 if (llc->raw.hdr.length != sizeof(*llc))
564 return; /* invalid message */
565 if (link->state == SMC_LNK_INACTIVE)
566 return; /* link not active, drop msg */
568 switch (llc->raw.hdr.common.type) {
569 case SMC_LLC_TEST_LINK:
570 smc_llc_rx_test_link(link, &llc->test_link);
572 case SMC_LLC_CONFIRM_LINK:
573 smc_llc_rx_confirm_link(link, &llc->confirm_link);
575 case SMC_LLC_ADD_LINK:
576 smc_llc_rx_add_link(link, &llc->add_link);
578 case SMC_LLC_DELETE_LINK:
579 smc_llc_rx_delete_link(link, &llc->delete_link);
581 case SMC_LLC_CONFIRM_RKEY:
582 smc_llc_rx_confirm_rkey(link, &llc->confirm_rkey);
584 case SMC_LLC_CONFIRM_RKEY_CONT:
585 smc_llc_rx_confirm_rkey_cont(link, &llc->confirm_rkey_cont);
587 case SMC_LLC_DELETE_RKEY:
588 smc_llc_rx_delete_rkey(link, &llc->delete_rkey);
593 /***************************** worker, utils *********************************/
595 static void smc_llc_testlink_work(struct work_struct *work)
597 struct smc_link *link = container_of(to_delayed_work(work),
598 struct smc_link, llc_testlink_wrk);
599 unsigned long next_interval;
600 unsigned long expire_time;
601 u8 user_data[16] = { 0 };
604 if (link->state != SMC_LNK_ACTIVE)
605 return; /* don't reschedule worker */
606 expire_time = link->wr_rx_tstamp + link->llc_testlink_time;
607 if (time_is_after_jiffies(expire_time)) {
608 next_interval = expire_time - jiffies;
611 reinit_completion(&link->llc_testlink_resp);
612 smc_llc_send_test_link(link, user_data);
613 /* receive TEST LINK response over RoCE fabric */
614 rc = wait_for_completion_interruptible_timeout(&link->llc_testlink_resp,
617 smc_lgr_terminate_sched(smc_get_lgr(link));
620 next_interval = link->llc_testlink_time;
622 queue_delayed_work(link->llc_wq, &link->llc_testlink_wrk,
626 int smc_llc_link_init(struct smc_link *link)
628 struct smc_link_group *lgr = smc_get_lgr(link);
629 link->llc_wq = alloc_ordered_workqueue("llc_wq-%x:%x)", WQ_MEM_RECLAIM,
634 init_completion(&link->llc_confirm);
635 init_completion(&link->llc_confirm_resp);
636 init_completion(&link->llc_add);
637 init_completion(&link->llc_add_resp);
638 init_completion(&link->llc_confirm_rkey);
639 init_completion(&link->llc_delete_rkey);
640 mutex_init(&link->llc_delete_rkey_mutex);
641 init_completion(&link->llc_testlink_resp);
642 INIT_DELAYED_WORK(&link->llc_testlink_wrk, smc_llc_testlink_work);
646 void smc_llc_link_active(struct smc_link *link, int testlink_time)
648 link->state = SMC_LNK_ACTIVE;
650 link->llc_testlink_time = testlink_time * HZ;
651 queue_delayed_work(link->llc_wq, &link->llc_testlink_wrk,
652 link->llc_testlink_time);
656 void smc_llc_link_deleting(struct smc_link *link)
658 link->state = SMC_LNK_DELETING;
659 smc_wr_wakeup_tx_wait(link);
662 /* called in tasklet context */
663 void smc_llc_link_inactive(struct smc_link *link)
665 link->state = SMC_LNK_INACTIVE;
666 cancel_delayed_work(&link->llc_testlink_wrk);
667 smc_wr_wakeup_reg_wait(link);
668 smc_wr_wakeup_tx_wait(link);
671 /* called in worker context */
672 void smc_llc_link_clear(struct smc_link *link)
674 flush_workqueue(link->llc_wq);
675 destroy_workqueue(link->llc_wq);
678 /* register a new rtoken at the remote peer */
679 int smc_llc_do_confirm_rkey(struct smc_link *link,
680 struct smc_buf_desc *rmb_desc)
684 /* protected by mutex smc_create_lgr_pending */
685 reinit_completion(&link->llc_confirm_rkey);
686 rc = smc_llc_send_confirm_rkey(link, rmb_desc);
689 /* receive CONFIRM RKEY response from server over RoCE fabric */
690 rc = wait_for_completion_interruptible_timeout(&link->llc_confirm_rkey,
692 if (rc <= 0 || link->llc_confirm_rkey_rc)
697 /* unregister an rtoken at the remote peer */
698 int smc_llc_do_delete_rkey(struct smc_link *link,
699 struct smc_buf_desc *rmb_desc)
703 mutex_lock(&link->llc_delete_rkey_mutex);
704 if (link->state != SMC_LNK_ACTIVE)
706 reinit_completion(&link->llc_delete_rkey);
707 rc = smc_llc_send_delete_rkey(link, rmb_desc);
710 /* receive DELETE RKEY response from server over RoCE fabric */
711 rc = wait_for_completion_interruptible_timeout(&link->llc_delete_rkey,
713 if (rc <= 0 || link->llc_delete_rkey_rc)
718 mutex_unlock(&link->llc_delete_rkey_mutex);
722 /***************************** init, exit, misc ******************************/
724 static struct smc_wr_rx_handler smc_llc_rx_handlers[] = {
726 .handler = smc_llc_rx_handler,
727 .type = SMC_LLC_CONFIRM_LINK
730 .handler = smc_llc_rx_handler,
731 .type = SMC_LLC_TEST_LINK
734 .handler = smc_llc_rx_handler,
735 .type = SMC_LLC_ADD_LINK
738 .handler = smc_llc_rx_handler,
739 .type = SMC_LLC_DELETE_LINK
742 .handler = smc_llc_rx_handler,
743 .type = SMC_LLC_CONFIRM_RKEY
746 .handler = smc_llc_rx_handler,
747 .type = SMC_LLC_CONFIRM_RKEY_CONT
750 .handler = smc_llc_rx_handler,
751 .type = SMC_LLC_DELETE_RKEY
758 int __init smc_llc_init(void)
760 struct smc_wr_rx_handler *handler;
763 for (handler = smc_llc_rx_handlers; handler->handler; handler++) {
764 INIT_HLIST_NODE(&handler->list);
765 rc = smc_wr_rx_register_handler(handler);