From 1c213bd24ad04f4430031d20d740d7783162b099 Mon Sep 17 00:00:00 2001 From: WANG Cong Date: Thu, 13 Feb 2014 11:46:28 -0800 Subject: net: introduce netdev_alloc_pcpu_stats() for drivers There are many drivers calling alloc_percpu() to allocate pcpu stats and then initializing ->syncp. So just introduce a helper function for them. Cc: David S. Miller Signed-off-by: Cong Wang Signed-off-by: David S. Miller --- drivers/net/vxlan.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'drivers/net/vxlan.c') diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index b0f705c2378f..dec9820bc182 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1978,19 +1978,11 @@ static int vxlan_init(struct net_device *dev) struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); struct vxlan_sock *vs; - int i; - dev->tstats = alloc_percpu(struct pcpu_sw_netstats); + dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); if (!dev->tstats) return -ENOMEM; - for_each_possible_cpu(i) { - struct pcpu_sw_netstats *vxlan_stats; - vxlan_stats = per_cpu_ptr(dev->tstats, i); - u64_stats_init(&vxlan_stats->syncp); - } - - spin_lock(&vn->sock_lock); vs = vxlan_find_sock(dev_net(dev), vxlan->dst_port); if (vs) { -- cgit v1.2.3 From 86c3f0f8307ac18f3ad3109e1969c62b8fbed5df Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 25 Feb 2014 17:46:10 +0100 Subject: vxlan: remove unused port variable in vxlan_udp_encap_recv() Signed-off-by: Pablo Neira Ayuso Signed-off-by: David S. Miller --- drivers/net/vxlan.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/net/vxlan.c') diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index dec9820bc182..eb59b14d5ee0 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1132,7 +1132,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) { struct vxlan_sock *vs; struct vxlanhdr *vxh; - __be16 port; /* Need Vxlan and inner Ethernet header to be present */ if (!pskb_may_pull(skb, VXLAN_HLEN)) @@ -1150,8 +1149,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) if (iptunnel_pull_header(skb, VXLAN_HLEN, htons(ETH_P_TEB))) goto drop; - port = inet_sk(sk)->inet_sport; - vs = rcu_dereference_sk_user_data(sk); if (!vs) goto drop; -- cgit v1.2.3