git: 638b5ae1c785 - main - HTPS has actually three states not two so the macro needs to account for that.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 01 Mar 2024 20:23:21 UTC
The branch main has been updated by rrs:
URL: https://cgit.FreeBSD.org/src/commit/?id=638b5ae1c7858373344bc7b9dcb5a1e7fab80bd9
commit 638b5ae1c7858373344bc7b9dcb5a1e7fab80bd9
Author: Randall Stewart <rrs@FreeBSD.org>
AuthorDate: 2024-03-01 20:21:15 +0000
Commit: Randall Stewart <rrs@FreeBSD.org>
CommitDate: 2024-03-01 20:21:15 +0000
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
---
sys/netinet/tcp_hpts.c | 2 +-
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 9d192b17c41a..8c4d2d41a3eb 100644
--- a/sys/netinet/tcp_hpts.c
+++ b/sys/netinet/tcp_hpts.c
@@ -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
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)
{