Skip to content

Commit f331981

Browse files
Eric Dumazetdavem330
authored andcommitted
tcp: pass previous skb to tcp_shifted_skb()
No need to recompute previous skb, as it will be a bit more expensive when rtx queue is converted to RB tree. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8ba6dda commit f331981

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

net/ipv4/tcp_input.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,13 +1288,13 @@ static u8 tcp_sacktag_one(struct sock *sk,
12881288
/* Shift newly-SACKed bytes from this skb to the immediately previous
12891289
* already-SACKed sk_buff. Mark the newly-SACKed bytes as such.
12901290
*/
1291-
static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
1291+
static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *prev,
1292+
struct sk_buff *skb,
12921293
struct tcp_sacktag_state *state,
12931294
unsigned int pcount, int shifted, int mss,
12941295
bool dup_sack)
12951296
{
12961297
struct tcp_sock *tp = tcp_sk(sk);
1297-
struct sk_buff *prev = tcp_write_queue_prev(sk, skb);
12981298
u32 start_seq = TCP_SKB_CB(skb)->seq; /* start of newly-SACKed */
12991299
u32 end_seq = start_seq + shifted; /* end of newly-SACKed */
13001300

@@ -1495,7 +1495,7 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
14951495

14961496
if (!skb_shift(prev, skb, len))
14971497
goto fallback;
1498-
if (!tcp_shifted_skb(sk, skb, state, pcount, len, mss, dup_sack))
1498+
if (!tcp_shifted_skb(sk, prev, skb, state, pcount, len, mss, dup_sack))
14991499
goto out;
15001500

15011501
/* Hole filled allows collapsing with the next as well, this is very
@@ -1514,7 +1514,8 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
15141514
len = skb->len;
15151515
if (skb_shift(prev, skb, len)) {
15161516
pcount += tcp_skb_pcount(skb);
1517-
tcp_shifted_skb(sk, skb, state, tcp_skb_pcount(skb), len, mss, 0);
1517+
tcp_shifted_skb(sk, prev, skb, state, tcp_skb_pcount(skb),
1518+
len, mss, 0);
15181519
}
15191520

15201521
out:

0 commit comments

Comments
 (0)