Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0bf90de authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner
Browse files

net/dev: Convert to hotplug state machine



Install the callbacks via the state machine.

Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarThomas 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: default avatarThomas Gleixner <tglx@linutronix.de>
parent 517bbed9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ enum cpuhp_state {
	CPUHP_PERCPU_CNT_DEAD,
	CPUHP_PERCPU_CNT_DEAD,
	CPUHP_RADIX_DEAD,
	CPUHP_RADIX_DEAD,
	CPUHP_PAGE_ALLOC_DEAD,
	CPUHP_PAGE_ALLOC_DEAD,
	CPUHP_NET_DEV_DEAD,
	CPUHP_WORKQUEUE_PREP,
	CPUHP_WORKQUEUE_PREP,
	CPUHP_POWER_NUMA_PREPARE,
	CPUHP_POWER_NUMA_PREPARE,
	CPUHP_HRTIMERS_PREPARE,
	CPUHP_HRTIMERS_PREPARE,
+6 −10
Original line number Original line Diff line number Diff line
@@ -7953,18 +7953,13 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
}
}
EXPORT_SYMBOL_GPL(dev_change_net_namespace);
EXPORT_SYMBOL_GPL(dev_change_net_namespace);


static int dev_cpu_callback(struct notifier_block *nfb,
static int dev_cpu_dead(unsigned int oldcpu)
			    unsigned long action,
			    void *ocpu)
{
{
	struct sk_buff **list_skb;
	struct sk_buff **list_skb;
	struct sk_buff *skb;
	struct sk_buff *skb;
	unsigned int cpu, oldcpu = (unsigned long)ocpu;
	unsigned int cpu;
	struct softnet_data *sd, *oldsd;
	struct softnet_data *sd, *oldsd;


	if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
		return NOTIFY_OK;

	local_irq_disable();
	local_irq_disable();
	cpu = smp_processor_id();
	cpu = smp_processor_id();
	sd = &per_cpu(softnet_data, cpu);
	sd = &per_cpu(softnet_data, cpu);
@@ -8014,10 +8009,9 @@ static int dev_cpu_callback(struct notifier_block *nfb,
		input_queue_head_incr(oldsd);
		input_queue_head_incr(oldsd);
	}
	}


	return NOTIFY_OK;
	return 0;
}
}



/**
/**
 *	netdev_increment_features - increment feature set by one
 *	netdev_increment_features - increment feature set by one
 *	@all: current feature set
 *	@all: current feature set
@@ -8351,7 +8345,9 @@ static int __init net_dev_init(void)
	open_softirq(NET_TX_SOFTIRQ, net_tx_action);
	open_softirq(NET_TX_SOFTIRQ, net_tx_action);
	open_softirq(NET_RX_SOFTIRQ, net_rx_action);
	open_softirq(NET_RX_SOFTIRQ, net_rx_action);


	hotcpu_notifier(dev_cpu_callback, 0);
	rc = cpuhp_setup_state_nocalls(CPUHP_NET_DEV_DEAD, "net/dev:dead",
				       NULL, dev_cpu_dead);
	WARN_ON(rc < 0);
	dst_subsys_init();
	dst_subsys_init();
	rc = 0;
	rc = 0;
out:
out: