netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: Eric Dumazet <edumazet@google.com>,
	mptcp@lists.01.org, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 06/13] mptcp: add accounting for pending data
Date: Thu, 12 Nov 2020 18:45:26 +0100	[thread overview]
Message-ID: <653b54ab33745d31c601ca0cd0754d181170838f.1605199807.git.pabeni@redhat.com> (raw)
In-Reply-To: <cover.1605199807.git.pabeni@redhat.com>

Preparation patch to track the data pending in the msk
write queue. No functional change introduced here

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/protocol.c |  1 +
 net/mptcp/protocol.h | 38 +++++++++++++++++++++++++++++++++++---
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 691fdb2071cf..0c07bed2bd28 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1859,6 +1859,7 @@ static int __mptcp_init_sock(struct sock *sk)
 	__set_bit(MPTCP_SEND_SPACE, &msk->flags);
 	INIT_WORK(&msk->work, mptcp_worker);
 	msk->out_of_order_queue = RB_ROOT;
+	msk->first_pending = NULL;
 
 	msk->first = NULL;
 	inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss;
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 5211564a533f..ec17f9c367c5 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -187,9 +187,10 @@ struct mptcp_pm_data {
 struct mptcp_data_frag {
 	struct list_head list;
 	u64 data_seq;
-	int data_len;
-	int offset;
-	int overhead;
+	u16 data_len;
+	u16 offset;
+	u16 overhead;
+	u16 already_sent;
 	struct page *page;
 };
 
@@ -219,6 +220,7 @@ struct mptcp_sock {
 	struct rb_root  out_of_order_queue;
 	struct list_head conn_list;
 	struct list_head rtx_queue;
+	struct mptcp_data_frag *first_pending;
 	struct list_head join_list;
 	struct skb_ext	*cached_ext;	/* for the next sendmsg */
 	struct socket	*subflow; /* outgoing connect/listener/!mp_capable */
@@ -240,6 +242,36 @@ static inline struct mptcp_sock *mptcp_sk(const struct sock *sk)
 	return (struct mptcp_sock *)sk;
 }
 
+static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk)
+{
+	const struct mptcp_sock *msk = mptcp_sk(sk);
+
+	return READ_ONCE(msk->first_pending);
+}
+
+static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk)
+{
+	struct mptcp_sock *msk = mptcp_sk(sk);
+	struct mptcp_data_frag *cur;
+
+	cur = msk->first_pending;
+	return list_is_last(&cur->list, &msk->rtx_queue) ? NULL :
+						     list_next_entry(cur, list);
+}
+
+static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk)
+{
+	struct mptcp_sock *msk = mptcp_sk(sk);
+
+	if (!msk->first_pending)
+		return NULL;
+
+	if (WARN_ON_ONCE(list_empty(&msk->rtx_queue)))
+		return NULL;
+
+	return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
+}
+
 static inline struct mptcp_data_frag *mptcp_rtx_tail(const struct sock *sk)
 {
 	struct mptcp_sock *msk = mptcp_sk(sk);
-- 
2.26.2


  parent reply	other threads:[~2020-11-12 17:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 17:45 [PATCH net-next v2 00/13] mptcp: improve multiple xmit streams support Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 01/13] tcp: factor out tcp_build_frag() Paolo Abeni
2020-11-12 23:08   ` Jakub Kicinski
2020-11-12 23:12     ` Jakub Kicinski
2020-11-13 10:38       ` Paolo Abeni
2020-11-14 21:02         ` Jakub Kicinski
2020-11-12 17:45 ` [PATCH net-next v2 02/13] mptcp: use tcp_build_frag() Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 03/13] tcp: factor out __tcp_close() helper Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 04/13] mptcp: introduce mptcp_schedule_work Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 05/13] mptcp: reduce the arguments of mptcp_sendmsg_frag Paolo Abeni
2020-11-12 17:45 ` Paolo Abeni [this message]
2020-11-12 17:45 ` [PATCH net-next v2 07/13] mptcp: introduce MPTCP snd_nxt Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 08/13] mptcp: refactor shutdown and close Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 09/13] mptcp: move page frag allocation in mptcp_sendmsg() Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 10/13] mptcp: try to push pending data on snd una updates Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 11/13] mptcp: rework poll+nospace handling Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 12/13] mptcp: keep track of advertised windows right edge Paolo Abeni
2020-11-12 17:45 ` [PATCH net-next v2 13/13] mptcp: send explicit ack on delayed ack_seq incr Paolo Abeni
2020-11-14 21:05 ` [PATCH net-next v2 00/13] mptcp: improve multiple xmit streams support Jakub Kicinski
2020-11-15 15:46   ` 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=653b54ab33745d31c601ca0cd0754d181170838f.1605199807.git.pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=mptcp@lists.01.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).