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
This commit is contained in:
Randall Stewart 2024-03-01 15:21:15 -05:00
parent c6a6ec85a7
commit 638b5ae1c7
2 changed files with 15 additions and 2 deletions

View file

@ -820,7 +820,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

View file

@ -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)
{