tcp: delete redundant calls of tcp_mtup_init() and
Subsystems (3)
cover tcp: delete redundant calls of tcp_mtup_init() and
I find that both tcp_v4_syn_recv_sock() and tcp_v6_syn_recv_sock() call them for new sock, so delete redundant calls of them.
Weiping Pan (2):
tcp: delete redundant calls of tcp_mtup_init()
tcp: delete redundant call of tcp_initialize_rcv_mss()
net/ipv4/tcp_input.c | 2 -- net/ipv4/tcp_ipv4.c | 1 - 2 files changed, 0 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.4
PATCH 1/2 tcp: delete redundant calls of tcp_mtup_init()
As both tcp_v4_syn_recv_sock() and tcp_v6_syn_recv_sock() already call tcp_mtup_init() for new sock, the calls of it in tcp_rcv_state_process() and tcp_v4_conn_req_fastopen() are redundant.
--- net/ipv4/tcp_input.c | 1 - net/ipv4/tcp_ipv4.c | 1 - 2 files changed, 0 insertions(+), 2 deletions(-)
net/ipv4/tcp_input.c +0 -1
@@ -5731,7 +5731,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, icsk->icsk_af_ops->rebuild_header (sk);tcp_init_congestion_control (sk); -tcp_mtup_init (sk); tp->copied_seq = tp->rcv_nxt;tcp_init_buffer_space (sk); }
net/ipv4/tcp_ipv4.c +0 -1
@@ -1410,7 +1410,6 @@ static int tcp_v4_conn_req_fastopen(struct sock *sk,/* Now finish processing the fastopen child socket. */ inet_csk (child)->icsk_af_ops->rebuild_header (child);tcp_init_congestion_control (child); -tcp_mtup_init (child);tcp_init_metrics (child);tcp_init_buffer_space (child);
Signature · 1 line
1.7.4
PATCH 2/2 tcp: delete redundant call of tcp_initialize_rcv_mss()
In reply to Weiping PanAs both tcp_v4_syn_recv_sock() and tcp_v6_syn_recv_sock() already call tcp_initialize_rcv_mss() for new sock, the call of it in tcp_rcv_state_process() is redundant.
--- net/ipv4/tcp_input.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
net/ipv4/tcp_input.c +0 -1
@@ -5771,7 +5771,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,/* Prevent spurious tcp_cwnd_restart() on first data packet */ tp->lsndtime = tcp_time_stamp; -tcp_initialize_rcv_mss (sk);tcp_fast_path_on (tp);break ;
Signature · 1 line
1.7.4
David Miller
maintainerFrom: Weiping Pan <[email protected]>
Date: Sun, 12 Jan 2014 15:54:29 +0800
Quoted 6 lines
I find that both
tcp_v4_syn_recv_sock()andtcp_v6_syn_recv_sock()call them for new sock, so delete redundant calls of them.Weiping Pan (2):
tcp: delete redundant calls oftcp_mtup_init()
tcp: delete redundant call oftcp_initialize_rcv_mss()
I do not agree with the approach of these two patches.
It is better to have tcp_rcv_state_process() (one location) make these calls rather than each and every inet sock operations instance.
Therefore you should remove the calls from tcp_v{4,6}_recv_sock() and keep the one in tcp_rcv_state_process().
Thanks.
PATCH v2 1/1 tcp: delete redundant calls of tcp_mtup_init()
As tcp_rcv_state_process() has already calls tcp_mtup_init() for non-fastopen sock, we can delete the redundant calls of tcp_mtup_init() in tcp_{v4,v6}_syn_recv_sock().
--- net/ipv4/tcp_ipv4.c | 1 - net/ipv6/tcp_ipv6.c | 1 - 2 files changed, 0 insertions(+), 2 deletions(-)
net/ipv4/tcp_ipv4.c +0 -1
@@ -1668,7 +1668,6 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, }sk_setup_caps (newsk, dst); -tcp_mtup_init (newsk);tcp_sync_mss (newsk,dst_mtu (dst)); newtp->advmss =dst_metric_advmss (dst); if (tcp_sk(sk)->rx_opt.user_mss &&
net/ipv6/tcp_ipv6.c +0 -1
@@ -1230,7 +1230,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,inet_csk (newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + newnp->opt->opt_flen); -tcp_mtup_init (newsk);tcp_sync_mss (newsk,dst_mtu (dst)); newtp->advmss =dst_metric_advmss (dst); if (tcp_sk(sk)->rx_opt.user_mss &&
Signature · 1 line
1.7.4.4
David Miller
maintainerRe: [PATCH net v2] tcp: delete redundant calls of tcp_mtup_init()
From: Weiping Pan <[email protected]>
Date: Sun, 19 Jan 2014 20:44:46 +0800
Quoted 5 lines
As
tcp_rcv_state_process()has already callstcp_mtup_init()for non-fastopen sock, we can delete the redundant calls oftcp_mtup_init()in tcp_{v4,v6}_syn_recv_sock().Signed-off-by Weiping Pan <[email protected]>
Looks good, applied.