netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <zbr@ioremap.net>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 6/8] tcp: Add GRO support
Date: Fri, 12 Dec 2008 22:56:15 +0300	[thread overview]
Message-ID: <20081212195615.GC27281@ioremap.net> (raw)
In-Reply-To: <E1LB0d1-0000rd-B2@gondolin.me.apana.org.au>

On Fri, Dec 12, 2008 at 04:31:55PM +1100, Herbert Xu (herbert@gondor.apana.org.au) wrote:
> +struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
> +{
> +	struct sk_buff **pp = NULL;
> +	struct sk_buff *p;
> +	struct tcphdr *th;
> +	struct tcphdr *th2;
> +	unsigned int thlen;
> +	unsigned int flags;
> +	unsigned int total;
> +	unsigned int mss = 1;
> +	int flush = 1;
> +
> +	if (!pskb_may_pull(skb, sizeof(*th)))
> +		goto out;
> +
> +	th = tcp_hdr(skb);
> +	thlen = th->doff * 4;
> +	if (thlen < sizeof(*th))
> +		goto out;
> +
> +	if (!pskb_may_pull(skb, thlen))
> +		goto out;
> +
> +	th = tcp_hdr(skb);
> +	__skb_pull(skb, thlen);
> +
> +	flags = tcp_flag_word(th);
> +
> +	for (; (p = *head); head = &p->next) {
> +		if (!NAPI_GRO_CB(p)->same_flow)
> +			continue;
> +
> +		th2 = tcp_hdr(p);
> +
> +		if (th->source != th2->source || th->dest != th2->dest) {
> +			NAPI_GRO_CB(p)->same_flow = 0;
> +			continue;
> +		}
> +
> +		goto found;
> +	}
> +
> +	goto out_check_final;
> +
> +found:
> +	flush = NAPI_GRO_CB(p)->flush;
> +	flush |= flags & TCP_FLAG_CWR;
> +	flush |= (flags ^ tcp_flag_word(th2)) &
> +		  ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH);
> +	flush |= th->ack_seq != th2->ack_seq || th->window != th2->window;
> +	flush |= memcmp(th + 1, th2 + 1, thlen - sizeof(*th));
> +
> +	total = p->len;
> +	mss = total;
> +	if (skb_shinfo(p)->frag_list)
> +		mss = skb_shinfo(p)->frag_list->len;
> +
> +	flush |= skb->len > mss || skb->len <= 0;
> +	flush |= ntohl(th2->seq) + total != ntohl(th->seq);
> +

No timestamp check?

> +	if (flush || skb_gro_receive(head, skb)) {
> +		mss = 1;
> +		goto out_check_final;
> +	}
> +
> +	p = *head;
> +	th2 = tcp_hdr(p);
> +	tcp_flag_word(th2) |= flags & (TCP_FLAG_FIN | TCP_FLAG_PSH);
> +
> +out_check_final:
> +	flush = skb->len < mss;
> +	flush |= flags & (TCP_FLAG_URG | TCP_FLAG_PSH | TCP_FLAG_RST |
> +			  TCP_FLAG_SYN | TCP_FLAG_FIN);
> +
> +	if (p && (!NAPI_GRO_CB(skb)->same_flow || flush))
> +		pp = head;
> +
> +out:
> +	NAPI_GRO_CB(skb)->flush |= flush;
> +
> +	return pp;
> +}

-- 
	Evgeniy Polyakov

  reply	other threads:[~2008-12-12 19:56 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12  5:31 [0/8] net: Generic Receive Offload Herbert Xu
2008-12-12  5:31 ` [PATCH 1/8] net: Add frag_list support to skb_segment Herbert Xu
2008-12-12 19:46   ` Evgeniy Polyakov
2008-12-12 21:41     ` Herbert Xu
2008-12-13  2:38       ` Evgeniy Polyakov
2008-12-13  2:43         ` Herbert Xu
2008-12-13  3:11           ` Evgeniy Polyakov
2008-12-13  3:20             ` Herbert Xu
2008-12-12  5:31 ` [PATCH 2/8] net: Add frag_list support to GSO Herbert Xu
2008-12-12  5:31 ` [PATCH 3/8] net: Add Generic Receive Offload infrastructure Herbert Xu
2008-12-12 19:51   ` Evgeniy Polyakov
2008-12-12 21:45     ` Herbert Xu
2008-12-12 22:25   ` Ben Hutchings
2008-12-12 22:56     ` Herbert Xu
2008-12-12 23:11       ` Herbert Xu
2008-12-13  3:43         ` Herbert Xu
2008-12-13 14:03           ` Evgeniy Polyakov
2008-12-12  5:31 ` [PATCH 4/8] ipv4: Add GRO infrastructure Herbert Xu
2008-12-12 22:55   ` Ben Hutchings
2008-12-12 23:04     ` Herbert Xu
2008-12-12  5:31 ` [PATCH 5/8] net: Add skb_gro_receive Herbert Xu
2008-12-12  5:31 ` [PATCH 6/8] tcp: Add GRO support Herbert Xu
2008-12-12 19:56   ` Evgeniy Polyakov [this message]
2008-12-12 21:46     ` Herbert Xu
2008-12-13  2:40       ` Evgeniy Polyakov
2008-12-13  2:46         ` Herbert Xu
2008-12-13  3:10           ` Evgeniy Polyakov
2008-12-13  3:19             ` Herbert Xu
2008-12-12  5:31 ` [PATCH 7/8] ethtool: Add GGRO and SGRO ops Herbert Xu
2008-12-12 20:11   ` Ben Hutchings
2008-12-12 21:48     ` Herbert Xu
2008-12-12 22:35       ` Ben Hutchings
2008-12-12 22:49         ` Herbert Xu
2008-12-14 19:36           ` Waskiewicz Jr, Peter P
2008-12-14 21:09             ` Herbert Xu
2008-12-14 22:00               ` Waskiewicz Jr, Peter P
2008-12-15  3:40                 ` Herbert Xu
2008-12-12  5:31 ` [PATCH 8/8] e1000e: Add GRO support Herbert Xu
2008-12-13  1:34 ` [0/8] net: Generic Receive Offload Herbert Xu
2008-12-13  1:35   ` [PATCH 1/8] net: Add frag_list support to skb_segment Herbert Xu
2008-12-16  7:27     ` David Miller
2008-12-13  1:35   ` [PATCH 2/8] net: Add frag_list support to GSO Herbert Xu
2008-12-16  7:30     ` David Miller
2008-12-13  1:35   ` [PATCH 3/8] net: Add Generic Receive Offload infrastructure Herbert Xu
2008-12-15 23:29     ` Paul E. McKenney
2008-12-15 23:39       ` David Miller
2008-12-16  0:02         ` Paul E. McKenney
2008-12-16  2:04         ` Herbert Xu
2008-12-16 16:37           ` Paul E. McKenney
2008-12-16  7:40     ` David Miller
2008-12-13  1:35   ` [PATCH 4/8] ipv4: Add GRO infrastructure Herbert Xu
2008-12-16  7:41     ` David Miller
2008-12-13  1:35   ` [PATCH 5/8] net: Add skb_gro_receive Herbert Xu
2008-12-13  2:52     ` Herbert Xu
2008-12-16  7:42       ` David Miller
2008-12-13  1:35   ` [PATCH 6/8] tcp: Add GRO support Herbert Xu
2008-12-16  7:43     ` David Miller
2008-12-13  1:35   ` [PATCH 7/8] ethtool: Add GGRO and SGRO ops Herbert Xu
2008-12-16  7:44     ` David Miller
2008-12-13  1:35   ` [PATCH 8/8] e1000e: Add GRO support Herbert Xu
2008-12-16  7:46     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081212195615.GC27281@ioremap.net \
    --to=zbr@ioremap.net \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).