Skip to content

Commit 581465f

Browse files
Jon Paul Maloydavem330
authored andcommitted
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: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f9a2c80 commit 581465f

3 files changed

Lines changed: 7 additions & 13 deletions

File tree

‎net/tipc/bcast.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ void tipc_bclink_init(void)
794794
void tipc_bclink_stop(void)
795795
{
796796
spin_lock_bh(&bc_lock);
797-
tipc_link_stop(bcl);
797+
tipc_link_purge_queues(bcl);
798798
spin_unlock_bh(&bc_lock);
799799

800800
memset(bclink, 0, sizeof(*bclink));

‎net/tipc/link.c‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ static int link_send_sections_long(struct tipc_port *sender,
8787
static void link_state_event(struct tipc_link *l_ptr, u32 event);
8888
static void link_reset_statistics(struct tipc_link *l_ptr);
8989
static void link_print(struct tipc_link *l_ptr, const char *str);
90-
static void link_start(struct tipc_link *l_ptr);
9190
static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf);
9291
static void tipc_link_send_sync(struct tipc_link *l);
9392
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,
281280
k_init_timer(&l_ptr->timer, (Handler)link_timeout,
282281
(unsigned long)l_ptr);
283282
list_add_tail(&l_ptr->link_list, &b_ptr->links);
284-
tipc_k_signal((Handler)link_start, (unsigned long)l_ptr);
283+
284+
link_state_event(l_ptr, STARTING_EVT);
285285

286286
return l_ptr;
287287
}
@@ -306,19 +306,13 @@ void tipc_link_delete(struct tipc_link *l_ptr)
306306
tipc_node_lock(l_ptr->owner);
307307
tipc_link_reset(l_ptr);
308308
tipc_node_detach_link(l_ptr->owner, l_ptr);
309-
tipc_link_stop(l_ptr);
309+
tipc_link_purge_queues(l_ptr);
310310
list_del_init(&l_ptr->link_list);
311311
tipc_node_unlock(l_ptr->owner);
312312
k_term_timer(&l_ptr->timer);
313313
kfree(l_ptr);
314314
}
315315

316-
static void link_start(struct tipc_link *l_ptr)
317-
{
318-
tipc_node_lock(l_ptr->owner);
319-
link_state_event(l_ptr, STARTING_EVT);
320-
tipc_node_unlock(l_ptr->owner);
321-
}
322316

323317
/**
324318
* link_schedule_port - schedule port for deferred sending
@@ -404,10 +398,10 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr)
404398
}
405399

406400
/**
407-
* tipc_link_stop - purge all inbound and outbound messages associated with link
401+
* tipc_link_purge_queues - purge all pkt queues associated with link
408402
* @l_ptr: pointer to link
409403
*/
410-
void tipc_link_stop(struct tipc_link *l_ptr)
404+
void tipc_link_purge_queues(struct tipc_link *l_ptr)
411405
{
412406
kfree_skb_list(l_ptr->oldest_deferred_in);
413407
kfree_skb_list(l_ptr->first_out);

‎net/tipc/link.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void tipc_link_dup_send_queue(struct tipc_link *l_ptr,
222222
void tipc_link_reset_fragments(struct tipc_link *l_ptr);
223223
int tipc_link_is_up(struct tipc_link *l_ptr);
224224
int tipc_link_is_active(struct tipc_link *l_ptr);
225-
void tipc_link_stop(struct tipc_link *l_ptr);
225+
void tipc_link_purge_queues(struct tipc_link *l_ptr);
226226
struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area,
227227
int req_tlv_space,
228228
u16 cmd);

0 commit comments

Comments
 (0)