aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ibm/ibmveth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/ibm/ibmveth.c')
-rw-r--r--drivers/net/ethernet/ibm/ibmveth.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 9010cea68bc3..b68d28a130e6 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -472,14 +472,9 @@ static void ibmveth_cleanup(struct ibmveth_adapter *adapter)
472 } 472 }
473 473
474 if (adapter->rx_queue.queue_addr != NULL) { 474 if (adapter->rx_queue.queue_addr != NULL) {
475 if (!dma_mapping_error(dev, adapter->rx_queue.queue_dma)) { 475 dma_free_coherent(dev, adapter->rx_queue.queue_len,
476 dma_unmap_single(dev, 476 adapter->rx_queue.queue_addr,
477 adapter->rx_queue.queue_dma, 477 adapter->rx_queue.queue_dma);
478 adapter->rx_queue.queue_len,
479 DMA_BIDIRECTIONAL);
480 adapter->rx_queue.queue_dma = DMA_ERROR_CODE;
481 }
482 kfree(adapter->rx_queue.queue_addr);
483 adapter->rx_queue.queue_addr = NULL; 478 adapter->rx_queue.queue_addr = NULL;
484 } 479 }
485 480
@@ -556,10 +551,13 @@ static int ibmveth_open(struct net_device *netdev)
556 goto err_out; 551 goto err_out;
557 } 552 }
558 553
554 dev = &adapter->vdev->dev;
555
559 adapter->rx_queue.queue_len = sizeof(struct ibmveth_rx_q_entry) * 556 adapter->rx_queue.queue_len = sizeof(struct ibmveth_rx_q_entry) *
560 rxq_entries; 557 rxq_entries;
561 adapter->rx_queue.queue_addr = kmalloc(adapter->rx_queue.queue_len, 558 adapter->rx_queue.queue_addr =
562 GFP_KERNEL); 559 dma_alloc_coherent(dev, adapter->rx_queue.queue_len,
560 &adapter->rx_queue.queue_dma, GFP_KERNEL);
563 561
564 if (!adapter->rx_queue.queue_addr) { 562 if (!adapter->rx_queue.queue_addr) {
565 netdev_err(netdev, "unable to allocate rx queue pages\n"); 563 netdev_err(netdev, "unable to allocate rx queue pages\n");
@@ -567,19 +565,13 @@ static int ibmveth_open(struct net_device *netdev)
567 goto err_out; 565 goto err_out;
568 } 566 }
569 567
570 dev = &adapter->vdev->dev;
571
572 adapter->buffer_list_dma = dma_map_single(dev, 568 adapter->buffer_list_dma = dma_map_single(dev,
573 adapter->buffer_list_addr, 4096, DMA_BIDIRECTIONAL); 569 adapter->buffer_list_addr, 4096, DMA_BIDIRECTIONAL);
574 adapter->filter_list_dma = dma_map_single(dev, 570 adapter->filter_list_dma = dma_map_single(dev,
575 adapter->filter_list_addr, 4096, DMA_BIDIRECTIONAL); 571 adapter->filter_list_addr, 4096, DMA_BIDIRECTIONAL);
576 adapter->rx_queue.queue_dma = dma_map_single(dev,
577 adapter->rx_queue.queue_addr,
578 adapter->rx_queue.queue_len, DMA_BIDIRECTIONAL);
579 572
580 if ((dma_mapping_error(dev, adapter->buffer_list_dma)) || 573 if ((dma_mapping_error(dev, adapter->buffer_list_dma)) ||
581 (dma_mapping_error(dev, adapter->filter_list_dma)) || 574 (dma_mapping_error(dev, adapter->filter_list_dma))) {
582 (dma_mapping_error(dev, adapter->rx_queue.queue_dma))) {
583 netdev_err(netdev, "unable to map filter or buffer list " 575 netdev_err(netdev, "unable to map filter or buffer list "
584 "pages\n"); 576 "pages\n");
585 rc = -ENOMEM; 577 rc = -ENOMEM;