Skip to content

Commit

Permalink
net-tcp_bbr: v2: Remove BBRv2 tcp congestion control patchset
Browse files Browse the repository at this point in the history
This reverts commit 187eba0...7c99a90

Signed-off-by: Alexandre Frade <kernel@xanmod.org>
  • Loading branch information
xanmod committed Aug 14, 2023
1 parent 489fabd commit 87668d4
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 2,867 deletions.
3 changes: 1 addition & 2 deletions include/linux/tcp.h
Expand Up @@ -255,8 +255,7 @@ struct tcp_sock {
u8 compressed_ack;
u8 dup_ack_counter:2,
tlp_retrans:1, /* TLP is a retransmission */
fast_ack_mode:2, /* which fast ack mode ? */
unused:3;
unused:5;
u32 chrono_start; /* Start time in jiffies of a TCP chrono */
u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */
u8 chrono_type:2, /* current chronograph type */
Expand Down
3 changes: 1 addition & 2 deletions include/net/inet_connection_sock.h
Expand Up @@ -135,8 +135,7 @@ struct inet_connection_sock {
u32 icsk_probes_tstamp;
u32 icsk_user_timeout;

/* XXX inflated by temporary internal debugging info */
u64 icsk_ca_priv[216 / sizeof(u64)];
u64 icsk_ca_priv[104 / sizeof(u64)];
#define ICSK_CA_PRIV_SIZE sizeof_field(struct inet_connection_sock, icsk_ca_priv)
};

Expand Down
41 changes: 5 additions & 36 deletions include/net/tcp.h
Expand Up @@ -375,7 +375,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk,
#define TCP_ECN_QUEUE_CWR 2
#define TCP_ECN_DEMAND_CWR 4
#define TCP_ECN_SEEN 8
#define TCP_ECN_ECT_PERMANENT 16

enum tcp_tw_status {
TCP_TW_SUCCESS = 0,
Expand Down Expand Up @@ -825,11 +824,6 @@ static inline u32 tcp_stamp_us_delta(u64 t1, u64 t0)
return max_t(s64, t1 - t0, 0);
}

static inline u32 tcp_stamp32_us_delta(u32 t1, u32 t0)
{
return max_t(s32, t1 - t0, 0);
}

static inline u32 tcp_skb_timestamp(const struct sk_buff *skb)
{
return tcp_ns_to_ts(skb->skb_mstamp_ns);
Expand Down Expand Up @@ -905,14 +899,9 @@ struct tcp_skb_cb {
/* pkts S/ACKed so far upon tx of skb, incl retrans: */
__u32 delivered;
/* start of send pipeline phase */
u32 first_tx_mstamp;
u64 first_tx_mstamp;
/* when we reached the "delivered" count */
u32 delivered_mstamp;
#define TCPCB_IN_FLIGHT_BITS 20
#define TCPCB_IN_FLIGHT_MAX ((1U << TCPCB_IN_FLIGHT_BITS) - 1)
u32 in_flight:20, /* packets in flight at transmit */
unused2:12;
u32 lost; /* packets lost so far upon tx of skb */
u64 delivered_mstamp;
} tx; /* only used for outgoing skbs */
union {
struct inet_skb_parm h4;
Expand Down Expand Up @@ -1038,11 +1027,7 @@ enum tcp_ca_ack_event_flags {
#define TCP_CONG_NON_RESTRICTED 0x1
/* Requires ECN/ECT set on all packets */
#define TCP_CONG_NEEDS_ECN 0x2
/* Wants notification of CE events (CA_EVENT_ECN_IS_CE, CA_EVENT_ECN_NO_CE). */
#define TCP_CONG_WANTS_CE_EVENTS 0x4
#define TCP_CONG_MASK (TCP_CONG_NON_RESTRICTED | \
TCP_CONG_NEEDS_ECN | \
TCP_CONG_WANTS_CE_EVENTS)
#define TCP_CONG_MASK (TCP_CONG_NON_RESTRICTED | TCP_CONG_NEEDS_ECN)

union tcp_cc_info;

Expand All @@ -1062,11 +1047,8 @@ struct ack_sample {
*/
struct rate_sample {
u64 prior_mstamp; /* starting timestamp for interval */
u32 prior_lost; /* tp->lost at "prior_mstamp" */
u32 prior_delivered; /* tp->delivered at "prior_mstamp" */
u32 prior_delivered_ce;/* tp->delivered_ce at "prior_mstamp" */
u32 tx_in_flight; /* packets in flight at starting timestamp */
s32 lost; /* number of packets lost over interval */
s32 delivered; /* number of packets delivered over interval */
s32 delivered_ce; /* number of packets delivered w/ CE marks*/
long interval_us; /* time for tp->delivered to incr "delivered" */
Expand All @@ -1080,7 +1062,6 @@ struct rate_sample {
bool is_app_limited; /* is sample from packet with bubble in pipe? */
bool is_retrans; /* is sample from retransmission? */
bool is_ack_delayed; /* is this (likely) a delayed ACK? */
bool is_ece; /* did this ACK have ECN marked? */
};

struct tcp_congestion_ops {
Expand All @@ -1104,11 +1085,8 @@ struct tcp_congestion_ops {
/* hook for packet ack accounting (optional) */
void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample);

/* pick target number of segments per TSO/GSO skb (optional): */
u32 (*tso_segs)(struct sock *sk, unsigned int mss_now);

/* react to a specific lost skb (optional) */
void (*skb_marked_lost)(struct sock *sk, const struct sk_buff *skb);
/* override sysctl_tcp_min_tso_segs */
u32 (*min_tso_segs)(struct sock *sk);

/* call when packets are delivered to update cwnd and pacing rate,
* after all the ca_state processing. (optional)
Expand Down Expand Up @@ -1174,14 +1152,6 @@ static inline char *tcp_ca_get_name_by_key(u32 key, char *buffer)
}
#endif

static inline bool tcp_ca_wants_ce_events(const struct sock *sk)
{
const struct inet_connection_sock *icsk = inet_csk(sk);

return icsk->icsk_ca_ops->flags & (TCP_CONG_NEEDS_ECN |
TCP_CONG_WANTS_CE_EVENTS);
}

static inline bool tcp_ca_needs_ecn(const struct sock *sk)
{
const struct inet_connection_sock *icsk = inet_csk(sk);
Expand All @@ -1201,7 +1171,6 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
void tcp_set_ca_state(struct sock *sk, const u8 ca_state);

/* From tcp_rate.c */
void tcp_set_tx_in_flight(struct sock *sk, struct sk_buff *skb);
void tcp_rate_skb_sent(struct sock *sk, struct sk_buff *skb);
void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb,
struct rate_sample *rs);
Expand Down
33 changes: 0 additions & 33 deletions include/uapi/linux/inet_diag.h
Expand Up @@ -231,42 +231,9 @@ struct tcp_bbr_info {
__u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */
};

/* Phase as reported in netlink/ss stats. */
enum tcp_bbr2_phase {
BBR2_PHASE_INVALID = 0,
BBR2_PHASE_STARTUP = 1,
BBR2_PHASE_DRAIN = 2,
BBR2_PHASE_PROBE_RTT = 3,
BBR2_PHASE_PROBE_BW_UP = 4,
BBR2_PHASE_PROBE_BW_DOWN = 5,
BBR2_PHASE_PROBE_BW_CRUISE = 6,
BBR2_PHASE_PROBE_BW_REFILL = 7
};

struct tcp_bbr2_info {
/* u64 bw: bandwidth (app throughput) estimate in Byte per sec: */
__u32 bbr_bw_lsb; /* lower 32 bits of bw */
__u32 bbr_bw_msb; /* upper 32 bits of bw */
__u32 bbr_min_rtt; /* min-filtered RTT in uSec */
__u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */
__u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */
__u32 bbr_bw_hi_lsb; /* lower 32 bits of bw_hi */
__u32 bbr_bw_hi_msb; /* upper 32 bits of bw_hi */
__u32 bbr_bw_lo_lsb; /* lower 32 bits of bw_lo */
__u32 bbr_bw_lo_msb; /* upper 32 bits of bw_lo */
__u8 bbr_mode; /* current bbr_mode in state machine */
__u8 bbr_phase; /* current state machine phase */
__u8 unused1; /* alignment padding; not used yet */
__u8 bbr_version; /* MUST be at this offset in struct */
__u32 bbr_inflight_lo; /* lower/short-term data volume bound */
__u32 bbr_inflight_hi; /* higher/long-term data volume bound */
__u32 bbr_extra_acked; /* max excess packets ACKed in epoch */
};

union tcp_cc_info {
struct tcpvegas_info vegas;
struct tcp_dctcp_info dctcp;
struct tcp_bbr_info bbr;
struct tcp_bbr2_info bbr2;
};
#endif /* _UAPI_INET_DIAG_H_ */
22 changes: 0 additions & 22 deletions net/ipv4/Kconfig
Expand Up @@ -678,24 +678,6 @@ config TCP_CONG_BBR
AQM schemes that do not provide a delay signal. It requires the fq
("Fair Queue") pacing packet scheduler.

config TCP_CONG_BBR2
tristate "BBR2 TCP"
default n
help

BBR2 TCP congestion control is a model-based congestion control
algorithm that aims to maximize network utilization, keep queues and
retransmit rates low, and to be able to coexist with Reno/CUBIC in
common scenarios. It builds an explicit model of the network path. It
tolerates a targeted degree of random packet loss and delay that are
unrelated to congestion. It can operate over LAN, WAN, cellular, wifi,
or cable modem links, and can use DCTCP-L4S-style ECN signals. It can
coexist with flows that use loss-based congestion control, and can
operate with shallow buffers, deep buffers, bufferbloat, policers, or
AQM schemes that do not provide a delay signal. It requires pacing,
using either TCP internal pacing or the fq ("Fair Queue") pacing packet
scheduler.

choice
prompt "Default TCP congestion control"
default DEFAULT_CUBIC
Expand Down Expand Up @@ -733,9 +715,6 @@ choice
config DEFAULT_BBR
bool "BBR" if TCP_CONG_BBR=y

config DEFAULT_BBR2
bool "BBR2" if TCP_CONG_BBR2=y

config DEFAULT_RENO
bool "Reno"
endchoice
Expand All @@ -760,7 +739,6 @@ config DEFAULT_TCP_CONG
default "dctcp" if DEFAULT_DCTCP
default "cdg" if DEFAULT_CDG
default "bbr" if DEFAULT_BBR
default "bbr2" if DEFAULT_BBR2
default "cubic"

config TCP_MD5SIG
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/Makefile
Expand Up @@ -47,7 +47,6 @@ obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o
obj-$(CONFIG_INET_UDP_DIAG) += udp_diag.o
obj-$(CONFIG_INET_RAW_DIAG) += raw_diag.o
obj-$(CONFIG_TCP_CONG_BBR) += tcp_bbr.o
obj-$(CONFIG_TCP_CONG_BBR2) += tcp_bbr2.o
obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o
obj-$(CONFIG_TCP_CONG_CDG) += tcp_cdg.o
obj-$(CONFIG_TCP_CONG_CUBIC) += tcp_cubic.o
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/tcp.c
Expand Up @@ -3192,7 +3192,6 @@ int tcp_disconnect(struct sock *sk, int flags)
tp->rx_opt.dsack = 0;
tp->rx_opt.num_sacks = 0;
tp->rcv_ooopack = 0;
tp->fast_ack_mode = 0;


/* Clean up fastopen related fields */
Expand Down
38 changes: 12 additions & 26 deletions net/ipv4/tcp_bbr.c
Expand Up @@ -294,40 +294,26 @@ static void bbr_set_pacing_rate(struct sock *sk, u32 bw, int gain)
sk->sk_pacing_rate = rate;
}

/* override sysctl_tcp_min_tso_segs */
__bpf_kfunc static u32 bbr_min_tso_segs(struct sock *sk)
{
return sk->sk_pacing_rate < (bbr_min_tso_rate >> 3) ? 1 : 2;
}

/* Return the number of segments BBR would like in a TSO/GSO skb, given
* a particular max gso size as a constraint.
*/
static u32 bbr_tso_segs_generic(struct sock *sk, unsigned int mss_now,
u32 gso_max_size)
{
u32 segs;
u64 bytes;

/* Budget a TSO/GSO burst size allowance based on bw (pacing_rate). */
bytes = sk->sk_pacing_rate >> sk->sk_pacing_shift;

bytes = min_t(u32, bytes, gso_max_size - 1 - MAX_TCP_HEADER);
segs = max_t(u32, div_u64(bytes, mss_now), bbr_min_tso_segs(sk));
return segs;
}

/* Custom tcp_tso_autosize() for BBR, used at transmit time to cap skb size. */
static u32 bbr_tso_segs(struct sock *sk, unsigned int mss_now)
{
return bbr_tso_segs_generic(sk, mss_now, sk->sk_gso_max_size);
}

/* Like bbr_tso_segs(), using mss_cache, ignoring driver's sk_gso_max_size. */
static u32 bbr_tso_segs_goal(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
u32 segs, bytes;

/* Sort of tcp_tso_autosize() but ignoring
* driver provided sk_gso_max_size.
*/
bytes = min_t(unsigned long,
sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift),
GSO_LEGACY_MAX_SIZE - 1 - MAX_TCP_HEADER);
segs = max_t(u32, bytes / tp->mss_cache, bbr_min_tso_segs(sk));

return bbr_tso_segs_generic(sk, tp->mss_cache, GSO_LEGACY_MAX_SIZE);
return min(segs, 0x7FU);
}

/* Save "last known good" cwnd so we can restore it after losses or PROBE_RTT */
Expand Down Expand Up @@ -1163,7 +1149,7 @@ static struct tcp_congestion_ops tcp_bbr_cong_ops __read_mostly = {
.undo_cwnd = bbr_undo_cwnd,
.cwnd_event = bbr_cwnd_event,
.ssthresh = bbr_ssthresh,
.tso_segs = bbr_tso_segs,
.min_tso_segs = bbr_min_tso_segs,
.get_info = bbr_get_info,
.set_state = bbr_set_state,
};
Expand Down

0 comments on commit 87668d4

Please sign in to comment.