diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-01-09 06:31:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-11 03:07:36 -0500 |
commit | 683d46a9798c382220ef282b37f8210b5276cb3a (patch) | |
tree | 3e17c27262cddd122c901df815ecb5b30cc85490 /drivers/net/qlge | |
parent | 0857e9d73feea0125280dcd431cee84f6cb3b4e2 (diff) |
qlge: Remove dynamic alloc of rx ring control blocks.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge')
-rw-r--r-- | drivers/net/qlge/qlge.h | 12 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_main.c | 31 |
2 files changed, 10 insertions, 33 deletions
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index a5095343eb11..c1dadadfab18 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -30,8 +30,9 @@ | |||
30 | #define QLGE_VENDOR_ID 0x1077 | 30 | #define QLGE_VENDOR_ID 0x1077 |
31 | #define QLGE_DEVICE_ID 0x8012 | 31 | #define QLGE_DEVICE_ID 0x8012 |
32 | 32 | ||
33 | #define MAX_RX_RINGS 128 | 33 | #define MAX_CPUS 8 |
34 | #define MAX_TX_RINGS 128 | 34 | #define MAX_TX_RINGS MAX_CPUS |
35 | #define MAX_RX_RINGS ((MAX_CPUS * 2) + 1) | ||
35 | 36 | ||
36 | #define NUM_TX_RING_ENTRIES 256 | 37 | #define NUM_TX_RING_ENTRIES 256 |
37 | #define NUM_RX_RING_ENTRIES 256 | 38 | #define NUM_RX_RING_ENTRIES 256 |
@@ -44,6 +45,7 @@ | |||
44 | #define MAX_SPLIT_SIZE 1023 | 45 | #define MAX_SPLIT_SIZE 1023 |
45 | #define QLGE_SB_PAD 32 | 46 | #define QLGE_SB_PAD 32 |
46 | 47 | ||
48 | #define MAX_CQ 128 | ||
47 | #define DFLT_COALESCE_WAIT 100 /* 100 usec wait for coalescing */ | 49 | #define DFLT_COALESCE_WAIT 100 /* 100 usec wait for coalescing */ |
48 | #define MAX_INTER_FRAME_WAIT 10 /* 10 usec max interframe-wait for coalescing */ | 50 | #define MAX_INTER_FRAME_WAIT 10 /* 10 usec max interframe-wait for coalescing */ |
49 | #define DFLT_INTER_FRAME_WAIT (MAX_INTER_FRAME_WAIT/2) | 51 | #define DFLT_INTER_FRAME_WAIT (MAX_INTER_FRAME_WAIT/2) |
@@ -1393,9 +1395,11 @@ struct ql_adapter { | |||
1393 | int rx_ring_count; | 1395 | int rx_ring_count; |
1394 | int ring_mem_size; | 1396 | int ring_mem_size; |
1395 | void *ring_mem; | 1397 | void *ring_mem; |
1396 | struct rx_ring *rx_ring; | 1398 | |
1399 | struct rx_ring rx_ring[MAX_RX_RINGS]; | ||
1400 | struct tx_ring tx_ring[MAX_TX_RINGS]; | ||
1401 | |||
1397 | int rx_csum; | 1402 | int rx_csum; |
1398 | struct tx_ring *tx_ring; | ||
1399 | u32 default_rx_queue; | 1403 | u32 default_rx_queue; |
1400 | 1404 | ||
1401 | u16 rx_coalesce_usecs; /* cqicb->int_delay */ | 1405 | u16 rx_coalesce_usecs; /* cqicb->int_delay */ |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 543a4135ae04..45421c8b6010 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -2355,28 +2355,6 @@ static void ql_tx_ring_clean(struct ql_adapter *qdev) | |||
2355 | } | 2355 | } |
2356 | } | 2356 | } |
2357 | 2357 | ||
2358 | static void ql_free_ring_cb(struct ql_adapter *qdev) | ||
2359 | { | ||
2360 | kfree(qdev->ring_mem); | ||
2361 | } | ||
2362 | |||
2363 | static int ql_alloc_ring_cb(struct ql_adapter *qdev) | ||
2364 | { | ||
2365 | /* Allocate space for tx/rx ring control blocks. */ | ||
2366 | qdev->ring_mem_size = | ||
2367 | (qdev->tx_ring_count * sizeof(struct tx_ring)) + | ||
2368 | (qdev->rx_ring_count * sizeof(struct rx_ring)); | ||
2369 | qdev->ring_mem = kmalloc(qdev->ring_mem_size, GFP_KERNEL); | ||
2370 | if (qdev->ring_mem == NULL) { | ||
2371 | return -ENOMEM; | ||
2372 | } else { | ||
2373 | qdev->rx_ring = qdev->ring_mem; | ||
2374 | qdev->tx_ring = qdev->ring_mem + | ||
2375 | (qdev->rx_ring_count * sizeof(struct rx_ring)); | ||
2376 | } | ||
2377 | return 0; | ||
2378 | } | ||
2379 | |||
2380 | static void ql_free_mem_resources(struct ql_adapter *qdev) | 2358 | static void ql_free_mem_resources(struct ql_adapter *qdev) |
2381 | { | 2359 | { |
2382 | int i; | 2360 | int i; |
@@ -3236,7 +3214,6 @@ static int qlge_close(struct net_device *ndev) | |||
3236 | msleep(1); | 3214 | msleep(1); |
3237 | ql_adapter_down(qdev); | 3215 | ql_adapter_down(qdev); |
3238 | ql_release_adapter_resources(qdev); | 3216 | ql_release_adapter_resources(qdev); |
3239 | ql_free_ring_cb(qdev); | ||
3240 | return 0; | 3217 | return 0; |
3241 | } | 3218 | } |
3242 | 3219 | ||
@@ -3262,8 +3239,8 @@ static int ql_configure_rings(struct ql_adapter *qdev) | |||
3262 | * This limitation can be removed when requested. | 3239 | * This limitation can be removed when requested. |
3263 | */ | 3240 | */ |
3264 | 3241 | ||
3265 | if (cpu_cnt > 8) | 3242 | if (cpu_cnt > MAX_CPUS) |
3266 | cpu_cnt = 8; | 3243 | cpu_cnt = MAX_CPUS; |
3267 | 3244 | ||
3268 | /* | 3245 | /* |
3269 | * rx_ring[0] is always the default queue. | 3246 | * rx_ring[0] is always the default queue. |
@@ -3283,9 +3260,6 @@ static int ql_configure_rings(struct ql_adapter *qdev) | |||
3283 | */ | 3260 | */ |
3284 | qdev->rx_ring_count = qdev->tx_ring_count + qdev->rss_ring_count + 1; | 3261 | qdev->rx_ring_count = qdev->tx_ring_count + qdev->rss_ring_count + 1; |
3285 | 3262 | ||
3286 | if (ql_alloc_ring_cb(qdev)) | ||
3287 | return -ENOMEM; | ||
3288 | |||
3289 | for (i = 0; i < qdev->tx_ring_count; i++) { | 3263 | for (i = 0; i < qdev->tx_ring_count; i++) { |
3290 | tx_ring = &qdev->tx_ring[i]; | 3264 | tx_ring = &qdev->tx_ring[i]; |
3291 | memset((void *)tx_ring, 0, sizeof(tx_ring)); | 3265 | memset((void *)tx_ring, 0, sizeof(tx_ring)); |
@@ -3382,7 +3356,6 @@ static int qlge_open(struct net_device *ndev) | |||
3382 | 3356 | ||
3383 | error_up: | 3357 | error_up: |
3384 | ql_release_adapter_resources(qdev); | 3358 | ql_release_adapter_resources(qdev); |
3385 | ql_free_ring_cb(qdev); | ||
3386 | return err; | 3359 | return err; |
3387 | } | 3360 | } |
3388 | 3361 | ||