Skip to content

Commit

Permalink
tcp: Introduce mss_cache_set_by_ca for CCA to set MSS
Browse files Browse the repository at this point in the history
Signed-off-by: Chia-Yu Chang <[email protected]>
  • Loading branch information
minuscat committed Aug 19, 2024
1 parent 10e5f2f commit 57f3db5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/linux/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ struct tcp_sock {
u32 snd_wnd; /* The window we expect to receive */
u32 max_window; /* Maximal window ever seen from peer */
u32 mss_cache; /* Cached effective mss, not including SACKS */
bool mss_cache_set_by_ca;

u32 window_clamp; /* Maximal window to advertise */
u32 rcv_ssthresh; /* Current window clamp */
Expand Down
1 change: 1 addition & 0 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ void tcp_init_sock(struct sock *sk)
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
tp->snd_cwnd_clamp = ~0;
tp->mss_cache = TCP_MSS_DEFAULT;
tp->mss_cache_set_by_ca = false;

tp->reordering = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reordering);
tcp_assign_congestion_control(sk);
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu)
struct inet_connection_sock *icsk = inet_csk(sk);
int mss_now;

if (icsk->icsk_mtup.search_high > pmtu)
if (icsk->icsk_mtup.search_high > pmtu && !tp->mss_cache_set_by_ca)
icsk->icsk_mtup.search_high = pmtu;

mss_now = tcp_mtu_to_mss(sk, pmtu);
Expand Down Expand Up @@ -2048,7 +2048,7 @@ unsigned int tcp_current_mss(struct sock *sk)

mss_now = tp->mss_cache;

if (dst) {
if (dst && !tp->mss_cache_set_by_ca) {
u32 mtu = dst_mtu(dst);
if (mtu != inet_csk(sk)->icsk_pmtu_cookie)
mss_now = tcp_sync_mss(sk, mtu);
Expand Down

0 comments on commit 57f3db5

Please sign in to comment.