netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] net: rfs: enable RFS before first data packet is received
@ 2011-06-15  2:15 Eric Dumazet
  2011-06-16 23:50 ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2011-06-15  2:15 UTC (permalink / raw)
  To: Tom Herbert, David Miller; +Cc: netdev, Ben Hutchings, jamal

First packet received on a passive tcp flow is not correctly RFS
steered.

One sock_rps_record_flow() call is missing in inet_accept()

But before that, we also must record rxhash when child socket is setup.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Tom Herbert <therbert@google.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
CC: Jamal Hadi Salim <hadi@cyberus.ca>
---
Netconf2011 workshop ;)

 net/ipv4/af_inet.c  |    1 +
 net/ipv4/tcp_ipv4.c |    1 +
 2 files changed, 2 insertions(+)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 83673d2..0600f0f 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -676,6 +676,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags)
 
 	lock_sock(sk2);
 
+	sock_rps_record_flow(sk2);
 	WARN_ON(!((1 << sk2->sk_state) &
 		  (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_CLOSE)));
 
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 617dee3..955b8e6 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1594,6 +1594,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
 			goto discard;
 
 		if (nsk != sk) {
+			sock_rps_save_rxhash(nsk, skb->rxhash);
 			if (tcp_child_process(sk, nsk, skb)) {
 				rsk = nsk;
 				goto reset;



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

* Re: [PATCH net-next-2.6] net: rfs: enable RFS before first data packet is received
  2011-06-15  2:15 [PATCH net-next-2.6] net: rfs: enable RFS before first data packet is received Eric Dumazet
@ 2011-06-16 23:50 ` Ben Hutchings
  2011-06-17  3:38   ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2011-06-16 23:50 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Tom Herbert, David Miller, netdev, jamal

On Wed, 2011-06-15 at 04:15 +0200, Eric Dumazet wrote:
> First packet received on a passive tcp flow is not correctly RFS
> steered.
> 
> One sock_rps_record_flow() call is missing in inet_accept()
> 
> But before that, we also must record rxhash when child socket is setup.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Tom Herbert <therbert@google.com>
> CC: Ben Hutchings <bhutchings@solarflare.com>
> CC: Jamal Hadi Salim <hadi@cyberus.ca>
> ---
> Netconf2011 workshop ;)
> 
>  net/ipv4/af_inet.c  |    1 +
>  net/ipv4/tcp_ipv4.c |    1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index 83673d2..0600f0f 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -676,6 +676,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags)
>  
>  	lock_sock(sk2);
>  
> +	sock_rps_record_flow(sk2);
>  	WARN_ON(!((1 << sk2->sk_state) &
>  		  (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_CLOSE)));
>  
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 617dee3..955b8e6 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -1594,6 +1594,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
>  			goto discard;
>  
>  		if (nsk != sk) {
> +			sock_rps_save_rxhash(nsk, skb->rxhash);
>  			if (tcp_child_process(sk, nsk, skb)) {
>  				rsk = nsk;
>  				goto reset;
> 

I haven't tried this, but it looks reasonable to me.

What about IPv6?  The logic in tcp_v6_do_rcv() looks very similar.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


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

* Re: [PATCH net-next-2.6] net: rfs: enable RFS before first data packet is received
  2011-06-16 23:50 ` Ben Hutchings
@ 2011-06-17  3:38   ` David Miller
  2011-06-17 13:45     ` [PATCH v2] " Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2011-06-17  3:38 UTC (permalink / raw)
  To: bhutchings; +Cc: eric.dumazet, therbert, netdev, hadi

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Fri, 17 Jun 2011 00:50:46 +0100

> On Wed, 2011-06-15 at 04:15 +0200, Eric Dumazet wrote:
>> @@ -1594,6 +1594,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
>>  			goto discard;
>>  
>>  		if (nsk != sk) {
>> +			sock_rps_save_rxhash(nsk, skb->rxhash);
>>  			if (tcp_child_process(sk, nsk, skb)) {
>>  				rsk = nsk;
>>  				goto reset;
>> 
> 
> I haven't tried this, but it looks reasonable to me.
> 
> What about IPv6?  The logic in tcp_v6_do_rcv() looks very similar.

Indeed ipv6 side needs the same fix.

Eric please add that part and resubmit.  And in fact I might stick
this into net-2.6 instead of net-next-2.6

Thanks!

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

* [PATCH v2] net: rfs: enable RFS before first data packet is received
  2011-06-17  3:38   ` David Miller
@ 2011-06-17 13:45     ` Eric Dumazet
  2011-06-17 19:27       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2011-06-17 13:45 UTC (permalink / raw)
  To: David Miller; +Cc: bhutchings, therbert, netdev, hadi

Le jeudi 16 juin 2011 à 23:38 -0400, David Miller a écrit :
> From: Ben Hutchings <bhutchings@solarflare.com>
> Date: Fri, 17 Jun 2011 00:50:46 +0100
> 
> > On Wed, 2011-06-15 at 04:15 +0200, Eric Dumazet wrote:
> >> @@ -1594,6 +1594,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
> >>  			goto discard;
> >>  
> >>  		if (nsk != sk) {
> >> +			sock_rps_save_rxhash(nsk, skb->rxhash);
> >>  			if (tcp_child_process(sk, nsk, skb)) {
> >>  				rsk = nsk;
> >>  				goto reset;
> >> 
> > 
> > I haven't tried this, but it looks reasonable to me.
> > 
> > What about IPv6?  The logic in tcp_v6_do_rcv() looks very similar.
> 
> Indeed ipv6 side needs the same fix.
> 
> Eric please add that part and resubmit.  And in fact I might stick
> this into net-2.6 instead of net-next-2.6
> 

OK, here is the net-2.6 based one then, thanks !

[PATCH v2] net: rfs: enable RFS before first data packet is received

First packet received on a passive tcp flow is not correctly RFS
steered.

One sock_rps_record_flow() call is missing in inet_accept()

But before that, we also must record rxhash when child socket is setup.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Tom Herbert <therbert@google.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
CC: Jamal Hadi Salim <hadi@cyberus.ca>
---
V2: add ipv6 support, as Ben noticed.

 net/ipv4/af_inet.c  |    1 +
 net/ipv4/tcp_ipv4.c |    1 +
 net/ipv6/tcp_ipv6.c |    1 +
 3 files changed, 3 insertions(+)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 9c19260..eae1f67 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -676,6 +676,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags)
 
 	lock_sock(sk2);
 
+	sock_rps_record_flow(sk2);
 	WARN_ON(!((1 << sk2->sk_state) &
 		  (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_CLOSE)));
 
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a7d6671..708dc20 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1589,6 +1589,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
 			goto discard;
 
 		if (nsk != sk) {
+			sock_rps_save_rxhash(nsk, skb->rxhash);
 			if (tcp_child_process(sk, nsk, skb)) {
 				rsk = nsk;
 				goto reset;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index d1fd287..87551ca 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1644,6 +1644,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
 		 * the new socket..
 		 */
 		if(nsk != sk) {
+			sock_rps_save_rxhash(nsk, skb->rxhash);
 			if (tcp_child_process(sk, nsk, skb))
 				goto reset;
 			if (opt_skb)



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

* Re: [PATCH v2] net: rfs: enable RFS before first data packet is received
  2011-06-17 13:45     ` [PATCH v2] " Eric Dumazet
@ 2011-06-17 19:27       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-06-17 19:27 UTC (permalink / raw)
  To: eric.dumazet; +Cc: bhutchings, therbert, netdev, hadi

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 17 Jun 2011 15:45:15 +0200

> [PATCH v2] net: rfs: enable RFS before first data packet is received
> 
> First packet received on a passive tcp flow is not correctly RFS
> steered.
> 
> One sock_rps_record_flow() call is missing in inet_accept()
> 
> But before that, we also must record rxhash when child socket is setup.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

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

end of thread, other threads:[~2011-06-17 19:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15  2:15 [PATCH net-next-2.6] net: rfs: enable RFS before first data packet is received Eric Dumazet
2011-06-16 23:50 ` Ben Hutchings
2011-06-17  3:38   ` David Miller
2011-06-17 13:45     ` [PATCH v2] " Eric Dumazet
2011-06-17 19:27       ` David Miller

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).