* [PATCH nf-next 1/1] net: tcp: Refine the __tcp_select_window
@ 2017-03-29 22:49 gfree.wind
2017-03-30 22:42 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: gfree.wind @ 2017-03-29 22:49 UTC (permalink / raw)
To: davem, kuznet, jmorris, kaber, netdev, gfree.wind; +Cc: Gao Feng
From: Gao Feng <fgao@ikuai8.com>
1. Move the "window = tp->rcv_wnd;" into the condition block without
tp->rx_opt.rcv_wscale.
Because it is unnecessary when enable wscale;
2. Use the macro ALIGN instead of two statements.
The two statements are used to make window align to 1<<wscale.
Use the ALIGN is more clearer.
3. Use the rounddown to make codes clearer.
Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
net/ipv4/tcp_output.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 22548b5..1397194 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2561,7 +2561,6 @@ u32 __tcp_select_window(struct sock *sk)
/* Don't do rounding if we are using window scaling, since the
* scaled window will not line up with the MSS boundary anyway.
*/
- window = tp->rcv_wnd;
if (tp->rx_opt.rcv_wscale) {
window = free_space;
@@ -2569,10 +2568,9 @@ u32 __tcp_select_window(struct sock *sk)
* Import case: prevent zero window announcement if
* 1<<rcv_wscale > mss.
*/
- if (((window >> tp->rx_opt.rcv_wscale) << tp->rx_opt.rcv_wscale) != window)
- window = (((window >> tp->rx_opt.rcv_wscale) + 1)
- << tp->rx_opt.rcv_wscale);
+ window = ALIGN(window, (1 << tp->rx_opt.rcv_wscale));
} else {
+ window = tp->rcv_wnd;
/* Get the largest window that is a nice multiple of mss.
* Window clamp already applied above.
* If our current window offering is within 1 mss of the
@@ -2582,7 +2580,7 @@ u32 __tcp_select_window(struct sock *sk)
* is too small.
*/
if (window <= free_space - mss || window > free_space)
- window = (free_space / mss) * mss;
+ window = rounddown(free_space, mss);
else if (mss == full_space &&
free_space > window + (full_space >> 1))
window = free_space;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH nf-next 1/1] net: tcp: Refine the __tcp_select_window
2017-03-29 22:49 [PATCH nf-next 1/1] net: tcp: Refine the __tcp_select_window gfree.wind
@ 2017-03-30 22:42 ` David Miller
2017-03-31 1:11 ` Gao Feng
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2017-03-30 22:42 UTC (permalink / raw)
To: gfree.wind; +Cc: kuznet, jmorris, netdev, fgao
From: gfree.wind@foxmail.com
Date: Thu, 30 Mar 2017 06:49:19 +0800
> From: Gao Feng <fgao@ikuai8.com>
>
> 1. Move the "window = tp->rcv_wnd;" into the condition block without
> tp->rx_opt.rcv_wscale.
> Because it is unnecessary when enable wscale;
>
> 2. Use the macro ALIGN instead of two statements.
> The two statements are used to make window align to 1<<wscale.
> Use the ALIGN is more clearer.
>
> 3. Use the rounddown to make codes clearer.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
Applied, but please do not target non-netfilter patches using
"nf-next" in your Subject lines.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH nf-next 1/1] net: tcp: Refine the __tcp_select_window
2017-03-30 22:42 ` David Miller
@ 2017-03-31 1:11 ` Gao Feng
0 siblings, 0 replies; 3+ messages in thread
From: Gao Feng @ 2017-03-31 1:11 UTC (permalink / raw)
To: 'David Miller'; +Cc: kuznet, jmorris, netdev, fgao
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
> On Behalf Of David Miller
> Sent: Friday, March 31, 2017 6:42 AM
> To: gfree.wind@foxmail.com
> Cc: kuznet@ms2.inr.ac.ru; jmorris@namei.org; netdev@vger.kernel.org;
> fgao@ikuai8.com
> Subject: Re: [PATCH nf-next 1/1] net: tcp: Refine the __tcp_select_window
>
> From: gfree.wind@foxmail.com
> Date: Thu, 30 Mar 2017 06:49:19 +0800
>
> > From: Gao Feng <fgao@ikuai8.com>
> >
> > 1. Move the "window = tp->rcv_wnd;" into the condition block without
> > tp->rx_opt.rcv_wscale.
> > Because it is unnecessary when enable wscale;
> >
> > 2. Use the macro ALIGN instead of two statements.
> > The two statements are used to make window align to 1<<wscale.
> > Use the ALIGN is more clearer.
> >
> > 3. Use the rounddown to make codes clearer.
> >
> > Signed-off-by: Gao Feng <fgao@ikuai8.com>
>
> Applied, but please do not target non-netfilter patches using "nf-next" in
your
> Subject lines.
Sorry, I misspelled the subject.
I would pay more attention on it.
Regards
Feng
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-31 1:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-29 22:49 [PATCH nf-next 1/1] net: tcp: Refine the __tcp_select_window gfree.wind
2017-03-30 22:42 ` David Miller
2017-03-31 1:11 ` Gao Feng
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).