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, pend);
173 sizeof(union smc_llc_msg) > SMC_WR_BUF_SIZE,
174 "must increase SMC_WR_BUF_SIZE to at least sizeof(struct smc_llc_msg)");
176 sizeof(union smc_llc_msg) != SMC_WR_TX_SIZE,
177 "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()");
179 sizeof(struct smc_llc_tx_pend) > SMC_WR_TX_PEND_PRIV_SIZE,
180 "must increase SMC_WR_TX_PEND_PRIV_SIZE to at least sizeof(struct smc_llc_tx_pend)");
184 /* high-level API to send LLC confirm link */
185 int smc_llc_send_confirm_link(struct smc_link *link,
186 enum smc_llc_reqresp reqresp)
188 struct smc_link_group *lgr = smc_get_lgr(link);
189 struct smc_llc_msg_confirm_link *confllc;
190 struct smc_wr_tx_pend_priv *pend;
191 struct smc_wr_buf *wr_buf;
194 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
197 confllc = (struct smc_llc_msg_confirm_link *)wr_buf;
198 memset(confllc, 0, sizeof(*confllc));
199 confllc->hd.common.type = SMC_LLC_CONFIRM_LINK;
200 confllc->hd.length = sizeof(struct smc_llc_msg_confirm_link);
201 confllc->hd.flags |= SMC_LLC_FLAG_NO_RMBE_EYEC;
202 if (reqresp == SMC_LLC_RESP)
203 confllc->hd.flags |= SMC_LLC_FLAG_RESP;
204 memcpy(confllc->sender_mac, link->smcibdev->mac[link->ibport - 1],
206 memcpy(confllc->sender_gid, link->gid, SMC_GID_SIZE);
207 hton24(confllc->sender_qp_num, link->roce_qp->qp_num);
208 confllc->link_num = link->link_id;
209 memcpy(confllc->link_uid, lgr->id, SMC_LGR_ID_SIZE);
210 confllc->max_links = SMC_LLC_ADD_LNK_MAX_LINKS; /* enforce peer resp. */
211 /* send llc message */
212 rc = smc_wr_tx_send(link, pend);
216 /* send LLC confirm rkey request */
217 static int smc_llc_send_confirm_rkey(struct smc_link *link,
218 struct smc_buf_desc *rmb_desc)
220 struct smc_llc_msg_confirm_rkey *rkeyllc;
221 struct smc_wr_tx_pend_priv *pend;
222 struct smc_wr_buf *wr_buf;
225 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
228 rkeyllc = (struct smc_llc_msg_confirm_rkey *)wr_buf;
229 memset(rkeyllc, 0, sizeof(*rkeyllc));
230 rkeyllc->hd.common.type = SMC_LLC_CONFIRM_RKEY;
231 rkeyllc->hd.length = sizeof(struct smc_llc_msg_confirm_rkey);
232 rkeyllc->rtoken[0].rmb_key =
233 htonl(rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey);
234 rkeyllc->rtoken[0].rmb_vaddr = cpu_to_be64(
235 (u64)sg_dma_address(rmb_desc->sgt[SMC_SINGLE_LINK].sgl));
236 /* send llc message */
237 rc = smc_wr_tx_send(link, pend);
241 /* send LLC delete rkey request */
242 static int smc_llc_send_delete_rkey(struct smc_link *link,
243 struct smc_buf_desc *rmb_desc)
245 struct smc_llc_msg_delete_rkey *rkeyllc;
246 struct smc_wr_tx_pend_priv *pend;
247 struct smc_wr_buf *wr_buf;
250 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
253 rkeyllc = (struct smc_llc_msg_delete_rkey *)wr_buf;
254 memset(rkeyllc, 0, sizeof(*rkeyllc));
255 rkeyllc->hd.common.type = SMC_LLC_DELETE_RKEY;
256 rkeyllc->hd.length = sizeof(struct smc_llc_msg_delete_rkey);
257 rkeyllc->num_rkeys = 1;
258 rkeyllc->rkey[0] = htonl(rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey);
259 /* send llc message */
260 rc = smc_wr_tx_send(link, pend);
264 /* prepare an add link message */
265 static void smc_llc_prep_add_link(struct smc_llc_msg_add_link *addllc,
266 struct smc_link *link, u8 mac[], u8 gid[],
267 enum smc_llc_reqresp reqresp)
269 memset(addllc, 0, sizeof(*addllc));
270 addllc->hd.common.type = SMC_LLC_ADD_LINK;
271 addllc->hd.length = sizeof(struct smc_llc_msg_add_link);
272 if (reqresp == SMC_LLC_RESP) {
273 addllc->hd.flags |= SMC_LLC_FLAG_RESP;
274 /* always reject more links for now */
275 addllc->hd.flags |= SMC_LLC_FLAG_ADD_LNK_REJ;
276 addllc->hd.add_link_rej_rsn = SMC_LLC_REJ_RSN_NO_ALT_PATH;
278 memcpy(addllc->sender_mac, mac, ETH_ALEN);
279 memcpy(addllc->sender_gid, gid, SMC_GID_SIZE);
282 /* send ADD LINK request or response */
283 int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[],
284 enum smc_llc_reqresp reqresp)
286 struct smc_llc_msg_add_link *addllc;
287 struct smc_wr_tx_pend_priv *pend;
288 struct smc_wr_buf *wr_buf;
291 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
294 addllc = (struct smc_llc_msg_add_link *)wr_buf;
295 smc_llc_prep_add_link(addllc, link, mac, gid, reqresp);
296 /* send llc message */
297 rc = smc_wr_tx_send(link, pend);
301 /* prepare a delete link message */
302 static void smc_llc_prep_delete_link(struct smc_llc_msg_del_link *delllc,
303 struct smc_link *link,
304 enum smc_llc_reqresp reqresp, bool orderly)
306 memset(delllc, 0, sizeof(*delllc));
307 delllc->hd.common.type = SMC_LLC_DELETE_LINK;
308 delllc->hd.length = sizeof(struct smc_llc_msg_add_link);
309 if (reqresp == SMC_LLC_RESP)
310 delllc->hd.flags |= SMC_LLC_FLAG_RESP;
311 /* DEL_LINK_ALL because only 1 link supported */
312 delllc->hd.flags |= SMC_LLC_FLAG_DEL_LINK_ALL;
314 delllc->hd.flags |= SMC_LLC_FLAG_DEL_LINK_ORDERLY;
315 delllc->link_num = link->link_id;
318 /* send DELETE LINK request or response */
319 int smc_llc_send_delete_link(struct smc_link *link,
320 enum smc_llc_reqresp reqresp, bool orderly)
322 struct smc_llc_msg_del_link *delllc;
323 struct smc_wr_tx_pend_priv *pend;
324 struct smc_wr_buf *wr_buf;
327 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
330 delllc = (struct smc_llc_msg_del_link *)wr_buf;
331 smc_llc_prep_delete_link(delllc, link, reqresp, orderly);
332 /* send llc message */
333 rc = smc_wr_tx_send(link, pend);
337 /* send LLC test link request */
338 static int smc_llc_send_test_link(struct smc_link *link, u8 user_data[16])
340 struct smc_llc_msg_test_link *testllc;
341 struct smc_wr_tx_pend_priv *pend;
342 struct smc_wr_buf *wr_buf;
345 rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
348 testllc = (struct smc_llc_msg_test_link *)wr_buf;
349 memset(testllc, 0, sizeof(*testllc));
350 testllc->hd.common.type = SMC_LLC_TEST_LINK;
351 testllc->hd.length = sizeof(struct smc_llc_msg_test_link);
352 memcpy(testllc->user_data, user_data, sizeof(testllc->user_data));
353 /* send llc message */
354 rc = smc_wr_tx_send(link, pend);
358 struct smc_llc_send_work {
359 struct work_struct work;
360 struct smc_link *link;
362 union smc_llc_msg llcbuf;
365 /* worker that sends a prepared message */
366 static void smc_llc_send_message_work(struct work_struct *work)
368 struct smc_llc_send_work *llcwrk = container_of(work,
369 struct smc_llc_send_work, work);
370 struct smc_wr_tx_pend_priv *pend;
371 struct smc_wr_buf *wr_buf;
374 if (llcwrk->link->state == SMC_LNK_INACTIVE)
376 rc = smc_llc_add_pending_send(llcwrk->link, &wr_buf, &pend);
379 memcpy(wr_buf, &llcwrk->llcbuf, llcwrk->llclen);
380 smc_wr_tx_send(llcwrk->link, pend);
385 /* copy llcbuf and schedule an llc send on link */
386 static int smc_llc_send_message(struct smc_link *link, void *llcbuf, int llclen)
388 struct smc_llc_send_work *wrk = kmalloc(sizeof(*wrk), GFP_ATOMIC);
392 INIT_WORK(&wrk->work, smc_llc_send_message_work);
394 wrk->llclen = llclen;
395 memcpy(&wrk->llcbuf, llcbuf, llclen);
396 queue_work(link->llc_wq, &wrk->work);
400 /********************************* receive ***********************************/
402 static void smc_llc_rx_confirm_link(struct smc_link *link,
403 struct smc_llc_msg_confirm_link *llc)
405 struct smc_link_group *lgr = smc_get_lgr(link);
408 /* RMBE eyecatchers are not supported */
409 if (llc->hd.flags & SMC_LLC_FLAG_NO_RMBE_EYEC)
414 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
415 if (lgr->role == SMC_SERV &&
416 link->state == SMC_LNK_ACTIVATING) {
417 link->llc_confirm_resp_rc = conf_rc;
418 complete(&link->llc_confirm_resp);
421 if (lgr->role == SMC_CLNT &&
422 link->state == SMC_LNK_ACTIVATING) {
423 link->llc_confirm_rc = conf_rc;
424 link->link_id = llc->link_num;
425 complete(&link->llc_confirm);
430 static void smc_llc_rx_add_link(struct smc_link *link,
431 struct smc_llc_msg_add_link *llc)
433 struct smc_link_group *lgr = smc_get_lgr(link);
435 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
436 if (link->state == SMC_LNK_ACTIVATING)
437 complete(&link->llc_add_resp);
439 if (link->state == SMC_LNK_ACTIVATING) {
440 complete(&link->llc_add);
444 if (lgr->role == SMC_SERV) {
445 smc_llc_prep_add_link(llc, link,
446 link->smcibdev->mac[link->ibport - 1],
447 link->gid, SMC_LLC_REQ);
450 smc_llc_prep_add_link(llc, link,
451 link->smcibdev->mac[link->ibport - 1],
452 link->gid, SMC_LLC_RESP);
454 smc_llc_send_message(link, llc, sizeof(*llc));
458 static void smc_llc_rx_delete_link(struct smc_link *link,
459 struct smc_llc_msg_del_link *llc)
461 struct smc_link_group *lgr = smc_get_lgr(link);
463 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
464 if (lgr->role == SMC_SERV)
465 smc_lgr_schedule_free_work_fast(lgr);
468 smc_llc_link_deleting(link);
469 if (lgr->role == SMC_SERV) {
470 /* client asks to delete this link, send request */
471 smc_llc_prep_delete_link(llc, link, SMC_LLC_REQ, true);
473 /* server requests to delete this link, send response */
474 smc_llc_prep_delete_link(llc, link, SMC_LLC_RESP, true);
476 smc_llc_send_message(link, llc, sizeof(*llc));
477 smc_lgr_schedule_free_work_fast(lgr);
481 static void smc_llc_rx_test_link(struct smc_link *link,
482 struct smc_llc_msg_test_link *llc)
484 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
485 if (link->state == SMC_LNK_ACTIVE)
486 complete(&link->llc_testlink_resp);
488 llc->hd.flags |= SMC_LLC_FLAG_RESP;
489 smc_llc_send_message(link, llc, sizeof(*llc));
493 static void smc_llc_rx_confirm_rkey(struct smc_link *link,
494 struct smc_llc_msg_confirm_rkey *llc)
498 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
499 link->llc_confirm_rkey_rc = llc->hd.flags &
500 SMC_LLC_FLAG_RKEY_NEG;
501 complete(&link->llc_confirm_rkey);
503 rc = smc_rtoken_add(smc_get_lgr(link),
504 llc->rtoken[0].rmb_vaddr,
505 llc->rtoken[0].rmb_key);
507 /* ignore rtokens for other links, we have only one link */
509 llc->hd.flags |= SMC_LLC_FLAG_RESP;
511 llc->hd.flags |= SMC_LLC_FLAG_RKEY_NEG;
512 smc_llc_send_message(link, llc, sizeof(*llc));
516 static void smc_llc_rx_confirm_rkey_cont(struct smc_link *link,
517 struct smc_llc_msg_confirm_rkey_cont *llc)
519 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
520 /* unused as long as we don't send this type of msg */
522 /* ignore rtokens for other links, we have only one link */
523 llc->hd.flags |= SMC_LLC_FLAG_RESP;
524 smc_llc_send_message(link, llc, sizeof(*llc));
528 static void smc_llc_rx_delete_rkey(struct smc_link *link,
529 struct smc_llc_msg_delete_rkey *llc)
534 if (llc->hd.flags & SMC_LLC_FLAG_RESP) {
535 link->llc_delete_rkey_rc = llc->hd.flags &
536 SMC_LLC_FLAG_RKEY_NEG;
537 complete(&link->llc_delete_rkey);
539 max = min_t(u8, llc->num_rkeys, SMC_LLC_DEL_RKEY_MAX);
540 for (i = 0; i < max; i++) {
541 if (smc_rtoken_delete(smc_get_lgr(link), llc->rkey[i]))
542 err_mask |= 1 << (SMC_LLC_DEL_RKEY_MAX - 1 - i);
546 llc->hd.flags |= SMC_LLC_FLAG_RKEY_NEG;
547 llc->err_mask = err_mask;
550 llc->hd.flags |= SMC_LLC_FLAG_RESP;
551 smc_llc_send_message(link, llc, sizeof(*llc));
555 static void smc_llc_rx_handler(struct ib_wc *wc, void *buf)
557 struct smc_link *link = (struct smc_link *)wc->qp->qp_context;
558 union smc_llc_msg *llc = buf;
560 if (wc->byte_len < sizeof(*llc))
561 return; /* short message */
562 if (llc->raw.hdr.length != sizeof(*llc))
563 return; /* invalid message */
564 if (link->state == SMC_LNK_INACTIVE)
565 return; /* link not active, drop msg */
567 switch (llc->raw.hdr.common.type) {
568 case SMC_LLC_TEST_LINK:
569 smc_llc_rx_test_link(link, &llc->test_link);
571 case SMC_LLC_CONFIRM_LINK:
572 smc_llc_rx_confirm_link(link, &llc->confirm_link);
574 case SMC_LLC_ADD_LINK:
575 smc_llc_rx_add_link(link, &llc->add_link);
577 case SMC_LLC_DELETE_LINK:
578 smc_llc_rx_delete_link(link, &llc->delete_link);
580 case SMC_LLC_CONFIRM_RKEY:
581 smc_llc_rx_confirm_rkey(link, &llc->confirm_rkey);
583 case SMC_LLC_CONFIRM_RKEY_CONT:
584 smc_llc_rx_confirm_rkey_cont(link, &llc->confirm_rkey_cont);
586 case SMC_LLC_DELETE_RKEY:
587 smc_llc_rx_delete_rkey(link, &llc->delete_rkey);
592 /***************************** worker, utils *********************************/
594 static void smc_llc_testlink_work(struct work_struct *work)
596 struct smc_link *link = container_of(to_delayed_work(work),
597 struct smc_link, llc_testlink_wrk);
598 unsigned long next_interval;
599 unsigned long expire_time;
600 u8 user_data[16] = { 0 };
603 if (link->state != SMC_LNK_ACTIVE)
604 return; /* don't reschedule worker */
605 expire_time = link->wr_rx_tstamp + link->llc_testlink_time;
606 if (time_is_after_jiffies(expire_time)) {
607 next_interval = expire_time - jiffies;
610 reinit_completion(&link->llc_testlink_resp);
611 smc_llc_send_test_link(link, user_data);
612 /* receive TEST LINK response over RoCE fabric */
613 rc = wait_for_completion_interruptible_timeout(&link->llc_testlink_resp,
616 smc_lgr_terminate(smc_get_lgr(link));
619 next_interval = link->llc_testlink_time;
621 queue_delayed_work(link->llc_wq, &link->llc_testlink_wrk,
625 int smc_llc_link_init(struct smc_link *link)
627 struct smc_link_group *lgr = smc_get_lgr(link);
628 link->llc_wq = alloc_ordered_workqueue("llc_wq-%x:%x)", WQ_MEM_RECLAIM,
633 init_completion(&link->llc_confirm);
634 init_completion(&link->llc_confirm_resp);
635 init_completion(&link->llc_add);
636 init_completion(&link->llc_add_resp);
637 init_completion(&link->llc_confirm_rkey);
638 init_completion(&link->llc_delete_rkey);
639 mutex_init(&link->llc_delete_rkey_mutex);
640 init_completion(&link->llc_testlink_resp);
641 INIT_DELAYED_WORK(&link->llc_testlink_wrk, smc_llc_testlink_work);
645 void smc_llc_link_active(struct smc_link *link, int testlink_time)
647 link->state = SMC_LNK_ACTIVE;
649 link->llc_testlink_time = testlink_time * HZ;
650 queue_delayed_work(link->llc_wq, &link->llc_testlink_wrk,
651 link->llc_testlink_time);
655 void smc_llc_link_deleting(struct smc_link *link)
657 link->state = SMC_LNK_DELETING;
660 /* called in tasklet context */
661 void smc_llc_link_inactive(struct smc_link *link)
663 link->state = SMC_LNK_INACTIVE;
664 cancel_delayed_work(&link->llc_testlink_wrk);
667 /* called in worker context */
668 void smc_llc_link_clear(struct smc_link *link)
670 flush_workqueue(link->llc_wq);
671 destroy_workqueue(link->llc_wq);
674 /* register a new rtoken at the remote peer */
675 int smc_llc_do_confirm_rkey(struct smc_link *link,
676 struct smc_buf_desc *rmb_desc)
680 /* protected by mutex smc_create_lgr_pending */
681 reinit_completion(&link->llc_confirm_rkey);
682 rc = smc_llc_send_confirm_rkey(link, rmb_desc);
685 /* receive CONFIRM RKEY response from server over RoCE fabric */
686 rc = wait_for_completion_interruptible_timeout(&link->llc_confirm_rkey,
688 if (rc <= 0 || link->llc_confirm_rkey_rc)
693 /* unregister an rtoken at the remote peer */
694 int smc_llc_do_delete_rkey(struct smc_link *link,
695 struct smc_buf_desc *rmb_desc)
699 mutex_lock(&link->llc_delete_rkey_mutex);
700 reinit_completion(&link->llc_delete_rkey);
701 rc = smc_llc_send_delete_rkey(link, rmb_desc);
704 /* receive DELETE RKEY response from server over RoCE fabric */
705 rc = wait_for_completion_interruptible_timeout(&link->llc_delete_rkey,
707 if (rc <= 0 || link->llc_delete_rkey_rc)
712 mutex_unlock(&link->llc_delete_rkey_mutex);
716 /***************************** init, exit, misc ******************************/
718 static struct smc_wr_rx_handler smc_llc_rx_handlers[] = {
720 .handler = smc_llc_rx_handler,
721 .type = SMC_LLC_CONFIRM_LINK
724 .handler = smc_llc_rx_handler,
725 .type = SMC_LLC_TEST_LINK
728 .handler = smc_llc_rx_handler,
729 .type = SMC_LLC_ADD_LINK
732 .handler = smc_llc_rx_handler,
733 .type = SMC_LLC_DELETE_LINK
736 .handler = smc_llc_rx_handler,
737 .type = SMC_LLC_CONFIRM_RKEY
740 .handler = smc_llc_rx_handler,
741 .type = SMC_LLC_CONFIRM_RKEY_CONT
744 .handler = smc_llc_rx_handler,
745 .type = SMC_LLC_DELETE_RKEY
752 int __init smc_llc_init(void)
754 struct smc_wr_rx_handler *handler;
757 for (handler = smc_llc_rx_handlers; handler->handler; handler++) {
758 INIT_HLIST_NODE(&handler->list);
759 rc = smc_wr_rx_register_handler(handler);