summaryrefslogtreecommitdiffstats
path: root/net/hsr
diff options
context:
space:
mode:
authorArvid Brodin <arvid.brodin@alten.se>2014-07-04 23:35:47 +0200
committerDavid S. Miller <davem@davemloft.net>2014-07-08 11:35:30 -0700
commitabff7162765cd66ab109c97fd433ef1f39299120 (patch)
tree4d7f1547bf99ac7a0e9a68556b8d74550ba26d0d /net/hsr
parent81ba6afd6e6443d2bf4bf40f16df1f1f91c603f8 (diff)
downloadlinux-abff7162765cd66ab109c97fd433ef1f39299120.tar.gz
linux-abff7162765cd66ab109c97fd433ef1f39299120.tar.bz2
linux-abff7162765cd66ab109c97fd433ef1f39299120.zip
net/hsr: Move to per-hsr device prune timer.
Signed-off-by: Arvid Brodin <arvid.brodin@alten.se> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/hsr')
-rw-r--r--net/hsr/hsr_device.c10
-rw-r--r--net/hsr/hsr_framereg.c5
-rw-r--r--net/hsr/hsr_framereg.h2
-rw-r--r--net/hsr/hsr_main.c24
-rw-r--r--net/hsr/hsr_main.h1
5 files changed, 15 insertions, 27 deletions
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 4e5d92a8f079..f224067153e4 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -429,7 +429,8 @@ static void hsr_dev_destroy(struct net_device *hsr_dev)
hsr = netdev_priv(hsr_dev);
- del_timer(&hsr->announce_timer);
+ del_timer_sync(&hsr->prune_timer);
+ del_timer_sync(&hsr->announce_timer);
unregister_hsr_master(hsr); /* calls list_del_rcu on hsr */
restore_slaves(hsr_dev);
call_rcu(&hsr->rcu_head, reclaim_hsr_dev); /* reclaim hsr */
@@ -523,6 +524,10 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
hsr->announce_timer.function = hsr_announce;
hsr->announce_timer.data = (unsigned long) hsr;
+ init_timer(&hsr->prune_timer);
+ hsr->prune_timer.function = hsr_prune_nodes;
+ hsr->prune_timer.data = (unsigned long) hsr;
+
ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr);
hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec;
@@ -596,6 +601,9 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
if (res)
goto fail;
+ hsr->prune_timer.expires = jiffies + msecs_to_jiffies(PRUNE_PERIOD);
+ add_timer(&hsr->prune_timer);
+
register_hsr_master(hsr);
return 0;
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
index b419edbd7012..79e3f7ff6654 100644
--- a/net/hsr/hsr_framereg.c
+++ b/net/hsr/hsr_framereg.c
@@ -366,12 +366,15 @@ static bool is_late(struct hsr_node *node, enum hsr_dev_idx dev_idx)
/* Remove stale sequence_nr records. Called by timer every
* HSR_LIFE_CHECK_INTERVAL (two seconds or so).
*/
-void hsr_prune_nodes(struct hsr_priv *hsr)
+void hsr_prune_nodes(unsigned long data)
{
+ struct hsr_priv *hsr;
struct hsr_node *node;
unsigned long timestamp;
unsigned long time_a, time_b;
+ hsr = (struct hsr_priv *) data;
+
rcu_read_lock();
list_for_each_entry_rcu(node, &hsr->node_db, mac_list) {
/* Shorthand */
diff --git a/net/hsr/hsr_framereg.h b/net/hsr/hsr_framereg.h
index 3675139df379..ccb09cf4ec5b 100644
--- a/net/hsr/hsr_framereg.h
+++ b/net/hsr/hsr_framereg.h
@@ -32,7 +32,7 @@ void hsr_register_frame_in(struct hsr_node *node, enum hsr_dev_idx dev_idx);
int hsr_register_frame_out(struct hsr_node *node, enum hsr_dev_idx dev_idx,
struct sk_buff *skb);
-void hsr_prune_nodes(struct hsr_priv *hsr);
+void hsr_prune_nodes(unsigned long data);
int hsr_create_self_node(struct list_head *self_node_db,
unsigned char addr_a[ETH_ALEN],
diff --git a/net/hsr/hsr_main.c b/net/hsr/hsr_main.c
index bcda901437bc..5f9cd7fdbd93 100644
--- a/net/hsr/hsr_main.c
+++ b/net/hsr/hsr_main.c
@@ -175,22 +175,6 @@ static int hsr_netdev_notify(struct notifier_block *nb, unsigned long event,
}
-static struct timer_list prune_timer;
-
-static void prune_nodes_all(unsigned long data)
-{
- struct hsr_priv *hsr;
-
- rcu_read_lock();
- list_for_each_entry_rcu(hsr, &hsr_list, hsr_list)
- hsr_prune_nodes(hsr);
- rcu_read_unlock();
-
- prune_timer.expires = jiffies + msecs_to_jiffies(PRUNE_PERIOD);
- add_timer(&prune_timer);
-}
-
-
static struct notifier_block hsr_nb = {
.notifier_call = hsr_netdev_notify, /* Slave event notifications */
};
@@ -202,14 +186,7 @@ static int __init hsr_init(void)
BUILD_BUG_ON(sizeof(struct hsr_tag) != HSR_HLEN);
- init_timer(&prune_timer);
- prune_timer.function = prune_nodes_all;
- prune_timer.data = 0;
- prune_timer.expires = jiffies + msecs_to_jiffies(PRUNE_PERIOD);
- add_timer(&prune_timer);
-
register_netdevice_notifier(&hsr_nb);
-
res = hsr_netlink_init();
return res;
@@ -218,7 +195,6 @@ static int __init hsr_init(void)
static void __exit hsr_exit(void)
{
unregister_netdevice_notifier(&hsr_nb);
- del_timer_sync(&prune_timer);
hsr_netlink_exit();
}
diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h
index d919321b0bdb..43689a6d731f 100644
--- a/net/hsr/hsr_main.h
+++ b/net/hsr/hsr_main.h
@@ -153,6 +153,7 @@ struct hsr_priv {
struct list_head node_db; /* Other HSR nodes */
struct list_head self_node_db; /* MACs of slaves */
struct timer_list announce_timer; /* Supervision frame dispatch */
+ struct timer_list prune_timer;
int announce_count;
u16 sequence_nr;
spinlock_t seqnr_lock; /* locking for sequence_nr */