Commit 59d71989 authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller

igb: convert igb from using PCI DMA functions to using DMA API functions

This patch makes it so that igb now uses the DMA API functions instead of
the PCI API functions.  To do this the pci_dev pointer that was in the
rings has been replaced with a device pointer, and as a result all
references to [tr]x_ring->pdev have been replaced with [tr]x_ring->dev.

This patch is based of of work originally done by Nicholas Nunley.
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0be3f55f
...@@ -186,7 +186,7 @@ struct igb_q_vector { ...@@ -186,7 +186,7 @@ struct igb_q_vector {
struct igb_ring { struct igb_ring {
struct igb_q_vector *q_vector; /* backlink to q_vector */ struct igb_q_vector *q_vector; /* backlink to q_vector */
struct net_device *netdev; /* back pointer to net_device */ struct net_device *netdev; /* back pointer to net_device */
struct pci_dev *pdev; /* pci device for dma mapping */ struct device *dev; /* device pointer for dma mapping */
dma_addr_t dma; /* phys address of the ring */ dma_addr_t dma; /* phys address of the ring */
void *desc; /* descriptor ring memory */ void *desc; /* descriptor ring memory */
unsigned int size; /* length of desc. ring in bytes */ unsigned int size; /* length of desc. ring in bytes */
......
...@@ -1394,7 +1394,7 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter) ...@@ -1394,7 +1394,7 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
/* Setup Tx descriptor ring and Tx buffers */ /* Setup Tx descriptor ring and Tx buffers */
tx_ring->count = IGB_DEFAULT_TXD; tx_ring->count = IGB_DEFAULT_TXD;
tx_ring->pdev = adapter->pdev; tx_ring->dev = &adapter->pdev->dev;
tx_ring->netdev = adapter->netdev; tx_ring->netdev = adapter->netdev;
tx_ring->reg_idx = adapter->vfs_allocated_count; tx_ring->reg_idx = adapter->vfs_allocated_count;
...@@ -1408,7 +1408,7 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter) ...@@ -1408,7 +1408,7 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
/* Setup Rx descriptor ring and Rx buffers */ /* Setup Rx descriptor ring and Rx buffers */
rx_ring->count = IGB_DEFAULT_RXD; rx_ring->count = IGB_DEFAULT_RXD;
rx_ring->pdev = adapter->pdev; rx_ring->dev = &adapter->pdev->dev;
rx_ring->netdev = adapter->netdev; rx_ring->netdev = adapter->netdev;
rx_ring->rx_buffer_len = IGB_RXBUFFER_2048; rx_ring->rx_buffer_len = IGB_RXBUFFER_2048;
rx_ring->reg_idx = adapter->vfs_allocated_count; rx_ring->reg_idx = adapter->vfs_allocated_count;
...@@ -1604,10 +1604,10 @@ static int igb_clean_test_rings(struct igb_ring *rx_ring, ...@@ -1604,10 +1604,10 @@ static int igb_clean_test_rings(struct igb_ring *rx_ring,
buffer_info = &rx_ring->buffer_info[rx_ntc]; buffer_info = &rx_ring->buffer_info[rx_ntc];
/* unmap rx buffer, will be remapped by alloc_rx_buffers */ /* unmap rx buffer, will be remapped by alloc_rx_buffers */
pci_unmap_single(rx_ring->pdev, dma_unmap_single(rx_ring->dev,
buffer_info->dma, buffer_info->dma,
rx_ring->rx_buffer_len, rx_ring->rx_buffer_len,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
buffer_info->dma = 0; buffer_info->dma = 0;
/* verify contents of skb */ /* verify contents of skb */
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment