diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2010-02-03 09:18:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-03 22:48:35 -0500 |
commit | 1a6c14a2c7c313c584f26730e67f062f474bb744 (patch) | |
tree | 0f318d7c67e64b7925f5055bf618dc3bfa1caa82 /drivers/net/ixgbe/ixgbe_main.c | |
parent | dbb5aaebc44ce7f64b12904c58fbc1dd487982a7 (diff) |
ixgbe: Allocate driver resources per NUMA node
The default policy for the current driver is to do all its memory
allocation on whatever processor is running insmod/modprobe. This
is less than optimal.
This driver's default mode of operation will be to use each node for each
subsequent transmit/receive queue. The most efficient allocation will be
to then have the interrupts bound in such a way as to match up the
interrupt of the queue to the cpu where its memory was allocated.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 1ec3cbdf8729..87e1aa5ba788 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -3946,7 +3946,11 @@ static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter) | |||
3946 | } | 3946 | } |
3947 | 3947 | ||
3948 | for (q_idx = 0; q_idx < num_q_vectors; q_idx++) { | 3948 | for (q_idx = 0; q_idx < num_q_vectors; q_idx++) { |
3949 | q_vector = kzalloc(sizeof(struct ixgbe_q_vector), GFP_KERNEL); | 3949 | q_vector = kzalloc_node(sizeof(struct ixgbe_q_vector), |
3950 | GFP_KERNEL, adapter->node); | ||
3951 | if (!q_vector) | ||
3952 | q_vector = kzalloc(sizeof(struct ixgbe_q_vector), | ||
3953 | GFP_KERNEL); | ||
3950 | if (!q_vector) | 3954 | if (!q_vector) |
3951 | goto err_out; | 3955 | goto err_out; |
3952 | q_vector->adapter = adapter; | 3956 | q_vector->adapter = adapter; |
@@ -4246,6 +4250,9 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
4246 | /* enable rx csum by default */ | 4250 | /* enable rx csum by default */ |
4247 | adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED; | 4251 | adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED; |
4248 | 4252 | ||
4253 | /* get assigned NUMA node */ | ||
4254 | adapter->node = dev_to_node(&pdev->dev); | ||
4255 | |||
4249 | set_bit(__IXGBE_DOWN, &adapter->state); | 4256 | set_bit(__IXGBE_DOWN, &adapter->state); |
4250 | 4257 | ||
4251 | return 0; | 4258 | return 0; |
@@ -4265,7 +4272,9 @@ int ixgbe_setup_tx_resources(struct ixgbe_adapter *adapter, | |||
4265 | int size; | 4272 | int size; |
4266 | 4273 | ||
4267 | size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; | 4274 | size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; |
4268 | tx_ring->tx_buffer_info = vmalloc(size); | 4275 | tx_ring->tx_buffer_info = vmalloc_node(size, adapter->node); |
4276 | if (!tx_ring->tx_buffer_info) | ||
4277 | tx_ring->tx_buffer_info = vmalloc(size); | ||
4269 | if (!tx_ring->tx_buffer_info) | 4278 | if (!tx_ring->tx_buffer_info) |
4270 | goto err; | 4279 | goto err; |
4271 | memset(tx_ring->tx_buffer_info, 0, size); | 4280 | memset(tx_ring->tx_buffer_info, 0, size); |
@@ -4305,8 +4314,15 @@ err: | |||
4305 | static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter) | 4314 | static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter) |
4306 | { | 4315 | { |
4307 | int i, err = 0; | 4316 | int i, err = 0; |
4317 | int orig_node = adapter->node; | ||
4308 | 4318 | ||
4309 | for (i = 0; i < adapter->num_tx_queues; i++) { | 4319 | for (i = 0; i < adapter->num_tx_queues; i++) { |
4320 | if (orig_node == -1) { | ||
4321 | int cur_node = next_online_node(adapter->node); | ||
4322 | if (cur_node == MAX_NUMNODES) | ||
4323 | cur_node = first_online_node; | ||
4324 | adapter->node = cur_node; | ||
4325 | } | ||
4310 | err = ixgbe_setup_tx_resources(adapter, &adapter->tx_ring[i]); | 4326 | err = ixgbe_setup_tx_resources(adapter, &adapter->tx_ring[i]); |
4311 | if (!err) | 4327 | if (!err) |
4312 | continue; | 4328 | continue; |
@@ -4314,6 +4330,9 @@ static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter) | |||
4314 | break; | 4330 | break; |
4315 | } | 4331 | } |
4316 | 4332 | ||
4333 | /* reset the node back to its starting value */ | ||
4334 | adapter->node = orig_node; | ||
4335 | |||
4317 | return err; | 4336 | return err; |
4318 | } | 4337 | } |
4319 | 4338 | ||
@@ -4331,7 +4350,9 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter, | |||
4331 | int size; | 4350 | int size; |
4332 | 4351 | ||
4333 | size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count; | 4352 | size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count; |
4334 | rx_ring->rx_buffer_info = vmalloc(size); | 4353 | rx_ring->rx_buffer_info = vmalloc_node(size, adapter->node); |
4354 | if (!rx_ring->rx_buffer_info) | ||
4355 | rx_ring->rx_buffer_info = vmalloc(size); | ||
4335 | if (!rx_ring->rx_buffer_info) { | 4356 | if (!rx_ring->rx_buffer_info) { |
4336 | DPRINTK(PROBE, ERR, | 4357 | DPRINTK(PROBE, ERR, |
4337 | "vmalloc allocation failed for the rx desc ring\n"); | 4358 | "vmalloc allocation failed for the rx desc ring\n"); |
@@ -4375,8 +4396,15 @@ alloc_failed: | |||
4375 | static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter) | 4396 | static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter) |
4376 | { | 4397 | { |
4377 | int i, err = 0; | 4398 | int i, err = 0; |
4399 | int orig_node = adapter->node; | ||
4378 | 4400 | ||
4379 | for (i = 0; i < adapter->num_rx_queues; i++) { | 4401 | for (i = 0; i < adapter->num_rx_queues; i++) { |
4402 | if (orig_node == -1) { | ||
4403 | int cur_node = next_online_node(adapter->node); | ||
4404 | if (cur_node == MAX_NUMNODES) | ||
4405 | cur_node = first_online_node; | ||
4406 | adapter->node = cur_node; | ||
4407 | } | ||
4380 | err = ixgbe_setup_rx_resources(adapter, &adapter->rx_ring[i]); | 4408 | err = ixgbe_setup_rx_resources(adapter, &adapter->rx_ring[i]); |
4381 | if (!err) | 4409 | if (!err) |
4382 | continue; | 4410 | continue; |
@@ -4384,6 +4412,9 @@ static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter) | |||
4384 | break; | 4412 | break; |
4385 | } | 4413 | } |
4386 | 4414 | ||
4415 | /* reset the node back to its starting value */ | ||
4416 | adapter->node = orig_node; | ||
4417 | |||
4387 | return err; | 4418 | return err; |
4388 | } | 4419 | } |
4389 | 4420 | ||