aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-12-02 11:45:31 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-02 22:57:10 -0500
commit03b1320dfceeb093890cdd7433e910dca6225ddb (patch)
tree1cdb866369e0f3f05c7933df72f63dfed552f5ba /drivers/net/e1000e
parent614c12a1581687501f1b0fc721feff69b47abd92 (diff)
e1000e: remove use of skb_dma_map from e1000e driver
In testing we have found that skb_dma_map/unmap is incompatible with HW IOMMU due to the fact that multiple mappings will return different results. In order to correct this we need to remove skb_dma_map/unmap calls from the e1000e driver. Signed-off-by: Alexander Duyck <alexander.h.duyck@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/e1000e')
-rw-r--r--drivers/net/e1000e/e1000.h9
-rw-r--r--drivers/net/e1000e/netdev.c59
2 files changed, 47 insertions, 21 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index c4e861fb3862..b9f9e7836fad 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -194,12 +194,15 @@ struct e1000_buffer {
194 unsigned long time_stamp; 194 unsigned long time_stamp;
195 u16 length; 195 u16 length;
196 u16 next_to_watch; 196 u16 next_to_watch;
197 u16 mapped_as_page;
197 }; 198 };
198 /* Rx */ 199 /* Rx */
199 /* arrays of page information for packet split */ 200 struct {
200 struct e1000_ps_page *ps_pages; 201 /* arrays of page information for packet split */
202 struct e1000_ps_page *ps_pages;
203 struct page *page;
204 };
201 }; 205 };
202 struct page *page;
203}; 206};
204 207
205struct e1000_ring { 208struct e1000_ring {
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index d57880ed9452..941c5f9d0dd9 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -534,10 +534,17 @@ next_desc:
534static void e1000_put_txbuf(struct e1000_adapter *adapter, 534static void e1000_put_txbuf(struct e1000_adapter *adapter,
535 struct e1000_buffer *buffer_info) 535 struct e1000_buffer *buffer_info)
536{ 536{
537 buffer_info->dma = 0; 537 if (buffer_info->dma) {
538 if (buffer_info->mapped_as_page)
539 pci_unmap_page(adapter->pdev, buffer_info->dma,
540 buffer_info->length, PCI_DMA_TODEVICE);
541 else
542 pci_unmap_single(adapter->pdev, buffer_info->dma,
543 buffer_info->length,
544 PCI_DMA_TODEVICE);
545 buffer_info->dma = 0;
546 }
538 if (buffer_info->skb) { 547 if (buffer_info->skb) {
539 skb_dma_unmap(&adapter->pdev->dev, buffer_info->skb,
540 DMA_TO_DEVICE);
541 dev_kfree_skb_any(buffer_info->skb); 548 dev_kfree_skb_any(buffer_info->skb);
542 buffer_info->skb = NULL; 549 buffer_info->skb = NULL;
543 } 550 }
@@ -3884,23 +3891,14 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
3884 unsigned int mss) 3891 unsigned int mss)
3885{ 3892{
3886 struct e1000_ring *tx_ring = adapter->tx_ring; 3893 struct e1000_ring *tx_ring = adapter->tx_ring;
3894 struct pci_dev *pdev = adapter->pdev;
3887 struct e1000_buffer *buffer_info; 3895 struct e1000_buffer *buffer_info;
3888 unsigned int len = skb_headlen(skb); 3896 unsigned int len = skb_headlen(skb);
3889 unsigned int offset, size, count = 0, i; 3897 unsigned int offset = 0, size, count = 0, i;
3890 unsigned int f; 3898 unsigned int f;
3891 dma_addr_t *map;
3892 3899
3893 i = tx_ring->next_to_use; 3900 i = tx_ring->next_to_use;
3894 3901
3895 if (skb_dma_map(&adapter->pdev->dev, skb, DMA_TO_DEVICE)) {
3896 dev_err(&adapter->pdev->dev, "TX DMA map failed\n");
3897 adapter->tx_dma_failed++;
3898 return 0;
3899 }
3900
3901 map = skb_shinfo(skb)->dma_maps;
3902 offset = 0;
3903
3904 while (len) { 3902 while (len) {
3905 buffer_info = &tx_ring->buffer_info[i]; 3903 buffer_info = &tx_ring->buffer_info[i];
3906 size = min(len, max_per_txd); 3904 size = min(len, max_per_txd);
@@ -3908,11 +3906,15 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
3908 buffer_info->length = size; 3906 buffer_info->length = size;
3909 buffer_info->time_stamp = jiffies; 3907 buffer_info->time_stamp = jiffies;
3910 buffer_info->next_to_watch = i; 3908 buffer_info->next_to_watch = i;
3911 buffer_info->dma = skb_shinfo(skb)->dma_head + offset; 3909 buffer_info->dma = pci_map_single(pdev, skb->data + offset,
3912 count++; 3910 size, PCI_DMA_TODEVICE);
3911 buffer_info->mapped_as_page = false;
3912 if (pci_dma_mapping_error(pdev, buffer_info->dma))
3913 goto dma_error;
3913 3914
3914 len -= size; 3915 len -= size;
3915 offset += size; 3916 offset += size;
3917 count++;
3916 3918
3917 if (len) { 3919 if (len) {
3918 i++; 3920 i++;
@@ -3926,7 +3928,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
3926 3928
3927 frag = &skb_shinfo(skb)->frags[f]; 3929 frag = &skb_shinfo(skb)->frags[f];
3928 len = frag->size; 3930 len = frag->size;
3929 offset = 0; 3931 offset = frag->page_offset;
3930 3932
3931 while (len) { 3933 while (len) {
3932 i++; 3934 i++;
@@ -3939,7 +3941,12 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
3939 buffer_info->length = size; 3941 buffer_info->length = size;
3940 buffer_info->time_stamp = jiffies; 3942 buffer_info->time_stamp = jiffies;
3941 buffer_info->next_to_watch = i; 3943 buffer_info->next_to_watch = i;
3942 buffer_info->dma = map[f] + offset; 3944 buffer_info->dma = pci_map_page(pdev, frag->page,
3945 offset, size,
3946 PCI_DMA_TODEVICE);
3947 buffer_info->mapped_as_page = true;
3948 if (pci_dma_mapping_error(pdev, buffer_info->dma))
3949 goto dma_error;
3943 3950
3944 len -= size; 3951 len -= size;
3945 offset += size; 3952 offset += size;
@@ -3951,6 +3958,22 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
3951 tx_ring->buffer_info[first].next_to_watch = i; 3958 tx_ring->buffer_info[first].next_to_watch = i;
3952 3959
3953 return count; 3960 return count;
3961
3962dma_error:
3963 dev_err(&pdev->dev, "TX DMA map failed\n");
3964 buffer_info->dma = 0;
3965 count--;
3966
3967 while (count >= 0) {
3968 count--;
3969 i--;
3970 if (i < 0)
3971 i += tx_ring->count;
3972 buffer_info = &tx_ring->buffer_info[i];
3973 e1000_put_txbuf(adapter, buffer_info);;
3974 }
3975
3976 return 0;
3954} 3977}
3955 3978
3956static void e1000_tx_queue(struct e1000_adapter *adapter, 3979static void e1000_tx_queue(struct e1000_adapter *adapter,