diff options
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r-- | drivers/net/bnx2.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 4e7b46e44874..dfe50c286d95 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -468,8 +468,7 @@ bnx2_free_mem(struct bnx2 *bp) | |||
468 | bp->stats_blk = NULL; | 468 | bp->stats_blk = NULL; |
469 | } | 469 | } |
470 | if (bp->tx_desc_ring) { | 470 | if (bp->tx_desc_ring) { |
471 | pci_free_consistent(bp->pdev, | 471 | pci_free_consistent(bp->pdev, TXBD_RING_SIZE, |
472 | sizeof(struct tx_bd) * TX_DESC_CNT, | ||
473 | bp->tx_desc_ring, bp->tx_desc_mapping); | 472 | bp->tx_desc_ring, bp->tx_desc_mapping); |
474 | bp->tx_desc_ring = NULL; | 473 | bp->tx_desc_ring = NULL; |
475 | } | 474 | } |
@@ -477,8 +476,7 @@ bnx2_free_mem(struct bnx2 *bp) | |||
477 | bp->tx_buf_ring = NULL; | 476 | bp->tx_buf_ring = NULL; |
478 | for (i = 0; i < bp->rx_max_ring; i++) { | 477 | for (i = 0; i < bp->rx_max_ring; i++) { |
479 | if (bp->rx_desc_ring[i]) | 478 | if (bp->rx_desc_ring[i]) |
480 | pci_free_consistent(bp->pdev, | 479 | pci_free_consistent(bp->pdev, RXBD_RING_SIZE, |
481 | sizeof(struct rx_bd) * RX_DESC_CNT, | ||
482 | bp->rx_desc_ring[i], | 480 | bp->rx_desc_ring[i], |
483 | bp->rx_desc_mapping[i]); | 481 | bp->rx_desc_mapping[i]); |
484 | bp->rx_desc_ring[i] = NULL; | 482 | bp->rx_desc_ring[i] = NULL; |
@@ -492,30 +490,24 @@ bnx2_alloc_mem(struct bnx2 *bp) | |||
492 | { | 490 | { |
493 | int i, status_blk_size; | 491 | int i, status_blk_size; |
494 | 492 | ||
495 | bp->tx_buf_ring = kzalloc(sizeof(struct sw_bd) * TX_DESC_CNT, | 493 | bp->tx_buf_ring = kzalloc(SW_TXBD_RING_SIZE, GFP_KERNEL); |
496 | GFP_KERNEL); | ||
497 | if (bp->tx_buf_ring == NULL) | 494 | if (bp->tx_buf_ring == NULL) |
498 | return -ENOMEM; | 495 | return -ENOMEM; |
499 | 496 | ||
500 | bp->tx_desc_ring = pci_alloc_consistent(bp->pdev, | 497 | bp->tx_desc_ring = pci_alloc_consistent(bp->pdev, TXBD_RING_SIZE, |
501 | sizeof(struct tx_bd) * | ||
502 | TX_DESC_CNT, | ||
503 | &bp->tx_desc_mapping); | 498 | &bp->tx_desc_mapping); |
504 | if (bp->tx_desc_ring == NULL) | 499 | if (bp->tx_desc_ring == NULL) |
505 | goto alloc_mem_err; | 500 | goto alloc_mem_err; |
506 | 501 | ||
507 | bp->rx_buf_ring = vmalloc(sizeof(struct sw_bd) * RX_DESC_CNT * | 502 | bp->rx_buf_ring = vmalloc(SW_RXBD_RING_SIZE * bp->rx_max_ring); |
508 | bp->rx_max_ring); | ||
509 | if (bp->rx_buf_ring == NULL) | 503 | if (bp->rx_buf_ring == NULL) |
510 | goto alloc_mem_err; | 504 | goto alloc_mem_err; |
511 | 505 | ||
512 | memset(bp->rx_buf_ring, 0, sizeof(struct sw_bd) * RX_DESC_CNT * | 506 | memset(bp->rx_buf_ring, 0, SW_RXBD_RING_SIZE * bp->rx_max_ring); |
513 | bp->rx_max_ring); | ||
514 | 507 | ||
515 | for (i = 0; i < bp->rx_max_ring; i++) { | 508 | for (i = 0; i < bp->rx_max_ring; i++) { |
516 | bp->rx_desc_ring[i] = | 509 | bp->rx_desc_ring[i] = |
517 | pci_alloc_consistent(bp->pdev, | 510 | pci_alloc_consistent(bp->pdev, RXBD_RING_SIZE, |
518 | sizeof(struct rx_bd) * RX_DESC_CNT, | ||
519 | &bp->rx_desc_mapping[i]); | 511 | &bp->rx_desc_mapping[i]); |
520 | if (bp->rx_desc_ring[i] == NULL) | 512 | if (bp->rx_desc_ring[i] == NULL) |
521 | goto alloc_mem_err; | 513 | goto alloc_mem_err; |