提交 46d0de4e 编写于 作者: I Ilpo Järvinen 提交者: David S. Miller

[TCP] FRTO: Entry is allowed only during (New)Reno like recovery

This interpretation comes from RFC4138:
    "If the sender implements some loss recovery algorithm other
     than Reno or NewReno [FHG04], the F-RTO algorithm SHOULD
     NOT be entered when earlier fast recovery is underway."

I think the RFC means to say (especially in the light of
Appendix B) that ...recovery is underway (not just fast recovery)
or was underway when it was interrupted by an earlier (F-)RTO
that hasn't yet been resolved (snd_una has not advanced enough).
Thus, my interpretation is that whenever TCP has ever
retransmitted other than head, basic version cannot be used
because then the order assumptions which are used as FRTO basis
do not hold.

NewReno has only the head segment retransmitted at a time.
Therefore, walk up to the segment that has not been SACKed, if
that segment is not retransmitted nor anything before it, we know
for sure, that nothing after the non-SACKed segment should be
either. This assumption is valid because TCPCB_EVER_RETRANS does
not leave holes but each non-SACKed segment is rexmitted
in-order.

Check for retrans_out > 1 avoids more expensive walk through the
skb list, as we can know the result beforehand: F-RTO will not be
allowed.

SACKed skb can turn into non-SACked only in the extremely rare
case of SACK reneging, in this case we might fail to detect
retransmissions if there were them for any other than head. To
get rid of that feature, whole rexmit queue would have to be
walked (always) or FRTO should be prevented when SACK reneging
happens. Of course RTO should still trigger after reneging which
makes this issue even less likely to show up. And as long as the
response is as conservative as it's now, nothing bad happens even
then.
Signed-off-by: NIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7c9a4a5b
...@@ -341,7 +341,7 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, ...@@ -341,7 +341,7 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
extern int tcp_child_process(struct sock *parent, extern int tcp_child_process(struct sock *parent,
struct sock *child, struct sock *child,
struct sk_buff *skb); struct sk_buff *skb);
extern int tcp_use_frto(const struct sock *sk); extern int tcp_use_frto(struct sock *sk);
extern void tcp_enter_frto(struct sock *sk); extern void tcp_enter_frto(struct sock *sk);
extern void tcp_enter_loss(struct sock *sk, int how); extern void tcp_enter_loss(struct sock *sk, int how);
extern void tcp_clear_retrans(struct tcp_sock *tp); extern void tcp_clear_retrans(struct tcp_sock *tp);
......
...@@ -1239,14 +1239,31 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ ...@@ -1239,14 +1239,31 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
/* F-RTO can only be used if these conditions are satisfied: /* F-RTO can only be used if these conditions are satisfied:
* - there must be some unsent new data * - there must be some unsent new data
* - the advertised window should allow sending it * - the advertised window should allow sending it
* - TCP has never retransmitted anything other than head
*/ */
int tcp_use_frto(const struct sock *sk) int tcp_use_frto(struct sock *sk)
{ {
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *skb;
if (!sysctl_tcp_frto || !sk->sk_send_head ||
after(TCP_SKB_CB(sk->sk_send_head)->end_seq,
tp->snd_una + tp->snd_wnd))
return 0;
return (sysctl_tcp_frto && sk->sk_send_head && /* Avoid expensive walking of rexmit queue if possible */
!after(TCP_SKB_CB(sk->sk_send_head)->end_seq, if (tp->retrans_out > 1)
tp->snd_una + tp->snd_wnd)); return 0;
skb = skb_peek(&sk->sk_write_queue)->next; /* Skips head */
sk_stream_for_retrans_queue_from(skb, sk) {
if (TCP_SKB_CB(skb)->sacked&TCPCB_RETRANS)
return 0;
/* Short-circuit when first non-SACKed skb has been checked */
if (!(TCP_SKB_CB(skb)->sacked&TCPCB_SACKED_ACKED))
break;
}
return 1;
} }
/* RTO occurred, but do not yet enter Loss state. Instead, defer RTO /* RTO occurred, but do not yet enter Loss state. Instead, defer RTO
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册