aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2013-10-07 18:51:58 -0400
committerIngo Molnar <mingo@kernel.org>2013-11-06 06:40:25 -0500
commit827da44c61419f29ae3be198c342e2147f1a10cb (patch)
tree54cff222bd9ec230df4c92908d41efba7cc9c928 /drivers/net
parent32cf7c3c94623514eb882addae307212c1507239 (diff)
net: Explicitly initialize u64_stats_sync structures for lockdep
In order to enable lockdep on seqcount/seqlock structures, we must explicitly initialize any locks. The u64_stats_sync structure, uses a seqcount, and thus we need to introduce a u64_stats_init() function and use it to initialize the structure. This unfortunately adds a lot of fairly trivial initialization code to a number of drivers. But the benefit of ensuring correctness makes this worth while. Because these changes are required for lockdep to be enabled, and the changes are quite trivial, I've not yet split this patch out into 30-some separate patches, as I figured it would be better to get the various maintainers thoughts on how to best merge this change along with the seqcount lockdep enablement. Feedback would be appreciated! Signed-off-by: John Stultz <john.stultz@linaro.org> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> Cc: James Morris <jmorris@namei.org> Cc: Jesse Gross <jesse@nicira.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Mirko Lindner <mlindner@marvell.com> Cc: Patrick McHardy <kaber@trash.net> Cc: Roger Luethi <rl@hellgate.ch> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Simon Horman <horms@verge.net.au> Cc: Stephen Hemminger <stephen@networkplumber.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Wensong Zhang <wensong@linux-vs.org> Cc: netdev@vger.kernel.org Link: http://lkml.kernel.org/r/1381186321-4906-2-git-send-email-john.stultz@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/dummy.c6
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c4
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c5
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c3
-rw-r--r--drivers/net/ethernet/marvell/sky2.c3
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-main.c4
-rw-r--r--drivers/net/ethernet/nvidia/forcedeth.c2
-rw-r--r--drivers/net/ethernet/realtek/8139too.c3
-rw-r--r--drivers/net/ethernet/tile/tilepro.c2
-rw-r--r--drivers/net/ethernet/via/via-rhine.c3
-rw-r--r--drivers/net/ifb.c5
-rw-r--r--drivers/net/loopback.c6
-rw-r--r--drivers/net/macvlan.c7
-rw-r--r--drivers/net/nlmon.c8
-rw-r--r--drivers/net/team/team.c6
-rw-r--r--drivers/net/team/team_mode_loadbalance.c9
-rw-r--r--drivers/net/veth.c8
-rw-r--r--drivers/net/virtio_net.c8
-rw-r--r--drivers/net/vxlan.c8
-rw-r--r--drivers/net/xen-netfront.c6
21 files changed, 109 insertions, 1 deletions
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index b710c6b2d659..bd8f84b0b894 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -88,10 +88,16 @@ static netdev_tx_t dummy_xmit(struct sk_buff *skb, struct net_device *dev)
88 88
89static int dummy_dev_init(struct net_device *dev) 89static int dummy_dev_init(struct net_device *dev)
90{ 90{
91 int i;
91 dev->dstats = alloc_percpu(struct pcpu_dstats); 92 dev->dstats = alloc_percpu(struct pcpu_dstats);
92 if (!dev->dstats) 93 if (!dev->dstats)
93 return -ENOMEM; 94 return -ENOMEM;
94 95
96 for_each_possible_cpu(i) {
97 struct pcpu_dstats *dstats;
98 dstats = per_cpu_ptr(dev->dstats, i);
99 u64_stats_init(&dstats->syncp);
100 }
95 return 0; 101 return 0;
96} 102}
97 103
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 2c38cc402119..edd75950855a 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2047,6 +2047,9 @@ static int be_tx_qs_create(struct be_adapter *adapter)
2047 if (status) 2047 if (status)
2048 return status; 2048 return status;
2049 2049
2050 u64_stats_init(&txo->stats.sync);
2051 u64_stats_init(&txo->stats.sync_compl);
2052
2050 /* If num_evt_qs is less than num_tx_qs, then more than 2053 /* If num_evt_qs is less than num_tx_qs, then more than
2051 * one txq share an eq 2054 * one txq share an eq
2052 */ 2055 */
@@ -2108,6 +2111,7 @@ static int be_rx_cqs_create(struct be_adapter *adapter)
2108 if (rc) 2111 if (rc)
2109 return rc; 2112 return rc;
2110 2113
2114 u64_stats_init(&rxo->stats.sync);
2111 eq = &adapter->eq_obj[i % adapter->num_evt_qs].q; 2115 eq = &adapter->eq_obj[i % adapter->num_evt_qs].q;
2112 rc = be_cmd_cq_create(adapter, cq, eq, false, 3); 2116 rc = be_cmd_cq_create(adapter, cq, eq, false, 3);
2113 if (rc) 2117 if (rc)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 8cf44f2a8ccd..b6edb93a8fc1 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1223,6 +1223,9 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,
1223 ring->count = adapter->tx_ring_count; 1223 ring->count = adapter->tx_ring_count;
1224 ring->queue_index = txr_idx; 1224 ring->queue_index = txr_idx;
1225 1225
1226 u64_stats_init(&ring->tx_syncp);
1227 u64_stats_init(&ring->tx_syncp2);
1228
1226 /* assign ring to adapter */ 1229 /* assign ring to adapter */
1227 adapter->tx_ring[txr_idx] = ring; 1230 adapter->tx_ring[txr_idx] = ring;
1228 1231
@@ -1256,6 +1259,8 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,
1256 ring->count = adapter->rx_ring_count; 1259 ring->count = adapter->rx_ring_count;
1257 ring->queue_index = rxr_idx; 1260 ring->queue_index = rxr_idx;
1258 1261
1262 u64_stats_init(&ring->rx_syncp);
1263
1259 /* assign ring to adapter */ 1264 /* assign ring to adapter */
1260 adapter->rx_ring[rxr_idx] = ring; 1265 adapter->rx_ring[rxr_idx] = ring;
1261 } 1266 }
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 0ade0cd5ef53..c1750364ddc0 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -4867,6 +4867,8 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
4867 if (!tx_ring->tx_buffer_info) 4867 if (!tx_ring->tx_buffer_info)
4868 goto err; 4868 goto err;
4869 4869
4870 u64_stats_init(&tx_ring->syncp);
4871
4870 /* round up to nearest 4K */ 4872 /* round up to nearest 4K */
4871 tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc); 4873 tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc);
4872 tx_ring->size = ALIGN(tx_ring->size, 4096); 4874 tx_ring->size = ALIGN(tx_ring->size, 4096);
@@ -4949,6 +4951,8 @@ int ixgbe_setup_rx_resources(struct ixgbe_ring *rx_ring)
4949 if (!rx_ring->rx_buffer_info) 4951 if (!rx_ring->rx_buffer_info)
4950 goto err; 4952 goto err;
4951 4953
4954 u64_stats_init(&rx_ring->syncp);
4955
4952 /* Round up to nearest 4K */ 4956 /* Round up to nearest 4K */
4953 rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc); 4957 rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc);
4954 rx_ring->size = ALIGN(rx_ring->size, 4096); 4958 rx_ring->size = ALIGN(rx_ring->size, 4096);
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index e35bac7cfdf1..cb4635c0cd73 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2792,6 +2792,9 @@ static int mvneta_probe(struct platform_device *pdev)
2792 2792
2793 pp = netdev_priv(dev); 2793 pp = netdev_priv(dev);
2794 2794
2795 u64_stats_init(&pp->tx_stats.syncp);
2796 u64_stats_init(&pp->rx_stats.syncp);
2797
2795 pp->weight = MVNETA_RX_POLL_WEIGHT; 2798 pp->weight = MVNETA_RX_POLL_WEIGHT;
2796 pp->phy_node = phy_node; 2799 pp->phy_node = phy_node;
2797 pp->phy_interface = phy_mode; 2800 pp->phy_interface = phy_mode;
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index e09a8c6f8536..339d841a538b 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4763,6 +4763,9 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
4763 sky2->hw = hw; 4763 sky2->hw = hw;
4764 sky2->msg_enable = netif_msg_init(debug, default_msg); 4764 sky2->msg_enable = netif_msg_init(debug, default_msg);
4765 4765
4766 u64_stats_init(&sky2->tx_stats.syncp);
4767 u64_stats_init(&sky2->rx_stats.syncp);
4768
4766 /* Auto speed and flow control */ 4769 /* Auto speed and flow control */
4767 sky2->flags = SKY2_FLAG_AUTO_SPEED | SKY2_FLAG_AUTO_PAUSE; 4770 sky2->flags = SKY2_FLAG_AUTO_SPEED | SKY2_FLAG_AUTO_PAUSE;
4768 if (hw->chip_id != CHIP_ID_YUKON_XL) 4771 if (hw->chip_id != CHIP_ID_YUKON_XL)
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index 5a20eaf903dd..44626ec1127b 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -2072,6 +2072,10 @@ static int vxge_open_vpaths(struct vxgedev *vdev)
2072 vdev->config.tx_steering_type; 2072 vdev->config.tx_steering_type;
2073 vpath->fifo.ndev = vdev->ndev; 2073 vpath->fifo.ndev = vdev->ndev;
2074 vpath->fifo.pdev = vdev->pdev; 2074 vpath->fifo.pdev = vdev->pdev;
2075
2076 u64_stats_init(&vpath->fifo.stats.syncp);
2077 u64_stats_init(&vpath->ring.stats.syncp);
2078
2075 if (vdev->config.tx_steering_type) 2079 if (vdev->config.tx_steering_type)
2076 vpath->fifo.txq = 2080 vpath->fifo.txq =
2077 netdev_get_tx_queue(vdev->ndev, i); 2081 netdev_get_tx_queue(vdev->ndev, i);
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 098b96dad66f..2d045be4b5cf 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -5619,6 +5619,8 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
5619 spin_lock_init(&np->lock); 5619 spin_lock_init(&np->lock);
5620 spin_lock_init(&np->hwstats_lock); 5620 spin_lock_init(&np->hwstats_lock);
5621 SET_NETDEV_DEV(dev, &pci_dev->dev); 5621 SET_NETDEV_DEV(dev, &pci_dev->dev);
5622 u64_stats_init(&np->swstats_rx_syncp);
5623 u64_stats_init(&np->swstats_tx_syncp);
5622 5624
5623 init_timer(&np->oom_kick); 5625 init_timer(&np->oom_kick);
5624 np->oom_kick.data = (unsigned long) dev; 5626 np->oom_kick.data = (unsigned long) dev;
diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index 3ccedeb8aba0..c40e984868ad 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -791,6 +791,9 @@ static struct net_device *rtl8139_init_board(struct pci_dev *pdev)
791 791
792 pci_set_master (pdev); 792 pci_set_master (pdev);
793 793
794 u64_stats_init(&tp->rx_stats.syncp);
795 u64_stats_init(&tp->tx_stats.syncp);
796
794retry: 797retry:
795 /* PIO bar register comes first. */ 798 /* PIO bar register comes first. */
796 bar = !use_io; 799 bar = !use_io;
diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c
index 106be47716e7..edb2e12a0fe2 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -1008,6 +1008,8 @@ static void tile_net_register(void *dev_ptr)
1008 info->egress_timer.data = (long)info; 1008 info->egress_timer.data = (long)info;
1009 info->egress_timer.function = tile_net_handle_egress_timer; 1009 info->egress_timer.function = tile_net_handle_egress_timer;
1010 1010
1011 u64_stats_init(&info->stats.syncp);
1012
1011 priv->cpu[my_cpu] = info; 1013 priv->cpu[my_cpu] = info;
1012 1014
1013 /* 1015 /*
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index bdf697b184ae..dd99715e6645 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -987,6 +987,9 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
987 987
988 rp->base = ioaddr; 988 rp->base = ioaddr;
989 989
990 u64_stats_init(&rp->tx_stats.syncp);
991 u64_stats_init(&rp->rx_stats.syncp);
992
990 /* Get chip registers into a sane state */ 993 /* Get chip registers into a sane state */
991 rhine_power_init(dev); 994 rhine_power_init(dev);
992 rhine_hw_init(dev, pioaddr); 995 rhine_hw_init(dev, pioaddr);
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index a3bed28197d2..c14d39bf32d0 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -265,6 +265,7 @@ MODULE_PARM_DESC(numifbs, "Number of ifb devices");
265static int __init ifb_init_one(int index) 265static int __init ifb_init_one(int index)
266{ 266{
267 struct net_device *dev_ifb; 267 struct net_device *dev_ifb;
268 struct ifb_private *dp;
268 int err; 269 int err;
269 270
270 dev_ifb = alloc_netdev(sizeof(struct ifb_private), 271 dev_ifb = alloc_netdev(sizeof(struct ifb_private),
@@ -273,6 +274,10 @@ static int __init ifb_init_one(int index)
273 if (!dev_ifb) 274 if (!dev_ifb)
274 return -ENOMEM; 275 return -ENOMEM;
275 276
277 dp = netdev_priv(dev_ifb);
278 u64_stats_init(&dp->rsync);
279 u64_stats_init(&dp->tsync);
280
276 dev_ifb->rtnl_link_ops = &ifb_link_ops; 281 dev_ifb->rtnl_link_ops = &ifb_link_ops;
277 err = register_netdevice(dev_ifb); 282 err = register_netdevice(dev_ifb);
278 if (err < 0) 283 if (err < 0)
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index a17d85a331f1..ac24c27b4b2d 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -137,10 +137,16 @@ static const struct ethtool_ops loopback_ethtool_ops = {
137 137
138static int loopback_dev_init(struct net_device *dev) 138static int loopback_dev_init(struct net_device *dev)
139{ 139{
140 int i;
140 dev->lstats = alloc_percpu(struct pcpu_lstats); 141 dev->lstats = alloc_percpu(struct pcpu_lstats);
141 if (!dev->lstats) 142 if (!dev->lstats)
142 return -ENOMEM; 143 return -ENOMEM;
143 144
145 for_each_possible_cpu(i) {
146 struct pcpu_lstats *lb_stats;
147 lb_stats = per_cpu_ptr(dev->lstats, i);
148 u64_stats_init(&lb_stats->syncp);
149 }
144 return 0; 150 return 0;
145} 151}
146 152
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 9bf46bd19b87..0924e51b9ee0 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -501,6 +501,7 @@ static int macvlan_init(struct net_device *dev)
501{ 501{
502 struct macvlan_dev *vlan = netdev_priv(dev); 502 struct macvlan_dev *vlan = netdev_priv(dev);
503 const struct net_device *lowerdev = vlan->lowerdev; 503 const struct net_device *lowerdev = vlan->lowerdev;
504 int i;
504 505
505 dev->state = (dev->state & ~MACVLAN_STATE_MASK) | 506 dev->state = (dev->state & ~MACVLAN_STATE_MASK) |
506 (lowerdev->state & MACVLAN_STATE_MASK); 507 (lowerdev->state & MACVLAN_STATE_MASK);
@@ -516,6 +517,12 @@ static int macvlan_init(struct net_device *dev)
516 if (!vlan->pcpu_stats) 517 if (!vlan->pcpu_stats)
517 return -ENOMEM; 518 return -ENOMEM;
518 519
520 for_each_possible_cpu(i) {
521 struct macvlan_pcpu_stats *mvlstats;
522 mvlstats = per_cpu_ptr(vlan->pcpu_stats, i);
523 u64_stats_init(&mvlstats->syncp);
524 }
525
519 return 0; 526 return 0;
520} 527}
521 528
diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c
index b57ce5f48962..d2bb12bfabd5 100644
--- a/drivers/net/nlmon.c
+++ b/drivers/net/nlmon.c
@@ -47,8 +47,16 @@ static int nlmon_change_mtu(struct net_device *dev, int new_mtu)
47 47
48static int nlmon_dev_init(struct net_device *dev) 48static int nlmon_dev_init(struct net_device *dev)
49{ 49{
50 int i;
51
50 dev->lstats = alloc_percpu(struct pcpu_lstats); 52 dev->lstats = alloc_percpu(struct pcpu_lstats);
51 53
54 for_each_possible_cpu(i) {
55 struct pcpu_lstats *nlmstats;
56 nlmstats = per_cpu_ptr(dev->lstats, i);
57 u64_stats_init(&nlmstats->syncp);
58 }
59
52 return dev->lstats == NULL ? -ENOMEM : 0; 60 return dev->lstats == NULL ? -ENOMEM : 0;
53} 61}
54 62
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 50e43e64d51d..6574eb8766f9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1540,6 +1540,12 @@ static int team_init(struct net_device *dev)
1540 if (!team->pcpu_stats) 1540 if (!team->pcpu_stats)
1541 return -ENOMEM; 1541 return -ENOMEM;
1542 1542
1543 for_each_possible_cpu(i) {
1544 struct team_pcpu_stats *team_stats;
1545 team_stats = per_cpu_ptr(team->pcpu_stats, i);
1546 u64_stats_init(&team_stats->syncp);
1547 }
1548
1543 for (i = 0; i < TEAM_PORT_HASHENTRIES; i++) 1549 for (i = 0; i < TEAM_PORT_HASHENTRIES; i++)
1544 INIT_HLIST_HEAD(&team->en_port_hlist[i]); 1550 INIT_HLIST_HEAD(&team->en_port_hlist[i]);
1545 INIT_LIST_HEAD(&team->port_list); 1551 INIT_LIST_HEAD(&team->port_list);
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
index 829a9cd2b4da..d671fc3ac5ac 100644
--- a/drivers/net/team/team_mode_loadbalance.c
+++ b/drivers/net/team/team_mode_loadbalance.c
@@ -570,7 +570,7 @@ static int lb_init(struct team *team)
570{ 570{
571 struct lb_priv *lb_priv = get_lb_priv(team); 571 struct lb_priv *lb_priv = get_lb_priv(team);
572 lb_select_tx_port_func_t *func; 572 lb_select_tx_port_func_t *func;
573 int err; 573 int i, err;
574 574
575 /* set default tx port selector */ 575 /* set default tx port selector */
576 func = lb_select_tx_port_get_func("hash"); 576 func = lb_select_tx_port_get_func("hash");
@@ -588,6 +588,13 @@ static int lb_init(struct team *team)
588 goto err_alloc_pcpu_stats; 588 goto err_alloc_pcpu_stats;
589 } 589 }
590 590
591 for_each_possible_cpu(i) {
592 struct lb_pcpu_stats *team_lb_stats;
593 team_lb_stats = per_cpu_ptr(lb_priv->pcpu_stats, i);
594 u64_stats_init(&team_lb_stats->syncp);
595 }
596
597
591 INIT_DELAYED_WORK(&lb_priv->ex->stats.refresh_dw, lb_stats_refresh); 598 INIT_DELAYED_WORK(&lb_priv->ex->stats.refresh_dw, lb_stats_refresh);
592 599
593 err = team_options_register(team, lb_options, ARRAY_SIZE(lb_options)); 600 err = team_options_register(team, lb_options, ARRAY_SIZE(lb_options));
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index eee1f19ef1e9..46e83e3fe999 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -230,10 +230,18 @@ static int veth_change_mtu(struct net_device *dev, int new_mtu)
230 230
231static int veth_dev_init(struct net_device *dev) 231static int veth_dev_init(struct net_device *dev)
232{ 232{
233 int i;
234
233 dev->vstats = alloc_percpu(struct pcpu_vstats); 235 dev->vstats = alloc_percpu(struct pcpu_vstats);
234 if (!dev->vstats) 236 if (!dev->vstats)
235 return -ENOMEM; 237 return -ENOMEM;
236 238
239 for_each_possible_cpu(i) {
240 struct pcpu_vstats *veth_stats;
241 veth_stats = per_cpu_ptr(dev->vstats, i);
242 u64_stats_init(&veth_stats->syncp);
243 }
244
237 return 0; 245 return 0;
238} 246}
239 247
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9fbdfcd1e1a0..ee384f3d612b 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1569,6 +1569,14 @@ static int virtnet_probe(struct virtio_device *vdev)
1569 if (vi->stats == NULL) 1569 if (vi->stats == NULL)
1570 goto free; 1570 goto free;
1571 1571
1572 for_each_possible_cpu(i) {
1573 struct virtnet_stats *virtnet_stats;
1574 virtnet_stats = per_cpu_ptr(vi->stats, i);
1575 u64_stats_init(&virtnet_stats->tx_syncp);
1576 u64_stats_init(&virtnet_stats->rx_syncp);
1577 }
1578
1579
1572 vi->vq_index = alloc_percpu(int); 1580 vi->vq_index = alloc_percpu(int);
1573 if (vi->vq_index == NULL) 1581 if (vi->vq_index == NULL)
1574 goto free_stats; 1582 goto free_stats;
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 2ef5b6219f3f..01ab64d5f9a4 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1884,11 +1884,19 @@ static int vxlan_init(struct net_device *dev)
1884 struct vxlan_dev *vxlan = netdev_priv(dev); 1884 struct vxlan_dev *vxlan = netdev_priv(dev);
1885 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 1885 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
1886 struct vxlan_sock *vs; 1886 struct vxlan_sock *vs;
1887 int i;
1887 1888
1888 dev->tstats = alloc_percpu(struct pcpu_tstats); 1889 dev->tstats = alloc_percpu(struct pcpu_tstats);
1889 if (!dev->tstats) 1890 if (!dev->tstats)
1890 return -ENOMEM; 1891 return -ENOMEM;
1891 1892
1893 for_each_possible_cpu(i) {
1894 struct pcpu_tstats *vxlan_stats;
1895 vxlan_stats = per_cpu_ptr(dev->tstats, i);
1896 u64_stats_init(&vxlan_stats->syncp);
1897 }
1898
1899
1892 spin_lock(&vn->sock_lock); 1900 spin_lock(&vn->sock_lock);
1893 vs = vxlan_find_sock(dev_net(dev), vxlan->dst_port); 1901 vs = vxlan_find_sock(dev_net(dev), vxlan->dst_port);
1894 if (vs) { 1902 if (vs) {
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 36808bf25677..54223ac6d8a6 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1338,6 +1338,12 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
1338 if (np->stats == NULL) 1338 if (np->stats == NULL)
1339 goto exit; 1339 goto exit;
1340 1340
1341 for_each_possible_cpu(i) {
1342 struct netfront_stats *xen_nf_stats;
1343 xen_nf_stats = per_cpu_ptr(np->stats, i);
1344 u64_stats_init(&xen_nf_stats->syncp);
1345 }
1346
1341 /* Initialise tx_skbs as a free chain containing every entry. */ 1347 /* Initialise tx_skbs as a free chain containing every entry. */
1342 np->tx_skb_freelist = 0; 1348 np->tx_skb_freelist = 0;
1343 for (i = 0; i < NET_TX_RING_SIZE; i++) { 1349 for (i = 0; i < NET_TX_RING_SIZE; i++) {