aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skge.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2010-04-27 10:57:04 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-16 02:29:31 -0400
commit10fc51b9953112ade61e33ff2f6f005f005a2361 (patch)
tree47d268ef493f5d7dab138c775c05d37f3c25bf65 /drivers/net/skge.c
parente3826f1e946e7d2354943232f1457be1455a29e2 (diff)
skge: use the DMA state API instead of the pci equivalents
This replace the PCI DMA state API (include/linux/pci-dma.h) with the DMA equivalents since the PCI DMA state API will be obsolete. No functional change. For further information about the background: http://marc.info/?l=linux-netdev&m=127037540020276&w=2 Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r--drivers/net/skge.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 96eee8666877..40e5c46e7571 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -984,8 +984,8 @@ static void skge_rx_setup(struct skge_port *skge, struct skge_element *e,
984 wmb(); 984 wmb();
985 985
986 rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; 986 rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize;
987 pci_unmap_addr_set(e, mapaddr, map); 987 dma_unmap_addr_set(e, mapaddr, map);
988 pci_unmap_len_set(e, maplen, bufsize); 988 dma_unmap_len_set(e, maplen, bufsize);
989} 989}
990 990
991/* Resume receiving using existing skb, 991/* Resume receiving using existing skb,
@@ -1018,8 +1018,8 @@ static void skge_rx_clean(struct skge_port *skge)
1018 rd->control = 0; 1018 rd->control = 0;
1019 if (e->skb) { 1019 if (e->skb) {
1020 pci_unmap_single(hw->pdev, 1020 pci_unmap_single(hw->pdev,
1021 pci_unmap_addr(e, mapaddr), 1021 dma_unmap_addr(e, mapaddr),
1022 pci_unmap_len(e, maplen), 1022 dma_unmap_len(e, maplen),
1023 PCI_DMA_FROMDEVICE); 1023 PCI_DMA_FROMDEVICE);
1024 dev_kfree_skb(e->skb); 1024 dev_kfree_skb(e->skb);
1025 e->skb = NULL; 1025 e->skb = NULL;
@@ -2756,8 +2756,8 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb,
2756 e->skb = skb; 2756 e->skb = skb;
2757 len = skb_headlen(skb); 2757 len = skb_headlen(skb);
2758 map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); 2758 map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
2759 pci_unmap_addr_set(e, mapaddr, map); 2759 dma_unmap_addr_set(e, mapaddr, map);
2760 pci_unmap_len_set(e, maplen, len); 2760 dma_unmap_len_set(e, maplen, len);
2761 2761
2762 td->dma_lo = map; 2762 td->dma_lo = map;
2763 td->dma_hi = map >> 32; 2763 td->dma_hi = map >> 32;
@@ -2799,8 +2799,8 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb,
2799 2799
2800 tf->dma_lo = map; 2800 tf->dma_lo = map;
2801 tf->dma_hi = (u64) map >> 32; 2801 tf->dma_hi = (u64) map >> 32;
2802 pci_unmap_addr_set(e, mapaddr, map); 2802 dma_unmap_addr_set(e, mapaddr, map);
2803 pci_unmap_len_set(e, maplen, frag->size); 2803 dma_unmap_len_set(e, maplen, frag->size);
2804 2804
2805 tf->control = BMU_OWN | BMU_SW | control | frag->size; 2805 tf->control = BMU_OWN | BMU_SW | control | frag->size;
2806 } 2806 }
@@ -2837,12 +2837,12 @@ static void skge_tx_free(struct skge_port *skge, struct skge_element *e,
2837 2837
2838 /* skb header vs. fragment */ 2838 /* skb header vs. fragment */
2839 if (control & BMU_STF) 2839 if (control & BMU_STF)
2840 pci_unmap_single(pdev, pci_unmap_addr(e, mapaddr), 2840 pci_unmap_single(pdev, dma_unmap_addr(e, mapaddr),
2841 pci_unmap_len(e, maplen), 2841 dma_unmap_len(e, maplen),
2842 PCI_DMA_TODEVICE); 2842 PCI_DMA_TODEVICE);
2843 else 2843 else
2844 pci_unmap_page(pdev, pci_unmap_addr(e, mapaddr), 2844 pci_unmap_page(pdev, dma_unmap_addr(e, mapaddr),
2845 pci_unmap_len(e, maplen), 2845 dma_unmap_len(e, maplen),
2846 PCI_DMA_TODEVICE); 2846 PCI_DMA_TODEVICE);
2847 2847
2848 if (control & BMU_EOF) { 2848 if (control & BMU_EOF) {
@@ -3060,11 +3060,11 @@ static struct sk_buff *skge_rx_get(struct net_device *dev,
3060 goto resubmit; 3060 goto resubmit;
3061 3061
3062 pci_dma_sync_single_for_cpu(skge->hw->pdev, 3062 pci_dma_sync_single_for_cpu(skge->hw->pdev,
3063 pci_unmap_addr(e, mapaddr), 3063 dma_unmap_addr(e, mapaddr),
3064 len, PCI_DMA_FROMDEVICE); 3064 len, PCI_DMA_FROMDEVICE);
3065 skb_copy_from_linear_data(e->skb, skb->data, len); 3065 skb_copy_from_linear_data(e->skb, skb->data, len);
3066 pci_dma_sync_single_for_device(skge->hw->pdev, 3066 pci_dma_sync_single_for_device(skge->hw->pdev,
3067 pci_unmap_addr(e, mapaddr), 3067 dma_unmap_addr(e, mapaddr),
3068 len, PCI_DMA_FROMDEVICE); 3068 len, PCI_DMA_FROMDEVICE);
3069 skge_rx_reuse(e, skge->rx_buf_size); 3069 skge_rx_reuse(e, skge->rx_buf_size);
3070 } else { 3070 } else {
@@ -3075,8 +3075,8 @@ static struct sk_buff *skge_rx_get(struct net_device *dev,
3075 goto resubmit; 3075 goto resubmit;
3076 3076
3077 pci_unmap_single(skge->hw->pdev, 3077 pci_unmap_single(skge->hw->pdev,
3078 pci_unmap_addr(e, mapaddr), 3078 dma_unmap_addr(e, mapaddr),
3079 pci_unmap_len(e, maplen), 3079 dma_unmap_len(e, maplen),
3080 PCI_DMA_FROMDEVICE); 3080 PCI_DMA_FROMDEVICE);
3081 skb = e->skb; 3081 skb = e->skb;
3082 prefetch(skb->data); 3082 prefetch(skb->data);
ass="hl com"> * permits coherency to be managed when a new inode binds to an already extant * cache object. */ struct nfs_fscache_inode_auxdata { struct timespec mtime; struct timespec ctime; loff_t size; u64 change_attr; }; /* * Generate a key to describe an NFS inode in an NFS server's index */ static uint16_t nfs_fscache_inode_get_key(const void *cookie_netfs_data, void *buffer, uint16_t bufmax) { const struct nfs_inode *nfsi = cookie_netfs_data; uint16_t nsize; /* use the inode's NFS filehandle as the key */ nsize = nfsi->fh.size; memcpy(buffer, nfsi->fh.data, nsize); return nsize; } /* * Get certain file attributes from the netfs data * - This function can be absent for an index * - Not permitted to return an error * - The netfs data from the cookie being used as the source is presented */ static void nfs_fscache_inode_get_attr(const void *cookie_netfs_data, uint64_t *size) { const struct nfs_inode *nfsi = cookie_netfs_data; *size = nfsi->vfs_inode.i_size; } /* * Get the auxiliary data from netfs data * - This function can be absent if the index carries no state data * - Should store the auxiliary data in the buffer * - Should return the amount of amount stored * - Not permitted to return an error * - The netfs data from the cookie being used as the source is presented */ static uint16_t nfs_fscache_inode_get_aux(const void *cookie_netfs_data, void *buffer, uint16_t bufmax) { struct nfs_fscache_inode_auxdata auxdata; const struct nfs_inode *nfsi = cookie_netfs_data; memset(&auxdata, 0, sizeof(auxdata)); auxdata.size = nfsi->vfs_inode.i_size; auxdata.mtime = nfsi->vfs_inode.i_mtime; auxdata.ctime = nfsi->vfs_inode.i_ctime; if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) auxdata.change_attr = nfsi->vfs_inode.i_version; if (bufmax > sizeof(auxdata)) bufmax = sizeof(auxdata); memcpy(buffer, &auxdata, bufmax); return bufmax; } /* * Consult the netfs about the state of an object * - This function can be absent if the index carries no state data * - The netfs data from the cookie being used as the target is * presented, as is the auxiliary data */ static enum fscache_checkaux nfs_fscache_inode_check_aux(void *cookie_netfs_data, const void *data, uint16_t datalen) { struct nfs_fscache_inode_auxdata auxdata; struct nfs_inode *nfsi = cookie_netfs_data; if (datalen != sizeof(auxdata)) return FSCACHE_CHECKAUX_OBSOLETE; memset(&auxdata, 0, sizeof(auxdata)); auxdata.size = nfsi->vfs_inode.i_size; auxdata.mtime = nfsi->vfs_inode.i_mtime; auxdata.ctime = nfsi->vfs_inode.i_ctime; if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) auxdata.change_attr = nfsi->vfs_inode.i_version; if (memcmp(data, &auxdata, datalen) != 0) return FSCACHE_CHECKAUX_OBSOLETE; return FSCACHE_CHECKAUX_OKAY; } /* * Indication from FS-Cache that the cookie is no longer cached * - This function is called when the backing store currently caching a cookie * is removed * - The netfs should use this to clean up any markers indicating cached pages * - This is mandatory for any object that may have data */ static void nfs_fscache_inode_now_uncached(void *cookie_netfs_data) { struct nfs_inode *nfsi = cookie_netfs_data; struct pagevec pvec; pgoff_t first; int loop, nr_pages; pagevec_init(&pvec, 0); first = 0; dprintk("NFS: nfs_inode_now_uncached: nfs_inode 0x%p\n", nfsi); for (;;) { /* grab a bunch of pages to unmark */ nr_pages = pagevec_lookup(&pvec, nfsi->vfs_inode.i_mapping, first, PAGEVEC_SIZE - pagevec_count(&pvec)); if (!nr_pages) break; for (loop = 0; loop < nr_pages; loop++) ClearPageFsCache(pvec.pages[loop]); first = pvec.pages[nr_pages - 1]->index + 1; pvec.nr = nr_pages; pagevec_release(&pvec); cond_resched(); } } /* * Get an extra reference on a read context. * - This function can be absent if the completion function doesn't require a * context. * - The read context is passed back to NFS in the event that a data read on the * cache fails with EIO - in which case the server must be contacted to * retrieve the data, which requires the read context for security. */ static void nfs_fh_get_context(void *cookie_netfs_data, void *context) { get_nfs_open_context(context); } /* * Release an extra reference on a read context. * - This function can be absent if the completion function doesn't require a * context. */ static void nfs_fh_put_context(void *cookie_netfs_data, void *context) { if (context) put_nfs_open_context(context); } /* * Define the inode object for FS-Cache. This is used to describe an inode * object to fscache_acquire_cookie(). It is keyed by the NFS file handle for * an inode. * * Coherency is managed by comparing the copies of i_size, i_mtime and i_ctime * held in the cache auxiliary data for the data storage object with those in * the inode struct in memory. */ const struct fscache_cookie_def nfs_fscache_inode_object_def = { .name = "NFS.fh", .type = FSCACHE_COOKIE_TYPE_DATAFILE, .get_key = nfs_fscache_inode_get_key, .get_attr = nfs_fscache_inode_get_attr, .get_aux = nfs_fscache_inode_get_aux, .check_aux = nfs_fscache_inode_check_aux, .now_uncached = nfs_fscache_inode_now_uncached, .get_context = nfs_fh_get_context, .put_context = nfs_fh_put_context, };