tcp: Build RACK and BBR stacks as a part of LINT

When RACK and BBR were added to the kernel, they were put
behind 'WITH_EXTRA_TCP_STACKS=1'.   Unfortunately that was
never added to any NOTES file, so RACK & BBR were not compiled
with the various LINT-NOINET, LINT-NOINET6, and LINT-NOIP kernels.
This lead to the stacks sometimes being broken.

This change:

- Fixes RACK so that it compiles with the various LINT-NO* kernels
- Adds WITH_EXTRA_TCP_STACKS=1 to all NOTES kernels so that
   RACK and BBR are compile tested regularly

Sponsored by: Netflix
Reviewed by: rrs
Differential Revision: https://reviews.freebsd.org/D37903
This commit is contained in:
Andrew Gallatin 2023-01-10 16:09:00 -05:00
parent db1cdf2fab
commit 8ea4182995
2 changed files with 21 additions and 3 deletions

View File

@ -677,6 +677,7 @@ options TCP_OFFLOAD # TCP offload support.
options TCP_RFC7413 # TCP Fast Open
options TCPHPTS
makeoptions WITH_EXTRA_TCP_STACKS=1 # RACK and BBR TCP kernel modules
# In order to enable IPSEC you MUST also add device crypto to
# your kernel configuration

View File

@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include "opt_ipsec.h"
#include "opt_ratelimit.h"
#include "opt_kern_tls.h"
#if defined(INET) || defined(INET6)
#include <sys/param.h>
#include <sys/arb.h>
#include <sys/module.h>
@ -12347,6 +12348,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack)
ip6, rack->r_ctl.fsb.th);
} else
#endif /* INET6 */
#ifdef INET
{
rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct tcpiphdr);
ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr;
@ -12366,6 +12368,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack)
tp->t_port,
ip, rack->r_ctl.fsb.th);
}
#endif
rack->r_fsb_inited = 1;
}
@ -15611,7 +15614,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma
struct tcpopt to;
u_char opt[TCP_MAXOLEN];
uint32_t hdrlen, optlen;
int32_t slot, segsiz, max_val, tso = 0, error, ulen = 0;
int32_t slot, segsiz, max_val, tso = 0, error = 0, ulen = 0;
uint16_t flags;
uint32_t if_hw_tsomaxsegcount = 0, startseq;
uint32_t if_hw_tsomaxsegsize;
@ -15935,8 +15938,6 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma
&inp->inp_route6,
0, NULL, NULL, inp);
}
#endif
#if defined(INET) && defined(INET6)
else
#endif
#ifdef INET
@ -16102,7 +16103,9 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val,
* the max-burst). We have how much to send and all the info we
* need to just send.
*/
#ifdef INET
struct ip *ip = NULL;
#endif
struct udphdr *udp = NULL;
struct tcphdr *th = NULL;
struct mbuf *m, *s_mb;
@ -16133,8 +16136,10 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val,
} else
#endif /* INET6 */
{
#ifdef INET
ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr;
hdrlen = sizeof(struct tcpiphdr);
#endif
}
if (tp->t_port && (V_tcp_udp_tunneling_port == 0)) {
m = NULL;
@ -16281,8 +16286,10 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val,
else
#endif
{
#ifdef INET
ip->ip_tos &= ~IPTOS_ECN_MASK;
ip->ip_tos |= ect;
#endif
}
}
tcp_set_flags(th, flags);
@ -18346,7 +18353,9 @@ rack_output(struct tcpcb *tp)
ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr;
else
#endif /* INET6 */
#ifdef INET
ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr;
#endif
th = rack->r_ctl.fsb.th;
udp = rack->r_ctl.fsb.udp;
if (udp) {
@ -18375,6 +18384,7 @@ rack_output(struct tcpcb *tp)
} else
#endif /* INET6 */
{
#ifdef INET
ip = mtod(m, struct ip *);
if (tp->t_port) {
udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip));
@ -18386,6 +18396,7 @@ rack_output(struct tcpcb *tp)
} else
th = (struct tcphdr *)(ip + 1);
tcpip_fillheaders(inp, tp->t_port, ip, th);
#endif
}
}
/*
@ -18419,8 +18430,10 @@ rack_output(struct tcpcb *tp)
else
#endif
{
#ifdef INET
ip->ip_tos &= ~IPTOS_ECN_MASK;
ip->ip_tos |= ect;
#endif
}
}
/*
@ -18514,7 +18527,9 @@ rack_output(struct tcpcb *tp)
ip6 = mtod(m, struct ip6_hdr *);
else
#endif /* INET6 */
#ifdef INET
ip = mtod(m, struct ip *);
#endif
th = (struct tcphdr *)(cpto + ((uint8_t *)rack->r_ctl.fsb.th - rack->r_ctl.fsb.tcp_ip_hdr));
/* If we have a udp header lets set it into the mbuf as well */
if (udp)
@ -20834,3 +20849,5 @@ static moduledata_t tcp_rack = {
MODULE_VERSION(MODNAME, 1);
DECLARE_MODULE(MODNAME, tcp_rack, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY);
MODULE_DEPEND(MODNAME, tcphpts, 1, 1, 1);
#endif /* #if !defined(INET) && !defined(INET6) */