tcp: Refactor pingpong code
Instead of using pingpong as a single bit information, we refactor the code to treat it as a counter. When interactive session is detected, we set pingpong count to TCP_PINGPONG_THRESH. And when pingpong count is >= TCP_PINGPONG_THRESH, we consider the session in pingpong mode. This patch is a pure refactor and sets foundation for the next patch. This patch itself does not change any pingpong logic. Signed-off-by: Wei Wang <weiwan@google.com> Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
fb1b699991
commit
31954cd8bb
@@ -314,4 +314,21 @@ int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
|
||||
char __user *optval, unsigned int optlen);
|
||||
|
||||
struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu);
|
||||
|
||||
#define TCP_PINGPONG_THRESH 1
|
||||
|
||||
static inline void inet_csk_enter_pingpong_mode(struct sock *sk)
|
||||
{
|
||||
inet_csk(sk)->icsk_ack.pingpong = TCP_PINGPONG_THRESH;
|
||||
}
|
||||
|
||||
static inline void inet_csk_exit_pingpong_mode(struct sock *sk)
|
||||
{
|
||||
inet_csk(sk)->icsk_ack.pingpong = 0;
|
||||
}
|
||||
|
||||
static inline bool inet_csk_in_pingpong_mode(struct sock *sk)
|
||||
{
|
||||
return inet_csk(sk)->icsk_ack.pingpong >= TCP_PINGPONG_THRESH;
|
||||
}
|
||||
#endif /* _INET_CONNECTION_SOCK_H */
|
||||
|
Reference in New Issue
Block a user