aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
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/ethernet/intel
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/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c5
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c4
2 files changed, 9 insertions, 0 deletions
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);