Netdev List
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: <alexander.duyck@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linuxarm@huawei.com" <linuxarm@huawei.com>,
	<yuxiaowu@hisilicon.com>, <wzhen.wang@hisilicon.com>,
	Xuehuahu <xuehuahu@hisilicon.com>
Subject: [QUESTION] Doubt about NAPI_GRO_CB(skb)->is_atomic in tcpv4 gro process
Date: Wed, 20 Dec 2017 17:09:40 +0800	[thread overview]
Message-ID: <ca367d0d-b0d7-3357-7196-c0da17ef9890@huawei.com> (raw)

Hi, all
	I have some doubt about NAPI_GRO_CB(skb)->is_atomic when
analyzing the tcpv4 gro process:

Firstly we set NAPI_GRO_CB(skb)->is_atomic to 1 in dev_gro_receive:
https://elixir.free-electrons.com/linux/v4.15-rc4/source/net/core/dev.c#L4838

And then in inet_gro_receive, we check the NAPI_GRO_CB(skb)->is_atomic
before setting NAPI_GRO_CB(skb)->is_atomic according to IP_DF bit in the ip header:
https://elixir.free-electrons.com/linux/v4.15-rc4/source/net/ipv4/af_inet.c#L1319

struct sk_buff **inet_gro_receive(struct sk_buff **head, struct sk_buff *skb)
{
.....................
	for (p = *head; p; p = p->next) {
........................

		/* If the previous IP ID value was based on an atomic
		 * datagram we can overwrite the value and ignore it.
		 */
		if (NAPI_GRO_CB(skb)->is_atomic)                      //we check it here
			NAPI_GRO_CB(p)->flush_id = flush_id;
		else
			NAPI_GRO_CB(p)->flush_id |= flush_id;
	}

	NAPI_GRO_CB(skb)->is_atomic = !!(iph->frag_off & htons(IP_DF));  //we set it here
	NAPI_GRO_CB(skb)->flush |= flush;
	skb_set_network_header(skb, off);
................................
}

My question is whether we should check the NAPI_GRO_CB(skb)->is_atomic or NAPI_GRO_CB(p)->is_atomic?
If we should check NAPI_GRO_CB(skb)->is_atomic, then maybe it is unnecessary because it is alway true.
If we should check NAPI_GRO_CB(p)->is_atomic, maybe there is a bug here.

So what is the logic here? I am just start analyzing the gro, maybe I miss something obvious here.

             reply	other threads:[~2017-12-20  9:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20  9:09 Yunsheng Lin [this message]
2017-12-20 16:24 ` [QUESTION] Doubt about NAPI_GRO_CB(skb)->is_atomic in tcpv4 gro process Alexander Duyck
2017-12-21  9:16   ` Yunsheng Lin
2017-12-21 16:29     ` Alexander Duyck
2017-12-22  8:49       ` Yunsheng Lin
2017-12-22 16:32         ` Alexander Duyck
2017-12-25  9:32           ` Yunsheng Lin

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=ca367d0d-b0d7-3357-7196-c0da17ef9890@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=wzhen.wang@hisilicon.com \
    --cc=xuehuahu@hisilicon.com \
    --cc=yuxiaowu@hisilicon.com \
    /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