diff options
34 files changed, 253 insertions, 6 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 | ||
89 | static int dummy_dev_init(struct net_device *dev) | 89 | static 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 | |||
794 | retry: | 797 | retry: |
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"); | |||
265 | static int __init ifb_init_one(int index) | 265 | static 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 | ||
138 | static int loopback_dev_init(struct net_device *dev) | 138 | static 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 | ||
48 | static int nlmon_dev_init(struct net_device *dev) | 48 | static 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 | ||
231 | static int veth_dev_init(struct net_device *dev) | 231 | static 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++) { |
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h index 8da8c4e87da3..7bfabd20204c 100644 --- a/include/linux/u64_stats_sync.h +++ b/include/linux/u64_stats_sync.h | |||
@@ -67,6 +67,13 @@ struct u64_stats_sync { | |||
67 | #endif | 67 | #endif |
68 | }; | 68 | }; |
69 | 69 | ||
70 | |||
71 | #if BITS_PER_LONG == 32 && defined(CONFIG_SMP) | ||
72 | # define u64_stats_init(syncp) seqcount_init(syncp.seq) | ||
73 | #else | ||
74 | # define u64_stats_init(syncp) do { } while (0) | ||
75 | #endif | ||
76 | |||
70 | static inline void u64_stats_update_begin(struct u64_stats_sync *syncp) | 77 | static inline void u64_stats_update_begin(struct u64_stats_sync *syncp) |
71 | { | 78 | { |
72 | #if BITS_PER_LONG==32 && defined(CONFIG_SMP) | 79 | #if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 09bf1c38805b..4deff3ed1da1 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -558,7 +558,7 @@ static const struct net_device_ops vlan_netdev_ops; | |||
558 | static int vlan_dev_init(struct net_device *dev) | 558 | static int vlan_dev_init(struct net_device *dev) |
559 | { | 559 | { |
560 | struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; | 560 | struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; |
561 | int subclass = 0; | 561 | int subclass = 0, i; |
562 | 562 | ||
563 | netif_carrier_off(dev); | 563 | netif_carrier_off(dev); |
564 | 564 | ||
@@ -612,6 +612,13 @@ static int vlan_dev_init(struct net_device *dev) | |||
612 | if (!vlan_dev_priv(dev)->vlan_pcpu_stats) | 612 | if (!vlan_dev_priv(dev)->vlan_pcpu_stats) |
613 | return -ENOMEM; | 613 | return -ENOMEM; |
614 | 614 | ||
615 | for_each_possible_cpu(i) { | ||
616 | struct vlan_pcpu_stats *vlan_stat; | ||
617 | vlan_stat = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i); | ||
618 | u64_stats_init(&vlan_stat->syncp); | ||
619 | } | ||
620 | |||
621 | |||
615 | return 0; | 622 | return 0; |
616 | } | 623 | } |
617 | 624 | ||
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index ca04163635da..7893d641775b 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -88,11 +88,18 @@ out: | |||
88 | static int br_dev_init(struct net_device *dev) | 88 | static int br_dev_init(struct net_device *dev) |
89 | { | 89 | { |
90 | struct net_bridge *br = netdev_priv(dev); | 90 | struct net_bridge *br = netdev_priv(dev); |
91 | int i; | ||
91 | 92 | ||
92 | br->stats = alloc_percpu(struct br_cpu_netstats); | 93 | br->stats = alloc_percpu(struct br_cpu_netstats); |
93 | if (!br->stats) | 94 | if (!br->stats) |
94 | return -ENOMEM; | 95 | return -ENOMEM; |
95 | 96 | ||
97 | for_each_possible_cpu(i) { | ||
98 | struct br_cpu_netstats *br_dev_stats; | ||
99 | br_dev_stats = per_cpu_ptr(br->stats, i); | ||
100 | u64_stats_init(&br_dev_stats->syncp); | ||
101 | } | ||
102 | |||
96 | return 0; | 103 | return 0; |
97 | } | 104 | } |
98 | 105 | ||
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index cfeb85cff4f0..5f4617e377b8 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1518,6 +1518,7 @@ int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align) | |||
1518 | ptr[0] = __alloc_percpu(mibsize, align); | 1518 | ptr[0] = __alloc_percpu(mibsize, align); |
1519 | if (!ptr[0]) | 1519 | if (!ptr[0]) |
1520 | return -ENOMEM; | 1520 | return -ENOMEM; |
1521 | |||
1521 | #if SNMP_ARRAY_SZ == 2 | 1522 | #if SNMP_ARRAY_SZ == 2 |
1522 | ptr[1] = __alloc_percpu(mibsize, align); | 1523 | ptr[1] = __alloc_percpu(mibsize, align); |
1523 | if (!ptr[1]) { | 1524 | if (!ptr[1]) { |
@@ -1561,6 +1562,8 @@ static const struct net_protocol icmp_protocol = { | |||
1561 | 1562 | ||
1562 | static __net_init int ipv4_mib_init_net(struct net *net) | 1563 | static __net_init int ipv4_mib_init_net(struct net *net) |
1563 | { | 1564 | { |
1565 | int i; | ||
1566 | |||
1564 | if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics, | 1567 | if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics, |
1565 | sizeof(struct tcp_mib), | 1568 | sizeof(struct tcp_mib), |
1566 | __alignof__(struct tcp_mib)) < 0) | 1569 | __alignof__(struct tcp_mib)) < 0) |
@@ -1569,6 +1572,17 @@ static __net_init int ipv4_mib_init_net(struct net *net) | |||
1569 | sizeof(struct ipstats_mib), | 1572 | sizeof(struct ipstats_mib), |
1570 | __alignof__(struct ipstats_mib)) < 0) | 1573 | __alignof__(struct ipstats_mib)) < 0) |
1571 | goto err_ip_mib; | 1574 | goto err_ip_mib; |
1575 | |||
1576 | for_each_possible_cpu(i) { | ||
1577 | struct ipstats_mib *af_inet_stats; | ||
1578 | af_inet_stats = per_cpu_ptr(net->mib.ip_statistics[0], i); | ||
1579 | u64_stats_init(&af_inet_stats->syncp); | ||
1580 | #if SNMP_ARRAY_SZ == 2 | ||
1581 | af_inet_stats = per_cpu_ptr(net->mib.ip_statistics[1], i); | ||
1582 | u64_stats_init(&af_inet_stats->syncp); | ||
1583 | #endif | ||
1584 | } | ||
1585 | |||
1572 | if (snmp_mib_init((void __percpu **)net->mib.net_statistics, | 1586 | if (snmp_mib_init((void __percpu **)net->mib.net_statistics, |
1573 | sizeof(struct linux_mib), | 1587 | sizeof(struct linux_mib), |
1574 | __alignof__(struct linux_mib)) < 0) | 1588 | __alignof__(struct linux_mib)) < 0) |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 63a6d6d6b875..caf01176a5e4 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -976,13 +976,19 @@ int ip_tunnel_init(struct net_device *dev) | |||
976 | { | 976 | { |
977 | struct ip_tunnel *tunnel = netdev_priv(dev); | 977 | struct ip_tunnel *tunnel = netdev_priv(dev); |
978 | struct iphdr *iph = &tunnel->parms.iph; | 978 | struct iphdr *iph = &tunnel->parms.iph; |
979 | int err; | 979 | int i, err; |
980 | 980 | ||
981 | dev->destructor = ip_tunnel_dev_free; | 981 | dev->destructor = ip_tunnel_dev_free; |
982 | dev->tstats = alloc_percpu(struct pcpu_tstats); | 982 | dev->tstats = alloc_percpu(struct pcpu_tstats); |
983 | if (!dev->tstats) | 983 | if (!dev->tstats) |
984 | return -ENOMEM; | 984 | return -ENOMEM; |
985 | 985 | ||
986 | for_each_possible_cpu(i) { | ||
987 | struct pcpu_tstats *ipt_stats; | ||
988 | ipt_stats = per_cpu_ptr(dev->tstats, i); | ||
989 | u64_stats_init(&ipt_stats->syncp); | ||
990 | } | ||
991 | |||
986 | err = gro_cells_init(&tunnel->gro_cells, dev); | 992 | err = gro_cells_init(&tunnel->gro_cells, dev); |
987 | if (err) { | 993 | if (err) { |
988 | free_percpu(dev->tstats); | 994 | free_percpu(dev->tstats); |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index cd3fb301da38..d62d589bb622 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -281,10 +281,24 @@ static void addrconf_mod_dad_timer(struct inet6_ifaddr *ifp, | |||
281 | 281 | ||
282 | static int snmp6_alloc_dev(struct inet6_dev *idev) | 282 | static int snmp6_alloc_dev(struct inet6_dev *idev) |
283 | { | 283 | { |
284 | int i; | ||
285 | |||
284 | if (snmp_mib_init((void __percpu **)idev->stats.ipv6, | 286 | if (snmp_mib_init((void __percpu **)idev->stats.ipv6, |
285 | sizeof(struct ipstats_mib), | 287 | sizeof(struct ipstats_mib), |
286 | __alignof__(struct ipstats_mib)) < 0) | 288 | __alignof__(struct ipstats_mib)) < 0) |
287 | goto err_ip; | 289 | goto err_ip; |
290 | |||
291 | for_each_possible_cpu(i) { | ||
292 | struct ipstats_mib *addrconf_stats; | ||
293 | addrconf_stats = per_cpu_ptr(idev->stats.ipv6[0], i); | ||
294 | u64_stats_init(&addrconf_stats->syncp); | ||
295 | #if SNMP_ARRAY_SZ == 2 | ||
296 | addrconf_stats = per_cpu_ptr(idev->stats.ipv6[1], i); | ||
297 | u64_stats_init(&addrconf_stats->syncp); | ||
298 | #endif | ||
299 | } | ||
300 | |||
301 | |||
288 | idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device), | 302 | idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device), |
289 | GFP_KERNEL); | 303 | GFP_KERNEL); |
290 | if (!idev->stats.icmpv6dev) | 304 | if (!idev->stats.icmpv6dev) |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 7c96100b021e..a8f8559b3dce 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -719,6 +719,8 @@ static void ipv6_packet_cleanup(void) | |||
719 | 719 | ||
720 | static int __net_init ipv6_init_mibs(struct net *net) | 720 | static int __net_init ipv6_init_mibs(struct net *net) |
721 | { | 721 | { |
722 | int i; | ||
723 | |||
722 | if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6, | 724 | if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6, |
723 | sizeof(struct udp_mib), | 725 | sizeof(struct udp_mib), |
724 | __alignof__(struct udp_mib)) < 0) | 726 | __alignof__(struct udp_mib)) < 0) |
@@ -731,6 +733,18 @@ static int __net_init ipv6_init_mibs(struct net *net) | |||
731 | sizeof(struct ipstats_mib), | 733 | sizeof(struct ipstats_mib), |
732 | __alignof__(struct ipstats_mib)) < 0) | 734 | __alignof__(struct ipstats_mib)) < 0) |
733 | goto err_ip_mib; | 735 | goto err_ip_mib; |
736 | |||
737 | for_each_possible_cpu(i) { | ||
738 | struct ipstats_mib *af_inet6_stats; | ||
739 | af_inet6_stats = per_cpu_ptr(net->mib.ipv6_statistics[0], i); | ||
740 | u64_stats_init(&af_inet6_stats->syncp); | ||
741 | #if SNMP_ARRAY_SZ == 2 | ||
742 | af_inet6_stats = per_cpu_ptr(net->mib.ipv6_statistics[1], i); | ||
743 | u64_stats_init(&af_inet6_stats->syncp); | ||
744 | #endif | ||
745 | } | ||
746 | |||
747 | |||
734 | if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics, | 748 | if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics, |
735 | sizeof(struct icmpv6_mib), | 749 | sizeof(struct icmpv6_mib), |
736 | __alignof__(struct icmpv6_mib)) < 0) | 750 | __alignof__(struct icmpv6_mib)) < 0) |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index bf4a9a084de5..8acb28621f9c 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -1252,6 +1252,7 @@ static void ip6gre_tunnel_setup(struct net_device *dev) | |||
1252 | static int ip6gre_tunnel_init(struct net_device *dev) | 1252 | static int ip6gre_tunnel_init(struct net_device *dev) |
1253 | { | 1253 | { |
1254 | struct ip6_tnl *tunnel; | 1254 | struct ip6_tnl *tunnel; |
1255 | int i; | ||
1255 | 1256 | ||
1256 | tunnel = netdev_priv(dev); | 1257 | tunnel = netdev_priv(dev); |
1257 | 1258 | ||
@@ -1269,6 +1270,13 @@ static int ip6gre_tunnel_init(struct net_device *dev) | |||
1269 | if (!dev->tstats) | 1270 | if (!dev->tstats) |
1270 | return -ENOMEM; | 1271 | return -ENOMEM; |
1271 | 1272 | ||
1273 | for_each_possible_cpu(i) { | ||
1274 | struct pcpu_tstats *ip6gre_tunnel_stats; | ||
1275 | ip6gre_tunnel_stats = per_cpu_ptr(dev->tstats, i); | ||
1276 | u64_stats_init(&ip6gre_tunnel_stats->syncp); | ||
1277 | } | ||
1278 | |||
1279 | |||
1272 | return 0; | 1280 | return 0; |
1273 | } | 1281 | } |
1274 | 1282 | ||
@@ -1449,6 +1457,7 @@ static void ip6gre_netlink_parms(struct nlattr *data[], | |||
1449 | static int ip6gre_tap_init(struct net_device *dev) | 1457 | static int ip6gre_tap_init(struct net_device *dev) |
1450 | { | 1458 | { |
1451 | struct ip6_tnl *tunnel; | 1459 | struct ip6_tnl *tunnel; |
1460 | int i; | ||
1452 | 1461 | ||
1453 | tunnel = netdev_priv(dev); | 1462 | tunnel = netdev_priv(dev); |
1454 | 1463 | ||
@@ -1462,6 +1471,12 @@ static int ip6gre_tap_init(struct net_device *dev) | |||
1462 | if (!dev->tstats) | 1471 | if (!dev->tstats) |
1463 | return -ENOMEM; | 1472 | return -ENOMEM; |
1464 | 1473 | ||
1474 | for_each_possible_cpu(i) { | ||
1475 | struct pcpu_tstats *ip6gre_tap_stats; | ||
1476 | ip6gre_tap_stats = per_cpu_ptr(dev->tstats, i); | ||
1477 | u64_stats_init(&ip6gre_tap_stats->syncp); | ||
1478 | } | ||
1479 | |||
1465 | return 0; | 1480 | return 0; |
1466 | } | 1481 | } |
1467 | 1482 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 583b77e2f69b..df1fa58528c6 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1494,12 +1494,19 @@ static inline int | |||
1494 | ip6_tnl_dev_init_gen(struct net_device *dev) | 1494 | ip6_tnl_dev_init_gen(struct net_device *dev) |
1495 | { | 1495 | { |
1496 | struct ip6_tnl *t = netdev_priv(dev); | 1496 | struct ip6_tnl *t = netdev_priv(dev); |
1497 | int i; | ||
1497 | 1498 | ||
1498 | t->dev = dev; | 1499 | t->dev = dev; |
1499 | t->net = dev_net(dev); | 1500 | t->net = dev_net(dev); |
1500 | dev->tstats = alloc_percpu(struct pcpu_tstats); | 1501 | dev->tstats = alloc_percpu(struct pcpu_tstats); |
1501 | if (!dev->tstats) | 1502 | if (!dev->tstats) |
1502 | return -ENOMEM; | 1503 | return -ENOMEM; |
1504 | |||
1505 | for_each_possible_cpu(i) { | ||
1506 | struct pcpu_tstats *ip6_tnl_stats; | ||
1507 | ip6_tnl_stats = per_cpu_ptr(dev->tstats, i); | ||
1508 | u64_stats_init(&ip6_tnl_stats->syncp); | ||
1509 | } | ||
1503 | return 0; | 1510 | return 0; |
1504 | } | 1511 | } |
1505 | 1512 | ||
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 19269453a8ea..365dc5473eb2 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -1310,6 +1310,7 @@ static void ipip6_tunnel_setup(struct net_device *dev) | |||
1310 | static int ipip6_tunnel_init(struct net_device *dev) | 1310 | static int ipip6_tunnel_init(struct net_device *dev) |
1311 | { | 1311 | { |
1312 | struct ip_tunnel *tunnel = netdev_priv(dev); | 1312 | struct ip_tunnel *tunnel = netdev_priv(dev); |
1313 | int i; | ||
1313 | 1314 | ||
1314 | tunnel->dev = dev; | 1315 | tunnel->dev = dev; |
1315 | tunnel->net = dev_net(dev); | 1316 | tunnel->net = dev_net(dev); |
@@ -1322,6 +1323,12 @@ static int ipip6_tunnel_init(struct net_device *dev) | |||
1322 | if (!dev->tstats) | 1323 | if (!dev->tstats) |
1323 | return -ENOMEM; | 1324 | return -ENOMEM; |
1324 | 1325 | ||
1326 | for_each_possible_cpu(i) { | ||
1327 | struct pcpu_tstats *ipip6_tunnel_stats; | ||
1328 | ipip6_tunnel_stats = per_cpu_ptr(dev->tstats, i); | ||
1329 | u64_stats_init(&ipip6_tunnel_stats->syncp); | ||
1330 | } | ||
1331 | |||
1325 | return 0; | 1332 | return 0; |
1326 | } | 1333 | } |
1327 | 1334 | ||
@@ -1331,6 +1338,7 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) | |||
1331 | struct iphdr *iph = &tunnel->parms.iph; | 1338 | struct iphdr *iph = &tunnel->parms.iph; |
1332 | struct net *net = dev_net(dev); | 1339 | struct net *net = dev_net(dev); |
1333 | struct sit_net *sitn = net_generic(net, sit_net_id); | 1340 | struct sit_net *sitn = net_generic(net, sit_net_id); |
1341 | int i; | ||
1334 | 1342 | ||
1335 | tunnel->dev = dev; | 1343 | tunnel->dev = dev; |
1336 | tunnel->net = dev_net(dev); | 1344 | tunnel->net = dev_net(dev); |
@@ -1344,6 +1352,13 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) | |||
1344 | dev->tstats = alloc_percpu(struct pcpu_tstats); | 1352 | dev->tstats = alloc_percpu(struct pcpu_tstats); |
1345 | if (!dev->tstats) | 1353 | if (!dev->tstats) |
1346 | return -ENOMEM; | 1354 | return -ENOMEM; |
1355 | |||
1356 | for_each_possible_cpu(i) { | ||
1357 | struct pcpu_tstats *ipip6_fb_stats; | ||
1358 | ipip6_fb_stats = per_cpu_ptr(dev->tstats, i); | ||
1359 | u64_stats_init(&ipip6_fb_stats->syncp); | ||
1360 | } | ||
1361 | |||
1347 | dev_hold(dev); | 1362 | dev_hold(dev); |
1348 | rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); | 1363 | rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); |
1349 | return 0; | 1364 | return 0; |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index a3df9bddc4f7..3825725907f6 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -842,7 +842,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest, | |||
842 | struct ip_vs_dest **dest_p) | 842 | struct ip_vs_dest **dest_p) |
843 | { | 843 | { |
844 | struct ip_vs_dest *dest; | 844 | struct ip_vs_dest *dest; |
845 | unsigned int atype; | 845 | unsigned int atype, i; |
846 | 846 | ||
847 | EnterFunction(2); | 847 | EnterFunction(2); |
848 | 848 | ||
@@ -869,6 +869,12 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest, | |||
869 | if (!dest->stats.cpustats) | 869 | if (!dest->stats.cpustats) |
870 | goto err_alloc; | 870 | goto err_alloc; |
871 | 871 | ||
872 | for_each_possible_cpu(i) { | ||
873 | struct ip_vs_cpu_stats *ip_vs_dest_stats; | ||
874 | ip_vs_dest_stats = per_cpu_ptr(dest->stats.cpustats, i); | ||
875 | u64_stats_init(&ip_vs_dest_stats->syncp); | ||
876 | } | ||
877 | |||
872 | dest->af = svc->af; | 878 | dest->af = svc->af; |
873 | dest->protocol = svc->protocol; | 879 | dest->protocol = svc->protocol; |
874 | dest->vaddr = svc->addr; | 880 | dest->vaddr = svc->addr; |
@@ -1134,7 +1140,7 @@ static int | |||
1134 | ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u, | 1140 | ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u, |
1135 | struct ip_vs_service **svc_p) | 1141 | struct ip_vs_service **svc_p) |
1136 | { | 1142 | { |
1137 | int ret = 0; | 1143 | int ret = 0, i; |
1138 | struct ip_vs_scheduler *sched = NULL; | 1144 | struct ip_vs_scheduler *sched = NULL; |
1139 | struct ip_vs_pe *pe = NULL; | 1145 | struct ip_vs_pe *pe = NULL; |
1140 | struct ip_vs_service *svc = NULL; | 1146 | struct ip_vs_service *svc = NULL; |
@@ -1184,6 +1190,13 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u, | |||
1184 | goto out_err; | 1190 | goto out_err; |
1185 | } | 1191 | } |
1186 | 1192 | ||
1193 | for_each_possible_cpu(i) { | ||
1194 | struct ip_vs_cpu_stats *ip_vs_stats; | ||
1195 | ip_vs_stats = per_cpu_ptr(svc->stats.cpustats, i); | ||
1196 | u64_stats_init(&ip_vs_stats->syncp); | ||
1197 | } | ||
1198 | |||
1199 | |||
1187 | /* I'm the first user of the service */ | 1200 | /* I'm the first user of the service */ |
1188 | atomic_set(&svc->refcnt, 0); | 1201 | atomic_set(&svc->refcnt, 0); |
1189 | 1202 | ||
@@ -3780,7 +3793,7 @@ static struct notifier_block ip_vs_dst_notifier = { | |||
3780 | 3793 | ||
3781 | int __net_init ip_vs_control_net_init(struct net *net) | 3794 | int __net_init ip_vs_control_net_init(struct net *net) |
3782 | { | 3795 | { |
3783 | int idx; | 3796 | int i, idx; |
3784 | struct netns_ipvs *ipvs = net_ipvs(net); | 3797 | struct netns_ipvs *ipvs = net_ipvs(net); |
3785 | 3798 | ||
3786 | /* Initialize rs_table */ | 3799 | /* Initialize rs_table */ |
@@ -3799,6 +3812,12 @@ int __net_init ip_vs_control_net_init(struct net *net) | |||
3799 | if (!ipvs->tot_stats.cpustats) | 3812 | if (!ipvs->tot_stats.cpustats) |
3800 | return -ENOMEM; | 3813 | return -ENOMEM; |
3801 | 3814 | ||
3815 | for_each_possible_cpu(i) { | ||
3816 | struct ip_vs_cpu_stats *ipvs_tot_stats; | ||
3817 | ipvs_tot_stats = per_cpu_ptr(ipvs->tot_stats.cpustats, i); | ||
3818 | u64_stats_init(&ipvs_tot_stats->syncp); | ||
3819 | } | ||
3820 | |||
3802 | spin_lock_init(&ipvs->tot_stats.lock); | 3821 | spin_lock_init(&ipvs->tot_stats.lock); |
3803 | 3822 | ||
3804 | proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops); | 3823 | proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops); |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 2aa13bd7f2b2..b92553c02279 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -1698,6 +1698,12 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) | |||
1698 | goto err_destroy_table; | 1698 | goto err_destroy_table; |
1699 | } | 1699 | } |
1700 | 1700 | ||
1701 | for_each_possible_cpu(i) { | ||
1702 | struct dp_stats_percpu *dpath_stats; | ||
1703 | dpath_stats = per_cpu_ptr(dp->stats_percpu, i); | ||
1704 | u64_stats_init(&dpath_stats->sync); | ||
1705 | } | ||
1706 | |||
1701 | dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head), | 1707 | dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head), |
1702 | GFP_KERNEL); | 1708 | GFP_KERNEL); |
1703 | if (!dp->ports) { | 1709 | if (!dp->ports) { |
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 6f65dbe13812..d830a95f03a4 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c | |||
@@ -118,6 +118,7 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, | |||
118 | { | 118 | { |
119 | struct vport *vport; | 119 | struct vport *vport; |
120 | size_t alloc_size; | 120 | size_t alloc_size; |
121 | int i; | ||
121 | 122 | ||
122 | alloc_size = sizeof(struct vport); | 123 | alloc_size = sizeof(struct vport); |
123 | if (priv_size) { | 124 | if (priv_size) { |
@@ -141,6 +142,13 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, | |||
141 | return ERR_PTR(-ENOMEM); | 142 | return ERR_PTR(-ENOMEM); |
142 | } | 143 | } |
143 | 144 | ||
145 | for_each_possible_cpu(i) { | ||
146 | struct pcpu_tstats *vport_stats; | ||
147 | vport_stats = per_cpu_ptr(vport->percpu_stats, i); | ||
148 | u64_stats_init(&vport_stats->syncp); | ||
149 | } | ||
150 | |||
151 | |||
144 | spin_lock_init(&vport->stats_lock); | 152 | spin_lock_init(&vport->stats_lock); |
145 | 153 | ||
146 | return vport; | 154 | return vport; |