aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-05-14 10:46:11 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-14 12:24:45 -0400
commitb1c29f6b10d5981c89d3ea9b9991ca97141ed6d0 (patch)
treee0ad8668ed30f2d253423beba2c614baab2ec781
parentc16ead798ee31f154eb230a728de6c60d0786aab (diff)
tipc: simplify resetting and disabling of bearers
Since commit 4b475e3f2f8e4e241de101c8240f1d74d0470494 ("tipc: eliminate delayed link deletion at link failover") the extra boolean parameter "shutting_down" is not any longer needed for the functions bearer_disable() and tipc_link_delete_list(). Furhermore, the function tipc_link_reset_links(), called from bearer_reset() is now unnecessary. We can just as well delete all the links, as we do in bearer_disable(), and start over with creating new links. This commit introduces those changes. Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/tipc/bearer.c18
-rw-r--r--net/tipc/link.c20
-rw-r--r--net/tipc/link.h4
3 files changed, 10 insertions, 32 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 99c0bd43feed..00bc0e620532 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -71,8 +71,7 @@ static const struct nla_policy tipc_nl_media_policy[TIPC_NLA_MEDIA_MAX + 1] = {
71 [TIPC_NLA_MEDIA_PROP] = { .type = NLA_NESTED } 71 [TIPC_NLA_MEDIA_PROP] = { .type = NLA_NESTED }
72}; 72};
73 73
74static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, 74static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr);
75 bool shutting_down);
76 75
77/** 76/**
78 * tipc_media_find - locates specified media object by name 77 * tipc_media_find - locates specified media object by name
@@ -324,7 +323,7 @@ restart:
324 323
325 res = tipc_disc_create(net, b_ptr, &b_ptr->bcast_addr); 324 res = tipc_disc_create(net, b_ptr, &b_ptr->bcast_addr);
326 if (res) { 325 if (res) {
327 bearer_disable(net, b_ptr, false); 326 bearer_disable(net, b_ptr);
328 pr_warn("Bearer <%s> rejected, discovery object creation failed\n", 327 pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
329 name); 328 name);
330 return -EINVAL; 329 return -EINVAL;
@@ -344,7 +343,7 @@ restart:
344static int tipc_reset_bearer(struct net *net, struct tipc_bearer *b_ptr) 343static int tipc_reset_bearer(struct net *net, struct tipc_bearer *b_ptr)
345{ 344{
346 pr_info("Resetting bearer <%s>\n", b_ptr->name); 345 pr_info("Resetting bearer <%s>\n", b_ptr->name);
347 tipc_link_reset_list(net, b_ptr->identity); 346 tipc_link_delete_list(net, b_ptr->identity);
348 tipc_disc_reset(net, b_ptr); 347 tipc_disc_reset(net, b_ptr);
349 return 0; 348 return 0;
350} 349}
@@ -354,8 +353,7 @@ static int tipc_reset_bearer(struct net *net, struct tipc_bearer *b_ptr)
354 * 353 *
355 * Note: This routine assumes caller holds RTNL lock. 354 * Note: This routine assumes caller holds RTNL lock.
356 */ 355 */
357static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, 356static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr)
358 bool shutting_down)
359{ 357{
360 struct tipc_net *tn = net_generic(net, tipc_net_id); 358 struct tipc_net *tn = net_generic(net, tipc_net_id);
361 u32 i; 359 u32 i;
@@ -363,7 +361,7 @@ static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr,
363 pr_info("Disabling bearer <%s>\n", b_ptr->name); 361 pr_info("Disabling bearer <%s>\n", b_ptr->name);
364 b_ptr->media->disable_media(b_ptr); 362 b_ptr->media->disable_media(b_ptr);
365 363
366 tipc_link_delete_list(net, b_ptr->identity, shutting_down); 364 tipc_link_delete_list(net, b_ptr->identity);
367 if (b_ptr->link_req) 365 if (b_ptr->link_req)
368 tipc_disc_delete(b_ptr->link_req); 366 tipc_disc_delete(b_ptr->link_req);
369 367
@@ -541,7 +539,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
541 break; 539 break;
542 case NETDEV_UNREGISTER: 540 case NETDEV_UNREGISTER:
543 case NETDEV_CHANGENAME: 541 case NETDEV_CHANGENAME:
544 bearer_disable(dev_net(dev), b_ptr, false); 542 bearer_disable(dev_net(dev), b_ptr);
545 break; 543 break;
546 } 544 }
547 return NOTIFY_OK; 545 return NOTIFY_OK;
@@ -583,7 +581,7 @@ void tipc_bearer_stop(struct net *net)
583 for (i = 0; i < MAX_BEARERS; i++) { 581 for (i = 0; i < MAX_BEARERS; i++) {
584 b_ptr = rtnl_dereference(tn->bearer_list[i]); 582 b_ptr = rtnl_dereference(tn->bearer_list[i]);
585 if (b_ptr) { 583 if (b_ptr) {
586 bearer_disable(net, b_ptr, true); 584 bearer_disable(net, b_ptr);
587 tn->bearer_list[i] = NULL; 585 tn->bearer_list[i] = NULL;
588 } 586 }
589 } 587 }
@@ -747,7 +745,7 @@ int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info)
747 return -EINVAL; 745 return -EINVAL;
748 } 746 }
749 747
750 bearer_disable(net, bearer, false); 748 bearer_disable(net, bearer);
751 rtnl_unlock(); 749 rtnl_unlock();
752 750
753 return 0; 751 return 0;
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 374d52335168..266dbc6a34c1 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -311,8 +311,7 @@ void tipc_link_delete(struct tipc_link *l)
311 tipc_link_put(l); 311 tipc_link_put(l);
312} 312}
313 313
314void tipc_link_delete_list(struct net *net, unsigned int bearer_id, 314void tipc_link_delete_list(struct net *net, unsigned int bearer_id)
315 bool shutting_down)
316{ 315{
317 struct tipc_net *tn = net_generic(net, tipc_net_id); 316 struct tipc_net *tn = net_generic(net, tipc_net_id);
318 struct tipc_link *link; 317 struct tipc_link *link;
@@ -476,23 +475,6 @@ void tipc_link_reset(struct tipc_link *l_ptr)
476 link_reset_statistics(l_ptr); 475 link_reset_statistics(l_ptr);
477} 476}
478 477
479void tipc_link_reset_list(struct net *net, unsigned int bearer_id)
480{
481 struct tipc_net *tn = net_generic(net, tipc_net_id);
482 struct tipc_link *l_ptr;
483 struct tipc_node *n_ptr;
484
485 rcu_read_lock();
486 list_for_each_entry_rcu(n_ptr, &tn->node_list, list) {
487 tipc_node_lock(n_ptr);
488 l_ptr = n_ptr->links[bearer_id];
489 if (l_ptr)
490 tipc_link_reset(l_ptr);
491 tipc_node_unlock(n_ptr);
492 }
493 rcu_read_unlock();
494}
495
496static void link_activate(struct tipc_link *link) 478static void link_activate(struct tipc_link *link)
497{ 479{
498 struct tipc_node *node = link->owner; 480 struct tipc_node *node = link->owner;
diff --git a/net/tipc/link.h b/net/tipc/link.h
index b5b4e3554d4e..dc27bb62b1f5 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -213,8 +213,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
213 struct tipc_bearer *b_ptr, 213 struct tipc_bearer *b_ptr,
214 const struct tipc_media_addr *media_addr); 214 const struct tipc_media_addr *media_addr);
215void tipc_link_delete(struct tipc_link *link); 215void tipc_link_delete(struct tipc_link *link);
216void tipc_link_delete_list(struct net *net, unsigned int bearer_id, 216void tipc_link_delete_list(struct net *net, unsigned int bearer_id);
217 bool shutting_down);
218void tipc_link_failover_send_queue(struct tipc_link *l_ptr); 217void tipc_link_failover_send_queue(struct tipc_link *l_ptr);
219void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr, struct tipc_link *dest); 218void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr, struct tipc_link *dest);
220void tipc_link_reset_fragments(struct tipc_link *l_ptr); 219void tipc_link_reset_fragments(struct tipc_link *l_ptr);
@@ -223,7 +222,6 @@ int tipc_link_is_active(struct tipc_link *l_ptr);
223void tipc_link_purge_queues(struct tipc_link *l_ptr); 222void tipc_link_purge_queues(struct tipc_link *l_ptr);
224void tipc_link_reset_all(struct tipc_node *node); 223void tipc_link_reset_all(struct tipc_node *node);
225void tipc_link_reset(struct tipc_link *l_ptr); 224void tipc_link_reset(struct tipc_link *l_ptr);
226void tipc_link_reset_list(struct net *net, unsigned int bearer_id);
227int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest, 225int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest,
228 u32 selector); 226 u32 selector);
229int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest, 227int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest,