Skip to content

Commit 8099201

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: add work queue skeleton
Will be extended with functionality in followup patches. Initial user is moving skbs from subflows receive queue to the mptcp-level receive queue. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 101f6f8 commit 8099201

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

net/mptcp/protocol.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,24 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
551551
}
552552
}
553553

554+
static void mptcp_worker(struct work_struct *work)
555+
{
556+
struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work);
557+
struct sock *sk = &msk->sk.icsk_inet.sk;
558+
559+
lock_sock(sk);
560+
561+
release_sock(sk);
562+
sock_put(sk);
563+
}
564+
554565
static int __mptcp_init_sock(struct sock *sk)
555566
{
556567
struct mptcp_sock *msk = mptcp_sk(sk);
557568

558569
INIT_LIST_HEAD(&msk->conn_list);
559570
__set_bit(MPTCP_SEND_SPACE, &msk->flags);
571+
INIT_WORK(&msk->work, mptcp_worker);
560572

561573
msk->first = NULL;
562574

@@ -571,6 +583,14 @@ static int mptcp_init_sock(struct sock *sk)
571583
return __mptcp_init_sock(sk);
572584
}
573585

586+
static void mptcp_cancel_work(struct sock *sk)
587+
{
588+
struct mptcp_sock *msk = mptcp_sk(sk);
589+
590+
if (cancel_work_sync(&msk->work))
591+
sock_put(sk);
592+
}
593+
574594
static void mptcp_subflow_shutdown(struct sock *ssk, int how)
575595
{
576596
lock_sock(ssk);
@@ -616,6 +636,8 @@ static void mptcp_close(struct sock *sk, long timeout)
616636
__mptcp_close_ssk(sk, ssk, subflow, timeout);
617637
}
618638

639+
mptcp_cancel_work(sk);
640+
619641
sk_common_release(sk);
620642
}
621643

net/mptcp/protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct mptcp_sock {
7070
u32 token;
7171
unsigned long flags;
7272
bool can_ack;
73+
struct work_struct work;
7374
struct list_head conn_list;
7475
struct skb_ext *cached_ext; /* for the next sendmsg */
7576
struct socket *subflow; /* outgoing connect/listener/!mp_capable */

0 commit comments

Comments
 (0)