Lines Matching full:conn
26 struct rxrpc_connection *conn = in rxrpc_connection_timer() local
29 rxrpc_queue_conn(conn); in rxrpc_connection_timer()
37 struct rxrpc_connection *conn; in rxrpc_alloc_connection() local
41 conn = kzalloc(sizeof(struct rxrpc_connection), gfp); in rxrpc_alloc_connection()
42 if (conn) { in rxrpc_alloc_connection()
43 INIT_LIST_HEAD(&conn->cache_link); in rxrpc_alloc_connection()
44 timer_setup(&conn->timer, &rxrpc_connection_timer, 0); in rxrpc_alloc_connection()
45 INIT_WORK(&conn->processor, &rxrpc_process_connection); in rxrpc_alloc_connection()
46 INIT_LIST_HEAD(&conn->proc_link); in rxrpc_alloc_connection()
47 INIT_LIST_HEAD(&conn->link); in rxrpc_alloc_connection()
48 skb_queue_head_init(&conn->rx_queue); in rxrpc_alloc_connection()
49 conn->security = &rxrpc_no_security; in rxrpc_alloc_connection()
50 spin_lock_init(&conn->state_lock); in rxrpc_alloc_connection()
51 conn->debug_id = atomic_inc_return(&rxrpc_debug_id); in rxrpc_alloc_connection()
52 conn->idle_timestamp = jiffies; in rxrpc_alloc_connection()
55 _leave(" = %p{%d}", conn, conn ? conn->debug_id : 0); in rxrpc_alloc_connection()
56 return conn; in rxrpc_alloc_connection()
74 struct rxrpc_connection *conn; in rxrpc_find_connection_rcu() local
106 conn = rxrpc_find_service_conn_rcu(peer, skb); in rxrpc_find_connection_rcu()
107 if (!conn || refcount_read(&conn->ref) == 0) in rxrpc_find_connection_rcu()
109 _leave(" = %p", conn); in rxrpc_find_connection_rcu()
110 return conn; in rxrpc_find_connection_rcu()
115 conn = idr_find(&rxrpc_client_conn_ids, in rxrpc_find_connection_rcu()
117 if (!conn || refcount_read(&conn->ref) == 0) { in rxrpc_find_connection_rcu()
118 _debug("no conn"); in rxrpc_find_connection_rcu()
122 if (conn->proto.epoch != k.epoch || in rxrpc_find_connection_rcu()
123 conn->params.local != local) in rxrpc_find_connection_rcu()
126 peer = conn->params.peer; in rxrpc_find_connection_rcu()
149 _leave(" = %p", conn); in rxrpc_find_connection_rcu()
150 return conn; in rxrpc_find_connection_rcu()
163 void __rxrpc_disconnect_call(struct rxrpc_connection *conn, in __rxrpc_disconnect_call() argument
167 &conn->channels[call->cid & RXRPC_CHANNELMASK]; in __rxrpc_disconnect_call()
169 _enter("%d,%x", conn->debug_id, call->cid); in __rxrpc_disconnect_call()
208 struct rxrpc_connection *conn = call->conn; in rxrpc_disconnect_call() local
219 return rxrpc_disconnect_client_call(conn->bundle, call); in rxrpc_disconnect_call()
221 spin_lock(&conn->bundle->channel_lock); in rxrpc_disconnect_call()
222 __rxrpc_disconnect_call(conn, call); in rxrpc_disconnect_call()
223 spin_unlock(&conn->bundle->channel_lock); in rxrpc_disconnect_call()
226 conn->idle_timestamp = jiffies; in rxrpc_disconnect_call()
232 void rxrpc_kill_connection(struct rxrpc_connection *conn) in rxrpc_kill_connection() argument
234 struct rxrpc_net *rxnet = conn->params.local->rxnet; in rxrpc_kill_connection()
236 ASSERT(!rcu_access_pointer(conn->channels[0].call) && in rxrpc_kill_connection()
237 !rcu_access_pointer(conn->channels[1].call) && in rxrpc_kill_connection()
238 !rcu_access_pointer(conn->channels[2].call) && in rxrpc_kill_connection()
239 !rcu_access_pointer(conn->channels[3].call)); in rxrpc_kill_connection()
240 ASSERT(list_empty(&conn->cache_link)); in rxrpc_kill_connection()
243 list_del_init(&conn->proc_link); in rxrpc_kill_connection()
250 rxrpc_purge_queue(&conn->rx_queue); in rxrpc_kill_connection()
256 call_rcu(&conn->rcu, rxrpc_destroy_connection); in rxrpc_kill_connection()
263 bool rxrpc_queue_conn(struct rxrpc_connection *conn) in rxrpc_queue_conn() argument
268 if (!__refcount_inc_not_zero(&conn->ref, &r)) in rxrpc_queue_conn()
270 if (rxrpc_queue_work(&conn->processor)) in rxrpc_queue_conn()
271 trace_rxrpc_conn(conn->debug_id, rxrpc_conn_queued, r + 1, here); in rxrpc_queue_conn()
273 rxrpc_put_connection(conn); in rxrpc_queue_conn()
280 void rxrpc_see_connection(struct rxrpc_connection *conn) in rxrpc_see_connection() argument
283 if (conn) { in rxrpc_see_connection()
284 int n = refcount_read(&conn->ref); in rxrpc_see_connection()
286 trace_rxrpc_conn(conn->debug_id, rxrpc_conn_seen, n, here); in rxrpc_see_connection()
293 struct rxrpc_connection *rxrpc_get_connection(struct rxrpc_connection *conn) in rxrpc_get_connection() argument
298 __refcount_inc(&conn->ref, &r); in rxrpc_get_connection()
299 trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, r, here); in rxrpc_get_connection()
300 return conn; in rxrpc_get_connection()
307 rxrpc_get_connection_maybe(struct rxrpc_connection *conn) in rxrpc_get_connection_maybe() argument
312 if (conn) { in rxrpc_get_connection_maybe()
313 if (__refcount_inc_not_zero(&conn->ref, &r)) in rxrpc_get_connection_maybe()
314 trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, r + 1, here); in rxrpc_get_connection_maybe()
316 conn = NULL; in rxrpc_get_connection_maybe()
318 return conn; in rxrpc_get_connection_maybe()
334 void rxrpc_put_service_conn(struct rxrpc_connection *conn) in rxrpc_put_service_conn() argument
337 unsigned int debug_id = conn->debug_id; in rxrpc_put_service_conn()
340 __refcount_dec(&conn->ref, &r); in rxrpc_put_service_conn()
343 rxrpc_set_service_reap_timer(conn->params.local->rxnet, in rxrpc_put_service_conn()
352 struct rxrpc_connection *conn = in rxrpc_destroy_connection() local
355 _enter("{%d,u=%d}", conn->debug_id, refcount_read(&conn->ref)); in rxrpc_destroy_connection()
357 ASSERTCMP(refcount_read(&conn->ref), ==, 0); in rxrpc_destroy_connection()
359 _net("DESTROY CONN %d", conn->debug_id); in rxrpc_destroy_connection()
361 del_timer_sync(&conn->timer); in rxrpc_destroy_connection()
362 rxrpc_purge_queue(&conn->rx_queue); in rxrpc_destroy_connection()
364 conn->security->clear(conn); in rxrpc_destroy_connection()
365 key_put(conn->params.key); in rxrpc_destroy_connection()
366 rxrpc_put_bundle(conn->bundle); in rxrpc_destroy_connection()
367 rxrpc_put_peer(conn->params.peer); in rxrpc_destroy_connection()
369 if (atomic_dec_and_test(&conn->params.local->rxnet->nr_conns)) in rxrpc_destroy_connection()
370 wake_up_var(&conn->params.local->rxnet->nr_conns); in rxrpc_destroy_connection()
371 rxrpc_put_local(conn->params.local); in rxrpc_destroy_connection()
373 kfree(conn); in rxrpc_destroy_connection()
382 struct rxrpc_connection *conn, *_p; in rxrpc_service_connection_reaper() local
395 list_for_each_entry_safe(conn, _p, &rxnet->service_conns, link) { in rxrpc_service_connection_reaper()
396 ASSERTCMP(refcount_read(&conn->ref), >, 0); in rxrpc_service_connection_reaper()
397 if (likely(refcount_read(&conn->ref) > 1)) in rxrpc_service_connection_reaper()
399 if (conn->state == RXRPC_CONN_SERVICE_PREALLOC) in rxrpc_service_connection_reaper()
402 if (rxnet->live && !conn->params.local->dead) { in rxrpc_service_connection_reaper()
403 idle_timestamp = READ_ONCE(conn->idle_timestamp); in rxrpc_service_connection_reaper()
405 if (conn->params.local->service_closed) in rxrpc_service_connection_reaper()
408 _debug("reap CONN %d { u=%d,t=%ld }", in rxrpc_service_connection_reaper()
409 conn->debug_id, refcount_read(&conn->ref), in rxrpc_service_connection_reaper()
422 if (!refcount_dec_if_one(&conn->ref)) in rxrpc_service_connection_reaper()
424 trace_rxrpc_conn(conn->debug_id, rxrpc_conn_reap_service, 0, NULL); in rxrpc_service_connection_reaper()
426 if (rxrpc_conn_is_client(conn)) in rxrpc_service_connection_reaper()
429 rxrpc_unpublish_service_conn(conn); in rxrpc_service_connection_reaper()
431 list_move_tail(&conn->link, &graveyard); in rxrpc_service_connection_reaper()
442 conn = list_entry(graveyard.next, struct rxrpc_connection, in rxrpc_service_connection_reaper()
444 list_del_init(&conn->link); in rxrpc_service_connection_reaper()
446 ASSERTCMP(refcount_read(&conn->ref), ==, 0); in rxrpc_service_connection_reaper()
447 rxrpc_kill_connection(conn); in rxrpc_service_connection_reaper()
459 struct rxrpc_connection *conn, *_p; in rxrpc_destroy_all_connections() local
472 list_for_each_entry_safe(conn, _p, &rxnet->service_conns, link) { in rxrpc_destroy_all_connections()
473 pr_err("AF_RXRPC: Leaked conn %p {%d}\n", in rxrpc_destroy_all_connections()
474 conn, refcount_read(&conn->ref)); in rxrpc_destroy_all_connections()