Commit 6f094b9e authored by Lawrence Brakmo's avatar Lawrence Brakmo Committed by David S. Miller

tcp: add in_flight to tcp_skb_cb

Add in_flight (bytes in flight when packet was sent) field
to tx component of tcp_skb_cb and make it available to
congestion modules' pkts_acked() function through the
ack_sample function argument.
Signed-off-by: default avatarLawrence Brakmo <brakmo@fb.com>
Acked-by: default avatarYuchung Cheng <ycheng@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3e7fb80b
...@@ -767,6 +767,7 @@ struct tcp_skb_cb { ...@@ -767,6 +767,7 @@ struct tcp_skb_cb {
union { union {
struct { struct {
/* There is space for up to 20 bytes */ /* There is space for up to 20 bytes */
__u32 in_flight;/* Bytes in flight when packet sent */
} tx; /* only used for outgoing skbs */ } tx; /* only used for outgoing skbs */
union { union {
struct inet_skb_parm h4; struct inet_skb_parm h4;
...@@ -859,6 +860,7 @@ union tcp_cc_info; ...@@ -859,6 +860,7 @@ union tcp_cc_info;
struct ack_sample { struct ack_sample {
u32 pkts_acked; u32 pkts_acked;
s32 rtt_us; s32 rtt_us;
u32 in_flight;
}; };
struct tcp_congestion_ops { struct tcp_congestion_ops {
......
...@@ -3115,6 +3115,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, ...@@ -3115,6 +3115,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
long ca_rtt_us = -1L; long ca_rtt_us = -1L;
struct sk_buff *skb; struct sk_buff *skb;
u32 pkts_acked = 0; u32 pkts_acked = 0;
u32 last_in_flight = 0;
bool rtt_update; bool rtt_update;
int flag = 0; int flag = 0;
...@@ -3154,6 +3155,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, ...@@ -3154,6 +3155,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
if (!first_ackt.v64) if (!first_ackt.v64)
first_ackt = last_ackt; first_ackt = last_ackt;
last_in_flight = TCP_SKB_CB(skb)->tx.in_flight;
reord = min(pkts_acked, reord); reord = min(pkts_acked, reord);
if (!after(scb->end_seq, tp->high_seq)) if (!after(scb->end_seq, tp->high_seq))
flag |= FLAG_ORIG_SACK_ACKED; flag |= FLAG_ORIG_SACK_ACKED;
...@@ -3250,7 +3252,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, ...@@ -3250,7 +3252,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
if (icsk->icsk_ca_ops->pkts_acked) { if (icsk->icsk_ca_ops->pkts_acked) {
struct ack_sample sample = { .pkts_acked = pkts_acked, struct ack_sample sample = { .pkts_acked = pkts_acked,
.rtt_us = ca_rtt_us }; .rtt_us = ca_rtt_us,
.in_flight = last_in_flight };
icsk->icsk_ca_ops->pkts_acked(sk, &sample); icsk->icsk_ca_ops->pkts_acked(sk, &sample);
} }
......
...@@ -911,9 +911,12 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, ...@@ -911,9 +911,12 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
int err; int err;
BUG_ON(!skb || !tcp_skb_pcount(skb)); BUG_ON(!skb || !tcp_skb_pcount(skb));
tp = tcp_sk(sk);
if (clone_it) { if (clone_it) {
skb_mstamp_get(&skb->skb_mstamp); skb_mstamp_get(&skb->skb_mstamp);
TCP_SKB_CB(skb)->tx.in_flight = TCP_SKB_CB(skb)->end_seq
- tp->snd_una;
if (unlikely(skb_cloned(skb))) if (unlikely(skb_cloned(skb)))
skb = pskb_copy(skb, gfp_mask); skb = pskb_copy(skb, gfp_mask);
...@@ -924,7 +927,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, ...@@ -924,7 +927,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
} }
inet = inet_sk(sk); inet = inet_sk(sk);
tp = tcp_sk(sk);
tcb = TCP_SKB_CB(skb); tcb = TCP_SKB_CB(skb);
memset(&opts, 0, sizeof(opts)); memset(&opts, 0, sizeof(opts));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment