MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: netdev@vger.kernel.org
Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>,
	davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	matthieu.baerts@tessares.net, mptcp@lists.linux.dev,
	Kishen Maloor <kishen.maloor@intel.com>
Subject: [PATCH net-next 3/6] mptcp: Bypass kernel PM when userspace PM is enabled
Date: Wed, 27 Apr 2022 15:49:59 -0700	[thread overview]
Message-ID: <20220427225002.231996-4-mathew.j.martineau@linux.intel.com> (raw)
In-Reply-To: <20220427225002.231996-1-mathew.j.martineau@linux.intel.com>

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>
---
 net/mptcp/pm.c       | 2 +-
 net/mptcp/protocol.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index f9f1bf4be95e..5320270b3926 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -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)) {
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index f65395f04f81..79606e9d3f2a 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -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;
-- 
2.36.0


  parent reply	other threads:[~2022-04-27 22:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27 22:49 [PATCH net-next 0/6] mptcp: Path manager mode selection Mat Martineau
2022-04-27 22:49 ` [PATCH net-next 1/6] mptcp: Remove redundant assignments in path manager init Mat Martineau
2022-04-27 22:49 ` [PATCH net-next 2/6] mptcp: Add a member to mptcp_pm_data to track kernel vs userspace mode Mat Martineau
2022-04-27 22:49 ` Mat Martineau [this message]
2022-04-27 22:50 ` [PATCH net-next 4/6] mptcp: Make kernel path manager check for userspace-managed sockets Mat Martineau
2022-04-27 22:50 ` [PATCH net-next 5/6] mptcp: Add a per-namespace sysctl to set the default path manager type Mat Martineau
2022-04-27 22:50 ` [PATCH net-next 6/6] selftests: mptcp: Add tests for userspace PM type Mat Martineau
2022-04-29  1:57 ` [PATCH net-next 0/6] mptcp: Path manager mode selection Jakub Kicinski
2022-04-29  3:39   ` Mat Martineau
2022-04-30  0:51     ` Jakub Kicinski
2022-04-30  1:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220427225002.231996-4-mathew.j.martineau@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=kishen.maloor@intel.com \
    --cc=kuba@kernel.org \
    --cc=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox