aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2009-03-14 10:23:05 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-15 23:09:54 -0400
commit0c54b85f2828128274f319a1eb3ce7f604fe2a53 (patch)
tree8ff84b9aa9cd4775f244c2421e11adfbd206a7bf /include
parent72211e90501f954f586481c25521c3724cda3cc7 (diff)
tcp: simplify tcp_current_mss
There's very little need for most of the callsites to get tp->xmit_goal_size updated. That will cost us divide as is, so slice the function in two. Also, the only users of the tp->xmit_goal_size are directly behind tcp_current_mss(), so there's no need to store that variable into tcp_sock at all! The drop of xmit_goal_size currently leaves 16-bit hole and some reorganization would again be necessary to change that (but I'm aiming to fill that hole with u16 xmit_goal_size_segs to cache the results of the remaining divide to get that tso on regression). Bring xmit_goal_size parts into tcp.c Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Cc: Evgeniy Polyakov <zbr@ioremap.net> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/tcp.h1
-rw-r--r--include/net/tcp.h13
2 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 4b86ad71e054..ad2021ccc55a 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -248,7 +248,6 @@ struct tcp_sock {
248 /* inet_connection_sock has to be the first member of tcp_sock */ 248 /* inet_connection_sock has to be the first member of tcp_sock */
249 struct inet_connection_sock inet_conn; 249 struct inet_connection_sock inet_conn;
250 u16 tcp_header_len; /* Bytes of tcp header to send */ 250 u16 tcp_header_len; /* Bytes of tcp header to send */
251 u16 xmit_size_goal; /* Goal for segmenting output packets */
252 251
253/* 252/*
254 * Header prediction flags 253 * Header prediction flags
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 255ca35bea05..e54c76d75495 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -481,7 +481,16 @@ static inline void tcp_clear_xmit_timers(struct sock *sk)
481} 481}
482 482
483extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); 483extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
484extern unsigned int tcp_current_mss(struct sock *sk, int large); 484extern unsigned int tcp_current_mss(struct sock *sk);
485
486/* Bound MSS / TSO packet size with the half of the window */
487static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
488{
489 if (tp->max_window && pktsize > (tp->max_window >> 1))
490 return max(tp->max_window >> 1, 68U - tp->tcp_header_len);
491 else
492 return pktsize;
493}
485 494
486/* tcp.c */ 495/* tcp.c */
487extern void tcp_get_info(struct sock *, struct tcp_info *); 496extern void tcp_get_info(struct sock *, struct tcp_info *);
@@ -822,7 +831,7 @@ static inline void tcp_push_pending_frames(struct sock *sk)
822{ 831{
823 struct tcp_sock *tp = tcp_sk(sk); 832 struct tcp_sock *tp = tcp_sk(sk);
824 833
825 __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle); 834 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
826} 835}
827 836
828static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) 837static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq)