1 // SPDX-License-Identifier: GPL-2.0
3 * Shared Memory Communications over RDMA (SMC-R) and RoCE
5 * Basic Transport Functions exploiting Infiniband API
7 * Copyright IBM Corp. 2016
9 * Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com>
12 #include <linux/socket.h>
13 #include <linux/if_vlan.h>
14 #include <linux/random.h>
15 #include <linux/workqueue.h>
18 #include <rdma/ib_verbs.h>
27 #include "smc_close.h"
29 #define SMC_LGR_NUM_INCR 256
30 #define SMC_LGR_FREE_DELAY_SERV (600 * HZ)
31 #define SMC_LGR_FREE_DELAY_CLNT (SMC_LGR_FREE_DELAY_SERV + 10)
33 static u32 smc_lgr_num
; /* unique link group number */
35 /* Register connection's alert token in our lookup structure.
36 * To use rbtrees we have to implement our own insert core.
37 * Requires @conns_lock
38 * @smc connection to register
39 * Returns 0 on success, != otherwise.
41 static void smc_lgr_add_alert_token(struct smc_connection
*conn
)
43 struct rb_node
**link
, *parent
= NULL
;
44 u32 token
= conn
->alert_token_local
;
46 link
= &conn
->lgr
->conns_all
.rb_node
;
48 struct smc_connection
*cur
= rb_entry(*link
,
49 struct smc_connection
, alert_node
);
52 if (cur
->alert_token_local
> token
)
53 link
= &parent
->rb_left
;
55 link
= &parent
->rb_right
;
57 /* Put the new node there */
58 rb_link_node(&conn
->alert_node
, parent
, link
);
59 rb_insert_color(&conn
->alert_node
, &conn
->lgr
->conns_all
);
62 /* Register connection in link group by assigning an alert token
63 * registered in a search tree.
64 * Requires @conns_lock
65 * Note that '0' is a reserved value and not assigned.
67 static void smc_lgr_register_conn(struct smc_connection
*conn
)
69 struct smc_sock
*smc
= container_of(conn
, struct smc_sock
, conn
);
70 static atomic_t nexttoken
= ATOMIC_INIT(0);
72 /* find a new alert_token_local value not yet used by some connection
75 sock_hold(&smc
->sk
); /* sock_put in smc_lgr_unregister_conn() */
76 while (!conn
->alert_token_local
) {
77 conn
->alert_token_local
= atomic_inc_return(&nexttoken
);
78 if (smc_lgr_find_conn(conn
->alert_token_local
, conn
->lgr
))
79 conn
->alert_token_local
= 0;
81 smc_lgr_add_alert_token(conn
);
82 conn
->lgr
->conns_num
++;
85 /* Unregister connection and reset the alert token of the given connection<
87 static void __smc_lgr_unregister_conn(struct smc_connection
*conn
)
89 struct smc_sock
*smc
= container_of(conn
, struct smc_sock
, conn
);
90 struct smc_link_group
*lgr
= conn
->lgr
;
92 rb_erase(&conn
->alert_node
, &lgr
->conns_all
);
94 conn
->alert_token_local
= 0;
96 sock_put(&smc
->sk
); /* sock_hold in smc_lgr_register_conn() */
99 /* Unregister connection and trigger lgr freeing if applicable
101 static void smc_lgr_unregister_conn(struct smc_connection
*conn
)
103 struct smc_link_group
*lgr
= conn
->lgr
;
106 write_lock_bh(&lgr
->conns_lock
);
107 if (conn
->alert_token_local
) {
109 __smc_lgr_unregister_conn(conn
);
111 write_unlock_bh(&lgr
->conns_lock
);
112 if (!reduced
|| lgr
->conns_num
)
114 /* client link group creation always follows the server link group
115 * creation. For client use a somewhat higher removal delay time,
116 * otherwise there is a risk of out-of-sync link groups.
118 mod_delayed_work(system_wq
, &lgr
->free_work
,
119 lgr
->role
== SMC_CLNT
? SMC_LGR_FREE_DELAY_CLNT
:
120 SMC_LGR_FREE_DELAY_SERV
);
123 static void smc_lgr_free_work(struct work_struct
*work
)
125 struct smc_link_group
*lgr
= container_of(to_delayed_work(work
),
126 struct smc_link_group
,
130 spin_lock_bh(&smc_lgr_list
.lock
);
131 if (list_empty(&lgr
->list
))
133 read_lock_bh(&lgr
->conns_lock
);
134 conns
= RB_EMPTY_ROOT(&lgr
->conns_all
);
135 read_unlock_bh(&lgr
->conns_lock
);
136 if (!conns
) { /* number of lgr connections is no longer zero */
137 spin_unlock_bh(&smc_lgr_list
.lock
);
140 list_del_init(&lgr
->list
); /* remove from smc_lgr_list */
142 spin_unlock_bh(&smc_lgr_list
.lock
);
146 /* create a new SMC link group */
147 static int smc_lgr_create(struct smc_sock
*smc
, __be32 peer_in_addr
,
148 struct smc_ib_device
*smcibdev
, u8 ibport
,
149 char *peer_systemid
, unsigned short vlan_id
)
151 struct smc_link_group
*lgr
;
152 struct smc_link
*lnk
;
157 lgr
= kzalloc(sizeof(*lgr
), GFP_KERNEL
);
162 lgr
->role
= smc
->listen_smc
? SMC_SERV
: SMC_CLNT
;
163 lgr
->sync_err
= false;
164 lgr
->daddr
= peer_in_addr
;
165 memcpy(lgr
->peer_systemid
, peer_systemid
, SMC_SYSTEMID_LEN
);
166 lgr
->vlan_id
= vlan_id
;
167 rwlock_init(&lgr
->sndbufs_lock
);
168 rwlock_init(&lgr
->rmbs_lock
);
169 for (i
= 0; i
< SMC_RMBE_SIZES
; i
++) {
170 INIT_LIST_HEAD(&lgr
->sndbufs
[i
]);
171 INIT_LIST_HEAD(&lgr
->rmbs
[i
]);
173 smc_lgr_num
+= SMC_LGR_NUM_INCR
;
174 memcpy(&lgr
->id
, (u8
*)&smc_lgr_num
, SMC_LGR_ID_SIZE
);
175 INIT_DELAYED_WORK(&lgr
->free_work
, smc_lgr_free_work
);
176 lgr
->conns_all
= RB_ROOT
;
178 lnk
= &lgr
->lnk
[SMC_SINGLE_LINK
];
179 /* initialize link */
180 lnk
->smcibdev
= smcibdev
;
181 lnk
->ibport
= ibport
;
182 lnk
->path_mtu
= smcibdev
->pattr
[ibport
- 1].active_mtu
;
183 if (!smcibdev
->initialized
)
184 smc_ib_setup_per_ibdev(smcibdev
);
185 get_random_bytes(rndvec
, sizeof(rndvec
));
186 lnk
->psn_initial
= rndvec
[0] + (rndvec
[1] << 8) + (rndvec
[2] << 16);
187 rc
= smc_wr_alloc_link_mem(lnk
);
190 rc
= smc_ib_create_protection_domain(lnk
);
193 rc
= smc_ib_create_queue_pair(lnk
);
196 rc
= smc_wr_create_link(lnk
);
199 init_completion(&lnk
->llc_confirm
);
200 init_completion(&lnk
->llc_confirm_resp
);
203 rwlock_init(&lgr
->conns_lock
);
204 spin_lock_bh(&smc_lgr_list
.lock
);
205 list_add(&lgr
->list
, &smc_lgr_list
.list
);
206 spin_unlock_bh(&smc_lgr_list
.lock
);
210 smc_ib_destroy_queue_pair(lnk
);
212 smc_ib_dealloc_protection_domain(lnk
);
214 smc_wr_free_link_mem(lnk
);
221 static void smc_buf_unuse(struct smc_connection
*conn
)
223 if (conn
->sndbuf_desc
) {
224 conn
->sndbuf_desc
->used
= 0;
225 conn
->sndbuf_size
= 0;
227 if (conn
->rmb_desc
) {
228 conn
->rmb_desc
->reused
= true;
229 conn
->rmb_desc
->used
= 0;
234 /* remove a finished connection from its link group */
235 void smc_conn_free(struct smc_connection
*conn
)
239 smc_cdc_tx_dismiss_slots(conn
);
240 smc_lgr_unregister_conn(conn
);
244 static void smc_link_clear(struct smc_link
*lnk
)
247 smc_ib_modify_qp_reset(lnk
);
248 smc_wr_free_link(lnk
);
249 smc_ib_destroy_queue_pair(lnk
);
250 smc_ib_dealloc_protection_domain(lnk
);
251 smc_wr_free_link_mem(lnk
);
254 static void smc_buf_free(struct smc_buf_desc
*buf_desc
, struct smc_link
*lnk
,
258 if (buf_desc
->mr_rx
[SMC_SINGLE_LINK
])
259 smc_ib_put_memory_region(
260 buf_desc
->mr_rx
[SMC_SINGLE_LINK
]);
261 smc_ib_buf_unmap_sg(lnk
->smcibdev
, buf_desc
,
264 smc_ib_buf_unmap_sg(lnk
->smcibdev
, buf_desc
,
267 sg_free_table(&buf_desc
->sgt
[SMC_SINGLE_LINK
]);
268 if (buf_desc
->cpu_addr
)
269 free_pages((unsigned long)buf_desc
->cpu_addr
, buf_desc
->order
);
273 static void __smc_lgr_free_bufs(struct smc_link_group
*lgr
, bool is_rmb
)
275 struct smc_link
*lnk
= &lgr
->lnk
[SMC_SINGLE_LINK
];
276 struct smc_buf_desc
*buf_desc
, *bf_desc
;
277 struct list_head
*buf_list
;
280 for (i
= 0; i
< SMC_RMBE_SIZES
; i
++) {
282 buf_list
= &lgr
->rmbs
[i
];
284 buf_list
= &lgr
->sndbufs
[i
];
285 list_for_each_entry_safe(buf_desc
, bf_desc
, buf_list
,
287 list_del(&buf_desc
->list
);
288 smc_buf_free(buf_desc
, lnk
, is_rmb
);
293 static void smc_lgr_free_bufs(struct smc_link_group
*lgr
)
295 /* free send buffers */
296 __smc_lgr_free_bufs(lgr
, false);
298 __smc_lgr_free_bufs(lgr
, true);
301 /* remove a link group */
302 void smc_lgr_free(struct smc_link_group
*lgr
)
304 smc_lgr_free_bufs(lgr
);
305 smc_link_clear(&lgr
->lnk
[SMC_SINGLE_LINK
]);
309 /* terminate linkgroup abnormally */
310 void smc_lgr_terminate(struct smc_link_group
*lgr
)
312 struct smc_connection
*conn
;
313 struct smc_sock
*smc
;
314 struct rb_node
*node
;
316 spin_lock_bh(&smc_lgr_list
.lock
);
317 if (list_empty(&lgr
->list
)) {
318 /* termination already triggered */
319 spin_unlock_bh(&smc_lgr_list
.lock
);
322 /* do not use this link group for new connections */
323 list_del_init(&lgr
->list
);
324 spin_unlock_bh(&smc_lgr_list
.lock
);
326 write_lock_bh(&lgr
->conns_lock
);
327 node
= rb_first(&lgr
->conns_all
);
329 conn
= rb_entry(node
, struct smc_connection
, alert_node
);
330 smc
= container_of(conn
, struct smc_sock
, conn
);
331 sock_hold(&smc
->sk
); /* sock_put in close work */
332 conn
->local_tx_ctrl
.conn_state_flags
.peer_conn_abort
= 1;
333 __smc_lgr_unregister_conn(conn
);
334 write_unlock_bh(&lgr
->conns_lock
);
335 if (!schedule_work(&conn
->close_work
))
337 write_lock_bh(&lgr
->conns_lock
);
338 node
= rb_first(&lgr
->conns_all
);
340 write_unlock_bh(&lgr
->conns_lock
);
341 wake_up(&lgr
->lnk
[SMC_SINGLE_LINK
].wr_reg_wait
);
344 /* Determine vlan of internal TCP socket.
345 * @vlan_id: address to store the determined vlan id into
347 static int smc_vlan_by_tcpsk(struct socket
*clcsock
, unsigned short *vlan_id
)
349 struct dst_entry
*dst
= sk_dst_get(clcsock
->sk
);
362 if (is_vlan_dev(dst
->dev
))
363 *vlan_id
= vlan_dev_vlan_id(dst
->dev
);
371 /* determine the link gid matching the vlan id of the link group */
372 static int smc_link_determine_gid(struct smc_link_group
*lgr
)
374 struct smc_link
*lnk
= &lgr
->lnk
[SMC_SINGLE_LINK
];
375 struct ib_gid_attr gattr
;
380 lnk
->gid
= lnk
->smcibdev
->gid
[lnk
->ibport
- 1];
384 for (i
= 0; i
< lnk
->smcibdev
->pattr
[lnk
->ibport
- 1].gid_tbl_len
;
386 if (ib_query_gid(lnk
->smcibdev
->ibdev
, lnk
->ibport
, i
, &gid
,
390 if (is_vlan_dev(gattr
.ndev
) &&
391 vlan_dev_vlan_id(gattr
.ndev
) == lgr
->vlan_id
) {
402 /* create a new SMC connection (and a new link group if necessary) */
403 int smc_conn_create(struct smc_sock
*smc
, __be32 peer_in_addr
,
404 struct smc_ib_device
*smcibdev
, u8 ibport
,
405 struct smc_clc_msg_local
*lcl
, int srv_first_contact
)
407 struct smc_connection
*conn
= &smc
->conn
;
408 struct smc_link_group
*lgr
;
409 unsigned short vlan_id
;
410 enum smc_lgr_role role
;
411 int local_contact
= SMC_FIRST_CONTACT
;
414 role
= smc
->listen_smc
? SMC_SERV
: SMC_CLNT
;
415 rc
= smc_vlan_by_tcpsk(smc
->clcsock
, &vlan_id
);
419 if ((role
== SMC_CLNT
) && srv_first_contact
)
420 /* create new link group as well */
423 /* determine if an existing link group can be reused */
424 spin_lock_bh(&smc_lgr_list
.lock
);
425 list_for_each_entry(lgr
, &smc_lgr_list
.list
, list
) {
426 write_lock_bh(&lgr
->conns_lock
);
427 if (!memcmp(lgr
->peer_systemid
, lcl
->id_for_peer
,
429 !memcmp(lgr
->lnk
[SMC_SINGLE_LINK
].peer_gid
, &lcl
->gid
,
431 !memcmp(lgr
->lnk
[SMC_SINGLE_LINK
].peer_mac
, lcl
->mac
,
434 (lgr
->role
== role
) &&
435 (lgr
->vlan_id
== vlan_id
) &&
436 ((role
== SMC_CLNT
) ||
437 (lgr
->conns_num
< SMC_RMBS_PER_LGR_MAX
))) {
438 /* link group found */
439 local_contact
= SMC_REUSE_CONTACT
;
441 smc_lgr_register_conn(conn
); /* add smc conn to lgr */
442 write_unlock_bh(&lgr
->conns_lock
);
445 write_unlock_bh(&lgr
->conns_lock
);
447 spin_unlock_bh(&smc_lgr_list
.lock
);
449 if (role
== SMC_CLNT
&& !srv_first_contact
&&
450 (local_contact
== SMC_FIRST_CONTACT
)) {
451 /* Server reuses a link group, but Client wants to start
453 * send out_of_sync decline, reason synchr. error
459 if (local_contact
== SMC_FIRST_CONTACT
) {
460 rc
= smc_lgr_create(smc
, peer_in_addr
, smcibdev
, ibport
,
461 lcl
->id_for_peer
, vlan_id
);
464 smc_lgr_register_conn(conn
); /* add smc conn to lgr */
465 rc
= smc_link_determine_gid(conn
->lgr
);
467 conn
->local_tx_ctrl
.common
.type
= SMC_CDC_MSG_TYPE
;
468 conn
->local_tx_ctrl
.len
= sizeof(struct smc_cdc_msg
);
469 #ifndef KERNEL_HAS_ATOMIC64
470 spin_lock_init(&conn
->acurs_lock
);
474 return rc
? rc
: local_contact
;
477 /* try to reuse a sndbuf or rmb description slot for a certain
478 * buffer size; if not available, return NULL
481 struct smc_buf_desc
*smc_buf_get_slot(struct smc_link_group
*lgr
,
482 int compressed_bufsize
,
484 struct list_head
*buf_list
)
486 struct smc_buf_desc
*buf_slot
;
489 list_for_each_entry(buf_slot
, buf_list
, list
) {
490 if (cmpxchg(&buf_slot
->used
, 0, 1) == 0) {
491 read_unlock_bh(lock
);
495 read_unlock_bh(lock
);
499 /* one of the conditions for announcing a receiver's current window size is
500 * that it "results in a minimum increase in the window size of 10% of the
501 * receive buffer space" [RFC7609]
503 static inline int smc_rmb_wnd_update_limit(int rmbe_size
)
505 return min_t(int, rmbe_size
/ 10, SOCK_MIN_SNDBUF
/ 2);
508 static struct smc_buf_desc
*smc_new_buf_create(struct smc_link_group
*lgr
,
509 bool is_rmb
, int bufsize
)
511 struct smc_buf_desc
*buf_desc
;
512 struct smc_link
*lnk
;
515 /* try to alloc a new buffer */
516 buf_desc
= kzalloc(sizeof(*buf_desc
), GFP_KERNEL
);
518 return ERR_PTR(-ENOMEM
);
521 (void *)__get_free_pages(GFP_KERNEL
| __GFP_NOWARN
|
523 __GFP_NORETRY
| __GFP_ZERO
,
525 if (!buf_desc
->cpu_addr
) {
527 return ERR_PTR(-EAGAIN
);
529 buf_desc
->order
= get_order(bufsize
);
531 /* build the sg table from the pages */
532 lnk
= &lgr
->lnk
[SMC_SINGLE_LINK
];
533 rc
= sg_alloc_table(&buf_desc
->sgt
[SMC_SINGLE_LINK
], 1,
536 smc_buf_free(buf_desc
, lnk
, is_rmb
);
539 sg_set_buf(buf_desc
->sgt
[SMC_SINGLE_LINK
].sgl
,
540 buf_desc
->cpu_addr
, bufsize
);
542 /* map sg table to DMA address */
543 rc
= smc_ib_buf_map_sg(lnk
->smcibdev
, buf_desc
,
544 is_rmb
? DMA_FROM_DEVICE
: DMA_TO_DEVICE
);
545 /* SMC protocol depends on mapping to one DMA address only */
547 smc_buf_free(buf_desc
, lnk
, is_rmb
);
548 return ERR_PTR(-EAGAIN
);
551 /* create a new memory region for the RMB */
553 rc
= smc_ib_get_memory_region(lnk
->roce_pd
,
554 IB_ACCESS_REMOTE_WRITE
|
555 IB_ACCESS_LOCAL_WRITE
,
558 smc_buf_free(buf_desc
, lnk
, is_rmb
);
566 static int __smc_buf_create(struct smc_sock
*smc
, bool is_rmb
)
568 struct smc_connection
*conn
= &smc
->conn
;
569 struct smc_link_group
*lgr
= conn
->lgr
;
570 struct smc_buf_desc
*buf_desc
= ERR_PTR(-ENOMEM
);
571 struct list_head
*buf_list
;
572 int bufsize
, bufsize_short
;
577 /* use socket recv buffer size (w/o overhead) as start value */
578 sk_buf_size
= smc
->sk
.sk_rcvbuf
/ 2;
580 /* use socket send buffer size (w/o overhead) as start value */
581 sk_buf_size
= smc
->sk
.sk_sndbuf
/ 2;
583 for (bufsize_short
= smc_compress_bufsize(sk_buf_size
);
584 bufsize_short
>= 0; bufsize_short
--) {
587 lock
= &lgr
->rmbs_lock
;
588 buf_list
= &lgr
->rmbs
[bufsize_short
];
590 lock
= &lgr
->sndbufs_lock
;
591 buf_list
= &lgr
->sndbufs
[bufsize_short
];
593 bufsize
= smc_uncompress_bufsize(bufsize_short
);
594 if ((1 << get_order(bufsize
)) > SG_MAX_SINGLE_ALLOC
)
597 /* check for reusable slot in the link group */
598 buf_desc
= smc_buf_get_slot(lgr
, bufsize_short
, lock
, buf_list
);
600 memset(buf_desc
->cpu_addr
, 0, bufsize
);
601 break; /* found reusable slot */
604 buf_desc
= smc_new_buf_create(lgr
, is_rmb
, bufsize
);
605 if (PTR_ERR(buf_desc
) == -ENOMEM
)
607 if (IS_ERR(buf_desc
))
612 list_add(&buf_desc
->list
, buf_list
);
613 write_unlock_bh(lock
);
617 if (IS_ERR(buf_desc
))
621 conn
->rmb_desc
= buf_desc
;
622 conn
->rmbe_size
= bufsize
;
623 conn
->rmbe_size_short
= bufsize_short
;
624 smc
->sk
.sk_rcvbuf
= bufsize
* 2;
625 atomic_set(&conn
->bytes_to_rcv
, 0);
626 conn
->rmbe_update_limit
= smc_rmb_wnd_update_limit(bufsize
);
628 conn
->sndbuf_desc
= buf_desc
;
629 conn
->sndbuf_size
= bufsize
;
630 smc
->sk
.sk_sndbuf
= bufsize
* 2;
631 atomic_set(&conn
->sndbuf_space
, bufsize
);
636 void smc_sndbuf_sync_sg_for_cpu(struct smc_connection
*conn
)
638 struct smc_link_group
*lgr
= conn
->lgr
;
640 smc_ib_sync_sg_for_cpu(lgr
->lnk
[SMC_SINGLE_LINK
].smcibdev
,
641 conn
->sndbuf_desc
, DMA_TO_DEVICE
);
644 void smc_sndbuf_sync_sg_for_device(struct smc_connection
*conn
)
646 struct smc_link_group
*lgr
= conn
->lgr
;
648 smc_ib_sync_sg_for_device(lgr
->lnk
[SMC_SINGLE_LINK
].smcibdev
,
649 conn
->sndbuf_desc
, DMA_TO_DEVICE
);
652 void smc_rmb_sync_sg_for_cpu(struct smc_connection
*conn
)
654 struct smc_link_group
*lgr
= conn
->lgr
;
656 smc_ib_sync_sg_for_cpu(lgr
->lnk
[SMC_SINGLE_LINK
].smcibdev
,
657 conn
->rmb_desc
, DMA_FROM_DEVICE
);
660 void smc_rmb_sync_sg_for_device(struct smc_connection
*conn
)
662 struct smc_link_group
*lgr
= conn
->lgr
;
664 smc_ib_sync_sg_for_device(lgr
->lnk
[SMC_SINGLE_LINK
].smcibdev
,
665 conn
->rmb_desc
, DMA_FROM_DEVICE
);
668 /* create the send and receive buffer for an SMC socket;
669 * receive buffers are called RMBs;
670 * (even though the SMC protocol allows more than one RMB-element per RMB,
671 * the Linux implementation uses just one RMB-element per RMB, i.e. uses an
672 * extra RMB for every connection in a link group
674 int smc_buf_create(struct smc_sock
*smc
)
678 /* create send buffer */
679 rc
= __smc_buf_create(smc
, false);
683 rc
= __smc_buf_create(smc
, true);
685 smc_buf_free(smc
->conn
.sndbuf_desc
,
686 &smc
->conn
.lgr
->lnk
[SMC_SINGLE_LINK
], false);
690 static inline int smc_rmb_reserve_rtoken_idx(struct smc_link_group
*lgr
)
694 for_each_clear_bit(i
, lgr
->rtokens_used_mask
, SMC_RMBS_PER_LGR_MAX
) {
695 if (!test_and_set_bit(i
, lgr
->rtokens_used_mask
))
701 /* save rkey and dma_addr received from peer during clc handshake */
702 int smc_rmb_rtoken_handling(struct smc_connection
*conn
,
703 struct smc_clc_msg_accept_confirm
*clc
)
705 u64 dma_addr
= be64_to_cpu(clc
->rmb_dma_addr
);
706 struct smc_link_group
*lgr
= conn
->lgr
;
707 u32 rkey
= ntohl(clc
->rmb_rkey
);
710 for (i
= 0; i
< SMC_RMBS_PER_LGR_MAX
; i
++) {
711 if ((lgr
->rtokens
[i
][SMC_SINGLE_LINK
].rkey
== rkey
) &&
712 (lgr
->rtokens
[i
][SMC_SINGLE_LINK
].dma_addr
== dma_addr
) &&
713 test_bit(i
, lgr
->rtokens_used_mask
)) {
714 conn
->rtoken_idx
= i
;
718 conn
->rtoken_idx
= smc_rmb_reserve_rtoken_idx(lgr
);
719 if (conn
->rtoken_idx
< 0)
720 return conn
->rtoken_idx
;
721 lgr
->rtokens
[conn
->rtoken_idx
][SMC_SINGLE_LINK
].rkey
= rkey
;
722 lgr
->rtokens
[conn
->rtoken_idx
][SMC_SINGLE_LINK
].dma_addr
= dma_addr
;