]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.git/commitdiff
Use a minimally-sized inline prefix for RSCB packets. There's no point master
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Wed, 24 Jun 2009 15:24:47 +0000 (16:24 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 30 Jun 2009 12:02:15 +0000 (13:02 +0100)
in pushing more than this through the ring if the receiver's going to
have to do a copy anyway, and this reduces ring pressure fairly
significantly.

drivers/xen/netchannel2/rscb.c

index 2130d3a233ed290022413b2081b6441e5a9805b1..d736ebab8a97c95d39cd10f2ddac8044b33b51ba 100644 (file)
@@ -273,9 +273,23 @@ int prepare_xmit_allocate_grant(struct netchannel2_ring_pair *ncrp,
         if (allocate_txp_slot(ncrp, skb) < 0)
                 return -1;
 
-        inline_prefix_size = PACKET_PREFIX_SIZE;
-        if (skb_headlen(skb) < inline_prefix_size)
-                inline_prefix_size = skb_headlen(skb);
+        if (use_subpage_grants) {
+                /* We're going to have to get the remote to issue a
+                   grant copy hypercall anyway, so there's no real
+                   benefit to shoving the headers inline. */
+                /* (very small packets won't go through here, so
+                   there's no chance that we could completely
+                   eliminate the grant copy.) */
+                inline_prefix_size = sizeof(struct ethhdr);
+        } else {
+                /* If we're going off-box (and we probably are, if the
+                   remote is trusted), putting the header in the ring
+                   potentially saves a TLB miss in the bridge, which
+                   is worth doing. */
+                inline_prefix_size = PACKET_PREFIX_SIZE;
+                if (skb_headlen(skb) < inline_prefix_size)
+                        inline_prefix_size = skb_headlen(skb);
+        }
 
         if (skb_co->nr_fragments == 0) {
                 inline_bytes_left = inline_prefix_size;