On Thu, 5 Sep 2019 14:49:44 -0700 Alexander Duyck <alexander.du...@gmail.com> wrote:
> I would change the order of the tests you use here so that we can > eliminate the possibility of needing to perform many tests for the > more common cases. You could probably swap "list_skb" and "mss != > GSO_BY_FRAGS" since list_skb is more likely to be false for many of > the common cases such as a standard TSO send from a socket. You might > even consider moving the GSO_BY_FRAGS check toward the end of your > checks since SCTP is the only protocol that I believe uses it and the > likelihood of encountering it is much lower compared to other > protocols. > > You could probably test for !list_skb->head_frag before seeing if > there is a headlen since many NICs would be generating frames using > head_frag, so in the GRO case you mentioned above it could probably > save you some effort on a number of NICs. > > You might also consider moving this code up before we push the mac > header back on and instead of setting sg to false you could just clear > the NETIF_F_SG flag from features. It would save you from having to > then remove doffset in your last check. Thanks Alexander for the input. Will encorporate as much as possible into a v2 patch. BTW, I've strugged with myself regarding order of tests, and came up with this suggestion, as my motivation was to have the tests order tell a coherent logical story when read top-to-bottom left-to-right, FWIW. For example, although 'mss != skb_headlen(head_skb)' could be tested earlier, the condition by itself isn't meaningful unless we have an existing frag_list and with a !head_frag. Best Shmulik