tcp: improve testing of HPTS

Improve the HPTS API to allow testing and add several tests.

Reviewed by:	tuexen
Sponsored by:	Netflix, Inc.
This commit is contained in:
Nick Banks
2025-10-13 22:31:30 +02:00
committed by Michael Tuexen
parent 0eef2b4a00
commit bfdd5b643d
7 changed files with 2094 additions and 400 deletions
+1
View File
@@ -679,6 +679,7 @@ options TCP_OFFLOAD # TCP offload support.
options TCP_RFC7413 # TCP Fast Open
options TCPHPTS
#options TCP_HPTS_KTEST # Add KTEST support for HPTS
# In order to enable IPSEC you MUST also add device crypto to
# your kernel configuration
+1
View File
@@ -231,6 +231,7 @@ SYSVSEM opt_sysvipc.h
SYSVSHM opt_sysvipc.h
SW_WATCHDOG opt_watchdog.h
TCPHPTS
TCP_HPTS_KTEST opt_inet.h
TCP_REQUEST_TRK opt_global.h
TCP_ACCOUNTING opt_global.h
TCP_BBR opt_inet.h
+462 -372
View File
File diff suppressed because it is too large Load Diff
+16 -14
View File
@@ -84,13 +84,18 @@ struct hpts_diag {
#ifdef _KERNEL
extern struct tcp_hptsi *tcp_hptsi_pace;
/*
* The following are the definitions for the kernel HPTS interface for managing
* the HPTS ring and the TCBs on it.
*/
void tcp_hpts_init(struct tcpcb *);
void tcp_hpts_remove(struct tcpcb *);
void __tcp_hpts_init(struct tcp_hptsi *pace, struct tcpcb *);
#define tcp_hpts_init(tp) __tcp_hpts_init(tcp_hptsi_pace, tp)
void __tcp_hpts_remove(struct tcp_hptsi *pace, struct tcpcb *);
#define tcp_hpts_remove(tp) __tcp_hpts_remove(tcp_hptsi_pace, tp)
static inline bool
tcp_in_hpts(struct tcpcb *tp)
@@ -125,15 +130,19 @@ tcp_in_hpts(struct tcpcb *tp)
* you should already have the INP_WLOCK().
*/
#ifdef INVARIANTS
void __tcp_hpts_insert(struct tcpcb *tp, uint32_t slot, int32_t line,
void __tcp_hpts_insert(struct tcp_hptsi *pace, struct tcpcb *tp, uint32_t slot,
int32_t line, struct hpts_diag *diag);
#define tcp_hpts_insert(tp, slot, diag) \
__tcp_hpts_insert(tcp_hptsi_pace, (tp), (slot), __LINE__, (diag))
#else
void __tcp_hpts_insert(struct tcp_hptsi *pace, struct tcpcb *tp, uint32_t slot,
struct hpts_diag *diag);
#define tcp_hpts_insert(tp, slot, diag) \
__tcp_hpts_insert((tp), (slot), __LINE__, (diag))
#else
void tcp_hpts_insert(struct tcpcb *tp, uint32_t slot, struct hpts_diag *diag);
__tcp_hpts_insert(tcp_hptsi_pace, (tp), (slot), (diag))
#endif
void tcp_set_hpts(struct tcpcb *tp);
void __tcp_set_hpts(struct tcp_hptsi *pace, struct tcpcb *tp);
#define tcp_set_hpts(tp) __tcp_set_hpts(tcp_hptsi_pace, tp)
extern int32_t tcp_min_hptsi_time;
@@ -165,12 +174,5 @@ tcp_get_usecs(struct timeval *tv)
return (tcp_tv_to_usec(tv));
}
/*
* LRO HPTS initialization and uninitialization, only for internal use by the
* HPTS code.
*/
void tcp_lro_hpts_init(void);
void tcp_lro_hpts_uninit(void);
#endif /* _KERNEL */
#endif /* __tcp_hpts_h__ */
File diff suppressed because it is too large Load Diff
+3
View File
@@ -29,6 +29,8 @@
#include "opt_inet6.h"
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
@@ -62,6 +64,7 @@
#include <netinet/tcp_lro.h>
#include <netinet/tcp_var.h>
#include <netinet/tcp_hpts.h>
#include <netinet/tcp_hpts_internal.h>
#ifdef TCP_BLACKBOX
#include <netinet/tcp_log_buf.h>
#endif
+7
View File
@@ -57,6 +57,8 @@ struct ktest_test_info {
ktest_parse_t parse;
};
#define KTEST_FUNC(X) static int __ktest_##X(struct ktest_test_context *ctx)
struct ktest_module_info {
const char *name;
const struct ktest_test_info *tests;
@@ -64,6 +66,8 @@ struct ktest_module_info {
void *module_ptr;
};
#define KTEST_INFO(X) { "test_" #X, "Test " #X, __ktest_##X, NULL }
int ktest_default_modevent(module_t mod, int type, void *arg);
bool ktest_start_msg(struct ktest_test_context *ctx);
@@ -84,6 +88,9 @@ void ktest_end_msg(struct ktest_test_context *ctx);
#define KTEST_LOG(_ctx, _fmt, ...) \
KTEST_LOG_LEVEL(_ctx, LOG_DEBUG, _fmt, ## __VA_ARGS__)
#define KTEST_ERR(_ctx, _fmt, ...) \
KTEST_LOG_LEVEL(_ctx, LOG_ERR, _fmt, ## __VA_ARGS__)
#define KTEST_MAX_BUF 512
#define KTEST_MODULE_DECLARE(_n, _t) \