diff options
-rw-r--r-- | drivers/staging/et131x/README | 1 | ||||
-rw-r--r-- | drivers/staging/et131x/et131x.c | 39 |
2 files changed, 22 insertions, 18 deletions
diff --git a/drivers/staging/et131x/README b/drivers/staging/et131x/README index 1e0fcf468eb0..87b936012656 100644 --- a/drivers/staging/et131x/README +++ b/drivers/staging/et131x/README | |||
@@ -9,7 +9,6 @@ driver as they did not build properly at the time. | |||
9 | 9 | ||
10 | TODO: | 10 | TODO: |
11 | - Use of kmem_cache seems a bit unusual | 11 | - Use of kmem_cache seems a bit unusual |
12 | - Use dma_alloc_... in place of pci_alloc_... | ||
13 | - It's too late stopping the tx queue when there is no room for the current packet. The condition should be detected for the next packet. | 12 | - It's too late stopping the tx queue when there is no room for the current packet. The condition should be detected for the next packet. |
14 | - PCI_VDEVICE ? | 13 | - PCI_VDEVICE ? |
15 | 14 | ||
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 0fbb77d35c9c..06ba4a95955f 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c | |||
@@ -1965,9 +1965,10 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
1965 | 1965 | ||
1966 | /* Allocate an area of memory for Free Buffer Ring 1 */ | 1966 | /* Allocate an area of memory for Free Buffer Ring 1 */ |
1967 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; | 1967 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; |
1968 | rx_ring->fbr[0]->ring_virtaddr = pci_alloc_consistent(adapter->pdev, | 1968 | rx_ring->fbr[0]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, |
1969 | bufsize, | 1969 | bufsize, |
1970 | &rx_ring->fbr[0]->ring_physaddr); | 1970 | &rx_ring->fbr[0]->ring_physaddr, |
1971 | GFP_KERNEL); | ||
1971 | if (!rx_ring->fbr[0]->ring_virtaddr) { | 1972 | if (!rx_ring->fbr[0]->ring_virtaddr) { |
1972 | dev_err(&adapter->pdev->dev, | 1973 | dev_err(&adapter->pdev->dev, |
1973 | "Cannot alloc memory for Free Buffer Ring 1\n"); | 1974 | "Cannot alloc memory for Free Buffer Ring 1\n"); |
@@ -1995,9 +1996,10 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
1995 | #ifdef USE_FBR0 | 1996 | #ifdef USE_FBR0 |
1996 | /* Allocate an area of memory for Free Buffer Ring 0 */ | 1997 | /* Allocate an area of memory for Free Buffer Ring 0 */ |
1997 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; | 1998 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; |
1998 | rx_ring->fbr[1]->ring_virtaddr = pci_alloc_consistent(adapter->pdev, | 1999 | rx_ring->fbr[1]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, |
1999 | bufsize, | 2000 | bufsize, |
2000 | &rx_ring->fbr[1]->ring_physaddr); | 2001 | &rx_ring->fbr[1]->ring_physaddr, |
2002 | GFP_KERNEL); | ||
2001 | if (!rx_ring->fbr[1]->ring_virtaddr) { | 2003 | if (!rx_ring->fbr[1]->ring_virtaddr) { |
2002 | dev_err(&adapter->pdev->dev, | 2004 | dev_err(&adapter->pdev->dev, |
2003 | "Cannot alloc memory for Free Buffer Ring 0\n"); | 2005 | "Cannot alloc memory for Free Buffer Ring 0\n"); |
@@ -2042,8 +2044,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2042 | fbr_chunksize = | 2044 | fbr_chunksize = |
2043 | (FBR_CHUNKS * rx_ring->fbr[0]->buffsize) + fbr1_align - 1; | 2045 | (FBR_CHUNKS * rx_ring->fbr[0]->buffsize) + fbr1_align - 1; |
2044 | rx_ring->fbr[0]->mem_virtaddrs[i] = | 2046 | rx_ring->fbr[0]->mem_virtaddrs[i] = |
2045 | pci_alloc_consistent(adapter->pdev, fbr_chunksize, | 2047 | dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, |
2046 | &rx_ring->fbr[0]->mem_physaddrs[i]); | 2048 | &rx_ring->fbr[0]->mem_physaddrs[i], GFP_KERNEL); |
2047 | 2049 | ||
2048 | if (!rx_ring->fbr[0]->mem_virtaddrs[i]) { | 2050 | if (!rx_ring->fbr[0]->mem_virtaddrs[i]) { |
2049 | dev_err(&adapter->pdev->dev, | 2051 | dev_err(&adapter->pdev->dev, |
@@ -2094,8 +2096,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2094 | fbr_chunksize = | 2096 | fbr_chunksize = |
2095 | ((FBR_CHUNKS + 1) * rx_ring->fbr[1]->buffsize) - 1; | 2097 | ((FBR_CHUNKS + 1) * rx_ring->fbr[1]->buffsize) - 1; |
2096 | rx_ring->fbr[1]->mem_virtaddrs[i] = | 2098 | rx_ring->fbr[1]->mem_virtaddrs[i] = |
2097 | pci_alloc_consistent(adapter->pdev, fbr_chunksize, | 2099 | dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, |
2098 | &rx_ring->fbr[1]->mem_physaddrs[i]); | 2100 | &rx_ring->fbr[1]->mem_physaddrs[i], GFP_KERNEL); |
2099 | 2101 | ||
2100 | if (!rx_ring->fbr[1]->mem_virtaddrs[i]) { | 2102 | if (!rx_ring->fbr[1]->mem_virtaddrs[i]) { |
2101 | dev_err(&adapter->pdev->dev, | 2103 | dev_err(&adapter->pdev->dev, |
@@ -2137,9 +2139,10 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2137 | pktstat_ringsize = | 2139 | pktstat_ringsize = |
2138 | sizeof(struct pkt_stat_desc) * adapter->rx_ring.psr_num_entries; | 2140 | sizeof(struct pkt_stat_desc) * adapter->rx_ring.psr_num_entries; |
2139 | 2141 | ||
2140 | rx_ring->ps_ring_virtaddr = pci_alloc_consistent(adapter->pdev, | 2142 | rx_ring->ps_ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, |
2141 | pktstat_ringsize, | 2143 | pktstat_ringsize, |
2142 | &rx_ring->ps_ring_physaddr); | 2144 | &rx_ring->ps_ring_physaddr, |
2145 | GFP_KERNEL); | ||
2143 | 2146 | ||
2144 | if (!rx_ring->ps_ring_virtaddr) { | 2147 | if (!rx_ring->ps_ring_virtaddr) { |
2145 | dev_err(&adapter->pdev->dev, | 2148 | dev_err(&adapter->pdev->dev, |
@@ -2157,9 +2160,10 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2157 | */ | 2160 | */ |
2158 | 2161 | ||
2159 | /* Allocate an area of memory for writeback of status information */ | 2162 | /* Allocate an area of memory for writeback of status information */ |
2160 | rx_ring->rx_status_block = pci_alloc_consistent(adapter->pdev, | 2163 | rx_ring->rx_status_block = dma_alloc_coherent(&adapter->pdev->dev, |
2161 | sizeof(struct rx_status_block), | 2164 | sizeof(struct rx_status_block), |
2162 | &rx_ring->rx_status_bus); | 2165 | &rx_ring->rx_status_bus, |
2166 | GFP_KERNEL); | ||
2163 | if (!rx_ring->rx_status_block) { | 2167 | if (!rx_ring->rx_status_block) { |
2164 | dev_err(&adapter->pdev->dev, | 2168 | dev_err(&adapter->pdev->dev, |
2165 | "Cannot alloc memory for Status Block\n"); | 2169 | "Cannot alloc memory for Status Block\n"); |
@@ -2992,8 +2996,8 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2992 | */ | 2996 | */ |
2993 | desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1; | 2997 | desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1; |
2994 | tx_ring->tx_desc_ring = | 2998 | tx_ring->tx_desc_ring = |
2995 | (struct tx_desc *) pci_alloc_consistent(adapter->pdev, desc_size, | 2999 | (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev, desc_size, |
2996 | &tx_ring->tx_desc_ring_pa); | 3000 | &tx_ring->tx_desc_ring_pa, GFP_KERNEL); |
2997 | if (!adapter->tx_ring.tx_desc_ring) { | 3001 | if (!adapter->tx_ring.tx_desc_ring) { |
2998 | dev_err(&adapter->pdev->dev, | 3002 | dev_err(&adapter->pdev->dev, |
2999 | "Cannot alloc memory for Tx Ring\n"); | 3003 | "Cannot alloc memory for Tx Ring\n"); |
@@ -3008,9 +3012,10 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
3008 | * storing the adjusted address. | 3012 | * storing the adjusted address. |
3009 | */ | 3013 | */ |
3010 | /* Allocate memory for the Tx status block */ | 3014 | /* Allocate memory for the Tx status block */ |
3011 | tx_ring->tx_status = pci_alloc_consistent(adapter->pdev, | 3015 | tx_ring->tx_status = dma_alloc_coherent(&adapter->pdev->dev, |
3012 | sizeof(u32), | 3016 | sizeof(u32), |
3013 | &tx_ring->tx_status_pa); | 3017 | &tx_ring->tx_status_pa, |
3018 | GFP_KERNEL); | ||
3014 | if (!adapter->tx_ring.tx_status_pa) { | 3019 | if (!adapter->tx_ring.tx_status_pa) { |
3015 | dev_err(&adapter->pdev->dev, | 3020 | dev_err(&adapter->pdev->dev, |
3016 | "Cannot alloc memory for Tx status block\n"); | 3021 | "Cannot alloc memory for Tx status block\n"); |