]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.git/commitdiff
Prefetch received posted buffer packets before copying
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Fri, 11 Sep 2009 15:31:34 +0000 (16:31 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Fri, 11 Sep 2009 15:31:34 +0000 (16:31 +0100)
fragments into skb head and delivering the packet to the stack.

Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
drivers/xen/netchannel2/recv_packet.c

index bcbbb3f5187490af5d75b7deb8ca0b6657749e94..712ec442a575a4f82c48fb591b4506cdd75d2eee 100644 (file)
@@ -414,6 +414,28 @@ static inline int nc2_receive_skb(struct netchannel2 *nc,
        return 0;
 }
 
+static inline void nc2_prefetch_posted (struct sk_buff *skb)
+{
+       void *va;
+       skb_frag_t *frag;
+        struct skb_cb_overlay *sco;
+
+       sco = get_skb_overlay(skb);
+       if (sco->is_posted && !sco->failed) {
+               if (sco->rx_buf)
+                       va = sco->rx_buf->buffer + 
+                               sco->rx_buf->offset;
+               else {
+                       frag = skb_shinfo(skb)->frags;
+                       va = page_address(frag->page) + frag->page_offset;
+               }
+               prefetch(va);
+               prefetch(va+64);
+               prefetch(skb->head);
+               prefetch(skb->head+64);
+       }
+}
+
 void receive_pending_skbs(struct netchannel2 *nc)
 {
         struct sk_buff *skb, *next;
@@ -422,6 +444,7 @@ void receive_pending_skbs(struct netchannel2 *nc)
        skb = next = NULL;
         while (!skb_queue_empty(&nc->pending_rx_queue)) {
                 next = __skb_dequeue(&nc->pending_rx_queue);
+               nc2_prefetch_posted(next);
                if (skb) 
                        lro_used |= nc2_receive_skb(nc, skb);
                skb = next;