Skip to content

Commit d5fbeff

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: move __mptcp_error_report in protocol.c
This will simplify the next patch ("mptcp: process pending subflow error on close"). No functional change intended. Cc: [email protected] # v5.12+ Signed-off-by: Paolo Abeni <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: Matthieu Baerts <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6bec041 commit d5fbeff

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

net/mptcp/protocol.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,42 @@ static bool __mptcp_ofo_queue(struct mptcp_sock *msk)
770770
return moved;
771771
}
772772

773+
void __mptcp_error_report(struct sock *sk)
774+
{
775+
struct mptcp_subflow_context *subflow;
776+
struct mptcp_sock *msk = mptcp_sk(sk);
777+
778+
mptcp_for_each_subflow(msk, subflow) {
779+
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
780+
int err = sock_error(ssk);
781+
int ssk_state;
782+
783+
if (!err)
784+
continue;
785+
786+
/* only propagate errors on fallen-back sockets or
787+
* on MPC connect
788+
*/
789+
if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(msk))
790+
continue;
791+
792+
/* We need to propagate only transition to CLOSE state.
793+
* Orphaned socket will see such state change via
794+
* subflow_sched_work_if_closed() and that path will properly
795+
* destroy the msk as needed.
796+
*/
797+
ssk_state = inet_sk_state_load(ssk);
798+
if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD))
799+
inet_sk_state_store(sk, ssk_state);
800+
WRITE_ONCE(sk->sk_err, -err);
801+
802+
/* This barrier is coupled with smp_rmb() in mptcp_poll() */
803+
smp_wmb();
804+
sk_error_report(sk);
805+
break;
806+
}
807+
}
808+
773809
/* In most cases we will be able to lock the mptcp socket. If its already
774810
* owned, we need to defer to the work queue to avoid ABBA deadlock.
775811
*/

net/mptcp/subflow.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,42 +1362,6 @@ void mptcp_space(const struct sock *ssk, int *space, int *full_space)
13621362
*full_space = mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf));
13631363
}
13641364

1365-
void __mptcp_error_report(struct sock *sk)
1366-
{
1367-
struct mptcp_subflow_context *subflow;
1368-
struct mptcp_sock *msk = mptcp_sk(sk);
1369-
1370-
mptcp_for_each_subflow(msk, subflow) {
1371-
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
1372-
int err = sock_error(ssk);
1373-
int ssk_state;
1374-
1375-
if (!err)
1376-
continue;
1377-
1378-
/* only propagate errors on fallen-back sockets or
1379-
* on MPC connect
1380-
*/
1381-
if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(msk))
1382-
continue;
1383-
1384-
/* We need to propagate only transition to CLOSE state.
1385-
* Orphaned socket will see such state change via
1386-
* subflow_sched_work_if_closed() and that path will properly
1387-
* destroy the msk as needed.
1388-
*/
1389-
ssk_state = inet_sk_state_load(ssk);
1390-
if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD))
1391-
inet_sk_state_store(sk, ssk_state);
1392-
WRITE_ONCE(sk->sk_err, -err);
1393-
1394-
/* This barrier is coupled with smp_rmb() in mptcp_poll() */
1395-
smp_wmb();
1396-
sk_error_report(sk);
1397-
break;
1398-
}
1399-
}
1400-
14011365
static void subflow_error_report(struct sock *ssk)
14021366
{
14031367
struct sock *sk = mptcp_subflow_ctx(ssk)->conn;

0 commit comments

Comments
 (0)