Skip to content

Instantly share code, notes, and snippets.

Created July 2, 2016 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/078cf3ea121ccde05e81b35cf84aeb25 to your computer and use it in GitHub Desktop.
Save anonymous/078cf3ea121ccde05e81b35cf84aeb25 to your computer and use it in GitHub Desktop.
static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
{
struct net *net = sock_net((struct sock *)tp);
return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat;
}
static inline bool tcp_stream_memory_free(const struct sock *sk)
{
const struct tcp_sock *tp = tcp_sk(sk);
u32 notsent_bytes = tp->write_seq - tp->snd_nxt;
return notsent_bytes < tcp_notsent_lowat(tp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment