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 READ_ONCE(sk->sk_err) == ECONNABORTED || in smc_close_stream_wait()
71 READ_ONCE(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()
120 sock_put(sk); in smc_close_cancel_work()
122 lock_sock(sk); in smc_close_cancel_work()
130 struct sock *sk = &smc->sk; in smc_close_active_abort() local
133 if (sk->sk_state != SMC_INIT && smc->clcsock && smc->clcsock->sk) { in smc_close_active_abort()
134 sk->sk_err = ECONNABORTED; 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()
138 switch (sk->sk_state) { in smc_close_active_abort()
142 sk->sk_state = SMC_PEERABORTWAIT; in smc_close_active_abort()
144 if (sk->sk_state != SMC_PEERABORTWAIT) in smc_close_active_abort()
146 sk->sk_state = SMC_CLOSED; in smc_close_active_abort()
147 sock_put(sk); /* (postponed) passive closing */ in smc_close_active_abort()
152 sk->sk_state = SMC_PEERABORTWAIT; in smc_close_active_abort()
154 if (sk->sk_state != SMC_PEERABORTWAIT) in smc_close_active_abort()
156 sk->sk_state = SMC_CLOSED; in smc_close_active_abort()
159 sock_put(sk); /* passive closing */ in smc_close_active_abort()
163 sk->sk_state = SMC_PEERABORTWAIT; in smc_close_active_abort()
165 if (sk->sk_state != SMC_PEERABORTWAIT) in smc_close_active_abort()
167 sk->sk_state = SMC_CLOSED; in smc_close_active_abort()
177 smc_sock_set_flag(sk, SOCK_DEAD); in smc_close_active_abort()
178 sk->sk_state_change(sk); in smc_close_active_abort()
181 release_sock(sk); in smc_close_active_abort()
183 lock_sock(sk); in smc_close_active_abort()
198 struct sock *sk = &smc->sk; in smc_close_active() local
205 0 : sock_flag(sk, SOCK_LINGER) ? in smc_close_active()
206 sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT; in smc_close_active()
208 old_state = sk->sk_state; in smc_close_active()
210 switch (sk->sk_state) { in smc_close_active()
212 sk->sk_state = SMC_CLOSED; in smc_close_active()
215 sk->sk_state = SMC_CLOSED; in smc_close_active()
216 sk->sk_state_change(sk); /* wake up accept */ 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()
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()
225 smc_close_cleanup_listen(sk); in smc_close_active()
226 release_sock(sk); in smc_close_active()
228 lock_sock(sk); in smc_close_active()
232 release_sock(sk); in smc_close_active()
234 lock_sock(sk); in smc_close_active()
235 if (sk->sk_state == SMC_ACTIVE) { in smc_close_active()
238 sk->sk_state = SMC_PEERCLOSEWAIT1; in smc_close_active()
243 if (smc->clcsock && smc->clcsock->sk) { in smc_close_active()
260 sk->sk_state = SMC_CLOSED; in smc_close_active()
266 release_sock(sk); in smc_close_active()
268 lock_sock(sk); in smc_close_active()
269 if (sk->sk_state != SMC_APPCLOSEWAIT1 && in smc_close_active()
270 sk->sk_state != SMC_APPCLOSEWAIT2) in smc_close_active()
276 sk->sk_state = SMC_CLOSED; in smc_close_active()
277 sock_put(sk); /* postponed passive closing */ in smc_close_active()
280 sk->sk_state = SMC_PEERFINCLOSEWAIT; in smc_close_active()
297 sk->sk_state = SMC_CLOSED; in smc_close_active()
300 sk->sk_state = SMC_CLOSED; in smc_close_active()
307 if (old_state != sk->sk_state) in smc_close_active()
308 sk->sk_state_change(sk); in smc_close_active()
316 struct sock *sk = &smc->sk; in smc_close_passive_abort_received() local
318 switch (sk->sk_state) { in smc_close_passive_abort_received()
322 sk->sk_state = SMC_PROCESSABORT; in smc_close_passive_abort_received()
323 sock_put(sk); /* passive closing */ in smc_close_passive_abort_received()
326 sk->sk_state = SMC_PROCESSABORT; in smc_close_passive_abort_received()
333 sk->sk_state = SMC_PROCESSABORT; in smc_close_passive_abort_received()
335 sk->sk_state = SMC_CLOSED; in smc_close_passive_abort_received()
336 sock_put(sk); /* passive closing */ in smc_close_passive_abort_received()
340 sk->sk_state = SMC_CLOSED; in smc_close_passive_abort_received()
341 sock_put(sk); /* passive closing */ in smc_close_passive_abort_received()
344 sk->sk_state = SMC_CLOSED; in smc_close_passive_abort_received()
364 struct sock *sk = &smc->sk; in smc_close_passive_work() local
367 lock_sock(sk); in smc_close_passive_work()
368 old_state = sk->sk_state; in smc_close_passive_work()
374 release_sock(sk); in smc_close_passive_work()
376 lock_sock(sk); in smc_close_passive_work()
380 switch (sk->sk_state) { in smc_close_passive_work()
382 sk->sk_state = SMC_APPCLOSEWAIT1; in smc_close_passive_work()
385 sk->sk_state = SMC_APPCLOSEWAIT1; in smc_close_passive_work()
392 sk->sk_state = SMC_PEERCLOSEWAIT2; in smc_close_passive_work()
398 if (sock_flag(sk, SOCK_DEAD) && in smc_close_passive_work()
401 sk->sk_state = SMC_CLOSED; in smc_close_passive_work()
404 sk->sk_state = SMC_APPFINCLOSEWAIT; in smc_close_passive_work()
406 sock_put(sk); /* passive closing */ in smc_close_passive_work()
410 sk->sk_state = SMC_CLOSED; in smc_close_passive_work()
411 sock_put(sk); /* passive closing */ in smc_close_passive_work()
429 sk->sk_data_ready(sk); /* wakeup blocked rcvbuf consumers */ in smc_close_passive_work()
430 sk->sk_write_space(sk); /* wakeup blocked sndbuf producers */ in smc_close_passive_work()
432 if (old_state != sk->sk_state) { in smc_close_passive_work()
433 sk->sk_state_change(sk); in smc_close_passive_work()
434 if ((sk->sk_state == SMC_CLOSED) && in smc_close_passive_work()
435 (sock_flag(sk, SOCK_DEAD) || !sk->sk_socket)) { in smc_close_passive_work()
441 release_sock(sk); in smc_close_passive_work()
444 sock_put(sk); /* sock_hold done by schedulers of close_work */ in smc_close_passive_work()
450 struct sock *sk = &smc->sk; in smc_close_shutdown_write() local
456 0 : sock_flag(sk, SOCK_LINGER) ? in smc_close_shutdown_write()
457 sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT; in smc_close_shutdown_write()
459 old_state = sk->sk_state; in smc_close_shutdown_write()
461 switch (sk->sk_state) { in smc_close_shutdown_write()
464 release_sock(sk); in smc_close_shutdown_write()
466 lock_sock(sk); in smc_close_shutdown_write()
467 if (sk->sk_state != SMC_ACTIVE) in smc_close_shutdown_write()
471 sk->sk_state = SMC_PEERCLOSEWAIT1; in smc_close_shutdown_write()
477 release_sock(sk); in smc_close_shutdown_write()
479 lock_sock(sk); in smc_close_shutdown_write()
480 if (sk->sk_state != SMC_APPCLOSEWAIT1) in smc_close_shutdown_write()
484 sk->sk_state = SMC_APPCLOSEWAIT2; in smc_close_shutdown_write()
497 if (old_state != sk->sk_state) in smc_close_shutdown_write()
498 sk->sk_state_change(sk); in smc_close_shutdown_write()