From: Benjamin Poirier <bpoir...@suse.de> Date: Thu, 21 Aug 2014 14:59:11 -0700
> Ah, now I understand the reason for the * 3 in > u32 frag_cnt_est = skb_shinfo(skb)->gso_segs * 3; > > /* Estimate the number of fragments in the worst case */ > but that is not really the "worst case". It's not forbidden to have more than > two frags per skb output from skb_gso_segment(). I've kept this estimation > approach but I've added code to validate the estimation or else linearize the > skb. This is a common situation drivers run into, and there have been a few notable situations in virtualization drivers recently. Although in those cases the problems arise from the fact that if an SKB fragment is a compound page, this can evaluate to requiring multiple descriptors, one for each 4K segment within that fragment. Anyways, the point I wanted to make is that you shouldn't do anything too complicated to handle all of this. And I think your conclusion to linearize if the estimation fails is a good one. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/