Support extra tcp stacks, rack and bbr.

This commit is contained in:
fengbojiang 2021-09-23 15:16:09 +08:00
parent a08a136a15
commit 21cfeb4372
4 changed files with 45 additions and 1 deletions

View File

@ -188,11 +188,15 @@ __FBSDID("$FreeBSD$");
#endif #endif
MALLOC_DEFINE(M_TCPHPTS, "tcp_hpts", "TCP hpts"); MALLOC_DEFINE(M_TCPHPTS, "tcp_hpts", "TCP hpts");
#ifndef FSTACK
#ifdef RSS #ifdef RSS
static int tcp_bind_threads = 1; static int tcp_bind_threads = 1;
#else #else
static int tcp_bind_threads = 2; static int tcp_bind_threads = 2;
#endif #endif
#else
static int tcp_bind_threads = 1;
#endif
TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads);
static struct tcp_hptsi tcp_pace; static struct tcp_hptsi tcp_pace;
@ -1971,6 +1975,7 @@ tcp_init_hptsi(void *st)
if (intr_event_bind(hpts->ie, i) == 0) if (intr_event_bind(hpts->ie, i) == 0)
bound++; bound++;
} else if (tcp_bind_threads == 2) { } else if (tcp_bind_threads == 2) {
#ifndef FSTACK
pc = pcpu_find(i); pc = pcpu_find(i);
domain = pc->pc_domain; domain = pc->pc_domain;
CPU_COPY(&cpuset_domain[domain], &cs); CPU_COPY(&cpuset_domain[domain], &cs);
@ -1981,6 +1986,7 @@ tcp_init_hptsi(void *st)
hpts_domains[domain].cpu[count] = i; hpts_domains[domain].cpu[count] = i;
hpts_domains[domain].count++; hpts_domains[domain].count++;
} }
#endif
} }
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = hpts->p_hpts_sleep_time * HPTS_TICKS_PER_USEC; tv.tv_usec = hpts->p_hpts_sleep_time * HPTS_TICKS_PER_USEC;

View File

@ -147,6 +147,11 @@ struct sysctl_oid *bbr_sysctl_root;
/*#define BBR_INVARIANT 1*/ /*#define BBR_INVARIANT 1*/
#ifdef FSTACK
#define MODNAME tcp_bbr
#define STACKNAME bbr
#endif
/* /*
* initial window * initial window
*/ */

View File

@ -139,6 +139,11 @@ struct sysctl_oid *rack_sysctl_root;
#define CUM_ACKED 1 #define CUM_ACKED 1
#define SACKED 2 #define SACKED 2
#ifdef FSTACK
#define MODNAME tcp_rack
#define STACKNAME rack
#endif
/* /*
* The RACK module incorporates a number of * The RACK module incorporates a number of
* TCP ideas that have been put out into the IETF * TCP ideas that have been put out into the IETF

View File

@ -27,12 +27,20 @@ HOST_OS:=$(shell uname -s)
DEBUG=-O0 -gdwarf-2 -g3 -Wno-format-truncation DEBUG=-O0 -gdwarf-2 -g3 -Wno-format-truncation
FF_KNI=1 FF_KNI=1
#FF_FLOW_ISOLATE=1 #FF_FLOW_ISOLATE=1
# NETGRAPH drivers ipfw
#FF_NETGRAPH=1 #FF_NETGRAPH=1
#FF_IPFW=1 #FF_IPFW=1
#FF_USE_PAGE_ARRAY=1 #FF_USE_PAGE_ARRAY=1
FF_INET6=1 FF_INET6=1
# TCPHPTS drivers rack and bbr
FF_TCPHPTS=1
FF_EXTRA_TCP_STACKS=1
include ${TOPDIR}/mk/kern.pre.mk include ${TOPDIR}/mk/kern.pre.mk
@ -88,6 +96,10 @@ HOST_CFLAGS+= -DINET6
CFLAGS+= -DINET6 CFLAGS+= -DINET6
endif endif
ifdef FF_TCPHPTS
CFLAGS+= -DTCPHPTS -DRATELIMIT
endif
HOST_C= ${CC} -c $(HOST_CFLAGS) ${HOST_INCLUDES} ${WERROR} ${PROF} $< HOST_C= ${CC} -c $(HOST_CFLAGS) ${HOST_INCLUDES} ${WERROR} ${PROF} $<
@ -171,6 +183,9 @@ VPATH+= $S/netinet/cc
ifdef FF_INET6 ifdef FF_INET6
VPATH+= $S/netinet6 VPATH+= $S/netinet6
endif endif
ifdef FF_EXTRA_TCP_STACKS
VPATH+= $S/netinet/tcp_stacks
endif
VPATH+= $S/netipsec VPATH+= $S/netipsec
ifdef FF_IPFW ifdef FF_IPFW
VPATH+= $S/netpfil/ipfw VPATH+= $S/netpfil/ipfw
@ -489,6 +504,19 @@ NETINET6_SRCS+= \
#ip6_ipsec.c #ip6_ipsec.c
#sctp6_usrreq.c #sctp6_usrreq.c
#in6_rss.c #in6_rss.c
ifdef FF_EXTRA_TCP_STACKS
EXTRA_TCP_STACKS_SRCS+= \
subr_filter.c \
tcp_hpts.c \
tcp_ratelimit.c \
arc4random_uniform.c \
sack_filter.c \
rack_bbr_common.c \
rack.c \
bbr.c
endif
ifndef FF_KNI ifndef FF_KNI
FF_HOST_SRCS+= \ FF_HOST_SRCS+= \
ff_dpdk_kni.c ff_dpdk_kni.c
@ -568,7 +596,7 @@ MSRCS+= $(patsubst %.m,%.c,${OPENCRYPTO_MSRCS})
ASM_SRCS = ${CRYPTO_ASM_SRCS} ASM_SRCS = ${CRYPTO_ASM_SRCS}
SRCS= ${FF_SRCS} ${CRYPTO_SRCS} ${KERN_SRCS} ${LIBKERN_SRCS} ${MACHINE_SRCS} SRCS= ${FF_SRCS} ${CRYPTO_SRCS} ${KERN_SRCS} ${LIBKERN_SRCS} ${MACHINE_SRCS}
SRCS+= ${MSRCS} ${NET_SRCS} ${NETGRAPH_SRCS} ${NETINET_SRCS} ${NETINET6_SRCS} SRCS+= ${MSRCS} ${NET_SRCS} ${NETGRAPH_SRCS} ${NETINET_SRCS} ${NETINET6_SRCS} ${EXTRA_TCP_STACKS_SRCS}
SRCS+= ${NETIPSEC_SRCS} ${NETIPFW_SRCS} ${OPENCRYPTO_SRCS} ${VM_SRCS} SRCS+= ${NETIPSEC_SRCS} ${NETIPFW_SRCS} ${OPENCRYPTO_SRCS} ${VM_SRCS}
# If witness is enabled. # If witness is enabled.