Skip to content

Commit

Permalink
mptcp: push pending frames when subflow has free space
Browse files Browse the repository at this point in the history
When multiple subflows are active, we can receive a
window update on subflow with no write space available.
MPTCP will try to push frames on such subflow and will
fail. Pending frames will be pushed only after receiving
a window update on a subflow with some wspace available.

Overall the above could lead to suboptimal aggregate
bandwidth usage.

Instead, we should try to push pending frames as soon as
the subflow reaches both conditions mentioned above.

We can finally enable self-tests with asymmetric links,
as the above makes them finally pass.

Reviewed-by: Mat Martineau <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
Paolo Abeni authored and matttbe committed Dec 10, 2020
1 parent c8e3117 commit bbaa110
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
13 changes: 8 additions & 5 deletions net/mptcp/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,10 +873,13 @@ static void ack_update_msk(struct mptcp_sock *msk,

new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd;

if (after64(new_wnd_end, msk->wnd_end)) {
if (after64(new_wnd_end, msk->wnd_end))
msk->wnd_end = new_wnd_end;
__mptcp_wnd_updated(sk, ssk);
}

/* this assumes mptcp_incoming_options() is invoked after tcp_ack() */
if (after64(msk->wnd_end, READ_ONCE(msk->snd_nxt)) &&
sk_stream_memory_free(sk))
__mptcp_check_push(sk, ssk);

if (after64(new_snd_una, old_snd_una)) {
msk->snd_una = new_snd_una;
Expand Down Expand Up @@ -942,8 +945,8 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
* helpers are cheap.
*/
mptcp_data_lock(subflow->conn);
if (mptcp_send_head(subflow->conn))
__mptcp_wnd_updated(subflow->conn, sk);
if (sk_stream_memory_free(sk))
__mptcp_check_push(subflow->conn, sk);
__mptcp_data_acked(subflow->conn);
mptcp_data_unlock(subflow->conn);
return;
Expand Down
2 changes: 1 addition & 1 deletion net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2913,7 +2913,7 @@ void __mptcp_data_acked(struct sock *sk)
mptcp_schedule_work(sk);
}

void __mptcp_wnd_updated(struct sock *sk, struct sock *ssk)
void __mptcp_check_push(struct sock *sk, struct sock *ssk)
{
if (!mptcp_send_head(sk))
return;
Expand Down
2 changes: 1 addition & 1 deletion net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk);
void mptcp_data_ready(struct sock *sk, struct sock *ssk);
bool mptcp_finish_join(struct sock *sk);
bool mptcp_schedule_work(struct sock *sk);
void __mptcp_wnd_updated(struct sock *sk, struct sock *ssk);
void __mptcp_check_push(struct sock *sk, struct sock *ssk);
void __mptcp_data_acked(struct sock *sk);
void mptcp_subflow_eof(struct sock *sk);
bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit);
Expand Down
6 changes: 3 additions & 3 deletions tools/testing/selftests/net/mptcp/simult_flows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ run_test 10 10 0 0 "balanced bwidth"
run_test 10 10 1 50 "balanced bwidth with unbalanced delay"

# we still need some additional infrastructure to pass the following test-cases
# run_test 30 10 0 0 "unbalanced bwidth"
# run_test 30 10 1 50 "unbalanced bwidth with unbalanced delay"
# run_test 30 10 50 1 "unbalanced bwidth with opposed, unbalanced delay"
run_test 30 10 0 0 "unbalanced bwidth"
run_test 30 10 1 50 "unbalanced bwidth with unbalanced delay"
run_test 30 10 50 1 "unbalanced bwidth with opposed, unbalanced delay"
exit $ret

0 comments on commit bbaa110

Please sign in to comment.