mirror of
https://github.com/torvalds/linux.git
synced 2024-09-29 19:33:13 +00:00
tcp: uninline tcp_stream_memory_free()
Both IPv4 and IPv6 needs it via a function pointer. Following patch will avoid the indirect call. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
ae8cb93286
commit
d3cd4924e3
|
@ -1965,18 +1965,7 @@ static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
|
||||||
return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat;
|
return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @wake is one when sk_stream_write_space() calls us.
|
bool tcp_stream_memory_free(const struct sock *sk, int wake);
|
||||||
* This sends EPOLLOUT only if notsent_bytes is half the limit.
|
|
||||||
* This mimics the strategy used in sock_def_write_space().
|
|
||||||
*/
|
|
||||||
static inline bool tcp_stream_memory_free(const struct sock *sk, int wake)
|
|
||||||
{
|
|
||||||
const struct tcp_sock *tp = tcp_sk(sk);
|
|
||||||
u32 notsent_bytes = READ_ONCE(tp->write_seq) -
|
|
||||||
READ_ONCE(tp->snd_nxt);
|
|
||||||
|
|
||||||
return (notsent_bytes << wake) < tcp_notsent_lowat(tp);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
int tcp4_proc_init(void);
|
int tcp4_proc_init(void);
|
||||||
|
|
|
@ -2740,6 +2740,20 @@ void tcp4_proc_exit(void)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PROC_FS */
|
#endif /* CONFIG_PROC_FS */
|
||||||
|
|
||||||
|
/* @wake is one when sk_stream_write_space() calls us.
|
||||||
|
* This sends EPOLLOUT only if notsent_bytes is half the limit.
|
||||||
|
* This mimics the strategy used in sock_def_write_space().
|
||||||
|
*/
|
||||||
|
bool tcp_stream_memory_free(const struct sock *sk, int wake)
|
||||||
|
{
|
||||||
|
const struct tcp_sock *tp = tcp_sk(sk);
|
||||||
|
u32 notsent_bytes = READ_ONCE(tp->write_seq) -
|
||||||
|
READ_ONCE(tp->snd_nxt);
|
||||||
|
|
||||||
|
return (notsent_bytes << wake) < tcp_notsent_lowat(tp);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(tcp_stream_memory_free);
|
||||||
|
|
||||||
struct proto tcp_prot = {
|
struct proto tcp_prot = {
|
||||||
.name = "TCP",
|
.name = "TCP",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user