summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-14 01:36:35 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-14 01:36:35 +0300
commitd6b9ce75e87c5f4bfbc0f7bba4f4f7cbf942f98a (patch)
tree0b052e77f632b0cd080ffc5da3b5525e676f05f4 /net/ipv4/tcp_input.c
parent8d422b8beb76bfc57f0fe4b03082f3823eccd150 (diff)
parentd0fcf70c680e4d1669fcb3a8632f41400b9a73c2 (diff)
downloadlinux-d6b9ce75e87c5f4bfbc0f7bba4f4f7cbf942f98a.tar.xz
Merge tag 'stratix10_svc_fix_v6.18' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux into char-misc-linus
Dinh writes: firmware: stratix10-svc: fix saving contoller data for v6.18 - Fix the incorrect use of platform_set_drvdata and dev_set_drvdata * tag 'stratix10_svc_fix_v6.18' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux: (237 commits) firmware: stratix10-svc: fix bug in saving controller data Linux 6.18-rc4 objtool: Fix skip_alt_group() for non-alternative STAC/CLAC kconfig/nconf: Initialize the default locale at startup kconfig/mconf: Initialize the default locale at startup x86/mm: Ensure clear_page() variants always have __kcfi_typeid_ symbols PCI: Do not size non-existing prefetchable window Revert "PCI: qcom: Remove custom ASPM enablement code" bpf/arm64: Fix BPF_ST into arena memory bpf: Make migrate_disable always inline to avoid partial inlining null_blk: set dma alignment to logical block size xfs: document another racy GC case in xfs_zoned_map_extent xfs: prevent gc from picking the same zone twice drm/ast: Clear preserved bits from register output value s390: Disable ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP drm/imx: parallel-display: add the bridge before attaching it drm/imx: parallel-display: convert to devm_drm_bridge_alloc() API blk-crypto: use BLK_STS_INVAL for alignment errors regulator: bd718x7: Fix voltages scaled by resistor divider x86/cpu: Add/fix core comments for {Panther,Nova} Lake ...
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 31ea5af49f2d..e4a979b75cc6 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -891,18 +891,27 @@ static inline void tcp_rcv_rtt_measure_ts(struct sock *sk,
}
}
-void tcp_rcvbuf_grow(struct sock *sk)
+void tcp_rcvbuf_grow(struct sock *sk, u32 newval)
{
const struct net *net = sock_net(sk);
struct tcp_sock *tp = tcp_sk(sk);
- int rcvwin, rcvbuf, cap;
+ u32 rcvwin, rcvbuf, cap, oldval;
+ u64 grow;
+
+ oldval = tp->rcvq_space.space;
+ tp->rcvq_space.space = newval;
if (!READ_ONCE(net->ipv4.sysctl_tcp_moderate_rcvbuf) ||
(sk->sk_userlocks & SOCK_RCVBUF_LOCK))
return;
+ /* DRS is always one RTT late. */
+ rcvwin = newval << 1;
+
/* slow start: allow the sender to double its rate. */
- rcvwin = tp->rcvq_space.space << 1;
+ grow = (u64)rcvwin * (newval - oldval);
+ do_div(grow, oldval);
+ rcvwin += grow << 1;
if (!RB_EMPTY_ROOT(&tp->out_of_order_queue))
rcvwin += TCP_SKB_CB(tp->ooo_last_skb)->end_seq - tp->rcv_nxt;
@@ -943,9 +952,7 @@ void tcp_rcv_space_adjust(struct sock *sk)
trace_tcp_rcvbuf_grow(sk, time);
- tp->rcvq_space.space = copied;
-
- tcp_rcvbuf_grow(sk);
+ tcp_rcvbuf_grow(sk, copied);
new_measure:
tp->rcvq_space.seq = tp->copied_seq;
@@ -5270,7 +5277,7 @@ end:
}
/* do not grow rcvbuf for not-yet-accepted or orphaned sockets. */
if (sk->sk_socket)
- tcp_rcvbuf_grow(sk);
+ tcp_rcvbuf_grow(sk, tp->rcvq_space.space);
}
static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb,