From: Steven Smith Date: Wed, 24 Jun 2009 15:24:47 +0000 (+0100) Subject: Use a minimally-sized inline prefix for RSCB packets. There's no point X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;p=people%2Fssmith%2Fnc2-2.6.27.git Use a minimally-sized inline prefix for RSCB packets. There's no point 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. --- diff --git a/drivers/xen/netchannel2/rscb.c b/drivers/xen/netchannel2/rscb.c index 2130d3a2..d736ebab 100644 --- a/drivers/xen/netchannel2/rscb.c +++ b/drivers/xen/netchannel2/rscb.c @@ -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;