FROMGIT: net-tcp_bbr: v2: factor out tx.in_flight setting into tcp_set_tx_in_flight()

Factor out the code to set an skb's tx.in_flight field into its own
function, so that this code can be used for the TCP_REPAIR "fake send"
code path that inserts skbs into the rtx queue without sending
them. This is in preparation for the following patch, which fixes an
issue with TCP_REPAIR and tx.in_flight.

Tested: See last patch in series for sponge link.

Effort: net-tcp_bbr
Origin-9xx-SHA1: e880fc907d06ea7354333f60f712748ebce9497b
Change-Id: I4fbd4a6e18a51ab06d50ab1c9ad820ce5bea89af
(cherry-picked from f14b4e2b1c)
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
Neal Cardwell 2019-05-07 22:36:36 -04:00 committed by azrim
parent 0d4961e2c8
commit ec675cc5fa
No known key found for this signature in database
GPG Key ID: 497F8FB059B45D1C
2 changed files with 20 additions and 13 deletions

View File

@ -1131,6 +1131,7 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
}
/* From tcp_rate.c */
void tcp_set_tx_in_flight(struct sock *sk, struct sk_buff *skb);
void tcp_rate_skb_sent(struct sock *sk, struct sk_buff *skb);
void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb,
struct rate_sample *rs);

View File

@ -33,13 +33,30 @@
* ready to send in the write queue.
*/
void tcp_set_tx_in_flight(struct sock *sk, struct sk_buff *skb)
{
struct tcp_sock *tp = tcp_sk(sk);
u32 in_flight;
/* Check, sanitize, and record packets in flight after skb was sent. */
in_flight = tcp_packets_in_flight(tp) + tcp_skb_pcount(skb);
if (WARN_ONCE(in_flight > TCPCB_IN_FLIGHT_MAX,
"insane in_flight %u cc %s mss %u "
"cwnd %u pif %u %u %u %u\n",
in_flight, inet_csk(sk)->icsk_ca_ops->name,
tp->mss_cache, tp->snd_cwnd,
tp->packets_out, tp->retrans_out,
tp->sacked_out, tp->lost_out))
in_flight = TCPCB_IN_FLIGHT_MAX;
TCP_SKB_CB(skb)->tx.in_flight = in_flight;
}
/* Snapshot the current delivery information in the skb, to generate
* a rate sample later when the skb is (s)acked in tcp_rate_skb_delivered().
*/
void tcp_rate_skb_sent(struct sock *sk, struct sk_buff *skb)
{
struct tcp_sock *tp = tcp_sk(sk);
u32 in_flight;
/* In general we need to start delivery rate samples from the
* time we received the most recent ACK, to ensure we include
@ -66,18 +83,7 @@ void tcp_rate_skb_sent(struct sock *sk, struct sk_buff *skb)
TCP_SKB_CB(skb)->tx.delivered_ce = tp->delivered_ce;
TCP_SKB_CB(skb)->tx.lost = tp->lost;
TCP_SKB_CB(skb)->tx.is_app_limited = tp->app_limited ? 1 : 0;
/* Check, sanitize, and record packets in flight after skb was sent. */
in_flight = tcp_packets_in_flight(tp) + tcp_skb_pcount(skb);
WARN_ONCE(in_flight > TCPCB_IN_FLIGHT_MAX,
"insane in_flight %u cc %s mss %u "
"cwnd %u pif %u %u %u %u\n",
in_flight, inet_csk(sk)->icsk_ca_ops->name,
tp->mss_cache, tp->snd_cwnd,
tp->packets_out, tp->retrans_out,
tp->sacked_out, tp->lost_out);
in_flight = min(in_flight, TCPCB_IN_FLIGHT_MAX);
TCP_SKB_CB(skb)->tx.in_flight = in_flight;
tcp_set_tx_in_flight(sk, skb);
}
/* When an skb is sacked or acked, we fill in the rate sample with the (prior)