local_object.c (0d6bf319bc5aba4535bb46e1b607973688a2248a) local_object.c (9d35d880e0e4a3ab32d8c12f9e4d76198aadd42d)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* Local endpoint object management
3 *
4 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

--- 103 unchanged lines hidden (view full) ---

112 init_completion(&local->io_thread_ready);
113 skb_queue_head_init(&local->rx_queue);
114 INIT_LIST_HEAD(&local->conn_attend_q);
115 INIT_LIST_HEAD(&local->call_attend_q);
116
117 local->client_bundles = RB_ROOT;
118 spin_lock_init(&local->client_bundles_lock);
119 local->kill_all_client_conns = false;
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* Local endpoint object management
3 *
4 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

--- 103 unchanged lines hidden (view full) ---

112 init_completion(&local->io_thread_ready);
113 skb_queue_head_init(&local->rx_queue);
114 INIT_LIST_HEAD(&local->conn_attend_q);
115 INIT_LIST_HEAD(&local->call_attend_q);
116
117 local->client_bundles = RB_ROOT;
118 spin_lock_init(&local->client_bundles_lock);
119 local->kill_all_client_conns = false;
120 spin_lock_init(&local->client_conn_cache_lock);
121 INIT_LIST_HEAD(&local->idle_client_conns);
122 timer_setup(&local->client_conn_reap_timer,
123 rxrpc_client_conn_reap_timeout, 0);
124
125 spin_lock_init(&local->lock);
126 rwlock_init(&local->services_lock);
127 local->debug_id = atomic_inc_return(&rxrpc_debug_id);
128 memcpy(&local->srx, srx, sizeof(*srx));
129 local->srx.srx_service = 0;
130 idr_init(&local->conn_ids);
131 get_random_bytes(&tmp, sizeof(tmp));
132 tmp &= 0x3fffffff;
133 if (tmp == 0)
134 tmp = 1;
135 idr_set_cursor(&local->conn_ids, tmp);
120 INIT_LIST_HEAD(&local->idle_client_conns);
121 timer_setup(&local->client_conn_reap_timer,
122 rxrpc_client_conn_reap_timeout, 0);
123
124 spin_lock_init(&local->lock);
125 rwlock_init(&local->services_lock);
126 local->debug_id = atomic_inc_return(&rxrpc_debug_id);
127 memcpy(&local->srx, srx, sizeof(*srx));
128 local->srx.srx_service = 0;
129 idr_init(&local->conn_ids);
130 get_random_bytes(&tmp, sizeof(tmp));
131 tmp &= 0x3fffffff;
132 if (tmp == 0)
133 tmp = 1;
134 idr_set_cursor(&local->conn_ids, tmp);
136 spin_lock_init(&local->conn_lock);
135 INIT_LIST_HEAD(&local->new_client_calls);
136 spin_lock_init(&local->client_call_lock);
137
138 trace_rxrpc_local(local->debug_id, rxrpc_local_new, 1, 1);
139 }
140
141 _leave(" = %p", local);
142 return local;
143}
144

--- 285 unchanged lines hidden (view full) ---

430 socket->sk->sk_user_data = NULL;
431 sock_release(socket);
432 }
433
434 /* At this point, there should be no more packets coming in to the
435 * local endpoint.
436 */
437 rxrpc_purge_queue(&local->rx_queue);
137
138 trace_rxrpc_local(local->debug_id, rxrpc_local_new, 1, 1);
139 }
140
141 _leave(" = %p", local);
142 return local;
143}
144

--- 285 unchanged lines hidden (view full) ---

430 socket->sk->sk_user_data = NULL;
431 sock_release(socket);
432 }
433
434 /* At this point, there should be no more packets coming in to the
435 * local endpoint.
436 */
437 rxrpc_purge_queue(&local->rx_queue);
438 rxrpc_destroy_client_conn_ids(local);
438 rxrpc_purge_client_connections(local);
439}
440
441/*
442 * Destroy a local endpoint after the RCU grace period expires.
443 */
444static void rxrpc_local_rcu(struct rcu_head *rcu)
445{
446 struct rxrpc_local *local = container_of(rcu, struct rxrpc_local, rcu);

--- 26 unchanged lines hidden ---
439}
440
441/*
442 * Destroy a local endpoint after the RCU grace period expires.
443 */
444static void rxrpc_local_rcu(struct rcu_head *rcu)
445{
446 struct rxrpc_local *local = container_of(rcu, struct rxrpc_local, rcu);

--- 26 unchanged lines hidden ---