Netdev List
 help / color / mirror / Atom feed
* [QUESTION] Doubt about NAPI_GRO_CB(skb)->is_atomic in tcpv4 gro process
@ 2017-12-20  9:09 Yunsheng Lin
  2017-12-20 16:24 ` Alexander Duyck
  0 siblings, 1 reply; 7+ messages in thread
From: Yunsheng Lin @ 2017-12-20  9:09 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: alexander.duyck, davem@davemloft.net, linuxarm@huawei.com,
	yuxiaowu, wzhen.wang, Xuehuahu

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-25  9:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20  9:09 [QUESTION] Doubt about NAPI_GRO_CB(skb)->is_atomic in tcpv4 gro process Yunsheng Lin
2017-12-20 16:24 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox