* [MPTCP] [PATCH] mptcp: Re-factor expand_ack
@ 2020-01-16 1:13 Peter Krystad
0 siblings, 0 replies; only message in thread
From: Peter Krystad @ 2020-01-16 1:13 UTC (permalink / raw)
To: mptcp
[-- 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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-01-16 1:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-16 1:13 [MPTCP] [PATCH] mptcp: Re-factor expand_ack Peter Krystad
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.