Lines Matching +full:diff +full:- +full:channels
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Client connection-specific management code.
13 * (2) DONT_REUSE - The connection should be discarded as soon as possible and
31 #include "ar-internal.h"
38 * We use machine-unique IDs for our client connections.
54 struct rxrpc_net *rxnet = conn->params.local->rxnet; in rxrpc_get_client_connection_id()
70 conn->proto.epoch = rxnet->epoch; in rxrpc_get_client_connection_id()
71 conn->proto.cid = id << RXRPC_CIDSHIFT; in rxrpc_get_client_connection_id()
72 set_bit(RXRPC_CONN_HAS_IDR, &conn->flags); in rxrpc_get_client_connection_id()
73 _leave(" [CID %x]", conn->proto.cid); in rxrpc_get_client_connection_id()
88 if (test_bit(RXRPC_CONN_HAS_IDR, &conn->flags)) { in rxrpc_put_client_connection_id()
91 conn->proto.cid >> RXRPC_CIDSHIFT); in rxrpc_put_client_connection_id()
107 conn, refcount_read(&conn->ref)); in rxrpc_destroy_client_conn_ids()
125 bundle->params = *cp; in rxrpc_alloc_bundle()
126 rxrpc_get_peer(bundle->params.peer); in rxrpc_alloc_bundle()
127 refcount_set(&bundle->ref, 1); in rxrpc_alloc_bundle()
128 atomic_set(&bundle->active, 1); in rxrpc_alloc_bundle()
129 spin_lock_init(&bundle->channel_lock); in rxrpc_alloc_bundle()
130 INIT_LIST_HEAD(&bundle->waiting_calls); in rxrpc_alloc_bundle()
137 refcount_inc(&bundle->ref); in rxrpc_get_bundle()
143 rxrpc_put_peer(bundle->params.peer); in rxrpc_free_bundle()
149 unsigned int d = bundle->debug_id; in rxrpc_put_bundle()
153 dead = __refcount_dec_and_test(&bundle->ref, &r); in rxrpc_put_bundle()
155 _debug("PUT B=%x %d", d, r - 1); in rxrpc_put_bundle()
167 struct rxrpc_net *rxnet = bundle->params.local->rxnet; in rxrpc_alloc_client_connection()
174 _leave(" = -ENOMEM"); in rxrpc_alloc_client_connection()
175 return ERR_PTR(-ENOMEM); in rxrpc_alloc_client_connection()
178 refcount_set(&conn->ref, 1); in rxrpc_alloc_client_connection()
179 conn->bundle = bundle; in rxrpc_alloc_client_connection()
180 conn->params = bundle->params; in rxrpc_alloc_client_connection()
181 conn->out_clientflag = RXRPC_CLIENT_INITIATED; in rxrpc_alloc_client_connection()
182 conn->state = RXRPC_CONN_CLIENT; in rxrpc_alloc_client_connection()
183 conn->service_id = conn->params.service_id; in rxrpc_alloc_client_connection()
193 atomic_inc(&rxnet->nr_conns); in rxrpc_alloc_client_connection()
194 write_lock(&rxnet->conn_lock); in rxrpc_alloc_client_connection()
195 list_add_tail(&conn->proc_link, &rxnet->conn_proc_list); in rxrpc_alloc_client_connection()
196 write_unlock(&rxnet->conn_lock); in rxrpc_alloc_client_connection()
199 rxrpc_get_peer(conn->params.peer); in rxrpc_alloc_client_connection()
200 rxrpc_get_local(conn->params.local); in rxrpc_alloc_client_connection()
201 key_get(conn->params.key); in rxrpc_alloc_client_connection()
203 trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_client, in rxrpc_alloc_client_connection()
204 refcount_read(&conn->ref), in rxrpc_alloc_client_connection()
207 atomic_inc(&rxnet->nr_client_conns); in rxrpc_alloc_client_connection()
208 trace_rxrpc_client(conn, -1, rxrpc_client_alloc); in rxrpc_alloc_client_connection()
231 rxnet = conn->params.local->rxnet; in rxrpc_may_reuse_conn()
232 if (test_bit(RXRPC_CONN_DONT_REUSE, &conn->flags)) in rxrpc_may_reuse_conn()
235 if (conn->state != RXRPC_CONN_CLIENT || in rxrpc_may_reuse_conn()
236 conn->proto.epoch != rxnet->epoch) in rxrpc_may_reuse_conn()
246 id = conn->proto.cid >> RXRPC_CIDSHIFT; in rxrpc_may_reuse_conn()
247 distance = id - id_cursor; in rxrpc_may_reuse_conn()
249 distance = -distance; in rxrpc_may_reuse_conn()
250 limit = max_t(unsigned long, atomic_read(&rxnet->nr_conns) * 4, 1024); in rxrpc_may_reuse_conn()
257 set_bit(RXRPC_CONN_DONT_REUSE, &conn->flags); in rxrpc_may_reuse_conn()
271 struct rxrpc_local *local = cp->local; in rxrpc_look_up_bundle()
273 long diff; in rxrpc_look_up_bundle() local
276 cp->peer, key_serial(cp->key), cp->security_level, cp->upgrade); in rxrpc_look_up_bundle()
278 if (cp->exclusive) in rxrpc_look_up_bundle()
283 spin_lock(&local->client_bundles_lock); in rxrpc_look_up_bundle()
284 p = local->client_bundles.rb_node; in rxrpc_look_up_bundle()
288 #define cmp(X) ((long)bundle->params.X - (long)cp->X) in rxrpc_look_up_bundle()
289 diff = (cmp(peer) ?: in rxrpc_look_up_bundle()
294 if (diff < 0) in rxrpc_look_up_bundle()
295 p = p->rb_left; in rxrpc_look_up_bundle()
296 else if (diff > 0) in rxrpc_look_up_bundle()
297 p = p->rb_right; in rxrpc_look_up_bundle()
301 spin_unlock(&local->client_bundles_lock); in rxrpc_look_up_bundle()
310 spin_lock(&local->client_bundles_lock); in rxrpc_look_up_bundle()
311 pp = &local->client_bundles.rb_node; in rxrpc_look_up_bundle()
317 #define cmp(X) ((long)bundle->params.X - (long)cp->X) in rxrpc_look_up_bundle()
318 diff = (cmp(peer) ?: in rxrpc_look_up_bundle()
323 if (diff < 0) in rxrpc_look_up_bundle()
324 pp = &(*pp)->rb_left; in rxrpc_look_up_bundle()
325 else if (diff > 0) in rxrpc_look_up_bundle()
326 pp = &(*pp)->rb_right; in rxrpc_look_up_bundle()
332 candidate->debug_id = atomic_inc_return(&rxrpc_bundle_id); in rxrpc_look_up_bundle()
333 rb_link_node(&candidate->local_node, parent, pp); in rxrpc_look_up_bundle()
334 rb_insert_color(&candidate->local_node, &local->client_bundles); in rxrpc_look_up_bundle()
336 spin_unlock(&local->client_bundles_lock); in rxrpc_look_up_bundle()
337 _leave(" = %u [new]", candidate->debug_id); in rxrpc_look_up_bundle()
344 atomic_inc(&bundle->active); in rxrpc_look_up_bundle()
345 spin_unlock(&local->client_bundles_lock); in rxrpc_look_up_bundle()
346 _leave(" = %u [found]", bundle->debug_id); in rxrpc_look_up_bundle()
364 _enter("{%d,%lx},", call->debug_id, call->user_call_ID); in rxrpc_prep_call()
366 cp->peer = rxrpc_lookup_peer(rx, cp->local, srx, gfp); in rxrpc_prep_call()
367 if (!cp->peer) in rxrpc_prep_call()
370 call->cong_cwnd = cp->peer->cong_cwnd; in rxrpc_prep_call()
371 if (call->cong_cwnd >= call->cong_ssthresh) in rxrpc_prep_call()
372 call->cong_mode = RXRPC_CALL_CONGEST_AVOIDANCE; in rxrpc_prep_call()
374 call->cong_mode = RXRPC_CALL_SLOW_START; in rxrpc_prep_call()
375 if (cp->upgrade) in rxrpc_prep_call()
376 __set_bit(RXRPC_CALL_UPGRADE, &call->flags); in rxrpc_prep_call()
386 spin_lock(&bundle->channel_lock); in rxrpc_prep_call()
387 list_add_tail(&call->chan_wait_link, &bundle->waiting_calls); in rxrpc_prep_call()
388 spin_unlock(&bundle->channel_lock); in rxrpc_prep_call()
390 _leave(" = [B=%x]", bundle->debug_id); in rxrpc_prep_call()
394 _leave(" = -ENOMEM"); in rxrpc_prep_call()
395 return ERR_PTR(-ENOMEM); in rxrpc_prep_call()
402 __releases(bundle->channel_lock) in rxrpc_add_conn_to_bundle()
410 conflict = bundle->alloc_conn; in rxrpc_add_conn_to_bundle()
412 bundle->alloc_conn = true; in rxrpc_add_conn_to_bundle()
413 spin_unlock(&bundle->channel_lock); in rxrpc_add_conn_to_bundle()
421 spin_lock(&bundle->channel_lock); in rxrpc_add_conn_to_bundle()
422 bundle->alloc_conn = false; in rxrpc_add_conn_to_bundle()
425 bundle->alloc_error = PTR_ERR(candidate); in rxrpc_add_conn_to_bundle()
426 spin_unlock(&bundle->channel_lock); in rxrpc_add_conn_to_bundle()
431 bundle->alloc_error = 0; in rxrpc_add_conn_to_bundle()
433 for (i = 0; i < ARRAY_SIZE(bundle->conns); i++) { in rxrpc_add_conn_to_bundle()
437 old = bundle->conns[i]; in rxrpc_add_conn_to_bundle()
440 trace_rxrpc_client(old, -1, rxrpc_client_replace); in rxrpc_add_conn_to_bundle()
441 candidate->bundle_shift = shift; in rxrpc_add_conn_to_bundle()
442 atomic_inc(&bundle->active); in rxrpc_add_conn_to_bundle()
443 bundle->conns[i] = candidate; in rxrpc_add_conn_to_bundle()
445 set_bit(shift + j, &bundle->avail_chans); in rxrpc_add_conn_to_bundle()
453 spin_unlock(&bundle->channel_lock); in rxrpc_add_conn_to_bundle()
456 _debug("discard C=%x", candidate->debug_id); in rxrpc_add_conn_to_bundle()
457 trace_rxrpc_client(candidate, -1, rxrpc_client_duplicate); in rxrpc_add_conn_to_bundle()
476 spin_lock(&bundle->channel_lock); in rxrpc_maybe_add_conn()
480 for (i = 0; i < ARRAY_SIZE(bundle->conns); i++) in rxrpc_maybe_add_conn()
481 if (rxrpc_may_reuse_conn(bundle->conns[i])) in rxrpc_maybe_add_conn()
484 if (!usable && !list_empty(&bundle->waiting_calls)) { in rxrpc_maybe_add_conn()
485 call = list_first_entry(&bundle->waiting_calls, in rxrpc_maybe_add_conn()
487 if (test_bit(RXRPC_CALL_UPGRADE, &call->flags)) in rxrpc_maybe_add_conn()
488 bundle->try_upgrade = true; in rxrpc_maybe_add_conn()
494 if (!bundle->avail_chans && in rxrpc_maybe_add_conn()
495 !bundle->try_upgrade && in rxrpc_maybe_add_conn()
496 !list_empty(&bundle->waiting_calls) && in rxrpc_maybe_add_conn()
497 usable < ARRAY_SIZE(bundle->conns)) in rxrpc_maybe_add_conn()
500 spin_unlock(&bundle->channel_lock); in rxrpc_maybe_add_conn()
516 struct rxrpc_channel *chan = &conn->channels[channel]; in rxrpc_activate_one_channel()
517 struct rxrpc_bundle *bundle = conn->bundle; in rxrpc_activate_one_channel()
518 struct rxrpc_call *call = list_entry(bundle->waiting_calls.next, in rxrpc_activate_one_channel()
520 u32 call_id = chan->call_counter + 1; in rxrpc_activate_one_channel()
522 _enter("C=%x,%u", conn->debug_id, channel); in rxrpc_activate_one_channel()
529 clear_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags); in rxrpc_activate_one_channel()
530 clear_bit(conn->bundle_shift + channel, &bundle->avail_chans); in rxrpc_activate_one_channel()
533 list_del_init(&call->chan_wait_link); in rxrpc_activate_one_channel()
534 call->peer = rxrpc_get_peer(conn->params.peer); in rxrpc_activate_one_channel()
535 call->conn = rxrpc_get_connection(conn); in rxrpc_activate_one_channel()
536 call->cid = conn->proto.cid | channel; in rxrpc_activate_one_channel()
537 call->call_id = call_id; in rxrpc_activate_one_channel()
538 call->security = conn->security; in rxrpc_activate_one_channel()
539 call->security_ix = conn->security_ix; in rxrpc_activate_one_channel()
540 call->service_id = conn->service_id; in rxrpc_activate_one_channel()
544 call->cid, call->call_id, call->debug_id, conn->debug_id); in rxrpc_activate_one_channel()
546 write_lock_bh(&call->state_lock); in rxrpc_activate_one_channel()
547 call->state = RXRPC_CALL_CLIENT_SEND_REQUEST; in rxrpc_activate_one_channel()
548 write_unlock_bh(&call->state_lock); in rxrpc_activate_one_channel()
562 chan->call_id = call_id; in rxrpc_activate_one_channel()
563 chan->call_debug_id = call->debug_id; in rxrpc_activate_one_channel()
564 rcu_assign_pointer(chan->call, call); in rxrpc_activate_one_channel()
565 wake_up(&call->waitq); in rxrpc_activate_one_channel()
573 struct rxrpc_net *rxnet = bundle->params.local->rxnet; in rxrpc_unidle_conn()
576 if (!list_empty(&conn->cache_link)) { in rxrpc_unidle_conn()
578 spin_lock(&rxnet->client_conn_cache_lock); in rxrpc_unidle_conn()
579 if (!list_empty(&conn->cache_link)) { in rxrpc_unidle_conn()
580 list_del_init(&conn->cache_link); in rxrpc_unidle_conn()
583 spin_unlock(&rxnet->client_conn_cache_lock); in rxrpc_unidle_conn()
590 * Assign channels and callNumbers to waiting calls with channel_lock
599 if (bundle->try_upgrade) in rxrpc_activate_channels_locked()
604 while (!list_empty(&bundle->waiting_calls)) { in rxrpc_activate_channels_locked()
605 avail = bundle->avail_chans & mask; in rxrpc_activate_channels_locked()
609 clear_bit(channel, &bundle->avail_chans); in rxrpc_activate_channels_locked()
612 conn = bundle->conns[slot]; in rxrpc_activate_channels_locked()
616 if (bundle->try_upgrade) in rxrpc_activate_channels_locked()
617 set_bit(RXRPC_CONN_PROBING_FOR_UPGRADE, &conn->flags); in rxrpc_activate_channels_locked()
620 channel &= (RXRPC_MAXCALLS - 1); in rxrpc_activate_channels_locked()
621 conn->act_chans |= 1 << channel; in rxrpc_activate_channels_locked()
627 * Assign channels and callNumbers to waiting calls.
631 _enter("B=%x", bundle->debug_id); in rxrpc_activate_channels()
633 trace_rxrpc_client(NULL, -1, rxrpc_client_activate_chans); in rxrpc_activate_channels()
635 if (!bundle->avail_chans) in rxrpc_activate_channels()
638 spin_lock(&bundle->channel_lock); in rxrpc_activate_channels()
640 spin_unlock(&bundle->channel_lock); in rxrpc_activate_channels()
653 _enter("%d", call->debug_id); in rxrpc_wait_for_channel()
658 ret = bundle->alloc_error ?: -EAGAIN; in rxrpc_wait_for_channel()
662 add_wait_queue_exclusive(&call->waitq, &myself); in rxrpc_wait_for_channel()
666 ret = bundle->alloc_error; in rxrpc_wait_for_channel()
670 switch (call->interruptibility) { in rxrpc_wait_for_channel()
680 if (READ_ONCE(call->state) != RXRPC_CALL_CLIENT_AWAIT_CONN) in rxrpc_wait_for_channel()
682 if ((call->interruptibility == RXRPC_INTERRUPTIBLE || in rxrpc_wait_for_channel()
683 call->interruptibility == RXRPC_PREINTERRUPTIBLE) && in rxrpc_wait_for_channel()
685 ret = -ERESTARTSYS; in rxrpc_wait_for_channel()
690 remove_wait_queue(&call->waitq, &myself); in rxrpc_wait_for_channel()
700 * - called in process context with IRQs enabled
709 struct rxrpc_net *rxnet = cp->local->rxnet; in rxrpc_connect_call()
712 _enter("{%d,%lx},", call->debug_id, call->user_call_ID); in rxrpc_connect_call()
714 rxrpc_discard_expired_client_conns(&rxnet->client_conn_reaper); in rxrpc_connect_call()
722 if (call->state == RXRPC_CALL_CLIENT_AWAIT_CONN) { in rxrpc_connect_call()
740 spin_lock(&bundle->channel_lock); in rxrpc_connect_call()
741 list_del_init(&call->chan_wait_link); in rxrpc_connect_call()
742 spin_unlock(&bundle->channel_lock); in rxrpc_connect_call()
744 if (call->state != RXRPC_CALL_CLIENT_AWAIT_CONN) { in rxrpc_connect_call()
749 trace_rxrpc_client(call->conn, ret, rxrpc_client_chan_wait_failed); in rxrpc_connect_call()
761 unsigned int channel = call->cid & RXRPC_CHANNELMASK; in rxrpc_expose_client_call()
762 struct rxrpc_connection *conn = call->conn; in rxrpc_expose_client_call()
763 struct rxrpc_channel *chan = &conn->channels[channel]; in rxrpc_expose_client_call()
765 if (!test_and_set_bit(RXRPC_CALL_EXPOSED, &call->flags)) { in rxrpc_expose_client_call()
771 chan->call_counter++; in rxrpc_expose_client_call()
772 if (chan->call_counter >= INT_MAX) in rxrpc_expose_client_call()
773 set_bit(RXRPC_CONN_DONT_REUSE, &conn->flags); in rxrpc_expose_client_call()
783 if (!rxnet->kill_all_client_conns) { in rxrpc_set_client_reap_timer()
787 if (rxnet->live) in rxrpc_set_client_reap_timer()
788 timer_reduce(&rxnet->client_conn_reap_timer, reap_at); in rxrpc_set_client_reap_timer()
799 struct rxrpc_net *rxnet = bundle->params.local->rxnet; in rxrpc_disconnect_client_call()
804 _enter("c=%x", call->debug_id); in rxrpc_disconnect_client_call()
806 spin_lock(&bundle->channel_lock); in rxrpc_disconnect_client_call()
807 set_bit(RXRPC_CALL_DISCONNECTED, &call->flags); in rxrpc_disconnect_client_call()
812 conn = call->conn; in rxrpc_disconnect_client_call()
815 ASSERTCMP(call->call_id, ==, 0); in rxrpc_disconnect_client_call()
816 ASSERT(!test_bit(RXRPC_CALL_EXPOSED, &call->flags)); in rxrpc_disconnect_client_call()
817 list_del_init(&call->chan_wait_link); in rxrpc_disconnect_client_call()
821 cid = call->cid; in rxrpc_disconnect_client_call()
823 chan = &conn->channels[channel]; in rxrpc_disconnect_client_call()
826 if (rcu_access_pointer(chan->call) != call) { in rxrpc_disconnect_client_call()
827 spin_unlock(&bundle->channel_lock); in rxrpc_disconnect_client_call()
842 if (test_bit(RXRPC_CALL_EXPOSED, &call->flags)) { in rxrpc_disconnect_client_call()
843 _debug("exposed %u,%u", call->call_id, call->abort_code); in rxrpc_disconnect_client_call()
846 if (test_and_clear_bit(RXRPC_CONN_PROBING_FOR_UPGRADE, &conn->flags)) { in rxrpc_disconnect_client_call()
848 bundle->try_upgrade = false; in rxrpc_disconnect_client_call()
856 if (may_reuse && !list_empty(&bundle->waiting_calls)) { in rxrpc_disconnect_client_call()
863 * can be skipped if we find a follow-on call. The first DATA packet in rxrpc_disconnect_client_call()
866 if (call->completion == RXRPC_CALL_SUCCEEDED && in rxrpc_disconnect_client_call()
867 test_bit(RXRPC_CALL_EXPOSED, &call->flags)) { in rxrpc_disconnect_client_call()
870 WRITE_ONCE(chan->final_ack_at, final_ack_at); in rxrpc_disconnect_client_call()
872 set_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags); in rxrpc_disconnect_client_call()
877 rcu_assign_pointer(chan->call, NULL); in rxrpc_disconnect_client_call()
878 set_bit(conn->bundle_shift + channel, &conn->bundle->avail_chans); in rxrpc_disconnect_client_call()
879 conn->act_chans &= ~(1 << channel); in rxrpc_disconnect_client_call()
881 /* If no channels remain active, then put the connection on the idle in rxrpc_disconnect_client_call()
885 if (!conn->act_chans) { in rxrpc_disconnect_client_call()
887 conn->idle_timestamp = jiffies; in rxrpc_disconnect_client_call()
890 spin_lock(&rxnet->client_conn_cache_lock); in rxrpc_disconnect_client_call()
891 list_move_tail(&conn->cache_link, &rxnet->idle_client_conns); in rxrpc_disconnect_client_call()
892 spin_unlock(&rxnet->client_conn_cache_lock); in rxrpc_disconnect_client_call()
898 spin_unlock(&bundle->channel_lock); in rxrpc_disconnect_client_call()
908 struct rxrpc_bundle *bundle = conn->bundle; in rxrpc_unbundle_conn()
913 _enter("C=%x", conn->debug_id); in rxrpc_unbundle_conn()
915 if (conn->flags & RXRPC_CONN_FINAL_ACK_MASK) in rxrpc_unbundle_conn()
918 spin_lock(&bundle->channel_lock); in rxrpc_unbundle_conn()
919 bindex = conn->bundle_shift / RXRPC_MAXCALLS; in rxrpc_unbundle_conn()
920 if (bundle->conns[bindex] == conn) { in rxrpc_unbundle_conn()
922 bundle->conns[bindex] = NULL; in rxrpc_unbundle_conn()
924 clear_bit(conn->bundle_shift + i, &bundle->avail_chans); in rxrpc_unbundle_conn()
927 spin_unlock(&bundle->channel_lock); in rxrpc_unbundle_conn()
940 struct rxrpc_local *local = bundle->params.local; in rxrpc_deactivate_bundle()
943 if (atomic_dec_and_lock(&bundle->active, &local->client_bundles_lock)) { in rxrpc_deactivate_bundle()
944 if (!bundle->params.exclusive) { in rxrpc_deactivate_bundle()
946 rb_erase(&bundle->local_node, &local->client_bundles); in rxrpc_deactivate_bundle()
950 spin_unlock(&local->client_bundles_lock); in rxrpc_deactivate_bundle()
961 struct rxrpc_local *local = conn->params.local; in rxrpc_kill_client_conn()
962 struct rxrpc_net *rxnet = local->rxnet; in rxrpc_kill_client_conn()
964 _enter("C=%x", conn->debug_id); in rxrpc_kill_client_conn()
966 trace_rxrpc_client(conn, -1, rxrpc_client_cleanup); in rxrpc_kill_client_conn()
967 atomic_dec(&rxnet->nr_client_conns); in rxrpc_kill_client_conn()
979 unsigned int debug_id = conn->debug_id; in rxrpc_put_client_conn()
983 dead = __refcount_dec_and_test(&conn->ref, &r); in rxrpc_put_client_conn()
984 trace_rxrpc_conn(debug_id, rxrpc_conn_put_client, r - 1, here); in rxrpc_put_client_conn()
994 * considered non-reentrant.
1006 if (list_empty(&rxnet->idle_client_conns)) { in rxrpc_discard_expired_client_conns()
1012 if (!spin_trylock(&rxnet->client_conn_discard_lock)) { in rxrpc_discard_expired_client_conns()
1020 nr_conns = atomic_read(&rxnet->nr_client_conns); in rxrpc_discard_expired_client_conns()
1023 spin_lock(&rxnet->client_conn_cache_lock); in rxrpc_discard_expired_client_conns()
1025 if (list_empty(&rxnet->idle_client_conns)) in rxrpc_discard_expired_client_conns()
1028 conn = list_entry(rxnet->idle_client_conns.next, in rxrpc_discard_expired_client_conns()
1031 if (!rxnet->kill_all_client_conns) { in rxrpc_discard_expired_client_conns()
1035 * final-ACK or ABORT retransmission. in rxrpc_discard_expired_client_conns()
1040 if (conn->params.local->service_closed) in rxrpc_discard_expired_client_conns()
1043 conn_expires_at = conn->idle_timestamp + expiry; in rxrpc_discard_expired_client_conns()
1050 trace_rxrpc_client(conn, -1, rxrpc_client_discard); in rxrpc_discard_expired_client_conns()
1051 list_del_init(&conn->cache_link); in rxrpc_discard_expired_client_conns()
1053 spin_unlock(&rxnet->client_conn_cache_lock); in rxrpc_discard_expired_client_conns()
1056 rxrpc_put_connection(conn); /* Drop the ->cache_link ref */ in rxrpc_discard_expired_client_conns()
1058 nr_conns--; in rxrpc_discard_expired_client_conns()
1065 * We don't worry if the work item is already scheduled - it can look in rxrpc_discard_expired_client_conns()
1070 if (!rxnet->kill_all_client_conns) in rxrpc_discard_expired_client_conns()
1071 timer_reduce(&rxnet->client_conn_reap_timer, conn_expires_at); in rxrpc_discard_expired_client_conns()
1074 spin_unlock(&rxnet->client_conn_cache_lock); in rxrpc_discard_expired_client_conns()
1075 spin_unlock(&rxnet->client_conn_discard_lock); in rxrpc_discard_expired_client_conns()
1087 spin_lock(&rxnet->client_conn_cache_lock); in rxrpc_destroy_all_client_connections()
1088 rxnet->kill_all_client_conns = true; in rxrpc_destroy_all_client_connections()
1089 spin_unlock(&rxnet->client_conn_cache_lock); in rxrpc_destroy_all_client_connections()
1091 del_timer_sync(&rxnet->client_conn_reap_timer); in rxrpc_destroy_all_client_connections()
1093 if (!rxrpc_queue_work(&rxnet->client_conn_reaper)) in rxrpc_destroy_all_client_connections()
1105 struct rxrpc_net *rxnet = local->rxnet; in rxrpc_clean_up_local_conns()
1110 spin_lock(&rxnet->client_conn_cache_lock); in rxrpc_clean_up_local_conns()
1112 list_for_each_entry_safe(conn, tmp, &rxnet->idle_client_conns, in rxrpc_clean_up_local_conns()
1114 if (conn->params.local == local) { in rxrpc_clean_up_local_conns()
1115 trace_rxrpc_client(conn, -1, rxrpc_client_discard); in rxrpc_clean_up_local_conns()
1116 list_move(&conn->cache_link, &graveyard); in rxrpc_clean_up_local_conns()
1120 spin_unlock(&rxnet->client_conn_cache_lock); in rxrpc_clean_up_local_conns()
1125 list_del_init(&conn->cache_link); in rxrpc_clean_up_local_conns()