skbuff: remove skb_dma_map/unmap
authorAlexander Duyck <alexander.h.duyck@intel.com>
Wed, 2 Dec 2009 16:49:02 +0000 (16:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Dec 2009 03:57:15 +0000 (19:57 -0800)
The two functions skb_dma_map/unmap are unsafe to use as they cause
problems when packets are cloned and sent to multiple devices while a HW
IOMMU is enabled.  Due to this it is best to remove the code so it is not
used by any other network driver maintainters.

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>
include/linux/skbuff.h
net/core/Makefile
net/core/skb_dma_map.c [deleted file]

index 89eed8c..ae836fd 100644 (file)
@@ -416,14 +416,6 @@ struct sk_buff {
 
 #include <asm/system.h>
 
-#ifdef CONFIG_HAS_DMA
-#include <linux/dma-mapping.h>
-extern int skb_dma_map(struct device *dev, struct sk_buff *skb,
-                      enum dma_data_direction dir);
-extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
-                         enum dma_data_direction dir);
-#endif
-
 static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
 {
        return (struct dst_entry *)skb->_skb_dst;
index 796f46e..08791ac 100644 (file)
@@ -6,7 +6,6 @@ obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \
         gen_stats.o gen_estimator.o net_namespace.o
 
 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
-obj-$(CONFIG_HAS_DMA) += skb_dma_map.o
 
 obj-y               += dev.o ethtool.o dev_mcast.o dst.o netevent.o \
                        neighbour.o rtnetlink.o utils.o link_watch.o filter.o
diff --git a/net/core/skb_dma_map.c b/net/core/skb_dma_map.c
deleted file mode 100644 (file)
index 79687df..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/* skb_dma_map.c: DMA mapping helpers for socket buffers.
- *
- * Copyright (C) David S. Miller <davem@davemloft.net>
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/dma-mapping.h>
-#include <linux/skbuff.h>
-
-int skb_dma_map(struct device *dev, struct sk_buff *skb,
-               enum dma_data_direction dir)
-{
-       struct skb_shared_info *sp = skb_shinfo(skb);
-       dma_addr_t map;
-       int i;
-
-       map = dma_map_single(dev, skb->data,
-                            skb_headlen(skb), dir);
-       if (dma_mapping_error(dev, map))
-               goto out_err;
-
-       sp->dma_head = map;
-       for (i = 0; i < sp->nr_frags; i++) {
-               skb_frag_t *fp = &sp->frags[i];
-
-               map = dma_map_page(dev, fp->page, fp->page_offset,
-                                  fp->size, dir);
-               if (dma_mapping_error(dev, map))
-                       goto unwind;
-               sp->dma_maps[i] = map;
-       }
-
-       return 0;
-
-unwind:
-       while (--i >= 0) {
-               skb_frag_t *fp = &sp->frags[i];
-
-               dma_unmap_page(dev, sp->dma_maps[i],
-                              fp->size, dir);
-       }
-       dma_unmap_single(dev, sp->dma_head,
-                        skb_headlen(skb), dir);
-out_err:
-       return -ENOMEM;
-}
-EXPORT_SYMBOL(skb_dma_map);
-
-void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
-                  enum dma_data_direction dir)
-{
-       struct skb_shared_info *sp = skb_shinfo(skb);
-       int i;
-
-       dma_unmap_single(dev, sp->dma_head,
-                        skb_headlen(skb), dir);
-       for (i = 0; i < sp->nr_frags; i++) {
-               skb_frag_t *fp = &sp->frags[i];
-
-               dma_unmap_page(dev, sp->dma_maps[i],
-                              fp->size, dir);
-       }
-}
-EXPORT_SYMBOL(skb_dma_unmap);