From: Peter Krystad <peter.krystad at linux.intel.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH] mptcp: Re-factor expand_ack
Date: Wed, 15 Jan 2020 17:13:24 -0800 [thread overview]
Message-ID: <20200116011324.3253-1-peter.krystad@linux.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1866 bytes --]
Modify this commit to handle separately-stored 32-bit data acks.
squashto: update per unacked sequence on pkt reception
Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
net/mptcp/options.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index bd1c3ba134ae..6ad0cdfa6de2 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -674,15 +674,16 @@ static bool check_fourth_ack(struct mptcp_subflow_context *subflow,
return true;
}
-static u64 expand_ack(u64 old_ack, u64 cur_ack, bool use_64bit)
+static u64 expand_ack(u64 old_ack, u32 cur_ack32)
{
- u32 old_ack32, cur_ack32;
-
- if (use_64bit)
- return cur_ack;
+ u32 old_ack32;
+ u64 cur_ack;
+ /* avoid ack expansion on update conflict, to reduce the risk of
+ * wrongly expanding to a future ack sequence number, which is way
+ * more dangerous than missing an ack
+ */
old_ack32 = (u32)old_ack;
- cur_ack32 = (u32)cur_ack;
cur_ack = (old_ack & GENMASK_ULL(63, 32)) + cur_ack32;
if (unlikely(before(cur_ack32, old_ack32)))
return cur_ack + (1LL << 32);
@@ -695,11 +696,10 @@ static void update_una(struct mptcp_sock *msk,
u64 new_snd_una, snd_una, old_snd_una = atomic64_read(&msk->snd_una);
u64 write_seq = READ_ONCE(msk->write_seq);
- /* avoid ack expansion on update conflict, to reduce the risk of
- * wrongly expanding to a future ack sequence number, which is way
- * more dangerous than missing an ack
- */
- new_snd_una = expand_ack(old_snd_una, mp_opt->data_ack, mp_opt->ack64);
+ if (mp_opt->ack64)
+ new_snd_una = mp_opt->data_ack;
+ else
+ new_snd_una = expand_ack(old_snd_una, (u32)mp_opt->data_ack);
/* ACK for data not even sent yet? Ignore. */
if (after64(new_snd_una, write_seq))
--
2.17.2
reply other threads:[~2020-01-16 1:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200116011324.3253-1-peter.krystad@linux.intel.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.