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