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;