Lines Matching refs:call

46 void rxrpc_poke_call(struct rxrpc_call *call, enum rxrpc_call_poke_trace what)  in rxrpc_poke_call()  argument
48 struct rxrpc_local *local = call->local; in rxrpc_poke_call()
51 if (!test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) { in rxrpc_poke_call()
53 busy = !list_empty(&call->attend_link); in rxrpc_poke_call()
54 trace_rxrpc_poke_call(call, busy, what); in rxrpc_poke_call()
55 if (!busy && !rxrpc_try_get_call(call, rxrpc_call_get_poke)) in rxrpc_poke_call()
58 list_add_tail(&call->attend_link, &local->call_attend_q); in rxrpc_poke_call()
68 struct rxrpc_call *call = from_timer(call, t, timer); in rxrpc_call_timer_expired() local
70 _enter("%d", call->debug_id); in rxrpc_call_timer_expired()
72 if (!__rxrpc_call_is_complete(call)) { in rxrpc_call_timer_expired()
73 trace_rxrpc_timer_expired(call, jiffies); in rxrpc_call_timer_expired()
74 rxrpc_poke_call(call, rxrpc_call_poke_timer); in rxrpc_call_timer_expired()
78 void rxrpc_reduce_call_timer(struct rxrpc_call *call, in rxrpc_reduce_call_timer() argument
83 trace_rxrpc_timer(call, why, now); in rxrpc_reduce_call_timer()
84 timer_reduce(&call->timer, expire_at); in rxrpc_reduce_call_timer()
98 struct rxrpc_call *call; in rxrpc_find_call_by_user_ID() local
107 call = rb_entry(p, struct rxrpc_call, sock_node); in rxrpc_find_call_by_user_ID()
109 if (user_call_ID < call->user_call_ID) in rxrpc_find_call_by_user_ID()
111 else if (user_call_ID > call->user_call_ID) in rxrpc_find_call_by_user_ID()
122 rxrpc_get_call(call, rxrpc_call_get_sendmsg); in rxrpc_find_call_by_user_ID()
124 _leave(" = %p [%d]", call, refcount_read(&call->ref)); in rxrpc_find_call_by_user_ID()
125 return call; in rxrpc_find_call_by_user_ID()
134 struct rxrpc_call *call; in rxrpc_alloc_call() local
137 call = kmem_cache_zalloc(rxrpc_call_jar, gfp); in rxrpc_alloc_call()
138 if (!call) in rxrpc_alloc_call()
141 mutex_init(&call->user_mutex); in rxrpc_alloc_call()
147 lockdep_set_class(&call->user_mutex, in rxrpc_alloc_call()
150 timer_setup(&call->timer, rxrpc_call_timer_expired, 0); in rxrpc_alloc_call()
151 INIT_WORK(&call->destroyer, rxrpc_destroy_call); in rxrpc_alloc_call()
152 INIT_LIST_HEAD(&call->link); in rxrpc_alloc_call()
153 INIT_LIST_HEAD(&call->wait_link); in rxrpc_alloc_call()
154 INIT_LIST_HEAD(&call->accept_link); in rxrpc_alloc_call()
155 INIT_LIST_HEAD(&call->recvmsg_link); in rxrpc_alloc_call()
156 INIT_LIST_HEAD(&call->sock_link); in rxrpc_alloc_call()
157 INIT_LIST_HEAD(&call->attend_link); in rxrpc_alloc_call()
158 INIT_LIST_HEAD(&call->tx_sendmsg); in rxrpc_alloc_call()
159 INIT_LIST_HEAD(&call->tx_buffer); in rxrpc_alloc_call()
160 skb_queue_head_init(&call->recvmsg_queue); in rxrpc_alloc_call()
161 skb_queue_head_init(&call->rx_oos_queue); in rxrpc_alloc_call()
162 init_waitqueue_head(&call->waitq); in rxrpc_alloc_call()
163 spin_lock_init(&call->notify_lock); in rxrpc_alloc_call()
164 spin_lock_init(&call->tx_lock); in rxrpc_alloc_call()
165 refcount_set(&call->ref, 1); in rxrpc_alloc_call()
166 call->debug_id = debug_id; in rxrpc_alloc_call()
167 call->tx_total_len = -1; in rxrpc_alloc_call()
168 call->next_rx_timo = 20 * HZ; in rxrpc_alloc_call()
169 call->next_req_timo = 1 * HZ; in rxrpc_alloc_call()
170 call->ackr_window = 1; in rxrpc_alloc_call()
171 call->ackr_wtop = 1; in rxrpc_alloc_call()
173 memset(&call->sock_node, 0xed, sizeof(call->sock_node)); in rxrpc_alloc_call()
175 call->rx_winsize = rxrpc_rx_window_size; in rxrpc_alloc_call()
176 call->tx_winsize = 16; in rxrpc_alloc_call()
179 call->cong_cwnd = 2; in rxrpc_alloc_call()
181 call->cong_cwnd = 3; in rxrpc_alloc_call()
183 call->cong_cwnd = 4; in rxrpc_alloc_call()
184 call->cong_ssthresh = RXRPC_TX_MAX_WINDOW; in rxrpc_alloc_call()
186 call->rxnet = rxnet; in rxrpc_alloc_call()
187 call->rtt_avail = RXRPC_CALL_RTT_AVAIL_MASK; in rxrpc_alloc_call()
189 return call; in rxrpc_alloc_call()
202 struct rxrpc_call *call; in rxrpc_alloc_client_call() local
208 call = rxrpc_alloc_call(rx, gfp, debug_id); in rxrpc_alloc_client_call()
209 if (!call) in rxrpc_alloc_client_call()
212 call->acks_latest_ts = now; in rxrpc_alloc_client_call()
213 call->cong_tstamp = now; in rxrpc_alloc_client_call()
214 call->dest_srx = *srx; in rxrpc_alloc_client_call()
215 call->interruptibility = p->interruptibility; in rxrpc_alloc_client_call()
216 call->tx_total_len = p->tx_total_len; in rxrpc_alloc_client_call()
217 call->key = key_get(cp->key); in rxrpc_alloc_client_call()
218 call->local = rxrpc_get_local(cp->local, rxrpc_local_get_call); in rxrpc_alloc_client_call()
219 call->security_level = cp->security_level; in rxrpc_alloc_client_call()
221 __set_bit(RXRPC_CALL_KERNEL, &call->flags); in rxrpc_alloc_client_call()
223 __set_bit(RXRPC_CALL_UPGRADE, &call->flags); in rxrpc_alloc_client_call()
225 __set_bit(RXRPC_CALL_EXCLUSIVE, &call->flags); in rxrpc_alloc_client_call()
228 call->next_rx_timo = min(msecs_to_jiffies(p->timeouts.normal), 1UL); in rxrpc_alloc_client_call()
230 call->next_req_timo = min(msecs_to_jiffies(p->timeouts.idle), 1UL); in rxrpc_alloc_client_call()
232 call->hard_timo = p->timeouts.hard * HZ; in rxrpc_alloc_client_call()
234 ret = rxrpc_init_client_call_security(call); in rxrpc_alloc_client_call()
236 rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, ret); in rxrpc_alloc_client_call()
237 rxrpc_put_call(call, rxrpc_call_put_discard_error); in rxrpc_alloc_client_call()
241 rxrpc_set_call_state(call, RXRPC_CALL_CLIENT_AWAIT_CONN); in rxrpc_alloc_client_call()
243 trace_rxrpc_call(call->debug_id, refcount_read(&call->ref), in rxrpc_alloc_client_call()
246 _leave(" = %p", call); in rxrpc_alloc_client_call()
247 return call; in rxrpc_alloc_client_call()
253 void rxrpc_start_call_timer(struct rxrpc_call *call) in rxrpc_start_call_timer() argument
258 call->delay_ack_at = j; in rxrpc_start_call_timer()
259 call->ack_lost_at = j; in rxrpc_start_call_timer()
260 call->resend_at = j; in rxrpc_start_call_timer()
261 call->ping_at = j; in rxrpc_start_call_timer()
262 call->keepalive_at = j; in rxrpc_start_call_timer()
263 call->expect_rx_by = j; in rxrpc_start_call_timer()
264 call->expect_req_by = j; in rxrpc_start_call_timer()
265 call->expect_term_by = j + call->hard_timo; in rxrpc_start_call_timer()
266 call->timer.expires = now; in rxrpc_start_call_timer()
288 static void rxrpc_put_call_slot(struct rxrpc_call *call) in rxrpc_put_call_slot() argument
292 if (test_bit(RXRPC_CALL_KERNEL, &call->flags)) in rxrpc_put_call_slot()
302 static int rxrpc_connect_call(struct rxrpc_call *call, gfp_t gfp) in rxrpc_connect_call() argument
304 struct rxrpc_local *local = call->local; in rxrpc_connect_call()
307 _enter("{%d,%lx},", call->debug_id, call->user_call_ID); in rxrpc_connect_call()
309 call->peer = rxrpc_lookup_peer(local, &call->dest_srx, gfp); in rxrpc_connect_call()
310 if (!call->peer) in rxrpc_connect_call()
313 ret = rxrpc_look_up_bundle(call, gfp); in rxrpc_connect_call()
318 rxrpc_get_call(call, rxrpc_call_get_io_thread); in rxrpc_connect_call()
320 list_add_tail(&call->wait_link, &local->new_client_calls); in rxrpc_connect_call()
326 __set_bit(RXRPC_CALL_DISCONNECTED, &call->flags); in rxrpc_connect_call()
342 __acquires(&call->user_mutex) in rxrpc_new_client_call()
344 struct rxrpc_call *call, *xcall; in rxrpc_new_client_call() local
358 call = rxrpc_alloc_client_call(rx, srx, cp, p, gfp, debug_id); in rxrpc_new_client_call()
359 if (IS_ERR(call)) { in rxrpc_new_client_call()
362 _leave(" = %ld", PTR_ERR(call)); in rxrpc_new_client_call()
363 return call; in rxrpc_new_client_call()
369 mutex_lock(&call->user_mutex); in rxrpc_new_client_call()
388 rcu_assign_pointer(call->socket, rx); in rxrpc_new_client_call()
389 call->user_call_ID = p->user_call_ID; in rxrpc_new_client_call()
390 __set_bit(RXRPC_CALL_HAS_USERID, &call->flags); in rxrpc_new_client_call()
391 rxrpc_get_call(call, rxrpc_call_get_userid); in rxrpc_new_client_call()
392 rb_link_node(&call->sock_node, parent, pp); in rxrpc_new_client_call()
393 rb_insert_color(&call->sock_node, &rx->calls); in rxrpc_new_client_call()
394 list_add(&call->sock_link, &rx->sock_calls); in rxrpc_new_client_call()
398 rxnet = call->rxnet; in rxrpc_new_client_call()
400 list_add_tail_rcu(&call->link, &rxnet->calls); in rxrpc_new_client_call()
409 ret = rxrpc_connect_call(call, gfp); in rxrpc_new_client_call()
413 _leave(" = %p [new]", call); in rxrpc_new_client_call()
414 return call; in rxrpc_new_client_call()
424 rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, -EEXIST); in rxrpc_new_client_call()
425 trace_rxrpc_call(call->debug_id, refcount_read(&call->ref), 0, in rxrpc_new_client_call()
427 mutex_unlock(&call->user_mutex); in rxrpc_new_client_call()
428 rxrpc_put_call(call, rxrpc_call_put_userid_exists); in rxrpc_new_client_call()
438 trace_rxrpc_call(call->debug_id, refcount_read(&call->ref), ret, in rxrpc_new_client_call()
440 rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, 0, ret); in rxrpc_new_client_call()
441 _leave(" = c=%08x [err]", call->debug_id); in rxrpc_new_client_call()
442 return call; in rxrpc_new_client_call()
450 struct rxrpc_call *call, in rxrpc_incoming_call() argument
453 struct rxrpc_connection *conn = call->conn; in rxrpc_incoming_call()
457 _enter(",%d", call->conn->debug_id); in rxrpc_incoming_call()
459 rcu_assign_pointer(call->socket, rx); in rxrpc_incoming_call()
460 call->call_id = sp->hdr.callNumber; in rxrpc_incoming_call()
461 call->dest_srx.srx_service = sp->hdr.serviceId; in rxrpc_incoming_call()
462 call->cid = sp->hdr.cid; in rxrpc_incoming_call()
463 call->cong_tstamp = skb->tstamp; in rxrpc_incoming_call()
465 __set_bit(RXRPC_CALL_EXPOSED, &call->flags); in rxrpc_incoming_call()
466 rxrpc_set_call_state(call, RXRPC_CALL_SERVER_SECURING); in rxrpc_incoming_call()
473 rxrpc_set_call_state(call, RXRPC_CALL_SERVER_SECURING); in rxrpc_incoming_call()
476 rxrpc_set_call_state(call, RXRPC_CALL_SERVER_RECV_REQUEST); in rxrpc_incoming_call()
480 rxrpc_set_call_completion(call, conn->completion, in rxrpc_incoming_call()
487 rxrpc_get_call(call, rxrpc_call_get_io_thread); in rxrpc_incoming_call()
496 conn->channels[chan].call_counter = call->call_id; in rxrpc_incoming_call()
497 conn->channels[chan].call_id = call->call_id; in rxrpc_incoming_call()
498 conn->channels[chan].call = call; in rxrpc_incoming_call()
502 hlist_add_head(&call->error_link, &conn->peer->error_targets); in rxrpc_incoming_call()
505 rxrpc_start_call_timer(call); in rxrpc_incoming_call()
512 void rxrpc_see_call(struct rxrpc_call *call, enum rxrpc_call_trace why) in rxrpc_see_call() argument
514 if (call) { in rxrpc_see_call()
515 int r = refcount_read(&call->ref); in rxrpc_see_call()
517 trace_rxrpc_call(call->debug_id, r, 0, why); in rxrpc_see_call()
521 struct rxrpc_call *rxrpc_try_get_call(struct rxrpc_call *call, in rxrpc_try_get_call() argument
526 if (!call || !__refcount_inc_not_zero(&call->ref, &r)) in rxrpc_try_get_call()
528 trace_rxrpc_call(call->debug_id, r + 1, 0, why); in rxrpc_try_get_call()
529 return call; in rxrpc_try_get_call()
535 void rxrpc_get_call(struct rxrpc_call *call, enum rxrpc_call_trace why) in rxrpc_get_call() argument
539 __refcount_inc(&call->ref, &r); in rxrpc_get_call()
540 trace_rxrpc_call(call->debug_id, r + 1, 0, why); in rxrpc_get_call()
546 static void rxrpc_cleanup_ring(struct rxrpc_call *call) in rxrpc_cleanup_ring() argument
548 rxrpc_purge_queue(&call->recvmsg_queue); in rxrpc_cleanup_ring()
549 rxrpc_purge_queue(&call->rx_oos_queue); in rxrpc_cleanup_ring()
555 void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) in rxrpc_release_call() argument
557 struct rxrpc_connection *conn = call->conn; in rxrpc_release_call()
560 _enter("{%d,%d}", call->debug_id, refcount_read(&call->ref)); in rxrpc_release_call()
562 trace_rxrpc_call(call->debug_id, refcount_read(&call->ref), in rxrpc_release_call()
563 call->flags, rxrpc_call_see_release); in rxrpc_release_call()
565 if (test_and_set_bit(RXRPC_CALL_RELEASED, &call->flags)) in rxrpc_release_call()
568 rxrpc_put_call_slot(call); in rxrpc_release_call()
573 if (!list_empty(&call->recvmsg_link)) { in rxrpc_release_call()
575 call, call->events, call->flags); in rxrpc_release_call()
576 list_del(&call->recvmsg_link); in rxrpc_release_call()
581 call->recvmsg_link.next = NULL; in rxrpc_release_call()
582 call->recvmsg_link.prev = NULL; in rxrpc_release_call()
586 rxrpc_put_call(call, rxrpc_call_put_unnotify); in rxrpc_release_call()
590 if (test_and_clear_bit(RXRPC_CALL_HAS_USERID, &call->flags)) { in rxrpc_release_call()
591 rb_erase(&call->sock_node, &rx->calls); in rxrpc_release_call()
592 memset(&call->sock_node, 0xdd, sizeof(call->sock_node)); in rxrpc_release_call()
596 list_del(&call->sock_link); in rxrpc_release_call()
599 _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, conn); in rxrpc_release_call()
602 rxrpc_put_call(call, rxrpc_call_put_userid); in rxrpc_release_call()
612 struct rxrpc_call *call; in rxrpc_release_calls_on_socket() local
617 call = list_entry(rx->to_be_accepted.next, in rxrpc_release_calls_on_socket()
619 list_del(&call->accept_link); in rxrpc_release_calls_on_socket()
620 rxrpc_propose_abort(call, RX_CALL_DEAD, -ECONNRESET, in rxrpc_release_calls_on_socket()
622 rxrpc_put_call(call, rxrpc_call_put_release_sock_tba); in rxrpc_release_calls_on_socket()
626 call = list_entry(rx->sock_calls.next, in rxrpc_release_calls_on_socket()
628 rxrpc_get_call(call, rxrpc_call_get_release_sock); in rxrpc_release_calls_on_socket()
629 rxrpc_propose_abort(call, RX_CALL_DEAD, -ECONNRESET, in rxrpc_release_calls_on_socket()
631 rxrpc_release_call(rx, call); in rxrpc_release_calls_on_socket()
632 rxrpc_put_call(call, rxrpc_call_put_release_sock); in rxrpc_release_calls_on_socket()
641 void rxrpc_put_call(struct rxrpc_call *call, enum rxrpc_call_trace why) in rxrpc_put_call() argument
643 struct rxrpc_net *rxnet = call->rxnet; in rxrpc_put_call()
644 unsigned int debug_id = call->debug_id; in rxrpc_put_call()
648 ASSERT(call != NULL); in rxrpc_put_call()
650 dead = __refcount_dec_and_test(&call->ref, &r); in rxrpc_put_call()
653 ASSERTCMP(__rxrpc_call_state(call), ==, RXRPC_CALL_COMPLETE); in rxrpc_put_call()
655 if (!list_empty(&call->link)) { in rxrpc_put_call()
657 list_del_init(&call->link); in rxrpc_put_call()
661 rxrpc_cleanup_call(call); in rxrpc_put_call()
670 struct rxrpc_call *call = container_of(rcu, struct rxrpc_call, rcu); in rxrpc_rcu_free_call() local
671 struct rxrpc_net *rxnet = READ_ONCE(call->rxnet); in rxrpc_rcu_free_call()
673 kmem_cache_free(rxrpc_call_jar, call); in rxrpc_rcu_free_call()
683 struct rxrpc_call *call = container_of(work, struct rxrpc_call, destroyer); in rxrpc_destroy_call() local
686 del_timer_sync(&call->timer); in rxrpc_destroy_call()
688 rxrpc_free_skb(call->cong_last_nack, rxrpc_skb_put_last_nack); in rxrpc_destroy_call()
689 rxrpc_cleanup_ring(call); in rxrpc_destroy_call()
690 while ((txb = list_first_entry_or_null(&call->tx_sendmsg, in rxrpc_destroy_call()
695 while ((txb = list_first_entry_or_null(&call->tx_buffer, in rxrpc_destroy_call()
701 rxrpc_put_txbuf(call->tx_pending, rxrpc_txbuf_put_cleaned); in rxrpc_destroy_call()
702 rxrpc_put_connection(call->conn, rxrpc_conn_put_call); in rxrpc_destroy_call()
703 rxrpc_deactivate_bundle(call->bundle); in rxrpc_destroy_call()
704 rxrpc_put_bundle(call->bundle, rxrpc_bundle_put_call); in rxrpc_destroy_call()
705 rxrpc_put_peer(call->peer, rxrpc_peer_put_call); in rxrpc_destroy_call()
706 rxrpc_put_local(call->local, rxrpc_local_put_call); in rxrpc_destroy_call()
707 call_rcu(&call->rcu, rxrpc_rcu_free_call); in rxrpc_destroy_call()
713 void rxrpc_cleanup_call(struct rxrpc_call *call) in rxrpc_cleanup_call() argument
715 memset(&call->sock_node, 0xcd, sizeof(call->sock_node)); in rxrpc_cleanup_call()
717 ASSERTCMP(__rxrpc_call_state(call), ==, RXRPC_CALL_COMPLETE); in rxrpc_cleanup_call()
718 ASSERT(test_bit(RXRPC_CALL_RELEASED, &call->flags)); in rxrpc_cleanup_call()
720 del_timer(&call->timer); in rxrpc_cleanup_call()
726 schedule_work(&call->destroyer); in rxrpc_cleanup_call()
728 rxrpc_destroy_call(&call->destroyer); in rxrpc_cleanup_call()
738 struct rxrpc_call *call; in rxrpc_destroy_all_calls() local
746 call = list_entry(rxnet->calls.next, in rxrpc_destroy_all_calls()
748 _debug("Zapping call %p", call); in rxrpc_destroy_all_calls()
750 rxrpc_see_call(call, rxrpc_call_see_zap); in rxrpc_destroy_all_calls()
751 list_del_init(&call->link); in rxrpc_destroy_all_calls()
754 call, refcount_read(&call->ref), in rxrpc_destroy_all_calls()
755 rxrpc_call_states[__rxrpc_call_state(call)], in rxrpc_destroy_all_calls()
756 call->flags, call->events); in rxrpc_destroy_all_calls()