aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge/qlge_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/qlge/qlge_main.c')
-rw-r--r--drivers/net/qlge/qlge_main.c31
1 files changed, 2 insertions, 29 deletions
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
2358static void ql_free_ring_cb(struct ql_adapter *qdev)
2359{
2360 kfree(qdev->ring_mem);
2361}
2362
2363static 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
2380static void ql_free_mem_resources(struct ql_adapter *qdev) 2358static 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
3383error_up: 3357error_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