mptcp: Bypass kernel PM when userspace PM is enabled
authorMat Martineau <mathew.j.martineau@linux.intel.com>
Wed, 27 Apr 2022 22:49:59 +0000 (15:49 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 30 Apr 2022 00:25:14 +0000 (17:25 -0700)
When a MPTCP connection is managed by a userspace PM, bypass the kernel
PM for incoming advertisements and subflow events. Netlink events are
still sent to userspace.

v2: Remove unneeded check in mptcp_pm_rm_addr_received() (Kishen Maloor)
v3: Add and use helper function for PM mode (Paolo Abeni)

Acked-by: Paolo Abeni <pabeni@redhat.com>
Co-developed-by: Kishen Maloor <kishen.maloor@intel.com>
Signed-off-by: Kishen Maloor <kishen.maloor@intel.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/pm.c
net/mptcp/protocol.h

index f9f1bf4be95ed505124ee69f50f34b7d7f299e85..5320270b3926fa9ebadc3f2b8dc27d846efd428b 100644 (file)
@@ -208,7 +208,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 
        spin_lock_bh(&pm->lock);
 
-       if (!READ_ONCE(pm->accept_addr)) {
+       if (!READ_ONCE(pm->accept_addr) || mptcp_pm_is_userspace(msk)) {
                mptcp_pm_announce_addr(msk, addr, true);
                mptcp_pm_add_addr_send_ack(msk);
        } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) {
index f65395f04f811921c2544fafa4e22006ab777235..79606e9d3f2ad11727cc79857f767a48664d2dc6 100644 (file)
@@ -805,6 +805,11 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk)
        return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL);
 }
 
+static inline bool mptcp_pm_is_userspace(const struct mptcp_sock *msk)
+{
+       return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_USERSPACE;
+}
+
 static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port)
 {
        u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE;