• Home
  • Raw
  • Download

Lines Matching refs:conn

49 static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn,  in rxrpc_get_client_connection_id()  argument
52 struct rxrpc_net *rxnet = conn->params.local->rxnet; in rxrpc_get_client_connection_id()
60 id = idr_alloc_cyclic(&rxrpc_client_conn_ids, conn, in rxrpc_get_client_connection_id()
68 conn->proto.epoch = rxnet->epoch; in rxrpc_get_client_connection_id()
69 conn->proto.cid = id << RXRPC_CIDSHIFT; in rxrpc_get_client_connection_id()
70 set_bit(RXRPC_CONN_HAS_IDR, &conn->flags); in rxrpc_get_client_connection_id()
71 _leave(" [CID %x]", conn->proto.cid); in rxrpc_get_client_connection_id()
84 static void rxrpc_put_client_connection_id(struct rxrpc_connection *conn) in rxrpc_put_client_connection_id() argument
86 if (test_bit(RXRPC_CONN_HAS_IDR, &conn->flags)) { in rxrpc_put_client_connection_id()
89 conn->proto.cid >> RXRPC_CIDSHIFT); in rxrpc_put_client_connection_id()
99 struct rxrpc_connection *conn; in rxrpc_destroy_client_conn_ids() local
103 idr_for_each_entry(&rxrpc_client_conn_ids, conn, id) { in rxrpc_destroy_client_conn_ids()
105 conn, atomic_read(&conn->usage)); in rxrpc_destroy_client_conn_ids()
160 struct rxrpc_connection *conn; in rxrpc_alloc_client_connection() local
166 conn = rxrpc_alloc_connection(gfp); in rxrpc_alloc_client_connection()
167 if (!conn) { in rxrpc_alloc_client_connection()
172 atomic_set(&conn->usage, 1); in rxrpc_alloc_client_connection()
173 conn->bundle = bundle; in rxrpc_alloc_client_connection()
174 conn->params = bundle->params; in rxrpc_alloc_client_connection()
175 conn->out_clientflag = RXRPC_CLIENT_INITIATED; in rxrpc_alloc_client_connection()
176 conn->state = RXRPC_CONN_CLIENT; in rxrpc_alloc_client_connection()
177 conn->service_id = conn->params.service_id; in rxrpc_alloc_client_connection()
179 ret = rxrpc_get_client_connection_id(conn, gfp); in rxrpc_alloc_client_connection()
183 ret = rxrpc_init_client_conn_security(conn); in rxrpc_alloc_client_connection()
187 ret = conn->security->prime_packet_security(conn); in rxrpc_alloc_client_connection()
193 list_add_tail(&conn->proc_link, &rxnet->conn_proc_list); in rxrpc_alloc_client_connection()
197 rxrpc_get_peer(conn->params.peer); in rxrpc_alloc_client_connection()
198 rxrpc_get_local(conn->params.local); in rxrpc_alloc_client_connection()
199 key_get(conn->params.key); in rxrpc_alloc_client_connection()
201 trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_client, in rxrpc_alloc_client_connection()
202 atomic_read(&conn->usage), in rxrpc_alloc_client_connection()
206 trace_rxrpc_client(conn, -1, rxrpc_client_alloc); in rxrpc_alloc_client_connection()
207 _leave(" = %p", conn); in rxrpc_alloc_client_connection()
208 return conn; in rxrpc_alloc_client_connection()
211 conn->security->clear(conn); in rxrpc_alloc_client_connection()
213 rxrpc_put_client_connection_id(conn); in rxrpc_alloc_client_connection()
215 kfree(conn); in rxrpc_alloc_client_connection()
223 static bool rxrpc_may_reuse_conn(struct rxrpc_connection *conn) in rxrpc_may_reuse_conn() argument
228 if (!conn) in rxrpc_may_reuse_conn()
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()
257 set_bit(RXRPC_CONN_DONT_REUSE, &conn->flags); in rxrpc_may_reuse_conn()
511 static void rxrpc_activate_one_channel(struct rxrpc_connection *conn, in rxrpc_activate_one_channel() argument
514 struct rxrpc_channel *chan = &conn->channels[channel]; in rxrpc_activate_one_channel()
515 struct rxrpc_bundle *bundle = conn->bundle; in rxrpc_activate_one_channel()
520 _enter("C=%x,%u", conn->debug_id, channel); in rxrpc_activate_one_channel()
522 trace_rxrpc_client(conn, channel, rxrpc_client_chan_activate); in rxrpc_activate_one_channel()
527 clear_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags); in rxrpc_activate_one_channel()
528 clear_bit(conn->bundle_shift + channel, &bundle->avail_chans); in rxrpc_activate_one_channel()
532 call->peer = rxrpc_get_peer(conn->params.peer); in rxrpc_activate_one_channel()
533 call->conn = rxrpc_get_connection(conn); in rxrpc_activate_one_channel()
534 call->cid = conn->proto.cid | channel; in rxrpc_activate_one_channel()
536 call->security = conn->security; in rxrpc_activate_one_channel()
537 call->security_ix = conn->security_ix; in rxrpc_activate_one_channel()
538 call->service_id = conn->service_id; in rxrpc_activate_one_channel()
542 call->cid, call->call_id, call->debug_id, conn->debug_id); in rxrpc_activate_one_channel()
569 static void rxrpc_unidle_conn(struct rxrpc_bundle *bundle, struct rxrpc_connection *conn) in rxrpc_unidle_conn() argument
574 if (!list_empty(&conn->cache_link)) { in rxrpc_unidle_conn()
577 if (!list_empty(&conn->cache_link)) { in rxrpc_unidle_conn()
578 list_del_init(&conn->cache_link); in rxrpc_unidle_conn()
583 rxrpc_put_connection(conn); in rxrpc_unidle_conn()
593 struct rxrpc_connection *conn; in rxrpc_activate_channels_locked() local
610 conn = bundle->conns[slot]; in rxrpc_activate_channels_locked()
611 if (!conn) in rxrpc_activate_channels_locked()
615 set_bit(RXRPC_CONN_PROBING_FOR_UPGRADE, &conn->flags); in rxrpc_activate_channels_locked()
616 rxrpc_unidle_conn(bundle, conn); in rxrpc_activate_channels_locked()
619 conn->act_chans |= 1 << channel; in rxrpc_activate_channels_locked()
620 rxrpc_activate_one_channel(conn, channel); in rxrpc_activate_channels_locked()
746 trace_rxrpc_client(call->conn, ret, rxrpc_client_chan_wait_failed); in rxrpc_connect_call()
759 struct rxrpc_connection *conn = call->conn; in rxrpc_expose_client_call() local
760 struct rxrpc_channel *chan = &conn->channels[channel]; in rxrpc_expose_client_call()
770 set_bit(RXRPC_CONN_DONT_REUSE, &conn->flags); in rxrpc_expose_client_call()
771 trace_rxrpc_client(conn, channel, rxrpc_client_exposed); in rxrpc_expose_client_call()
794 struct rxrpc_connection *conn; in rxrpc_disconnect_client_call() local
809 conn = call->conn; in rxrpc_disconnect_client_call()
810 if (!conn) { in rxrpc_disconnect_client_call()
820 chan = &conn->channels[channel]; in rxrpc_disconnect_client_call()
821 trace_rxrpc_client(conn, channel, rxrpc_client_chan_disconnect); in rxrpc_disconnect_client_call()
828 may_reuse = rxrpc_may_reuse_conn(conn); in rxrpc_disconnect_client_call()
841 __rxrpc_disconnect_call(conn, call); in rxrpc_disconnect_client_call()
843 if (test_and_clear_bit(RXRPC_CONN_PROBING_FOR_UPGRADE, &conn->flags)) { in rxrpc_disconnect_client_call()
844 trace_rxrpc_client(conn, channel, rxrpc_client_to_active); in rxrpc_disconnect_client_call()
854 trace_rxrpc_client(conn, channel, rxrpc_client_chan_pass); in rxrpc_disconnect_client_call()
855 rxrpc_activate_one_channel(conn, channel); in rxrpc_disconnect_client_call()
869 set_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags); in rxrpc_disconnect_client_call()
870 rxrpc_reduce_conn_timer(conn, final_ack_at); in rxrpc_disconnect_client_call()
875 set_bit(conn->bundle_shift + channel, &conn->bundle->avail_chans); in rxrpc_disconnect_client_call()
876 conn->act_chans &= ~(1 << channel); in rxrpc_disconnect_client_call()
882 if (!conn->act_chans) { in rxrpc_disconnect_client_call()
883 trace_rxrpc_client(conn, channel, rxrpc_client_to_idle); in rxrpc_disconnect_client_call()
884 conn->idle_timestamp = jiffies; in rxrpc_disconnect_client_call()
886 rxrpc_get_connection(conn); in rxrpc_disconnect_client_call()
888 list_move_tail(&conn->cache_link, &rxnet->idle_client_conns); in rxrpc_disconnect_client_call()
903 static void rxrpc_unbundle_conn(struct rxrpc_connection *conn) in rxrpc_unbundle_conn() argument
905 struct rxrpc_bundle *bundle = conn->bundle; in rxrpc_unbundle_conn()
911 _enter("C=%x", conn->debug_id); in rxrpc_unbundle_conn()
913 if (conn->flags & RXRPC_CONN_FINAL_ACK_MASK) in rxrpc_unbundle_conn()
914 rxrpc_process_delayed_final_acks(conn, true); in rxrpc_unbundle_conn()
917 bindex = conn->bundle_shift / RXRPC_MAXCALLS; in rxrpc_unbundle_conn()
918 if (bundle->conns[bindex] == conn) { in rxrpc_unbundle_conn()
922 clear_bit(conn->bundle_shift + i, &bundle->avail_chans); in rxrpc_unbundle_conn()
947 rxrpc_put_connection(conn); in rxrpc_unbundle_conn()
954 static void rxrpc_kill_client_conn(struct rxrpc_connection *conn) in rxrpc_kill_client_conn() argument
956 struct rxrpc_local *local = conn->params.local; in rxrpc_kill_client_conn()
959 _enter("C=%x", conn->debug_id); in rxrpc_kill_client_conn()
961 trace_rxrpc_client(conn, -1, rxrpc_client_cleanup); in rxrpc_kill_client_conn()
964 rxrpc_put_client_connection_id(conn); in rxrpc_kill_client_conn()
965 rxrpc_kill_connection(conn); in rxrpc_kill_client_conn()
971 void rxrpc_put_client_conn(struct rxrpc_connection *conn) in rxrpc_put_client_conn() argument
974 unsigned int debug_id = conn->debug_id; in rxrpc_put_client_conn()
977 n = atomic_dec_return(&conn->usage); in rxrpc_put_client_conn()
981 rxrpc_kill_client_conn(conn); in rxrpc_put_client_conn()
994 struct rxrpc_connection *conn; in rxrpc_discard_expired_client_conns() local
1024 conn = list_entry(rxnet->idle_client_conns.next, in rxrpc_discard_expired_client_conns()
1036 if (conn->params.local->service_closed) in rxrpc_discard_expired_client_conns()
1039 conn_expires_at = conn->idle_timestamp + expiry; in rxrpc_discard_expired_client_conns()
1046 trace_rxrpc_client(conn, -1, rxrpc_client_discard); in rxrpc_discard_expired_client_conns()
1047 list_del_init(&conn->cache_link); in rxrpc_discard_expired_client_conns()
1051 rxrpc_unbundle_conn(conn); in rxrpc_discard_expired_client_conns()
1052 rxrpc_put_connection(conn); /* Drop the ->cache_link ref */ in rxrpc_discard_expired_client_conns()
1100 struct rxrpc_connection *conn, *tmp; in rxrpc_clean_up_local_conns() local
1108 list_for_each_entry_safe(conn, tmp, &rxnet->idle_client_conns, in rxrpc_clean_up_local_conns()
1110 if (conn->params.local == local) { in rxrpc_clean_up_local_conns()
1111 trace_rxrpc_client(conn, -1, rxrpc_client_discard); in rxrpc_clean_up_local_conns()
1112 list_move(&conn->cache_link, &graveyard); in rxrpc_clean_up_local_conns()
1119 conn = list_entry(graveyard.next, in rxrpc_clean_up_local_conns()
1121 list_del_init(&conn->cache_link); in rxrpc_clean_up_local_conns()
1122 rxrpc_unbundle_conn(conn); in rxrpc_clean_up_local_conns()
1123 rxrpc_put_connection(conn); in rxrpc_clean_up_local_conns()