net: Add a flow_cache_flush_deferred function
[linux-2.6.git] / net / core / user_dma.c
index de76050..25d717e 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <linux/dmaengine.h>
 #include <linux/socket.h>
-#include <linux/rtnetlink.h> /* for BUG_TRAP */
 #include <net/tcp.h>
 #include <net/netdma.h>
 
@@ -52,6 +51,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
 {
        int start = skb_headlen(skb);
        int i, copy = start - offset;
+       struct sk_buff *frag_iter;
        dma_cookie_t cookie = 0;
 
        /* Copy header. */
@@ -72,11 +72,11 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
                int end;
 
-               BUG_TRAP(start <= offset + len);
+               WARN_ON(start > offset + len);
 
                end = start + skb_shinfo(skb)->frags[i].size;
                copy = end - offset;
-               if ((copy = end - offset) > 0) {
+               if (copy > 0) {
                        skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
                        struct page *page = frag->page;
 
@@ -95,31 +95,28 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
                start = end;
        }
 
-       if (skb_shinfo(skb)->frag_list) {
-               struct sk_buff *list = skb_shinfo(skb)->frag_list;
-
-               for (; list; list = list->next) {
-                       int end;
-
-                       BUG_TRAP(start <= offset + len);
-
-                       end = start + list->len;
-                       copy = end - offset;
-                       if (copy > 0) {
-                               if (copy > len)
-                                       copy = len;
-                               cookie = dma_skb_copy_datagram_iovec(chan, list,
-                                               offset - start, to, copy,
-                                               pinned_list);
-                               if (cookie < 0)
-                                       goto fault;
-                               len -= copy;
-                               if (len == 0)
-                                       goto end;
-                               offset += copy;
-                       }
-                       start = end;
+       skb_walk_frags(skb, frag_iter) {
+               int end;
+
+               WARN_ON(start > offset + len);
+
+               end = start + frag_iter->len;
+               copy = end - offset;
+               if (copy > 0) {
+                       if (copy > len)
+                               copy = len;
+                       cookie = dma_skb_copy_datagram_iovec(chan, frag_iter,
+                                                            offset - start,
+                                                            to, copy,
+                                                            pinned_list);
+                       if (cookie < 0)
+                               goto fault;
+                       len -= copy;
+                       if (len == 0)
+                               goto end;
+                       offset += copy;
                }
+               start = end;
        }
 
 end: