diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2008-09-11 23:00:29 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-24 18:55:01 -0400 |
commit | b9804972f52c2e6d60ddfa3a892c3628ed0aa846 (patch) | |
tree | 59dabe8dc4416c91d68392c1578e9603b5caa5c1 /drivers/net/ixgbe/ixgbe_main.c | |
parent | 7f8218752a76bb1f70b5e4e918f49bc5bf33275a (diff) |
ixgbe: move set_num_queues and call it after msix failure
This is partial preparation for a future patch which will extend
ixgbe_set_num_queues
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index cafb915bc828..257866b06f62 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2333,6 +2333,46 @@ static void ixgbe_reset_task(struct work_struct *work) | |||
2333 | ixgbe_reinit_locked(adapter); | 2333 | ixgbe_reinit_locked(adapter); |
2334 | } | 2334 | } |
2335 | 2335 | ||
2336 | static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter) | ||
2337 | { | ||
2338 | int nrq = 1, ntq = 1; | ||
2339 | int feature_mask = 0, rss_i, rss_m; | ||
2340 | |||
2341 | /* Number of supported queues */ | ||
2342 | switch (adapter->hw.mac.type) { | ||
2343 | case ixgbe_mac_82598EB: | ||
2344 | rss_i = adapter->ring_feature[RING_F_RSS].indices; | ||
2345 | rss_m = 0; | ||
2346 | feature_mask |= IXGBE_FLAG_RSS_ENABLED; | ||
2347 | |||
2348 | switch (adapter->flags & feature_mask) { | ||
2349 | case (IXGBE_FLAG_RSS_ENABLED): | ||
2350 | rss_m = 0xF; | ||
2351 | nrq = rss_i; | ||
2352 | ntq = rss_i; | ||
2353 | break; | ||
2354 | case 0: | ||
2355 | default: | ||
2356 | rss_i = 0; | ||
2357 | rss_m = 0; | ||
2358 | nrq = 1; | ||
2359 | ntq = 1; | ||
2360 | break; | ||
2361 | } | ||
2362 | |||
2363 | adapter->ring_feature[RING_F_RSS].indices = rss_i; | ||
2364 | adapter->ring_feature[RING_F_RSS].mask = rss_m; | ||
2365 | break; | ||
2366 | default: | ||
2367 | nrq = 1; | ||
2368 | ntq = 1; | ||
2369 | break; | ||
2370 | } | ||
2371 | |||
2372 | adapter->num_rx_queues = nrq; | ||
2373 | adapter->num_tx_queues = ntq; | ||
2374 | } | ||
2375 | |||
2336 | static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, | 2376 | static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, |
2337 | int vectors) | 2377 | int vectors) |
2338 | { | 2378 | { |
@@ -2372,54 +2412,13 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, | |||
2372 | kfree(adapter->msix_entries); | 2412 | kfree(adapter->msix_entries); |
2373 | adapter->msix_entries = NULL; | 2413 | adapter->msix_entries = NULL; |
2374 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; | 2414 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; |
2375 | adapter->num_tx_queues = 1; | 2415 | ixgbe_set_num_queues(adapter); |
2376 | adapter->num_rx_queues = 1; | ||
2377 | } else { | 2416 | } else { |
2378 | adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */ | 2417 | adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */ |
2379 | adapter->num_msix_vectors = vectors; | 2418 | adapter->num_msix_vectors = vectors; |
2380 | } | 2419 | } |
2381 | } | 2420 | } |
2382 | 2421 | ||
2383 | static void __devinit ixgbe_set_num_queues(struct ixgbe_adapter *adapter) | ||
2384 | { | ||
2385 | int nrq, ntq; | ||
2386 | int feature_mask = 0, rss_i, rss_m; | ||
2387 | |||
2388 | /* Number of supported queues */ | ||
2389 | switch (adapter->hw.mac.type) { | ||
2390 | case ixgbe_mac_82598EB: | ||
2391 | rss_i = adapter->ring_feature[RING_F_RSS].indices; | ||
2392 | rss_m = 0; | ||
2393 | feature_mask |= IXGBE_FLAG_RSS_ENABLED; | ||
2394 | |||
2395 | switch (adapter->flags & feature_mask) { | ||
2396 | case (IXGBE_FLAG_RSS_ENABLED): | ||
2397 | rss_m = 0xF; | ||
2398 | nrq = rss_i; | ||
2399 | ntq = rss_i; | ||
2400 | break; | ||
2401 | case 0: | ||
2402 | default: | ||
2403 | rss_i = 0; | ||
2404 | rss_m = 0; | ||
2405 | nrq = 1; | ||
2406 | ntq = 1; | ||
2407 | break; | ||
2408 | } | ||
2409 | |||
2410 | adapter->ring_feature[RING_F_RSS].indices = rss_i; | ||
2411 | adapter->ring_feature[RING_F_RSS].mask = rss_m; | ||
2412 | break; | ||
2413 | default: | ||
2414 | nrq = 1; | ||
2415 | ntq = 1; | ||
2416 | break; | ||
2417 | } | ||
2418 | |||
2419 | adapter->num_rx_queues = nrq; | ||
2420 | adapter->num_tx_queues = ntq; | ||
2421 | } | ||
2422 | |||
2423 | /** | 2422 | /** |
2424 | * ixgbe_cache_ring_register - Descriptor ring to register mapping | 2423 | * ixgbe_cache_ring_register - Descriptor ring to register mapping |
2425 | * @adapter: board private structure to initialize | 2424 | * @adapter: board private structure to initialize |
@@ -2482,11 +2481,12 @@ static int __devinit ixgbe_alloc_queues(struct ixgbe_adapter *adapter) | |||
2482 | goto err_rx_ring_allocation; | 2481 | goto err_rx_ring_allocation; |
2483 | 2482 | ||
2484 | for (i = 0; i < adapter->num_tx_queues; i++) { | 2483 | for (i = 0; i < adapter->num_tx_queues; i++) { |
2485 | adapter->tx_ring[i].count = IXGBE_DEFAULT_TXD; | 2484 | adapter->tx_ring[i].count = adapter->tx_ring_count; |
2486 | adapter->tx_ring[i].queue_index = i; | 2485 | adapter->tx_ring[i].queue_index = i; |
2487 | } | 2486 | } |
2487 | |||
2488 | for (i = 0; i < adapter->num_rx_queues; i++) { | 2488 | for (i = 0; i < adapter->num_rx_queues; i++) { |
2489 | adapter->rx_ring[i].count = IXGBE_DEFAULT_RXD; | 2489 | adapter->rx_ring[i].count = adapter->rx_ring_count; |
2490 | adapter->rx_ring[i].queue_index = i; | 2490 | adapter->rx_ring[i].queue_index = i; |
2491 | } | 2491 | } |
2492 | 2492 | ||