From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: shemminger@vyatta.com, netdev@vger.kernel.org
Subject: Re: [PATCH v2] ipv4: Early TCP socket demux.
Date: Wed, 20 Jun 2012 14:38:40 +0200 [thread overview]
Message-ID: <1340195920.4604.918.camel@edumazet-glaptop> (raw)
In-Reply-To: <20120620.031543.1511134879638711616.davem@davemloft.net>
On Wed, 2012-06-20 at 03:15 -0700, David Miller wrote:
> dev->ifindex);
> + if (sk) {
> + skb_orphan(skb);
> + skb->sk = sk;
> + skb->destructor = sock_edemux;
> + if (!skb_dst(skb) &&
> + sk->sk_state != TCP_TIME_WAIT) {
> + struct dst_entry *dst = sk->sk_rx_dst;
> + if (dst)
> + dst = dst_check(dst, 0);
> + if (dst) {
> + struct rtable *rt = (struct rtable *) dst;
> +
> + if (rt->rt_iif == dev->ifindex)
> + skb_dst_set_noref(skb, dst);
> + }
> + }
> + }
> + }
> + return pp;
I am trying to convince myself its safe.
skb_dst_set_noref() assumes caller hold rcu_read_lock() until we use the
skb dst.
And dev_gro_receive() releases RCU...
Problem could happen if sk->sk_rx_dst is freed while some packets are
still in napi or socket backlog (can happen with some network
reordering)
1) Socket backlog must be flushed before sk->sk_rx_dst freeing
2) Even if we move rcu_read_lock() in net_rx_action(), we need some
napi_gro_forcedstrefs() in case we sofnet_break
Or maybe just use napi_gro_flush() ?
diff --git a/net/core/dev.c b/net/core/dev.c
index 57c4f9b..c0f71a0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3861,6 +3861,9 @@ static void net_rx_action(struct softirq_action *h)
budget -= work;
+ if (work == weight)
+ napi_gro_flush(n);
+
local_irq_disable();
/* Drivers must not modify the NAPI state if they
next prev parent reply other threads:[~2012-06-20 12:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 23:39 [PATCH v2] ipv4: Early TCP socket demux David Miller
2012-06-20 0:21 ` Ben Hutchings
2012-06-20 0:54 ` David Miller
2012-06-20 1:03 ` Ben Hutchings
2012-06-20 1:05 ` David Miller
2012-06-20 2:02 ` David Miller
2012-06-20 18:16 ` Ben Hutchings
2012-06-20 2:35 ` Stephen Hemminger
2012-06-20 4:46 ` David Miller
2012-06-20 5:49 ` Eric Dumazet
2012-06-20 5:51 ` Eric Dumazet
2012-06-20 6:14 ` David Miller
2012-06-20 16:21 ` Rick Jones
2012-06-20 5:59 ` Eric Dumazet
2012-06-20 6:14 ` David Miller
2012-06-20 10:15 ` David Miller
2012-06-20 11:03 ` Eric Dumazet
2012-06-20 11:09 ` David Miller
2012-06-20 12:38 ` Eric Dumazet [this message]
2012-06-20 22:29 ` David Miller
2012-06-20 18:07 ` Ben Hutchings
2012-06-20 18:40 ` Eric Dumazet
2012-06-20 21:01 ` David Miller
2012-06-20 21:04 ` Stephen Hemminger
2012-06-20 21:17 ` Eric Dumazet
2012-06-20 21:26 ` 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=1340195920.4604.918.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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