Skip to content

Commit

Permalink
tcp: define initial scaling factor value as a macro
Browse files Browse the repository at this point in the history
So that other users could access it. Notably MPTCP will use
it in the next patch.

No functional change intended.

Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
Paolo Abeni authored and intel-lab-lkp committed Oct 2, 2023
1 parent e53c362 commit 7153105
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1453,13 +1453,15 @@ static inline int tcp_space_from_win(const struct sock *sk, int win)
return __tcp_space_from_win(tcp_sk(sk)->scaling_ratio, win);
}

/* Assume a conservative default of 1200 bytes of payload per 4K page.
* This may be adjusted later in tcp_measure_rcv_mss().
*/
#define TCP_DEFAULT_SCALING_RATIO ((1200 << TCP_RMEM_TO_WIN_SCALE) / \
SKB_TRUESIZE(4096))

static inline void tcp_scaling_ratio_init(struct sock *sk)
{
/* Assume a conservative default of 1200 bytes of payload per 4K page.
* This may be adjusted later in tcp_measure_rcv_mss().
*/
tcp_sk(sk)->scaling_ratio = (1200 << TCP_RMEM_TO_WIN_SCALE) /
SKB_TRUESIZE(4096);
tcp_sk(sk)->scaling_ratio = TCP_DEFAULT_SCALING_RATIO;
}

/* Note: caller must be prepared to deal with negative returns */
Expand Down

0 comments on commit 7153105

Please sign in to comment.