Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Arvid Brodin and committed by
David S. Miller
abff7162 81ba6afd

+15 -27
+9 -1
net/hsr/hsr_device.c
··· 429 429 430 430 hsr = netdev_priv(hsr_dev); 431 431 432 - del_timer(&hsr->announce_timer); 432 + del_timer_sync(&hsr->prune_timer); 433 + del_timer_sync(&hsr->announce_timer); 433 434 unregister_hsr_master(hsr); /* calls list_del_rcu on hsr */ 434 435 restore_slaves(hsr_dev); 435 436 call_rcu(&hsr->rcu_head, reclaim_hsr_dev); /* reclaim hsr */ ··· 524 523 hsr->announce_timer.function = hsr_announce; 525 524 hsr->announce_timer.data = (unsigned long) hsr; 526 525 526 + init_timer(&hsr->prune_timer); 527 + hsr->prune_timer.function = hsr_prune_nodes; 528 + hsr->prune_timer.data = (unsigned long) hsr; 529 + 527 530 ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr); 528 531 hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec; 529 532 ··· 600 595 res = register_netdevice(hsr_dev); 601 596 if (res) 602 597 goto fail; 598 + 599 + hsr->prune_timer.expires = jiffies + msecs_to_jiffies(PRUNE_PERIOD); 600 + add_timer(&hsr->prune_timer); 603 601 604 602 register_hsr_master(hsr); 605 603
+4 -1
net/hsr/hsr_framereg.c
··· 366 366 /* Remove stale sequence_nr records. Called by timer every 367 367 * HSR_LIFE_CHECK_INTERVAL (two seconds or so). 368 368 */ 369 - void hsr_prune_nodes(struct hsr_priv *hsr) 369 + void hsr_prune_nodes(unsigned long data) 370 370 { 371 + struct hsr_priv *hsr; 371 372 struct hsr_node *node; 372 373 unsigned long timestamp; 373 374 unsigned long time_a, time_b; 375 + 376 + hsr = (struct hsr_priv *) data; 374 377 375 378 rcu_read_lock(); 376 379 list_for_each_entry_rcu(node, &hsr->node_db, mac_list) {
+1 -1
net/hsr/hsr_framereg.h
··· 32 32 int hsr_register_frame_out(struct hsr_node *node, enum hsr_dev_idx dev_idx, 33 33 struct sk_buff *skb); 34 34 35 - void hsr_prune_nodes(struct hsr_priv *hsr); 35 + void hsr_prune_nodes(unsigned long data); 36 36 37 37 int hsr_create_self_node(struct list_head *self_node_db, 38 38 unsigned char addr_a[ETH_ALEN],
-24
net/hsr/hsr_main.c
··· 175 175 } 176 176 177 177 178 - static struct timer_list prune_timer; 179 - 180 - static void prune_nodes_all(unsigned long data) 181 - { 182 - struct hsr_priv *hsr; 183 - 184 - rcu_read_lock(); 185 - list_for_each_entry_rcu(hsr, &hsr_list, hsr_list) 186 - hsr_prune_nodes(hsr); 187 - rcu_read_unlock(); 188 - 189 - prune_timer.expires = jiffies + msecs_to_jiffies(PRUNE_PERIOD); 190 - add_timer(&prune_timer); 191 - } 192 - 193 - 194 178 static struct notifier_block hsr_nb = { 195 179 .notifier_call = hsr_netdev_notify, /* Slave event notifications */ 196 180 }; ··· 186 202 187 203 BUILD_BUG_ON(sizeof(struct hsr_tag) != HSR_HLEN); 188 204 189 - init_timer(&prune_timer); 190 - prune_timer.function = prune_nodes_all; 191 - prune_timer.data = 0; 192 - prune_timer.expires = jiffies + msecs_to_jiffies(PRUNE_PERIOD); 193 - add_timer(&prune_timer); 194 - 195 205 register_netdevice_notifier(&hsr_nb); 196 - 197 206 res = hsr_netlink_init(); 198 207 199 208 return res; ··· 195 218 static void __exit hsr_exit(void) 196 219 { 197 220 unregister_netdevice_notifier(&hsr_nb); 198 - del_timer_sync(&prune_timer); 199 221 hsr_netlink_exit(); 200 222 } 201 223
+1
net/hsr/hsr_main.h
··· 153 153 struct list_head node_db; /* Other HSR nodes */ 154 154 struct list_head self_node_db; /* MACs of slaves */ 155 155 struct timer_list announce_timer; /* Supervision frame dispatch */ 156 + struct timer_list prune_timer; 156 157 int announce_count; 157 158 u16 sequence_nr; 158 159 spinlock_t seqnr_lock; /* locking for sequence_nr */