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()
317 struct rds_conn_path *cp; in __rds_conn_create() local
321 cp = &conn->c_path[i]; in __rds_conn_create()
326 if (cp->cp_transport_data) in __rds_conn_create()
327 trans->conn_free(cp->cp_transport_data); in __rds_conn_create()
367 void rds_conn_shutdown(struct rds_conn_path *cp) in rds_conn_shutdown() argument
369 struct rds_connection *conn = cp->cp_conn; in rds_conn_shutdown()
372 if (!rds_conn_path_transition(cp, RDS_CONN_DOWN, RDS_CONN_DOWN)) { in rds_conn_shutdown()
380 mutex_lock(&cp->cp_cm_lock); in rds_conn_shutdown()
381 if (!rds_conn_path_transition(cp, RDS_CONN_UP, in rds_conn_shutdown()
383 !rds_conn_path_transition(cp, RDS_CONN_ERROR, in rds_conn_shutdown()
385 rds_conn_path_error(cp, in rds_conn_shutdown()
387 atomic_read(&cp->cp_state)); in rds_conn_shutdown()
388 mutex_unlock(&cp->cp_cm_lock); in rds_conn_shutdown()
391 mutex_unlock(&cp->cp_cm_lock); in rds_conn_shutdown()
393 wait_event(cp->cp_waitq, in rds_conn_shutdown()
394 !test_bit(RDS_IN_XMIT, &cp->cp_flags)); in rds_conn_shutdown()
395 wait_event(cp->cp_waitq, in rds_conn_shutdown()
396 !test_bit(RDS_RECV_REFILL, &cp->cp_flags)); in rds_conn_shutdown()
398 conn->c_trans->conn_path_shutdown(cp); in rds_conn_shutdown()
399 rds_conn_path_reset(cp); in rds_conn_shutdown()
401 if (!rds_conn_path_transition(cp, RDS_CONN_DISCONNECTING, in rds_conn_shutdown()
403 !rds_conn_path_transition(cp, RDS_CONN_ERROR, in rds_conn_shutdown()
416 rds_conn_path_error(cp, "%s: failed to transition " in rds_conn_shutdown()
419 atomic_read(&cp->cp_state)); in rds_conn_shutdown()
428 cancel_delayed_work_sync(&cp->cp_conn_w); in rds_conn_shutdown()
432 rds_queue_reconnect(cp); in rds_conn_shutdown()
441 static void rds_conn_path_destroy(struct rds_conn_path *cp) in rds_conn_path_destroy() argument
445 if (!cp->cp_transport_data) in rds_conn_path_destroy()
449 cancel_delayed_work_sync(&cp->cp_send_w); in rds_conn_path_destroy()
450 cancel_delayed_work_sync(&cp->cp_recv_w); in rds_conn_path_destroy()
452 rds_conn_path_drop(cp, true); in rds_conn_path_destroy()
453 flush_work(&cp->cp_down_w); in rds_conn_path_destroy()
457 &cp->cp_send_queue, in rds_conn_path_destroy()
463 if (cp->cp_xmit_rm) in rds_conn_path_destroy()
464 rds_message_put(cp->cp_xmit_rm); in rds_conn_path_destroy()
466 WARN_ON(delayed_work_pending(&cp->cp_send_w)); in rds_conn_path_destroy()
467 WARN_ON(delayed_work_pending(&cp->cp_recv_w)); in rds_conn_path_destroy()
468 WARN_ON(delayed_work_pending(&cp->cp_conn_w)); in rds_conn_path_destroy()
469 WARN_ON(work_pending(&cp->cp_down_w)); in rds_conn_path_destroy()
471 cp->cp_conn->c_trans->conn_free(cp->cp_transport_data); in rds_conn_path_destroy()
485 struct rds_conn_path *cp; in rds_conn_destroy() local
500 cp = &conn->c_path[i]; in rds_conn_destroy()
501 rds_conn_path_destroy(cp); in rds_conn_destroy()
502 BUG_ON(!list_empty(&cp->cp_retrans)); in rds_conn_destroy()
558 struct rds_conn_path *cp; in rds_conn_message_info_cmn() local
568 cp = &conn->c_path[j]; in rds_conn_message_info_cmn()
570 list = &cp->cp_send_queue; in rds_conn_message_info_cmn()
572 list = &cp->cp_retrans; in rds_conn_message_info_cmn()
574 spin_lock_irqsave(&cp->cp_lock, flags); in rds_conn_message_info_cmn()
587 spin_unlock_irqrestore(&cp->cp_lock, flags); in rds_conn_message_info_cmn()
709 struct rds_conn_path *cp; in rds_walk_conn_path_info() local
719 cp = conn->c_path; in rds_walk_conn_path_info()
722 if (!visitor(cp, buffer)) in rds_walk_conn_path_info()
739 static int rds_conn_info_visitor(struct rds_conn_path *cp, void *buffer) in rds_conn_info_visitor() argument
742 struct rds_connection *conn = cp->cp_conn; in rds_conn_info_visitor()
747 cinfo->next_tx_seq = cp->cp_next_tx_seq; in rds_conn_info_visitor()
748 cinfo->next_rx_seq = cp->cp_next_rx_seq; in rds_conn_info_visitor()
756 rds_conn_info_set(cinfo->flags, test_bit(RDS_IN_XMIT, &cp->cp_flags), in rds_conn_info_visitor()
760 atomic_read(&cp->cp_state) == RDS_CONN_CONNECTING, in rds_conn_info_visitor()
763 atomic_read(&cp->cp_state) == RDS_CONN_UP, in rds_conn_info_visitor()
769 static int rds6_conn_info_visitor(struct rds_conn_path *cp, void *buffer) in rds6_conn_info_visitor() argument
772 struct rds_connection *conn = cp->cp_conn; in rds6_conn_info_visitor()
774 cinfo6->next_tx_seq = cp->cp_next_tx_seq; in rds6_conn_info_visitor()
775 cinfo6->next_rx_seq = cp->cp_next_rx_seq; in rds6_conn_info_visitor()
782 rds_conn_info_set(cinfo6->flags, test_bit(RDS_IN_XMIT, &cp->cp_flags), in rds6_conn_info_visitor()
786 atomic_read(&cp->cp_state) == RDS_CONN_CONNECTING, in rds6_conn_info_visitor()
789 atomic_read(&cp->cp_state) == RDS_CONN_UP, in rds6_conn_info_visitor()
879 void rds_conn_path_drop(struct rds_conn_path *cp, bool destroy) in rds_conn_path_drop() argument
881 atomic_set(&cp->cp_state, RDS_CONN_ERROR); in rds_conn_path_drop()
884 if (!destroy && rds_destroy_pending(cp->cp_conn)) { in rds_conn_path_drop()
888 queue_work(rds_wq, &cp->cp_down_w); in rds_conn_path_drop()
904 void rds_conn_path_connect_if_down(struct rds_conn_path *cp) in rds_conn_path_connect_if_down() argument
907 if (rds_destroy_pending(cp->cp_conn)) { in rds_conn_path_connect_if_down()
911 if (rds_conn_path_state(cp) == RDS_CONN_DOWN && in rds_conn_path_connect_if_down()
912 !test_and_set_bit(RDS_RECONNECT_PENDING, &cp->cp_flags)) in rds_conn_path_connect_if_down()
913 queue_delayed_work(rds_wq, &cp->cp_conn_w, 0); in rds_conn_path_connect_if_down()
937 __rds_conn_path_error(struct rds_conn_path *cp, const char *fmt, ...) in __rds_conn_path_error() argument
945 rds_conn_path_drop(cp, false); in __rds_conn_path_error()