summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-03-14 18:02:52 +0300
committerJakub Kicinski <kuba@kernel.org>2026-03-14 18:02:52 +0300
commitb58e3a2d014567a9092eb026fe677ff4bed5af38 (patch)
tree05110a05efb4bacc1c87491ef69ef50eea499dc2 /include
parent9089c5f3c444ad6e9eb172e9375615ed0b0bc31c (diff)
parent3eb371eddad0a47183dd4434de9c9190d0f721c5 (diff)
downloadlinux-b58e3a2d014567a9092eb026fe677ff4bed5af38.tar.xz
Merge branch 'tcp-rfc-7323-compliant-window-retraction-handling'
Simon Baatz says: ==================== tcp: RFC 7323-compliant window retraction handling this series implements the receiver-side requirements for TCP window retraction as specified in RFC 7323 and adds packetdrill tests to cover the new behavior. Please see the first patch for background and implementation details. Since MPTCP adjusts the TCP receive window on subflows, the relevant MPTCP code paths are updated accordingly. ==================== Link: https://patch.msgid.link/20260309-tcp_rfc7323_retract_wnd_rfc-v3-0-4c7f96b1ec69@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/tcp.h3
-rw-r--r--include/net/tcp.h22
2 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index bcebc4f07532..6982f10e826b 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -316,6 +316,9 @@ struct tcp_sock {
*/
u32 app_limited; /* limited until "delivered" reaches this val */
u32 rcv_wnd; /* Current receiver window */
+ u32 rcv_mwnd_seq; /* Maximum window sequence number (RFC 7323,
+ * section 2.4, receiver requirements)
+ */
u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
/*
* Options received (usually on last packet, some only on SYN packets).
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 48dffcca0a71..f87bdacb5a69 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -934,6 +934,28 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
return (u32) win;
}
+/* Compute the maximum receive window we ever advertised.
+ * Rcv_nxt can be after the window if our peer push more data
+ * than the offered window.
+ */
+static inline u32 tcp_max_receive_window(const struct tcp_sock *tp)
+{
+ s32 win = tp->rcv_mwnd_seq - tp->rcv_nxt;
+
+ if (win < 0)
+ win = 0;
+ return (u32) win;
+}
+
+/* Check if we need to update the maximum receive window sequence number */
+static inline void tcp_update_max_rcv_wnd_seq(struct tcp_sock *tp)
+{
+ u32 wre = tp->rcv_wup + tp->rcv_wnd;
+
+ if (after(wre, tp->rcv_mwnd_seq))
+ tp->rcv_mwnd_seq = wre;
+}
+
/* Choose a new window, without checks for shrinking, and without
* scaling applied to the result. The caller does these things
* if necessary. This is a "raw" window selection.