diff options
author | Paolo Abeni <pabeni@redhat.com> | 2022-04-08 22:45:55 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-04-11 13:55:53 +0300 |
commit | 43f5b111d1ff16161ce60e19aeddb999cb6f0b01 (patch) | |
tree | 01d06078d894393c44c35ae025494bdbd1baaf27 /net/mptcp/pm.c | |
parent | 65a569b03ca832ebc93ce45a7466137e2bb62254 (diff) | |
download | linux-43f5b111d1ff16161ce60e19aeddb999cb6f0b01.tar.xz |
mptcp: reset the packet scheduler on incoming MP_PRIO
When an incoming MP_PRIO option changes the backup
status of any subflow, we need to reset the packet
scheduler status, or the next send could keep using
the previously selected subflow, without taking in account
the new priorities.
Reported-by: Davide Caratti <dcaratti@redhat.com>
Fixes: 40453a5c61f4 ("mptcp: add the incoming MP_PRIO support")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp/pm.c')
-rw-r--r-- | net/mptcp/pm.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 01809eef29b4..8aa0cdb7ad46 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -262,14 +262,25 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, spin_unlock_bh(&pm->lock); } -void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup) +void mptcp_pm_mp_prio_received(struct sock *ssk, u8 bkup) { - struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + struct sock *sk = subflow->conn; + struct mptcp_sock *msk; pr_debug("subflow->backup=%d, bkup=%d\n", subflow->backup, bkup); - subflow->backup = bkup; + msk = mptcp_sk(sk); + if (subflow->backup != bkup) { + subflow->backup = bkup; + mptcp_data_lock(sk); + if (!sock_owned_by_user(sk)) + msk->last_snd = NULL; + else + __set_bit(MPTCP_RESET_SCHEDULER, &msk->cb_flags); + mptcp_data_unlock(sk); + } - mptcp_event(MPTCP_EVENT_SUB_PRIORITY, mptcp_sk(subflow->conn), sk, GFP_ATOMIC); + mptcp_event(MPTCP_EVENT_SUB_PRIORITY, msk, ssk, GFP_ATOMIC); } void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq) |