diff options
author | Ursula Braun <ubraun@linux.vnet.ibm.com> | 2017-01-09 16:55:18 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-09 22:07:39 +0100 |
commit | cd6851f30386e5e04b5c2253f8e1647ba0ebcd31 (patch) | |
tree | 9aadc7a36c03303408ebe4d24011be3fcc9b9b6e /net/smc/af_smc.c | |
parent | smc: connection and link group creation (diff) | |
download | linux-cd6851f30386e5e04b5c2253f8e1647ba0ebcd31.tar.xz linux-cd6851f30386e5e04b5c2253f8e1647ba0ebcd31.zip |
smc: remote memory buffers (RMBs)
* allocate data RMB memory for sending and receiving
* size depends on the maximum socket send and receive buffers
* allocated RMBs are kept during life time of the owning link group
* map the allocated RMBs to DMA
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/af_smc.c')
-rw-r--r-- | net/smc/af_smc.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 5fda37decc55..a38f470130d3 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -249,6 +249,8 @@ static void smc_conn_save_peer_info(struct smc_sock *smc, struct smc_clc_msg_accept_confirm *clc) { smc->conn.peer_conn_idx = clc->conn_idx; + smc->conn.peer_rmbe_size = smc_uncompress_bufsize(clc->rmbe_size); + atomic_set(&smc->conn.peer_rmbe_space, smc->conn.peer_rmbe_size); } static void smc_link_save_peer_info(struct smc_link *link, @@ -323,6 +325,18 @@ static int smc_connect_rdma(struct smc_sock *smc) link = &smc->conn.lgr->lnk[SMC_SINGLE_LINK]; smc_conn_save_peer_info(smc, &aclc); + + rc = smc_sndbuf_create(smc); + if (rc) { + reason_code = SMC_CLC_DECL_MEM; + goto decline_rdma_unlock; + } + rc = smc_rmb_create(smc); + if (rc) { + reason_code = SMC_CLC_DECL_MEM; + goto decline_rdma_unlock; + } + if (local_contact == SMC_FIRST_CONTACT) smc_link_save_peer_info(link, &aclc); /* tbd in follow-on patch: more steps to setup RDMA communcication, @@ -598,9 +612,16 @@ static void smc_listen_work(struct work_struct *work) } link = &new_smc->conn.lgr->lnk[SMC_SINGLE_LINK]; - /* tbd in follow-on patch: more steps to setup RDMA communcication, - * create rmbs, map rmbs - */ + rc = smc_sndbuf_create(new_smc); + if (rc) { + reason_code = SMC_CLC_DECL_MEM; + goto decline_rdma; + } + rc = smc_rmb_create(new_smc); + if (rc) { + reason_code = SMC_CLC_DECL_MEM; + goto decline_rdma; + } rc = smc_clc_send_accept(new_smc, local_contact); if (rc) @@ -1047,6 +1068,8 @@ static int smc_create(struct net *net, struct socket *sock, int protocol, IPPROTO_TCP, &smc->clcsock); if (rc) sk_common_release(sk); + smc->sk.sk_sndbuf = max(smc->clcsock->sk->sk_sndbuf, SMC_BUF_MIN_SIZE); + smc->sk.sk_rcvbuf = max(smc->clcsock->sk->sk_rcvbuf, SMC_BUF_MIN_SIZE); out: return rc; |