diff options
Diffstat (limited to 'net/ipv4/tcp_metrics.c')
-rw-r--r-- | net/ipv4/tcp_metrics.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index 78ecc4a01712..a51d63a43e33 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
@@ -28,7 +28,8 @@ static struct tcp_metrics_block *__tcp_get_metrics(const struct inetpeer_addr *s | |||
28 | 28 | ||
29 | struct tcp_fastopen_metrics { | 29 | struct tcp_fastopen_metrics { |
30 | u16 mss; | 30 | u16 mss; |
31 | u16 syn_loss:10; /* Recurring Fast Open SYN losses */ | 31 | u16 syn_loss:10, /* Recurring Fast Open SYN losses */ |
32 | try_exp:2; /* Request w/ exp. option (once) */ | ||
32 | unsigned long last_syn_loss; /* Last Fast Open SYN loss */ | 33 | unsigned long last_syn_loss; /* Last Fast Open SYN loss */ |
33 | struct tcp_fastopen_cookie cookie; | 34 | struct tcp_fastopen_cookie cookie; |
34 | }; | 35 | }; |
@@ -131,6 +132,8 @@ static void tcpm_suck_dst(struct tcp_metrics_block *tm, | |||
131 | if (fastopen_clear) { | 132 | if (fastopen_clear) { |
132 | tm->tcpm_fastopen.mss = 0; | 133 | tm->tcpm_fastopen.mss = 0; |
133 | tm->tcpm_fastopen.syn_loss = 0; | 134 | tm->tcpm_fastopen.syn_loss = 0; |
135 | tm->tcpm_fastopen.try_exp = 0; | ||
136 | tm->tcpm_fastopen.cookie.exp = false; | ||
134 | tm->tcpm_fastopen.cookie.len = 0; | 137 | tm->tcpm_fastopen.cookie.len = 0; |
135 | } | 138 | } |
136 | } | 139 | } |
@@ -713,6 +716,8 @@ void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, | |||
713 | if (tfom->mss) | 716 | if (tfom->mss) |
714 | *mss = tfom->mss; | 717 | *mss = tfom->mss; |
715 | *cookie = tfom->cookie; | 718 | *cookie = tfom->cookie; |
719 | if (cookie->len <= 0 && tfom->try_exp == 1) | ||
720 | cookie->exp = true; | ||
716 | *syn_loss = tfom->syn_loss; | 721 | *syn_loss = tfom->syn_loss; |
717 | *last_syn_loss = *syn_loss ? tfom->last_syn_loss : 0; | 722 | *last_syn_loss = *syn_loss ? tfom->last_syn_loss : 0; |
718 | } while (read_seqretry(&fastopen_seqlock, seq)); | 723 | } while (read_seqretry(&fastopen_seqlock, seq)); |
@@ -721,7 +726,8 @@ void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, | |||
721 | } | 726 | } |
722 | 727 | ||
723 | void tcp_fastopen_cache_set(struct sock *sk, u16 mss, | 728 | void tcp_fastopen_cache_set(struct sock *sk, u16 mss, |
724 | struct tcp_fastopen_cookie *cookie, bool syn_lost) | 729 | struct tcp_fastopen_cookie *cookie, bool syn_lost, |
730 | u16 try_exp) | ||
725 | { | 731 | { |
726 | struct dst_entry *dst = __sk_dst_get(sk); | 732 | struct dst_entry *dst = __sk_dst_get(sk); |
727 | struct tcp_metrics_block *tm; | 733 | struct tcp_metrics_block *tm; |
@@ -738,6 +744,9 @@ void tcp_fastopen_cache_set(struct sock *sk, u16 mss, | |||
738 | tfom->mss = mss; | 744 | tfom->mss = mss; |
739 | if (cookie && cookie->len > 0) | 745 | if (cookie && cookie->len > 0) |
740 | tfom->cookie = *cookie; | 746 | tfom->cookie = *cookie; |
747 | else if (try_exp > tfom->try_exp && | ||
748 | tfom->cookie.len <= 0 && !tfom->cookie.exp) | ||
749 | tfom->try_exp = try_exp; | ||
741 | if (syn_lost) { | 750 | if (syn_lost) { |
742 | ++tfom->syn_loss; | 751 | ++tfom->syn_loss; |
743 | tfom->last_syn_loss = jiffies; | 752 | tfom->last_syn_loss = jiffies; |