diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-11-03 10:50:04 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-11-09 17:45:28 -0500 |
commit | f0bf90def3528cebed45ebd81d9b5d0fa17d7422 (patch) | |
tree | 88169b4d9b748055249150799a581e75c80c5990 /net/core/dev.c | |
parent | 517bbed90635a17cf27450fb385af0e502413bea (diff) |
net/dev: Convert to hotplug state machine
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20161103145021.28528-9-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 820bac239738..8e909b2a5f2f 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -7953,18 +7953,13 @@ out: | |||
7953 | } | 7953 | } |
7954 | EXPORT_SYMBOL_GPL(dev_change_net_namespace); | 7954 | EXPORT_SYMBOL_GPL(dev_change_net_namespace); |
7955 | 7955 | ||
7956 | static int dev_cpu_callback(struct notifier_block *nfb, | 7956 | static int dev_cpu_dead(unsigned int oldcpu) |
7957 | unsigned long action, | ||
7958 | void *ocpu) | ||
7959 | { | 7957 | { |
7960 | struct sk_buff **list_skb; | 7958 | struct sk_buff **list_skb; |
7961 | struct sk_buff *skb; | 7959 | struct sk_buff *skb; |
7962 | unsigned int cpu, oldcpu = (unsigned long)ocpu; | 7960 | unsigned int cpu; |
7963 | struct softnet_data *sd, *oldsd; | 7961 | struct softnet_data *sd, *oldsd; |
7964 | 7962 | ||
7965 | if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) | ||
7966 | return NOTIFY_OK; | ||
7967 | |||
7968 | local_irq_disable(); | 7963 | local_irq_disable(); |
7969 | cpu = smp_processor_id(); | 7964 | cpu = smp_processor_id(); |
7970 | sd = &per_cpu(softnet_data, cpu); | 7965 | sd = &per_cpu(softnet_data, cpu); |
@@ -8014,10 +8009,9 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
8014 | input_queue_head_incr(oldsd); | 8009 | input_queue_head_incr(oldsd); |
8015 | } | 8010 | } |
8016 | 8011 | ||
8017 | return NOTIFY_OK; | 8012 | return 0; |
8018 | } | 8013 | } |
8019 | 8014 | ||
8020 | |||
8021 | /** | 8015 | /** |
8022 | * netdev_increment_features - increment feature set by one | 8016 | * netdev_increment_features - increment feature set by one |
8023 | * @all: current feature set | 8017 | * @all: current feature set |
@@ -8351,7 +8345,9 @@ static int __init net_dev_init(void) | |||
8351 | open_softirq(NET_TX_SOFTIRQ, net_tx_action); | 8345 | open_softirq(NET_TX_SOFTIRQ, net_tx_action); |
8352 | open_softirq(NET_RX_SOFTIRQ, net_rx_action); | 8346 | open_softirq(NET_RX_SOFTIRQ, net_rx_action); |
8353 | 8347 | ||
8354 | hotcpu_notifier(dev_cpu_callback, 0); | 8348 | rc = cpuhp_setup_state_nocalls(CPUHP_NET_DEV_DEAD, "net/dev:dead", |
8349 | NULL, dev_cpu_dead); | ||
8350 | WARN_ON(rc < 0); | ||
8355 | dst_subsys_init(); | 8351 | dst_subsys_init(); |
8356 | rc = 0; | 8352 | rc = 0; |
8357 | out: | 8353 | out: |