diff options
| author | Randall Stewart <rrs@FreeBSD.org> | 2024-03-01 20:21:15 +0000 |
|---|---|---|
| committer | Michael Tuexen <tuexen@FreeBSD.org> | 2024-04-24 20:36:32 +0000 |
| commit | 917b5431453d0a02ac4f976b76511357ed6c5604 (patch) | |
| tree | 2c35f614116085ce48272e63000d276d94eee2bb | |
| parent | d48e7e89e02f3b7f56121bf2bedbff7c94b7e9ba (diff) | |
HTPS has actually three states not two so the macro needs to account for that.
Ok lets fix up the tcp_in_hpts() so that it also says yes if you
are in the race state moving and you are scheduled to be put in.
This also requires changing the MPASS to be the old version non
inline function of tcp_in_hpts().
This change also adds a new inline macro so that a uint64_t timestamp can be
obtained by a transport (aka Rack will use this).
Reviewed by: glebius, tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D44157
(cherry picked from commit 638b5ae1c7858373344bc7b9dcb5a1e7fab80bd9)
| -rw-r--r-- | sys/netinet/tcp_hpts.c | 2 | ||||
| -rw-r--r-- | sys/netinet/tcp_hpts.h | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index af7b2691ff2e..07c5f04b907e 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -821,7 +821,7 @@ tcp_hpts_insert_diag(struct tcpcb *tp, uint32_t slot, int32_t line, struct hpts_ INP_WLOCK_ASSERT(tptoinpcb(tp)); MPASS(!(tptoinpcb(tp)->inp_flags & INP_DROPPED)); - MPASS(!tcp_in_hpts(tp)); + MPASS(!(tp->t_in_hpts == IHPTS_ONQUEUE)); /* * We now return the next-slot the hpts will be on, beyond its diff --git a/sys/netinet/tcp_hpts.h b/sys/netinet/tcp_hpts.h index 0c5cfac28a6c..b097a2b98db9 100644 --- a/sys/netinet/tcp_hpts.h +++ b/sys/netinet/tcp_hpts.h @@ -115,7 +115,9 @@ void tcp_hpts_remove(struct tcpcb *); static inline bool tcp_in_hpts(struct tcpcb *tp) { - return (tp->t_in_hpts == IHPTS_ONQUEUE); + return ((tp->t_in_hpts == IHPTS_ONQUEUE) || + ((tp->t_in_hpts == IHPTS_MOVING) && + (tp->t_hpts_slot != -1))); } /* @@ -208,6 +210,17 @@ tcp_gethptstick(struct timeval *sv) return (tcp_tv_to_hptstick(sv)); } +static __inline uint64_t +tcp_get_u64_usecs(struct timeval *tv) +{ + struct timeval tvd; + + if (tv == NULL) + tv = &tvd; + microuptime(tv); + return (tcp_tv_to_lusectick(tv)); +} + static __inline uint32_t tcp_get_usecs(struct timeval *tv) { |
