Skip to content

Commit b8fef65

Browse files
yuchungchengdavem330
authored andcommitted
tcp: new helper tcp_rack_skb_timeout
Create and export a new helper tcp_rack_skb_timeout and move tcp_is_rack to prepare the final RTO change. Signed-off-by: Yuchung Cheng <[email protected]> Signed-off-by: Neal Cardwell <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Reviewed-by: Soheil Hassas Yeganeh <[email protected]> Reviewed-by: Priyaranjan Jha <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c77d62f commit b8fef65

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

include/net/tcp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,8 @@ void tcp_init(void);
18791879
/* tcp_recovery.c */
18801880
void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb);
18811881
void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced);
1882+
extern s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb,
1883+
u32 reo_wnd);
18821884
extern void tcp_rack_mark_lost(struct sock *sk);
18831885
extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
18841886
u64 xmit_time);

net/ipv4/tcp_input.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,11 @@ static inline void tcp_init_undo(struct tcp_sock *tp)
19171917
tp->undo_retrans = tp->retrans_out ? : -1;
19181918
}
19191919

1920+
static bool tcp_is_rack(const struct sock *sk)
1921+
{
1922+
return sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION;
1923+
}
1924+
19201925
/* If we detect SACK reneging, forget all SACK information
19211926
* and reset tags completely, otherwise preserve SACKs. If receiver
19221927
* dropped its ofo queue, we will know this due to reneging detection.
@@ -2031,11 +2036,6 @@ static inline int tcp_dupack_heuristics(const struct tcp_sock *tp)
20312036
return tp->sacked_out + 1;
20322037
}
20332038

2034-
static bool tcp_is_rack(const struct sock *sk)
2035-
{
2036-
return sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION;
2037-
}
2038-
20392039
/* Linux NewReno/SACK/ECN state machine.
20402040
* --------------------------------------
20412041
*

net/ipv4/tcp_recovery.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ u32 tcp_rack_reo_wnd(const struct sock *sk)
4747
tp->srtt_us >> 3);
4848
}
4949

50+
s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb, u32 reo_wnd)
51+
{
52+
return tp->rack.rtt_us + reo_wnd -
53+
tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp);
54+
}
55+
5056
/* RACK loss detection (IETF draft draft-ietf-tcpm-rack-01):
5157
*
5258
* Marks a packet lost, if some packet sent later has been (s)acked.
@@ -92,8 +98,7 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout)
9298
/* A packet is lost if it has not been s/acked beyond
9399
* the recent RTT plus the reordering window.
94100
*/
95-
remaining = tp->rack.rtt_us + reo_wnd -
96-
tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp);
101+
remaining = tcp_rack_skb_timeout(tp, skb, reo_wnd);
97102
if (remaining <= 0) {
98103
tcp_mark_skb_lost(sk, skb);
99104
list_del_init(&skb->tcp_tsorted_anchor);

0 commit comments

Comments
 (0)