Commit 581465fa authored by Jon Paul Maloy's avatar Jon Paul Maloy Committed by David S. Miller

tipc: make link start event synchronous

When a link is created we delay the start event by launching it
to be executed later in a tasklet. As we hold all the
necessary locks at the moment of creation, and there is no risk
of deadlock or contention, this delay serves no purpose in the
current code.

We remove this obsolete indirection step, and the associated function
link_start(). At the same time, we rename the function tipc_link_stop()
to the more appropriate tipc_link_purge_queues().
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Reviewed-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f9a2c80b
...@@ -794,7 +794,7 @@ void tipc_bclink_init(void) ...@@ -794,7 +794,7 @@ void tipc_bclink_init(void)
void tipc_bclink_stop(void) void tipc_bclink_stop(void)
{ {
spin_lock_bh(&bc_lock); spin_lock_bh(&bc_lock);
tipc_link_stop(bcl); tipc_link_purge_queues(bcl);
spin_unlock_bh(&bc_lock); spin_unlock_bh(&bc_lock);
memset(bclink, 0, sizeof(*bclink)); memset(bclink, 0, sizeof(*bclink));
......
...@@ -87,7 +87,6 @@ static int link_send_sections_long(struct tipc_port *sender, ...@@ -87,7 +87,6 @@ static int link_send_sections_long(struct tipc_port *sender,
static void link_state_event(struct tipc_link *l_ptr, u32 event); static void link_state_event(struct tipc_link *l_ptr, u32 event);
static void link_reset_statistics(struct tipc_link *l_ptr); static void link_reset_statistics(struct tipc_link *l_ptr);
static void link_print(struct tipc_link *l_ptr, const char *str); static void link_print(struct tipc_link *l_ptr, const char *str);
static void link_start(struct tipc_link *l_ptr);
static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf); static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf);
static void tipc_link_send_sync(struct tipc_link *l); static void tipc_link_send_sync(struct tipc_link *l);
static void tipc_link_recv_sync(struct tipc_node *n, struct sk_buff *buf); static void tipc_link_recv_sync(struct tipc_node *n, struct sk_buff *buf);
...@@ -281,7 +280,8 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, ...@@ -281,7 +280,8 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
k_init_timer(&l_ptr->timer, (Handler)link_timeout, k_init_timer(&l_ptr->timer, (Handler)link_timeout,
(unsigned long)l_ptr); (unsigned long)l_ptr);
list_add_tail(&l_ptr->link_list, &b_ptr->links); list_add_tail(&l_ptr->link_list, &b_ptr->links);
tipc_k_signal((Handler)link_start, (unsigned long)l_ptr);
link_state_event(l_ptr, STARTING_EVT);
return l_ptr; return l_ptr;
} }
...@@ -306,19 +306,13 @@ void tipc_link_delete(struct tipc_link *l_ptr) ...@@ -306,19 +306,13 @@ void tipc_link_delete(struct tipc_link *l_ptr)
tipc_node_lock(l_ptr->owner); tipc_node_lock(l_ptr->owner);
tipc_link_reset(l_ptr); tipc_link_reset(l_ptr);
tipc_node_detach_link(l_ptr->owner, l_ptr); tipc_node_detach_link(l_ptr->owner, l_ptr);
tipc_link_stop(l_ptr); tipc_link_purge_queues(l_ptr);
list_del_init(&l_ptr->link_list); list_del_init(&l_ptr->link_list);
tipc_node_unlock(l_ptr->owner); tipc_node_unlock(l_ptr->owner);
k_term_timer(&l_ptr->timer); k_term_timer(&l_ptr->timer);
kfree(l_ptr); kfree(l_ptr);
} }
static void link_start(struct tipc_link *l_ptr)
{
tipc_node_lock(l_ptr->owner);
link_state_event(l_ptr, STARTING_EVT);
tipc_node_unlock(l_ptr->owner);
}
/** /**
* link_schedule_port - schedule port for deferred sending * link_schedule_port - schedule port for deferred sending
...@@ -404,10 +398,10 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr) ...@@ -404,10 +398,10 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr)
} }
/** /**
* tipc_link_stop - purge all inbound and outbound messages associated with link * tipc_link_purge_queues - purge all pkt queues associated with link
* @l_ptr: pointer to link * @l_ptr: pointer to link
*/ */
void tipc_link_stop(struct tipc_link *l_ptr) void tipc_link_purge_queues(struct tipc_link *l_ptr)
{ {
kfree_skb_list(l_ptr->oldest_deferred_in); kfree_skb_list(l_ptr->oldest_deferred_in);
kfree_skb_list(l_ptr->first_out); kfree_skb_list(l_ptr->first_out);
......
...@@ -222,7 +222,7 @@ void tipc_link_dup_send_queue(struct tipc_link *l_ptr, ...@@ -222,7 +222,7 @@ void tipc_link_dup_send_queue(struct tipc_link *l_ptr,
void tipc_link_reset_fragments(struct tipc_link *l_ptr); void tipc_link_reset_fragments(struct tipc_link *l_ptr);
int tipc_link_is_up(struct tipc_link *l_ptr); int tipc_link_is_up(struct tipc_link *l_ptr);
int tipc_link_is_active(struct tipc_link *l_ptr); int tipc_link_is_active(struct tipc_link *l_ptr);
void tipc_link_stop(struct tipc_link *l_ptr); void tipc_link_purge_queues(struct tipc_link *l_ptr);
struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area,
int req_tlv_space, int req_tlv_space,
u16 cmd); u16 cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment