aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 29999ef73b43..ea690afa592a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -118,6 +118,7 @@ int sysctl_tcp_abc __read_mostly;
118#define IsSackFrto() (sysctl_tcp_frto == 0x2) 118#define IsSackFrto() (sysctl_tcp_frto == 0x2)
119 119
120#define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH) 120#define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH)
121#define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH))
121 122
122/* Adapt the MSS value used to make delayed ack decision to the 123/* Adapt the MSS value used to make delayed ack decision to the
123 * real world. 124 * real world.
@@ -198,6 +199,55 @@ static inline int tcp_in_quickack_mode(const struct sock *sk)
198 return icsk->icsk_ack.quick && !icsk->icsk_ack.pingpong; 199 return icsk->icsk_ack.quick && !icsk->icsk_ack.pingpong;
199} 200}
200 201
202static inline void TCP_ECN_queue_cwr(struct tcp_sock *tp)
203{
204 if (tp->ecn_flags&TCP_ECN_OK)
205 tp->ecn_flags |= TCP_ECN_QUEUE_CWR;
206}
207
208static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb)
209{
210 if (tcp_hdr(skb)->cwr)
211 tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR;
212}
213
214static inline void TCP_ECN_withdraw_cwr(struct tcp_sock *tp)
215{
216 tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR;
217}
218
219static inline void TCP_ECN_check_ce(struct tcp_sock *tp, struct sk_buff *skb)
220{
221 if (tp->ecn_flags&TCP_ECN_OK) {
222 if (INET_ECN_is_ce(TCP_SKB_CB(skb)->flags))
223 tp->ecn_flags |= TCP_ECN_DEMAND_CWR;
224 /* Funny extension: if ECT is not set on a segment,
225 * it is surely retransmit. It is not in ECN RFC,
226 * but Linux follows this rule. */
227 else if (INET_ECN_is_not_ect((TCP_SKB_CB(skb)->flags)))
228 tcp_enter_quickack_mode((struct sock *)tp);
229 }
230}
231
232static inline void TCP_ECN_rcv_synack(struct tcp_sock *tp, struct tcphdr *th)
233{
234 if ((tp->ecn_flags&TCP_ECN_OK) && (!th->ece || th->cwr))
235 tp->ecn_flags &= ~TCP_ECN_OK;
236}
237
238static inline void TCP_ECN_rcv_syn(struct tcp_sock *tp, struct tcphdr *th)
239{
240 if ((tp->ecn_flags&TCP_ECN_OK) && (!th->ece || !th->cwr))
241 tp->ecn_flags &= ~TCP_ECN_OK;
242}
243
244static inline int TCP_ECN_rcv_ecn_echo(struct tcp_sock *tp, struct tcphdr *th)
245{
246 if (th->ece && !th->syn && (tp->ecn_flags&TCP_ECN_OK))
247 return 1;
248 return 0;
249}
250
201/* Buffer size and advertised window tuning. 251/* Buffer size and advertised window tuning.
202 * 252 *
203 * 1. Tuning sk->sk_sndbuf, when connection enters established state. 253 * 1. Tuning sk->sk_sndbuf, when connection enters established state.