diff options
author | Nick Nunley <nicholasx.d.nunley@intel.com> | 2010-04-27 09:08:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-27 19:29:49 -0400 |
commit | b16f53bef9be0a756a0672e27d0a526686040e02 (patch) | |
tree | ef44806ac770a2af3cc34501ee138ef00ed55a1f /drivers/net/e1000 | |
parent | ff65e8275f6c96a5eda57493bd84c4555decf7b3 (diff) |
e1000: use DMA API instead of PCI DMA functions
Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 46 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 110 |
2 files changed, 88 insertions, 68 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index c67e93117271..616b405a1cb1 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -980,9 +980,10 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter) | |||
980 | if (txdr->desc && txdr->buffer_info) { | 980 | if (txdr->desc && txdr->buffer_info) { |
981 | for (i = 0; i < txdr->count; i++) { | 981 | for (i = 0; i < txdr->count; i++) { |
982 | if (txdr->buffer_info[i].dma) | 982 | if (txdr->buffer_info[i].dma) |
983 | pci_unmap_single(pdev, txdr->buffer_info[i].dma, | 983 | dma_unmap_single(&pdev->dev, |
984 | txdr->buffer_info[i].dma, | ||
984 | txdr->buffer_info[i].length, | 985 | txdr->buffer_info[i].length, |
985 | PCI_DMA_TODEVICE); | 986 | DMA_TO_DEVICE); |
986 | if (txdr->buffer_info[i].skb) | 987 | if (txdr->buffer_info[i].skb) |
987 | dev_kfree_skb(txdr->buffer_info[i].skb); | 988 | dev_kfree_skb(txdr->buffer_info[i].skb); |
988 | } | 989 | } |
@@ -991,20 +992,23 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter) | |||
991 | if (rxdr->desc && rxdr->buffer_info) { | 992 | if (rxdr->desc && rxdr->buffer_info) { |
992 | for (i = 0; i < rxdr->count; i++) { | 993 | for (i = 0; i < rxdr->count; i++) { |
993 | if (rxdr->buffer_info[i].dma) | 994 | if (rxdr->buffer_info[i].dma) |
994 | pci_unmap_single(pdev, rxdr->buffer_info[i].dma, | 995 | dma_unmap_single(&pdev->dev, |
996 | rxdr->buffer_info[i].dma, | ||
995 | rxdr->buffer_info[i].length, | 997 | rxdr->buffer_info[i].length, |
996 | PCI_DMA_FROMDEVICE); | 998 | DMA_FROM_DEVICE); |
997 | if (rxdr->buffer_info[i].skb) | 999 | if (rxdr->buffer_info[i].skb) |
998 | dev_kfree_skb(rxdr->buffer_info[i].skb); | 1000 | dev_kfree_skb(rxdr->buffer_info[i].skb); |
999 | } | 1001 | } |
1000 | } | 1002 | } |
1001 | 1003 | ||
1002 | if (txdr->desc) { | 1004 | if (txdr->desc) { |
1003 | pci_free_consistent(pdev, txdr->size, txdr->desc, txdr->dma); | 1005 | dma_free_coherent(&pdev->dev, txdr->size, txdr->desc, |
1006 | txdr->dma); | ||
1004 | txdr->desc = NULL; | 1007 | txdr->desc = NULL; |
1005 | } | 1008 | } |
1006 | if (rxdr->desc) { | 1009 | if (rxdr->desc) { |
1007 | pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma); | 1010 | dma_free_coherent(&pdev->dev, rxdr->size, rxdr->desc, |
1011 | rxdr->dma); | ||
1008 | rxdr->desc = NULL; | 1012 | rxdr->desc = NULL; |
1009 | } | 1013 | } |
1010 | 1014 | ||
@@ -1039,7 +1043,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1039 | 1043 | ||
1040 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); | 1044 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); |
1041 | txdr->size = ALIGN(txdr->size, 4096); | 1045 | txdr->size = ALIGN(txdr->size, 4096); |
1042 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); | 1046 | txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, |
1047 | GFP_KERNEL); | ||
1043 | if (!txdr->desc) { | 1048 | if (!txdr->desc) { |
1044 | ret_val = 2; | 1049 | ret_val = 2; |
1045 | goto err_nomem; | 1050 | goto err_nomem; |
@@ -1070,8 +1075,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1070 | txdr->buffer_info[i].skb = skb; | 1075 | txdr->buffer_info[i].skb = skb; |
1071 | txdr->buffer_info[i].length = skb->len; | 1076 | txdr->buffer_info[i].length = skb->len; |
1072 | txdr->buffer_info[i].dma = | 1077 | txdr->buffer_info[i].dma = |
1073 | pci_map_single(pdev, skb->data, skb->len, | 1078 | dma_map_single(&pdev->dev, skb->data, skb->len, |
1074 | PCI_DMA_TODEVICE); | 1079 | DMA_TO_DEVICE); |
1075 | tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); | 1080 | tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); |
1076 | tx_desc->lower.data = cpu_to_le32(skb->len); | 1081 | tx_desc->lower.data = cpu_to_le32(skb->len); |
1077 | tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | | 1082 | tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | |
@@ -1093,7 +1098,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1093 | } | 1098 | } |
1094 | 1099 | ||
1095 | rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); | 1100 | rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); |
1096 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); | 1101 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, |
1102 | GFP_KERNEL); | ||
1097 | if (!rxdr->desc) { | 1103 | if (!rxdr->desc) { |
1098 | ret_val = 5; | 1104 | ret_val = 5; |
1099 | goto err_nomem; | 1105 | goto err_nomem; |
@@ -1126,8 +1132,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1126 | rxdr->buffer_info[i].skb = skb; | 1132 | rxdr->buffer_info[i].skb = skb; |
1127 | rxdr->buffer_info[i].length = E1000_RXBUFFER_2048; | 1133 | rxdr->buffer_info[i].length = E1000_RXBUFFER_2048; |
1128 | rxdr->buffer_info[i].dma = | 1134 | rxdr->buffer_info[i].dma = |
1129 | pci_map_single(pdev, skb->data, E1000_RXBUFFER_2048, | 1135 | dma_map_single(&pdev->dev, skb->data, |
1130 | PCI_DMA_FROMDEVICE); | 1136 | E1000_RXBUFFER_2048, DMA_FROM_DEVICE); |
1131 | rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); | 1137 | rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); |
1132 | memset(skb->data, 0x00, skb->len); | 1138 | memset(skb->data, 0x00, skb->len); |
1133 | } | 1139 | } |
@@ -1444,10 +1450,10 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) | |||
1444 | for (i = 0; i < 64; i++) { /* send the packets */ | 1450 | for (i = 0; i < 64; i++) { /* send the packets */ |
1445 | e1000_create_lbtest_frame(txdr->buffer_info[i].skb, | 1451 | e1000_create_lbtest_frame(txdr->buffer_info[i].skb, |
1446 | 1024); | 1452 | 1024); |
1447 | pci_dma_sync_single_for_device(pdev, | 1453 | dma_sync_single_for_device(&pdev->dev, |
1448 | txdr->buffer_info[k].dma, | 1454 | txdr->buffer_info[k].dma, |
1449 | txdr->buffer_info[k].length, | 1455 | txdr->buffer_info[k].length, |
1450 | PCI_DMA_TODEVICE); | 1456 | DMA_TO_DEVICE); |
1451 | if (unlikely(++k == txdr->count)) k = 0; | 1457 | if (unlikely(++k == txdr->count)) k = 0; |
1452 | } | 1458 | } |
1453 | ew32(TDT, k); | 1459 | ew32(TDT, k); |
@@ -1455,10 +1461,10 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) | |||
1455 | time = jiffies; /* set the start time for the receive */ | 1461 | time = jiffies; /* set the start time for the receive */ |
1456 | good_cnt = 0; | 1462 | good_cnt = 0; |
1457 | do { /* receive the sent packets */ | 1463 | do { /* receive the sent packets */ |
1458 | pci_dma_sync_single_for_cpu(pdev, | 1464 | dma_sync_single_for_cpu(&pdev->dev, |
1459 | rxdr->buffer_info[l].dma, | 1465 | rxdr->buffer_info[l].dma, |
1460 | rxdr->buffer_info[l].length, | 1466 | rxdr->buffer_info[l].length, |
1461 | PCI_DMA_FROMDEVICE); | 1467 | DMA_FROM_DEVICE); |
1462 | 1468 | ||
1463 | ret_val = e1000_check_lbtest_frame( | 1469 | ret_val = e1000_check_lbtest_frame( |
1464 | rxdr->buffer_info[l].skb, | 1470 | rxdr->buffer_info[l].skb, |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 974a02d81823..0a56e7d1f33b 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -823,13 +823,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
823 | if (err) | 823 | if (err) |
824 | return err; | 824 | return err; |
825 | 825 | ||
826 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && | 826 | if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) && |
827 | !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { | 827 | !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { |
828 | pci_using_dac = 1; | 828 | pci_using_dac = 1; |
829 | } else { | 829 | } else { |
830 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 830 | err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
831 | if (err) { | 831 | if (err) { |
832 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | 832 | err = dma_set_coherent_mask(&pdev->dev, |
833 | DMA_BIT_MASK(32)); | ||
833 | if (err) { | 834 | if (err) { |
834 | E1000_ERR("No usable DMA configuration, " | 835 | E1000_ERR("No usable DMA configuration, " |
835 | "aborting\n"); | 836 | "aborting\n"); |
@@ -1395,7 +1396,8 @@ static int e1000_setup_tx_resources(struct e1000_adapter *adapter, | |||
1395 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); | 1396 | txdr->size = txdr->count * sizeof(struct e1000_tx_desc); |
1396 | txdr->size = ALIGN(txdr->size, 4096); | 1397 | txdr->size = ALIGN(txdr->size, 4096); |
1397 | 1398 | ||
1398 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); | 1399 | txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma, |
1400 | GFP_KERNEL); | ||
1399 | if (!txdr->desc) { | 1401 | if (!txdr->desc) { |
1400 | setup_tx_desc_die: | 1402 | setup_tx_desc_die: |
1401 | vfree(txdr->buffer_info); | 1403 | vfree(txdr->buffer_info); |
@@ -1411,18 +1413,21 @@ setup_tx_desc_die: | |||
1411 | DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes " | 1413 | DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes " |
1412 | "at %p\n", txdr->size, txdr->desc); | 1414 | "at %p\n", txdr->size, txdr->desc); |
1413 | /* Try again, without freeing the previous */ | 1415 | /* Try again, without freeing the previous */ |
1414 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); | 1416 | txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, |
1417 | &txdr->dma, GFP_KERNEL); | ||
1415 | /* Failed allocation, critical failure */ | 1418 | /* Failed allocation, critical failure */ |
1416 | if (!txdr->desc) { | 1419 | if (!txdr->desc) { |
1417 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); | 1420 | dma_free_coherent(&pdev->dev, txdr->size, olddesc, |
1421 | olddma); | ||
1418 | goto setup_tx_desc_die; | 1422 | goto setup_tx_desc_die; |
1419 | } | 1423 | } |
1420 | 1424 | ||
1421 | if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) { | 1425 | if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) { |
1422 | /* give up */ | 1426 | /* give up */ |
1423 | pci_free_consistent(pdev, txdr->size, txdr->desc, | 1427 | dma_free_coherent(&pdev->dev, txdr->size, txdr->desc, |
1424 | txdr->dma); | 1428 | txdr->dma); |
1425 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); | 1429 | dma_free_coherent(&pdev->dev, txdr->size, olddesc, |
1430 | olddma); | ||
1426 | DPRINTK(PROBE, ERR, | 1431 | DPRINTK(PROBE, ERR, |
1427 | "Unable to allocate aligned memory " | 1432 | "Unable to allocate aligned memory " |
1428 | "for the transmit descriptor ring\n"); | 1433 | "for the transmit descriptor ring\n"); |
@@ -1430,7 +1435,8 @@ setup_tx_desc_die: | |||
1430 | return -ENOMEM; | 1435 | return -ENOMEM; |
1431 | } else { | 1436 | } else { |
1432 | /* Free old allocation, new allocation was successful */ | 1437 | /* Free old allocation, new allocation was successful */ |
1433 | pci_free_consistent(pdev, txdr->size, olddesc, olddma); | 1438 | dma_free_coherent(&pdev->dev, txdr->size, olddesc, |
1439 | olddma); | ||
1434 | } | 1440 | } |
1435 | } | 1441 | } |
1436 | memset(txdr->desc, 0, txdr->size); | 1442 | memset(txdr->desc, 0, txdr->size); |
@@ -1590,7 +1596,8 @@ static int e1000_setup_rx_resources(struct e1000_adapter *adapter, | |||
1590 | rxdr->size = rxdr->count * desc_len; | 1596 | rxdr->size = rxdr->count * desc_len; |
1591 | rxdr->size = ALIGN(rxdr->size, 4096); | 1597 | rxdr->size = ALIGN(rxdr->size, 4096); |
1592 | 1598 | ||
1593 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); | 1599 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, |
1600 | GFP_KERNEL); | ||
1594 | 1601 | ||
1595 | if (!rxdr->desc) { | 1602 | if (!rxdr->desc) { |
1596 | DPRINTK(PROBE, ERR, | 1603 | DPRINTK(PROBE, ERR, |
@@ -1607,10 +1614,12 @@ setup_rx_desc_die: | |||
1607 | DPRINTK(RX_ERR, ERR, "rxdr align check failed: %u bytes " | 1614 | DPRINTK(RX_ERR, ERR, "rxdr align check failed: %u bytes " |
1608 | "at %p\n", rxdr->size, rxdr->desc); | 1615 | "at %p\n", rxdr->size, rxdr->desc); |
1609 | /* Try again, without freeing the previous */ | 1616 | /* Try again, without freeing the previous */ |
1610 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); | 1617 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, |
1618 | &rxdr->dma, GFP_KERNEL); | ||
1611 | /* Failed allocation, critical failure */ | 1619 | /* Failed allocation, critical failure */ |
1612 | if (!rxdr->desc) { | 1620 | if (!rxdr->desc) { |
1613 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1621 | dma_free_coherent(&pdev->dev, rxdr->size, olddesc, |
1622 | olddma); | ||
1614 | DPRINTK(PROBE, ERR, | 1623 | DPRINTK(PROBE, ERR, |
1615 | "Unable to allocate memory " | 1624 | "Unable to allocate memory " |
1616 | "for the receive descriptor ring\n"); | 1625 | "for the receive descriptor ring\n"); |
@@ -1619,16 +1628,18 @@ setup_rx_desc_die: | |||
1619 | 1628 | ||
1620 | if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) { | 1629 | if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) { |
1621 | /* give up */ | 1630 | /* give up */ |
1622 | pci_free_consistent(pdev, rxdr->size, rxdr->desc, | 1631 | dma_free_coherent(&pdev->dev, rxdr->size, rxdr->desc, |
1623 | rxdr->dma); | 1632 | rxdr->dma); |
1624 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1633 | dma_free_coherent(&pdev->dev, rxdr->size, olddesc, |
1634 | olddma); | ||
1625 | DPRINTK(PROBE, ERR, | 1635 | DPRINTK(PROBE, ERR, |
1626 | "Unable to allocate aligned memory " | 1636 | "Unable to allocate aligned memory " |
1627 | "for the receive descriptor ring\n"); | 1637 | "for the receive descriptor ring\n"); |
1628 | goto setup_rx_desc_die; | 1638 | goto setup_rx_desc_die; |
1629 | } else { | 1639 | } else { |
1630 | /* Free old allocation, new allocation was successful */ | 1640 | /* Free old allocation, new allocation was successful */ |
1631 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1641 | dma_free_coherent(&pdev->dev, rxdr->size, olddesc, |
1642 | olddma); | ||
1632 | } | 1643 | } |
1633 | } | 1644 | } |
1634 | memset(rxdr->desc, 0, rxdr->size); | 1645 | memset(rxdr->desc, 0, rxdr->size); |
@@ -1804,7 +1815,8 @@ static void e1000_free_tx_resources(struct e1000_adapter *adapter, | |||
1804 | vfree(tx_ring->buffer_info); | 1815 | vfree(tx_ring->buffer_info); |
1805 | tx_ring->buffer_info = NULL; | 1816 | tx_ring->buffer_info = NULL; |
1806 | 1817 | ||
1807 | pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma); | 1818 | dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc, |
1819 | tx_ring->dma); | ||
1808 | 1820 | ||
1809 | tx_ring->desc = NULL; | 1821 | tx_ring->desc = NULL; |
1810 | } | 1822 | } |
@@ -1829,12 +1841,12 @@ static void e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, | |||
1829 | { | 1841 | { |
1830 | if (buffer_info->dma) { | 1842 | if (buffer_info->dma) { |
1831 | if (buffer_info->mapped_as_page) | 1843 | if (buffer_info->mapped_as_page) |
1832 | pci_unmap_page(adapter->pdev, buffer_info->dma, | 1844 | dma_unmap_page(&adapter->pdev->dev, buffer_info->dma, |
1833 | buffer_info->length, PCI_DMA_TODEVICE); | 1845 | buffer_info->length, DMA_TO_DEVICE); |
1834 | else | 1846 | else |
1835 | pci_unmap_single(adapter->pdev, buffer_info->dma, | 1847 | dma_unmap_single(&adapter->pdev->dev, buffer_info->dma, |
1836 | buffer_info->length, | 1848 | buffer_info->length, |
1837 | PCI_DMA_TODEVICE); | 1849 | DMA_TO_DEVICE); |
1838 | buffer_info->dma = 0; | 1850 | buffer_info->dma = 0; |
1839 | } | 1851 | } |
1840 | if (buffer_info->skb) { | 1852 | if (buffer_info->skb) { |
@@ -1912,7 +1924,8 @@ static void e1000_free_rx_resources(struct e1000_adapter *adapter, | |||
1912 | vfree(rx_ring->buffer_info); | 1924 | vfree(rx_ring->buffer_info); |
1913 | rx_ring->buffer_info = NULL; | 1925 | rx_ring->buffer_info = NULL; |
1914 | 1926 | ||
1915 | pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma); | 1927 | dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, |
1928 | rx_ring->dma); | ||
1916 | 1929 | ||
1917 | rx_ring->desc = NULL; | 1930 | rx_ring->desc = NULL; |
1918 | } | 1931 | } |
@@ -1952,14 +1965,14 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter, | |||
1952 | buffer_info = &rx_ring->buffer_info[i]; | 1965 | buffer_info = &rx_ring->buffer_info[i]; |
1953 | if (buffer_info->dma && | 1966 | if (buffer_info->dma && |
1954 | adapter->clean_rx == e1000_clean_rx_irq) { | 1967 | adapter->clean_rx == e1000_clean_rx_irq) { |
1955 | pci_unmap_single(pdev, buffer_info->dma, | 1968 | dma_unmap_single(&pdev->dev, buffer_info->dma, |
1956 | buffer_info->length, | 1969 | buffer_info->length, |
1957 | PCI_DMA_FROMDEVICE); | 1970 | DMA_FROM_DEVICE); |
1958 | } else if (buffer_info->dma && | 1971 | } else if (buffer_info->dma && |
1959 | adapter->clean_rx == e1000_clean_jumbo_rx_irq) { | 1972 | adapter->clean_rx == e1000_clean_jumbo_rx_irq) { |
1960 | pci_unmap_page(pdev, buffer_info->dma, | 1973 | dma_unmap_page(&pdev->dev, buffer_info->dma, |
1961 | buffer_info->length, | 1974 | buffer_info->length, |
1962 | PCI_DMA_FROMDEVICE); | 1975 | DMA_FROM_DEVICE); |
1963 | } | 1976 | } |
1964 | 1977 | ||
1965 | buffer_info->dma = 0; | 1978 | buffer_info->dma = 0; |
@@ -2714,9 +2727,10 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
2714 | /* set time_stamp *before* dma to help avoid a possible race */ | 2727 | /* set time_stamp *before* dma to help avoid a possible race */ |
2715 | buffer_info->time_stamp = jiffies; | 2728 | buffer_info->time_stamp = jiffies; |
2716 | buffer_info->mapped_as_page = false; | 2729 | buffer_info->mapped_as_page = false; |
2717 | buffer_info->dma = pci_map_single(pdev, skb->data + offset, | 2730 | buffer_info->dma = dma_map_single(&pdev->dev, |
2718 | size, PCI_DMA_TODEVICE); | 2731 | skb->data + offset, |
2719 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) | 2732 | size, DMA_TO_DEVICE); |
2733 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) | ||
2720 | goto dma_error; | 2734 | goto dma_error; |
2721 | buffer_info->next_to_watch = i; | 2735 | buffer_info->next_to_watch = i; |
2722 | 2736 | ||
@@ -2760,10 +2774,10 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
2760 | buffer_info->length = size; | 2774 | buffer_info->length = size; |
2761 | buffer_info->time_stamp = jiffies; | 2775 | buffer_info->time_stamp = jiffies; |
2762 | buffer_info->mapped_as_page = true; | 2776 | buffer_info->mapped_as_page = true; |
2763 | buffer_info->dma = pci_map_page(pdev, frag->page, | 2777 | buffer_info->dma = dma_map_page(&pdev->dev, frag->page, |
2764 | offset, size, | 2778 | offset, size, |
2765 | PCI_DMA_TODEVICE); | 2779 | DMA_TO_DEVICE); |
2766 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) | 2780 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
2767 | goto dma_error; | 2781 | goto dma_error; |
2768 | buffer_info->next_to_watch = i; | 2782 | buffer_info->next_to_watch = i; |
2769 | 2783 | ||
@@ -3634,8 +3648,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, | |||
3634 | 3648 | ||
3635 | cleaned = true; | 3649 | cleaned = true; |
3636 | cleaned_count++; | 3650 | cleaned_count++; |
3637 | pci_unmap_page(pdev, buffer_info->dma, buffer_info->length, | 3651 | dma_unmap_page(&pdev->dev, buffer_info->dma, |
3638 | PCI_DMA_FROMDEVICE); | 3652 | buffer_info->length, DMA_FROM_DEVICE); |
3639 | buffer_info->dma = 0; | 3653 | buffer_info->dma = 0; |
3640 | 3654 | ||
3641 | length = le16_to_cpu(rx_desc->length); | 3655 | length = le16_to_cpu(rx_desc->length); |
@@ -3817,8 +3831,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3817 | 3831 | ||
3818 | cleaned = true; | 3832 | cleaned = true; |
3819 | cleaned_count++; | 3833 | cleaned_count++; |
3820 | pci_unmap_single(pdev, buffer_info->dma, buffer_info->length, | 3834 | dma_unmap_single(&pdev->dev, buffer_info->dma, |
3821 | PCI_DMA_FROMDEVICE); | 3835 | buffer_info->length, DMA_FROM_DEVICE); |
3822 | buffer_info->dma = 0; | 3836 | buffer_info->dma = 0; |
3823 | 3837 | ||
3824 | length = le16_to_cpu(rx_desc->length); | 3838 | length = le16_to_cpu(rx_desc->length); |
@@ -3998,11 +4012,11 @@ check_page: | |||
3998 | } | 4012 | } |
3999 | 4013 | ||
4000 | if (!buffer_info->dma) { | 4014 | if (!buffer_info->dma) { |
4001 | buffer_info->dma = pci_map_page(pdev, | 4015 | buffer_info->dma = dma_map_page(&pdev->dev, |
4002 | buffer_info->page, 0, | 4016 | buffer_info->page, 0, |
4003 | buffer_info->length, | 4017 | buffer_info->length, |
4004 | PCI_DMA_FROMDEVICE); | 4018 | DMA_FROM_DEVICE); |
4005 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) { | 4019 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { |
4006 | put_page(buffer_info->page); | 4020 | put_page(buffer_info->page); |
4007 | dev_kfree_skb(skb); | 4021 | dev_kfree_skb(skb); |
4008 | buffer_info->page = NULL; | 4022 | buffer_info->page = NULL; |
@@ -4098,11 +4112,11 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
4098 | buffer_info->skb = skb; | 4112 | buffer_info->skb = skb; |
4099 | buffer_info->length = adapter->rx_buffer_len; | 4113 | buffer_info->length = adapter->rx_buffer_len; |
4100 | map_skb: | 4114 | map_skb: |
4101 | buffer_info->dma = pci_map_single(pdev, | 4115 | buffer_info->dma = dma_map_single(&pdev->dev, |
4102 | skb->data, | 4116 | skb->data, |
4103 | buffer_info->length, | 4117 | buffer_info->length, |
4104 | PCI_DMA_FROMDEVICE); | 4118 | DMA_FROM_DEVICE); |
4105 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) { | 4119 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { |
4106 | dev_kfree_skb(skb); | 4120 | dev_kfree_skb(skb); |
4107 | buffer_info->skb = NULL; | 4121 | buffer_info->skb = NULL; |
4108 | buffer_info->dma = 0; | 4122 | buffer_info->dma = 0; |
@@ -4126,9 +4140,9 @@ map_skb: | |||
4126 | dev_kfree_skb(skb); | 4140 | dev_kfree_skb(skb); |
4127 | buffer_info->skb = NULL; | 4141 | buffer_info->skb = NULL; |
4128 | 4142 | ||
4129 | pci_unmap_single(pdev, buffer_info->dma, | 4143 | dma_unmap_single(&pdev->dev, buffer_info->dma, |
4130 | adapter->rx_buffer_len, | 4144 | adapter->rx_buffer_len, |
4131 | PCI_DMA_FROMDEVICE); | 4145 | DMA_FROM_DEVICE); |
4132 | buffer_info->dma = 0; | 4146 | buffer_info->dma = 0; |
4133 | 4147 | ||
4134 | adapter->alloc_rx_buff_failed++; | 4148 | adapter->alloc_rx_buff_failed++; |