mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 22:54:05 +08:00
e1000: Fix DMA mapping error handling on RX
Check for error return from pci_map_single/pci_map_page and clean up. With this and the previous patch the driver was able to handle a significant percentage of errors (I set the fault injection rate to 10% and could still download large files at a reasonable speed). Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
242cc0547f
commit
b5abb028e2
@ -4006,11 +4006,21 @@ check_page:
|
||||
}
|
||||
}
|
||||
|
||||
if (!buffer_info->dma)
|
||||
if (!buffer_info->dma) {
|
||||
buffer_info->dma = pci_map_page(pdev,
|
||||
buffer_info->page, 0,
|
||||
buffer_info->length,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
|
||||
put_page(buffer_info->page);
|
||||
dev_kfree_skb(skb);
|
||||
buffer_info->page = NULL;
|
||||
buffer_info->skb = NULL;
|
||||
buffer_info->dma = 0;
|
||||
adapter->alloc_rx_buff_failed++;
|
||||
break; /* while !buffer_info->skb */
|
||||
}
|
||||
}
|
||||
|
||||
rx_desc = E1000_RX_DESC(*rx_ring, i);
|
||||
rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
|
||||
@ -4101,6 +4111,13 @@ map_skb:
|
||||
skb->data,
|
||||
buffer_info->length,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
|
||||
dev_kfree_skb(skb);
|
||||
buffer_info->skb = NULL;
|
||||
buffer_info->dma = 0;
|
||||
adapter->alloc_rx_buff_failed++;
|
||||
break; /* while !buffer_info->skb */
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX if it was allocated cleanly it will never map to a
|
||||
|
Loading…
Reference in New Issue
Block a user