All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni at redhat.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH net-next 12/13] mptcp: call tcp_cleanup_rbuf on subflows
Date: Fri, 11 Sep 2020 15:52:07 +0200	[thread overview]
Message-ID: <c3bd57834ebaf9030e6021c5bd51d169c995ab64.1599832097.git.pabeni@redhat.com> (raw)
In-Reply-To: cover.1599832097.git.pabeni@redhat.com

[-- Attachment #1: Type: text/plain, Size: 2885 bytes --]

That is needed to let the subflows announce promptly when new
space is available in the receive buffer.

tcp_cleanup_rbuf() is currently a static function, drop the
scope modifier and add a declaration in the TCP header.

Reviewed-by: Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
 include/net/tcp.h    | 2 ++
 net/ipv4/tcp.c       | 2 +-
 net/mptcp/protocol.c | 6 ++++++
 net/mptcp/subflow.c  | 2 ++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index e85d564446c6..852f0d71dd40 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1414,6 +1414,8 @@ static inline int tcp_full_space(const struct sock *sk)
 	return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf));
 }
 
+void tcp_cleanup_rbuf(struct sock *sk, int copied);
+
 /* We provision sk_rcvbuf around 200% of sk_rcvlowat.
  * If 87.5 % (7/8) of the space has been consumed, we want to override
  * SO_RCVLOWAT constraint, since we are receiving skbs with too small
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 57a568875539..d3781b6087cb 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1527,7 +1527,7 @@ static int tcp_peek_sndq(struct sock *sk, struct msghdr *msg, int len)
  * calculation of whether or not we must ACK for the sake of
  * a window update.
  */
-static void tcp_cleanup_rbuf(struct sock *sk, int copied)
+void tcp_cleanup_rbuf(struct sock *sk, int copied)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	bool time_to_ack = false;
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 148c4e685ecd..a17e534a1425 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -515,6 +515,8 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
 	} while (more_data_avail);
 
 	*bytes += moved;
+	if (moved)
+		tcp_cleanup_rbuf(ssk, moved);
 
 	return done;
 }
@@ -1422,10 +1424,14 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 			 */
 			mptcp_for_each_subflow(msk, subflow) {
 				struct sock *ssk;
+				bool slow;
 
 				ssk = mptcp_subflow_tcp_sock(subflow);
+				slow = lock_sock_fast(ssk);
 				WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf);
 				tcp_sk(ssk)->window_clamp = window_clamp;
+				tcp_cleanup_rbuf(ssk, 1);
+				unlock_sock_fast(ssk, slow);
 			}
 		}
 	}
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 58f2349930a5..fb59bbd9b4cc 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -823,6 +823,8 @@ static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb,
 		sk_eat_skb(ssk, skb);
 	if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len)
 		subflow->map_valid = 0;
+	if (incr)
+		tcp_cleanup_rbuf(ssk, incr);
 }
 
 static bool subflow_check_data_avail(struct sock *ssk)
-- 
2.26.2

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	mptcp@lists.01.org
Subject: [PATCH net-next 12/13] mptcp: call tcp_cleanup_rbuf on subflows
Date: Fri, 11 Sep 2020 15:52:07 +0200	[thread overview]
Message-ID: <c3bd57834ebaf9030e6021c5bd51d169c995ab64.1599832097.git.pabeni@redhat.com> (raw)
In-Reply-To: <cover.1599832097.git.pabeni@redhat.com>

That is needed to let the subflows announce promptly when new
space is available in the receive buffer.

tcp_cleanup_rbuf() is currently a static function, drop the
scope modifier and add a declaration in the TCP header.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 include/net/tcp.h    | 2 ++
 net/ipv4/tcp.c       | 2 +-
 net/mptcp/protocol.c | 6 ++++++
 net/mptcp/subflow.c  | 2 ++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index e85d564446c6..852f0d71dd40 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1414,6 +1414,8 @@ static inline int tcp_full_space(const struct sock *sk)
 	return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf));
 }
 
+void tcp_cleanup_rbuf(struct sock *sk, int copied);
+
 /* We provision sk_rcvbuf around 200% of sk_rcvlowat.
  * If 87.5 % (7/8) of the space has been consumed, we want to override
  * SO_RCVLOWAT constraint, since we are receiving skbs with too small
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 57a568875539..d3781b6087cb 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1527,7 +1527,7 @@ static int tcp_peek_sndq(struct sock *sk, struct msghdr *msg, int len)
  * calculation of whether or not we must ACK for the sake of
  * a window update.
  */
-static void tcp_cleanup_rbuf(struct sock *sk, int copied)
+void tcp_cleanup_rbuf(struct sock *sk, int copied)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	bool time_to_ack = false;
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 148c4e685ecd..a17e534a1425 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -515,6 +515,8 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
 	} while (more_data_avail);
 
 	*bytes += moved;
+	if (moved)
+		tcp_cleanup_rbuf(ssk, moved);
 
 	return done;
 }
@@ -1422,10 +1424,14 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 			 */
 			mptcp_for_each_subflow(msk, subflow) {
 				struct sock *ssk;
+				bool slow;
 
 				ssk = mptcp_subflow_tcp_sock(subflow);
+				slow = lock_sock_fast(ssk);
 				WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf);
 				tcp_sk(ssk)->window_clamp = window_clamp;
+				tcp_cleanup_rbuf(ssk, 1);
+				unlock_sock_fast(ssk, slow);
 			}
 		}
 	}
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 58f2349930a5..fb59bbd9b4cc 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -823,6 +823,8 @@ static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb,
 		sk_eat_skb(ssk, skb);
 	if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len)
 		subflow->map_valid = 0;
+	if (incr)
+		tcp_cleanup_rbuf(ssk, incr);
 }
 
 static bool subflow_check_data_avail(struct sock *ssk)
-- 
2.26.2


             reply	other threads:[~2020-09-11 13:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 13:52 Paolo Abeni [this message]
2020-09-11 13:52 ` [PATCH net-next 12/13] mptcp: call tcp_cleanup_rbuf on subflows Paolo Abeni
  -- strict thread matches above, loose matches on Subject: below --
2020-09-11 17:34 [MPTCP] Re: [PATCH net-next 11/13] mptcp: allow picking different xmit subflows Paolo Abeni
2020-09-11 17:34 ` Paolo Abeni
2020-09-11 13:52 [MPTCP] [PATCH net-next 13/13] mptcp: simult flow self-tests Paolo Abeni
2020-09-11 13:52 ` Paolo Abeni
2020-09-11 13:52 [MPTCP] [PATCH net-next 11/13] mptcp: allow picking different xmit subflows Paolo Abeni
2020-09-11 13:52 ` Paolo Abeni
2020-09-11 23:43 ` kernel test robot
2020-09-11 13:52 [MPTCP] [PATCH net-next 10/13] mptcp: allow creating non-backup subflows Paolo Abeni
2020-09-11 13:52 ` Paolo Abeni
2020-09-11 13:52 [MPTCP] [PATCH net-next 09/13] mptcp: move address attribute into mptcp_addr_info Paolo Abeni
2020-09-11 13:52 ` Paolo Abeni
2020-09-11 13:52 [MPTCP] [PATCH net-next 08/13] mptcp: add OoO related mibs Paolo Abeni
2020-09-11 13:52 ` Paolo Abeni
2020-09-11 13:52 [MPTCP] [PATCH net-next 07/13] mptcp: cleanup mptcp_subflow_discard_data() Paolo Abeni
2020-09-11 13:52 ` Paolo Abeni
2020-09-11 13:52 [MPTCP] [PATCH net-next 06/13] mptcp: move ooo skbs into msk out of order queue Paolo Abeni
2020-09-11 13:52 ` Paolo Abeni
2020-09-11 13:52 [MPTCP] [PATCH net-next 05/13] mptcp: introduce and use mptcp_try_coalesce() Paolo Abeni
2020-09-11 13:52 ` Paolo Abeni
2020-09-11 13:51 [MPTCP] [PATCH net-next 04/13] mptcp: basic sndbuf autotuning Paolo Abeni
2020-09-11 13:51 ` Paolo Abeni
2020-09-11 13:51 [MPTCP] [PATCH net-next 03/13] mptcp: trigger msk processing even for OoO data Paolo Abeni
2020-09-11 13:51 ` Paolo Abeni
2020-09-11 13:51 [MPTCP] [PATCH net-next 02/13] mptcp: set data_ready status bit in subflow_check_data_avail() Paolo Abeni
2020-09-11 13:51 ` Paolo Abeni
2020-09-11 13:51 [MPTCP] [PATCH net-next 01/13] mptcp: rethink 'is writable' conditional Paolo Abeni
2020-09-11 13:51 ` Paolo Abeni
2020-09-11 13:51 [MPTCP] [PATCH net-next 00/13] mptcp: introduce support for real multipath xmit Paolo Abeni
2020-09-11 13:51 ` Paolo Abeni

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=c3bd57834ebaf9030e6021c5bd51d169c995ab64.1599832097.git.pabeni@redhat.com \
    --to=unknown@example.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.