Lines Matching refs:sk
41 struct sock *sk; in smc_close_cleanup_listen() local
44 while ((sk = smc_accept_dequeue(parent, NULL))) in smc_close_cleanup_listen()
45 smc_close_non_accepted(sk); in smc_close_cleanup_listen()
52 struct sock *sk = &smc->sk; in smc_close_stream_wait() local
64 add_wait_queue(sk_sleep(sk), &wait); in smc_close_stream_wait()
68 rc = sk_wait_event(sk, &timeout, in smc_close_stream_wait()
70 sk->sk_err == ECONNABORTED || in smc_close_stream_wait()
71 sk->sk_err == ECONNRESET || in smc_close_stream_wait()
77 remove_wait_queue(sk_sleep(sk), &wait); in smc_close_stream_wait()
85 smc->sk.sk_state_change(&smc->sk); in smc_close_wake_tx_prepared()
116 struct sock *sk = &smc->sk; in smc_close_cancel_work() local
118 release_sock(sk); in smc_close_cancel_work()
121 lock_sock(sk); in smc_close_cancel_work()
129 struct sock *sk = &smc->sk; in smc_close_active_abort() local
132 if (sk->sk_state != SMC_INIT && smc->clcsock && smc->clcsock->sk) { in smc_close_active_abort()
133 sk->sk_err = ECONNABORTED; in smc_close_active_abort()
134 if (smc->clcsock && smc->clcsock->sk) in smc_close_active_abort()
135 tcp_abort(smc->clcsock->sk, ECONNABORTED); in smc_close_active_abort()
137 switch (sk->sk_state) { in smc_close_active_abort()
141 sk->sk_state = SMC_PEERABORTWAIT; in smc_close_active_abort()
143 if (sk->sk_state != SMC_PEERABORTWAIT) in smc_close_active_abort()
145 sk->sk_state = SMC_CLOSED; in smc_close_active_abort()
146 sock_put(sk); /* (postponed) passive closing */ in smc_close_active_abort()
151 sk->sk_state = SMC_PEERABORTWAIT; in smc_close_active_abort()
153 if (sk->sk_state != SMC_PEERABORTWAIT) in smc_close_active_abort()
155 sk->sk_state = SMC_CLOSED; in smc_close_active_abort()
158 sock_put(sk); /* passive closing */ in smc_close_active_abort()
162 sk->sk_state = SMC_PEERABORTWAIT; in smc_close_active_abort()
164 if (sk->sk_state != SMC_PEERABORTWAIT) in smc_close_active_abort()
166 sk->sk_state = SMC_CLOSED; in smc_close_active_abort()
176 sock_set_flag(sk, SOCK_DEAD); in smc_close_active_abort()
177 sk->sk_state_change(sk); in smc_close_active_abort()
180 release_sock(sk); in smc_close_active_abort()
182 lock_sock(sk); in smc_close_active_abort()
197 struct sock *sk = &smc->sk; in smc_close_active() local
204 0 : sock_flag(sk, SOCK_LINGER) ? in smc_close_active()
205 sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT; in smc_close_active()
207 old_state = sk->sk_state; in smc_close_active()
209 switch (sk->sk_state) { in smc_close_active()
211 sk->sk_state = SMC_CLOSED; in smc_close_active()
214 sk->sk_state = SMC_CLOSED; in smc_close_active()
215 sk->sk_state_change(sk); /* wake up accept */ in smc_close_active()
216 if (smc->clcsock && smc->clcsock->sk) { in smc_close_active()
217 write_lock_bh(&smc->clcsock->sk->sk_callback_lock); in smc_close_active()
218 smc_clcsock_restore_cb(&smc->clcsock->sk->sk_data_ready, in smc_close_active()
220 smc->clcsock->sk->sk_user_data = NULL; in smc_close_active()
221 write_unlock_bh(&smc->clcsock->sk->sk_callback_lock); in smc_close_active()
224 smc_close_cleanup_listen(sk); in smc_close_active()
225 release_sock(sk); in smc_close_active()
227 lock_sock(sk); in smc_close_active()
231 release_sock(sk); in smc_close_active()
233 lock_sock(sk); in smc_close_active()
234 if (sk->sk_state == SMC_ACTIVE) { in smc_close_active()
237 sk->sk_state = SMC_PEERCLOSEWAIT1; in smc_close_active()
242 if (smc->clcsock && smc->clcsock->sk) { in smc_close_active()
259 sk->sk_state = SMC_CLOSED; in smc_close_active()
265 release_sock(sk); in smc_close_active()
267 lock_sock(sk); in smc_close_active()
268 if (sk->sk_state != SMC_APPCLOSEWAIT1 && in smc_close_active()
269 sk->sk_state != SMC_APPCLOSEWAIT2) in smc_close_active()
275 sk->sk_state = SMC_CLOSED; in smc_close_active()
276 sock_put(sk); /* postponed passive closing */ in smc_close_active()
279 sk->sk_state = SMC_PEERFINCLOSEWAIT; in smc_close_active()
296 sk->sk_state = SMC_CLOSED; in smc_close_active()
299 sk->sk_state = SMC_CLOSED; in smc_close_active()
306 if (old_state != sk->sk_state) in smc_close_active()
307 sk->sk_state_change(sk); in smc_close_active()
315 struct sock *sk = &smc->sk; in smc_close_passive_abort_received() local
317 switch (sk->sk_state) { in smc_close_passive_abort_received()
321 sk->sk_state = SMC_PROCESSABORT; in smc_close_passive_abort_received()
322 sock_put(sk); /* passive closing */ in smc_close_passive_abort_received()
325 sk->sk_state = SMC_PROCESSABORT; in smc_close_passive_abort_received()
332 sk->sk_state = SMC_PROCESSABORT; in smc_close_passive_abort_received()
334 sk->sk_state = SMC_CLOSED; in smc_close_passive_abort_received()
335 sock_put(sk); /* passive closing */ in smc_close_passive_abort_received()
339 sk->sk_state = SMC_CLOSED; in smc_close_passive_abort_received()
340 sock_put(sk); /* passive closing */ in smc_close_passive_abort_received()
343 sk->sk_state = SMC_CLOSED; in smc_close_passive_abort_received()
363 struct sock *sk = &smc->sk; in smc_close_passive_work() local
366 lock_sock(sk); in smc_close_passive_work()
367 old_state = sk->sk_state; in smc_close_passive_work()
373 release_sock(sk); in smc_close_passive_work()
375 lock_sock(sk); in smc_close_passive_work()
379 switch (sk->sk_state) { in smc_close_passive_work()
381 sk->sk_state = SMC_APPCLOSEWAIT1; in smc_close_passive_work()
384 sk->sk_state = SMC_APPCLOSEWAIT1; in smc_close_passive_work()
391 sk->sk_state = SMC_PEERCLOSEWAIT2; in smc_close_passive_work()
397 if (sock_flag(sk, SOCK_DEAD) && in smc_close_passive_work()
400 sk->sk_state = SMC_CLOSED; in smc_close_passive_work()
403 sk->sk_state = SMC_APPFINCLOSEWAIT; in smc_close_passive_work()
405 sock_put(sk); /* passive closing */ in smc_close_passive_work()
409 sk->sk_state = SMC_CLOSED; in smc_close_passive_work()
410 sock_put(sk); /* passive closing */ in smc_close_passive_work()
428 sk->sk_data_ready(sk); /* wakeup blocked rcvbuf consumers */ in smc_close_passive_work()
429 sk->sk_write_space(sk); /* wakeup blocked sndbuf producers */ in smc_close_passive_work()
431 if (old_state != sk->sk_state) { in smc_close_passive_work()
432 sk->sk_state_change(sk); in smc_close_passive_work()
433 if ((sk->sk_state == SMC_CLOSED) && in smc_close_passive_work()
434 (sock_flag(sk, SOCK_DEAD) || !sk->sk_socket)) { in smc_close_passive_work()
440 release_sock(sk); in smc_close_passive_work()
443 sock_put(sk); /* sock_hold done by schedulers of close_work */ in smc_close_passive_work()
449 struct sock *sk = &smc->sk; in smc_close_shutdown_write() local
455 0 : sock_flag(sk, SOCK_LINGER) ? in smc_close_shutdown_write()
456 sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT; in smc_close_shutdown_write()
458 old_state = sk->sk_state; in smc_close_shutdown_write()
460 switch (sk->sk_state) { in smc_close_shutdown_write()
463 release_sock(sk); in smc_close_shutdown_write()
465 lock_sock(sk); in smc_close_shutdown_write()
466 if (sk->sk_state != SMC_ACTIVE) in smc_close_shutdown_write()
470 sk->sk_state = SMC_PEERCLOSEWAIT1; in smc_close_shutdown_write()
476 release_sock(sk); in smc_close_shutdown_write()
478 lock_sock(sk); in smc_close_shutdown_write()
479 if (sk->sk_state != SMC_APPCLOSEWAIT1) in smc_close_shutdown_write()
483 sk->sk_state = SMC_APPCLOSEWAIT2; in smc_close_shutdown_write()
496 if (old_state != sk->sk_state) in smc_close_shutdown_write()
497 sk->sk_state_change(sk); in smc_close_shutdown_write()