Skip to content

Commit

Permalink
mptcp: Skip unnecessary skb extension allocation for bare acks
Browse files Browse the repository at this point in the history
Bare TCP ack skbs are freed right after MPTCP sees them, so the work to
allocate, zero, and populate the MPTCP skb extension is wasted. Detect
these skbs and do not add skb extensions to them.

Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mat Martineau authored and David S. Miller committed Jul 29, 2020
1 parent 067a0b3 commit 06827b3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/mptcp/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,15 +868,18 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
if (mp_opt.use_ack)
update_una(msk, &mp_opt);

/* Zero-length packets, like bare ACKs carrying a DATA_FIN, are
* dropped by the caller and not propagated to the MPTCP layer.
* Copy the DATA_FIN information now.
/* Zero-data-length packets are dropped by the caller and not
* propagated to the MPTCP layer, so the skb extension does not
* need to be allocated or populated. DATA_FIN information, if
* present, needs to be updated here before the skb is freed.
*/
if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) {
if (mp_opt.data_fin && mp_opt.data_len == 1 &&
mptcp_update_rcv_data_fin(msk, mp_opt.data_seq) &&
schedule_work(&msk->work))
sock_hold(subflow->conn);

return;
}

mpext = skb_ext_add(skb, SKB_EXT_MPTCP);
Expand Down

0 comments on commit 06827b3

Please sign in to comment.