Lines Matching full:smc

3  *  Shared Memory Communications over RDMA (SMC-R) and RoCE
18 #include "smc.h"
24 void smc_clcsock_release(struct smc_sock *smc) in smc_clcsock_release() argument
28 if (smc->listen_smc && current_work() != &smc->smc_listen_work) in smc_clcsock_release()
29 cancel_work_sync(&smc->smc_listen_work); in smc_clcsock_release()
30 mutex_lock(&smc->clcsock_release_lock); in smc_clcsock_release()
31 if (smc->clcsock) { in smc_clcsock_release()
32 tcp = smc->clcsock; in smc_clcsock_release()
33 smc->clcsock = NULL; in smc_clcsock_release()
36 mutex_unlock(&smc->clcsock_release_lock); in smc_clcsock_release()
49 static void smc_close_stream_wait(struct smc_sock *smc, long timeout) in smc_close_stream_wait() argument
52 struct sock *sk = &smc->sk; in smc_close_stream_wait()
57 if (!smc_tx_prepared_sends(&smc->conn)) in smc_close_stream_wait()
61 smc_tx_pending(&smc->conn); in smc_close_stream_wait()
63 smc->wait_close_tx_prepared = 1; in smc_close_stream_wait()
69 !smc_tx_prepared_sends(&smc->conn) || in smc_close_stream_wait()
72 smc->conn.killed, in smc_close_stream_wait()
78 smc->wait_close_tx_prepared = 0; in smc_close_stream_wait()
81 void smc_close_wake_tx_prepared(struct smc_sock *smc) in smc_close_wake_tx_prepared() argument
83 if (smc->wait_close_tx_prepared) in smc_close_wake_tx_prepared()
85 smc->sk.sk_state_change(&smc->sk); in smc_close_wake_tx_prepared()
114 static void smc_close_cancel_work(struct smc_sock *smc) in smc_close_cancel_work() argument
116 struct sock *sk = &smc->sk; in smc_close_cancel_work()
119 if (cancel_work_sync(&smc->conn.close_work)) in smc_close_cancel_work()
121 cancel_delayed_work_sync(&smc->conn.tx_work); in smc_close_cancel_work()
125 /* terminate smc socket abnormally - active abort
128 void smc_close_active_abort(struct smc_sock *smc) in smc_close_active_abort() argument
130 struct sock *sk = &smc->sk; in smc_close_active_abort()
133 if (sk->sk_state != SMC_INIT && smc->clcsock && smc->clcsock->sk) { in smc_close_active_abort()
135 if (smc->clcsock && smc->clcsock->sk) in smc_close_active_abort()
136 tcp_abort(smc->clcsock->sk, ECONNABORTED); in smc_close_active_abort()
143 smc_close_cancel_work(smc); in smc_close_active_abort()
153 smc_close_cancel_work(smc); in smc_close_active_abort()
157 smc_conn_free(&smc->conn); in smc_close_active_abort()
164 smc_close_cancel_work(smc); in smc_close_active_abort()
168 smc_conn_free(&smc->conn); in smc_close_active_abort()
182 smc_clcsock_release(smc); in smc_close_active_abort()
193 int smc_close_active(struct smc_sock *smc) in smc_close_active() argument
196 &smc->conn.local_tx_ctrl.conn_state_flags; in smc_close_active()
197 struct smc_connection *conn = &smc->conn; in smc_close_active()
198 struct sock *sk = &smc->sk; in smc_close_active()
217 if (smc->clcsock && smc->clcsock->sk) { in smc_close_active()
218 write_lock_bh(&smc->clcsock->sk->sk_callback_lock); in smc_close_active()
219 smc_clcsock_restore_cb(&smc->clcsock->sk->sk_data_ready, in smc_close_active()
220 &smc->clcsk_data_ready); in smc_close_active()
221 smc->clcsock->sk->sk_user_data = NULL; in smc_close_active()
222 write_unlock_bh(&smc->clcsock->sk->sk_callback_lock); in smc_close_active()
223 rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR); in smc_close_active()
227 flush_work(&smc->tcp_listen_work); in smc_close_active()
231 smc_close_stream_wait(smc, timeout); in smc_close_active()
243 if (smc->clcsock && smc->clcsock->sk) { in smc_close_active()
244 rc1 = kernel_sock_shutdown(smc->clcsock, in smc_close_active()
265 smc_close_stream_wait(smc, timeout); in smc_close_active()
312 static void smc_close_passive_abort_received(struct smc_sock *smc) in smc_close_passive_abort_received() argument
315 &smc->conn.local_tx_ctrl.conn_state_flags; in smc_close_passive_abort_received()
316 struct sock *sk = &smc->sk; in smc_close_passive_abort_received()
331 !smc_close_sent_any_close(&smc->conn)) in smc_close_passive_abort_received()
361 struct smc_sock *smc = container_of(conn, struct smc_sock, conn); in smc_close_passive_work() local
364 struct sock *sk = &smc->sk; in smc_close_passive_work()
373 smc_close_passive_abort_received(smc); in smc_close_passive_work()
437 if (smc->clcsock) in smc_close_passive_work()
443 smc_clcsock_release(smc); in smc_close_passive_work()
447 int smc_close_shutdown_write(struct smc_sock *smc) in smc_close_shutdown_write() argument
449 struct smc_connection *conn = &smc->conn; in smc_close_shutdown_write()
450 struct sock *sk = &smc->sk; in smc_close_shutdown_write()
463 smc_close_stream_wait(smc, timeout); in smc_close_shutdown_write()
476 smc_close_stream_wait(smc, timeout); in smc_close_shutdown_write()
503 void smc_close_init(struct smc_sock *smc) in smc_close_init() argument
505 INIT_WORK(&smc->conn.close_work, smc_close_passive_work); in smc_close_init()