Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bece1b97 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

tcp: tcp_tso_segment() small optimization



We can move th->check computation out of the loop, as compiler
doesn't know each skb initially share same tcp headers after
skb_segment()

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eb1d0640
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -2886,6 +2886,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
	unsigned int oldlen;
	unsigned int oldlen;
	unsigned int mss;
	unsigned int mss;
	struct sk_buff *gso_skb = skb;
	struct sk_buff *gso_skb = skb;
	__sum16 newcheck;


	if (!pskb_may_pull(skb, sizeof(*th)))
	if (!pskb_may_pull(skb, sizeof(*th)))
		goto out;
		goto out;
@@ -2936,11 +2937,13 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
	th = tcp_hdr(skb);
	th = tcp_hdr(skb);
	seq = ntohl(th->seq);
	seq = ntohl(th->seq);


	newcheck = ~csum_fold((__force __wsum)((__force u32)th->check +
					       (__force u32)delta));

	do {
	do {
		th->fin = th->psh = 0;
		th->fin = th->psh = 0;
		th->check = newcheck;


		th->check = ~csum_fold((__force __wsum)((__force u32)th->check +
				       (__force u32)delta));
		if (skb->ip_summed != CHECKSUM_PARTIAL)
		if (skb->ip_summed != CHECKSUM_PARTIAL)
			th->check =
			th->check =
			     csum_fold(csum_partial(skb_transport_header(skb),
			     csum_fold(csum_partial(skb_transport_header(skb),