Lines Matching full:cp

113 static void rds_conn_path_reset(struct rds_conn_path *cp)  in rds_conn_path_reset()  argument
115 struct rds_connection *conn = cp->cp_conn; in rds_conn_path_reset()
121 rds_send_path_reset(cp); in rds_conn_path_reset()
122 cp->cp_flags = 0; in rds_conn_path_reset()
131 struct rds_conn_path *cp, bool is_outgoing) in __rds_conn_path_init() argument
133 spin_lock_init(&cp->cp_lock); in __rds_conn_path_init()
134 cp->cp_next_tx_seq = 1; in __rds_conn_path_init()
135 init_waitqueue_head(&cp->cp_waitq); in __rds_conn_path_init()
136 INIT_LIST_HEAD(&cp->cp_send_queue); in __rds_conn_path_init()
137 INIT_LIST_HEAD(&cp->cp_retrans); in __rds_conn_path_init()
139 cp->cp_conn = conn; in __rds_conn_path_init()
140 atomic_set(&cp->cp_state, RDS_CONN_DOWN); in __rds_conn_path_init()
141 cp->cp_send_gen = 0; in __rds_conn_path_init()
142 cp->cp_reconnect_jiffies = 0; in __rds_conn_path_init()
143 cp->cp_conn->c_proposed_version = RDS_PROTOCOL_VERSION; in __rds_conn_path_init()
144 INIT_DELAYED_WORK(&cp->cp_send_w, rds_send_worker); in __rds_conn_path_init()
145 INIT_DELAYED_WORK(&cp->cp_recv_w, rds_recv_worker); in __rds_conn_path_init()
146 INIT_DELAYED_WORK(&cp->cp_conn_w, rds_connect_worker); in __rds_conn_path_init()
147 INIT_WORK(&cp->cp_down_w, rds_shutdown_worker); in __rds_conn_path_init()
148 mutex_init(&cp->cp_cm_lock); in __rds_conn_path_init()
149 cp->cp_flags = 0; in __rds_conn_path_init()
305 struct rds_conn_path *cp; in __rds_conn_create() local
309 cp = &conn->c_path[i]; in __rds_conn_create()
314 if (cp->cp_transport_data) in __rds_conn_create()
315 trans->conn_free(cp->cp_transport_data); in __rds_conn_create()
355 void rds_conn_shutdown(struct rds_conn_path *cp) in rds_conn_shutdown() argument
357 struct rds_connection *conn = cp->cp_conn; in rds_conn_shutdown()
360 if (!rds_conn_path_transition(cp, RDS_CONN_DOWN, RDS_CONN_DOWN)) { in rds_conn_shutdown()
368 mutex_lock(&cp->cp_cm_lock); in rds_conn_shutdown()
369 if (!rds_conn_path_transition(cp, RDS_CONN_UP, in rds_conn_shutdown()
371 !rds_conn_path_transition(cp, RDS_CONN_ERROR, in rds_conn_shutdown()
373 rds_conn_path_error(cp, in rds_conn_shutdown()
375 atomic_read(&cp->cp_state)); in rds_conn_shutdown()
376 mutex_unlock(&cp->cp_cm_lock); in rds_conn_shutdown()
379 mutex_unlock(&cp->cp_cm_lock); in rds_conn_shutdown()
381 wait_event(cp->cp_waitq, in rds_conn_shutdown()
382 !test_bit(RDS_IN_XMIT, &cp->cp_flags)); in rds_conn_shutdown()
383 wait_event(cp->cp_waitq, in rds_conn_shutdown()
384 !test_bit(RDS_RECV_REFILL, &cp->cp_flags)); in rds_conn_shutdown()
386 conn->c_trans->conn_path_shutdown(cp); in rds_conn_shutdown()
387 rds_conn_path_reset(cp); in rds_conn_shutdown()
389 if (!rds_conn_path_transition(cp, RDS_CONN_DISCONNECTING, in rds_conn_shutdown()
391 !rds_conn_path_transition(cp, RDS_CONN_ERROR, in rds_conn_shutdown()
404 rds_conn_path_error(cp, "%s: failed to transition " in rds_conn_shutdown()
407 atomic_read(&cp->cp_state)); in rds_conn_shutdown()
416 cancel_delayed_work_sync(&cp->cp_conn_w); in rds_conn_shutdown()
420 rds_queue_reconnect(cp); in rds_conn_shutdown()
429 static void rds_conn_path_destroy(struct rds_conn_path *cp) in rds_conn_path_destroy() argument
433 if (!cp->cp_transport_data) in rds_conn_path_destroy()
437 cancel_delayed_work_sync(&cp->cp_send_w); in rds_conn_path_destroy()
438 cancel_delayed_work_sync(&cp->cp_recv_w); in rds_conn_path_destroy()
440 rds_conn_path_drop(cp, true); in rds_conn_path_destroy()
441 flush_work(&cp->cp_down_w); in rds_conn_path_destroy()
445 &cp->cp_send_queue, in rds_conn_path_destroy()
451 if (cp->cp_xmit_rm) in rds_conn_path_destroy()
452 rds_message_put(cp->cp_xmit_rm); in rds_conn_path_destroy()
454 WARN_ON(delayed_work_pending(&cp->cp_send_w)); in rds_conn_path_destroy()
455 WARN_ON(delayed_work_pending(&cp->cp_recv_w)); in rds_conn_path_destroy()
456 WARN_ON(delayed_work_pending(&cp->cp_conn_w)); in rds_conn_path_destroy()
457 WARN_ON(work_pending(&cp->cp_down_w)); in rds_conn_path_destroy()
459 cp->cp_conn->c_trans->conn_free(cp->cp_transport_data); in rds_conn_path_destroy()
473 struct rds_conn_path *cp; in rds_conn_destroy() local
488 cp = &conn->c_path[i]; in rds_conn_destroy()
489 rds_conn_path_destroy(cp); in rds_conn_destroy()
490 BUG_ON(!list_empty(&cp->cp_retrans)); in rds_conn_destroy()
546 struct rds_conn_path *cp; in rds_conn_message_info_cmn() local
556 cp = &conn->c_path[j]; in rds_conn_message_info_cmn()
558 list = &cp->cp_send_queue; in rds_conn_message_info_cmn()
560 list = &cp->cp_retrans; in rds_conn_message_info_cmn()
562 spin_lock_irqsave(&cp->cp_lock, flags); in rds_conn_message_info_cmn()
575 spin_unlock_irqrestore(&cp->cp_lock, flags); in rds_conn_message_info_cmn()
697 struct rds_conn_path *cp; in rds_walk_conn_path_info() local
707 cp = conn->c_path; in rds_walk_conn_path_info()
710 if (!visitor(cp, buffer)) in rds_walk_conn_path_info()
727 static int rds_conn_info_visitor(struct rds_conn_path *cp, void *buffer) in rds_conn_info_visitor() argument
730 struct rds_connection *conn = cp->cp_conn; in rds_conn_info_visitor()
735 cinfo->next_tx_seq = cp->cp_next_tx_seq; in rds_conn_info_visitor()
736 cinfo->next_rx_seq = cp->cp_next_rx_seq; in rds_conn_info_visitor()
744 rds_conn_info_set(cinfo->flags, test_bit(RDS_IN_XMIT, &cp->cp_flags), in rds_conn_info_visitor()
748 atomic_read(&cp->cp_state) == RDS_CONN_CONNECTING, in rds_conn_info_visitor()
751 atomic_read(&cp->cp_state) == RDS_CONN_UP, in rds_conn_info_visitor()
757 static int rds6_conn_info_visitor(struct rds_conn_path *cp, void *buffer) in rds6_conn_info_visitor() argument
760 struct rds_connection *conn = cp->cp_conn; in rds6_conn_info_visitor()
762 cinfo6->next_tx_seq = cp->cp_next_tx_seq; in rds6_conn_info_visitor()
763 cinfo6->next_rx_seq = cp->cp_next_rx_seq; in rds6_conn_info_visitor()
770 rds_conn_info_set(cinfo6->flags, test_bit(RDS_IN_XMIT, &cp->cp_flags), in rds6_conn_info_visitor()
774 atomic_read(&cp->cp_state) == RDS_CONN_CONNECTING, in rds6_conn_info_visitor()
777 atomic_read(&cp->cp_state) == RDS_CONN_UP, in rds6_conn_info_visitor()
869 void rds_conn_path_drop(struct rds_conn_path *cp, bool destroy) in rds_conn_path_drop() argument
871 atomic_set(&cp->cp_state, RDS_CONN_ERROR); in rds_conn_path_drop()
874 if (!destroy && rds_destroy_pending(cp->cp_conn)) { in rds_conn_path_drop()
878 queue_work(rds_wq, &cp->cp_down_w); in rds_conn_path_drop()
894 void rds_conn_path_connect_if_down(struct rds_conn_path *cp) in rds_conn_path_connect_if_down() argument
897 if (rds_destroy_pending(cp->cp_conn)) { in rds_conn_path_connect_if_down()
901 if (rds_conn_path_state(cp) == RDS_CONN_DOWN && in rds_conn_path_connect_if_down()
902 !test_and_set_bit(RDS_RECONNECT_PENDING, &cp->cp_flags)) in rds_conn_path_connect_if_down()
903 queue_delayed_work(rds_wq, &cp->cp_conn_w, 0); in rds_conn_path_connect_if_down()
927 __rds_conn_path_error(struct rds_conn_path *cp, const char *fmt, ...) in __rds_conn_path_error() argument
935 rds_conn_path_drop(cp, false); in __rds_conn_path_error()