Move all ECN related flags from the flags to the flags2 field.

This allows adding more ECN related flags in the future.
No functional change intended.

Submitted by:		Richard Scheffenegger
Reviewed by:		rrs@, tuexen@
Differential Revision:	https://reviews.freebsd.org/D22497
This commit is contained in:
Michael Tuexen 2019-12-01 21:01:33 +00:00
parent 77aabfd94f
commit 3cf38784e2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355273
7 changed files with 61 additions and 41 deletions

View File

@ -109,7 +109,7 @@ dctcp_ack_received(struct cc_var *ccv, uint16_t type)
dctcp_data = ccv->cc_data;
if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) {
/*
* DCTCP doesn't treat receipt of ECN marked packet as a
* congestion event. Thus, DCTCP always executes the ACK
@ -168,7 +168,7 @@ dctcp_after_idle(struct cc_var *ccv)
{
struct dctcp *dctcp_data;
if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) {
dctcp_data = ccv->cc_data;
/* Initialize internal parameters after idle time */
@ -234,7 +234,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
struct dctcp *dctcp_data;
u_int cwin, mss;
if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) {
dctcp_data = ccv->cc_data;
cwin = CCV(ccv, snd_cwnd);
mss = CCV(ccv, t_maxseg);
@ -284,7 +284,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
dctcp_data->ece_curr = 1;
break;
case CC_RTO:
CCV(ccv, t_flags) |= TF_ECN_SND_CWR;
CCV(ccv, t_flags2) |= TF2_ECN_SND_CWR;
dctcp_update_alpha(ccv);
dctcp_data->save_sndnxt += CCV(ccv, t_maxseg);
dctcp_data->num_cong_events++;
@ -301,7 +301,7 @@ dctcp_conn_init(struct cc_var *ccv)
dctcp_data = ccv->cc_data;
if (CCV(ccv, t_flags) & TF_ECN_PERMIT)
if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT)
dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
}
@ -313,7 +313,7 @@ dctcp_post_recovery(struct cc_var *ccv)
{
newreno_cc_algo.post_recovery(ccv);
if (CCV(ccv, t_flags) & TF_ECN_PERMIT)
if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT)
dctcp_update_alpha(ccv);
}
@ -344,12 +344,12 @@ dctcp_ecnpkt_handler(struct cc_var *ccv)
if (!dctcp_data->ce_prev && (ccflag & CCF_DELACK))
delay_ack = 0;
dctcp_data->ce_prev = 1;
CCV(ccv, t_flags) |= TF_ECN_SND_ECE;
CCV(ccv, t_flags2) |= TF2_ECN_SND_ECE;
} else {
if (dctcp_data->ce_prev && (ccflag & CCF_DELACK))
delay_ack = 0;
dctcp_data->ce_prev = 0;
CCV(ccv, t_flags) &= ~TF_ECN_SND_ECE;
CCV(ccv, t_flags2) &= ~TF2_ECN_SND_ECE;
}
/* DCTCP sets delayed ack when this segment sets the CWR flag. */

View File

@ -397,16 +397,16 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type)
case CC_NDUPACK:
if (!IN_FASTRECOVERY(tp->t_flags)) {
tp->snd_recover = tp->snd_max;
if (tp->t_flags & TF_ECN_PERMIT)
tp->t_flags |= TF_ECN_SND_CWR;
if (tp->t_flags2 & TF2_ECN_PERMIT)
tp->t_flags2 |= TF2_ECN_SND_CWR;
}
break;
case CC_ECN:
if (!IN_CONGRECOVERY(tp->t_flags)) {
TCPSTAT_INC(tcps_ecn_rcwnd);
tp->snd_recover = tp->snd_max;
if (tp->t_flags & TF_ECN_PERMIT)
tp->t_flags |= TF_ECN_SND_CWR;
if (tp->t_flags2 & TF2_ECN_PERMIT)
tp->t_flags2 |= TF2_ECN_SND_CWR;
}
break;
case CC_RTO:
@ -1500,12 +1500,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
/*
* TCP ECN processing.
*/
if (tp->t_flags & TF_ECN_PERMIT) {
if (tp->t_flags2 & TF2_ECN_PERMIT) {
if (thflags & TH_CWR)
tp->t_flags &= ~TF_ECN_SND_ECE;
tp->t_flags2 &= ~TF2_ECN_SND_ECE;
switch (iptos & IPTOS_ECN_MASK) {
case IPTOS_ECN_CE:
tp->t_flags |= TF_ECN_SND_ECE;
tp->t_flags2 |= TF2_ECN_SND_ECE;
TCPSTAT_INC(tcps_ecn_ce);
break;
case IPTOS_ECN_ECT0:
@ -1934,7 +1934,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
if (((thflags & (TH_CWR | TH_ECE)) == TH_ECE) &&
V_tcp_do_ecn) {
tp->t_flags |= TF_ECN_PERMIT;
tp->t_flags2 |= TF2_ECN_PERMIT;
TCPSTAT_INC(tcps_ecn_shs);
}

View File

@ -1135,7 +1135,7 @@ tcp_output(struct tcpcb *tp)
}
if (tp->t_state == TCPS_ESTABLISHED &&
(tp->t_flags & TF_ECN_PERMIT)) {
(tp->t_flags2 & TF2_ECN_PERMIT)) {
/*
* If the peer has ECN, mark data packets with
* ECN capable transmission (ECT).
@ -1155,11 +1155,11 @@ tcp_output(struct tcpcb *tp)
/*
* Reply with proper ECN notifications.
*/
if (tp->t_flags & TF_ECN_SND_CWR) {
if (tp->t_flags2 & TF2_ECN_SND_CWR) {
flags |= TH_CWR;
tp->t_flags &= ~TF_ECN_SND_CWR;
tp->t_flags2 &= ~TF2_ECN_SND_CWR;
}
if (tp->t_flags & TF_ECN_SND_ECE)
if (tp->t_flags2 & TF2_ECN_SND_ECE)
flags |= TH_ECE;
}

View File

@ -1811,16 +1811,16 @@ rack_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type)
rack_log_to_prr(rack, 2);
rack->r_ctl.rc_prr_recovery_fs = tp->snd_max - tp->snd_una;
tp->snd_recover = tp->snd_max;
if (tp->t_flags & TF_ECN_PERMIT)
tp->t_flags |= TF_ECN_SND_CWR;
if (tp->t_flags2 & TF2_ECN_PERMIT)
tp->t_flags2 |= TF2_ECN_SND_CWR;
}
break;
case CC_ECN:
if (!IN_CONGRECOVERY(tp->t_flags)) {
TCPSTAT_INC(tcps_ecn_rcwnd);
tp->snd_recover = tp->snd_max;
if (tp->t_flags & TF_ECN_PERMIT)
tp->t_flags |= TF_ECN_SND_CWR;
if (tp->t_flags2 & TF2_ECN_PERMIT)
tp->t_flags2 |= TF2_ECN_SND_CWR;
}
break;
case CC_RTO:
@ -6309,7 +6309,7 @@ rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, struct socket *so,
if (((thflags & (TH_CWR | TH_ECE)) == TH_ECE) &&
V_tcp_do_ecn) {
tp->t_flags |= TF_ECN_PERMIT;
tp->t_flags2 |= TF2_ECN_PERMIT;
TCPSTAT_INC(tcps_ecn_shs);
}
if (SEQ_GT(th->th_ack, tp->snd_una)) {
@ -7710,12 +7710,12 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so,
* TCP ECN processing. XXXJTL: If we ever use ECN, we need to move
* this to occur after we've validated the segment.
*/
if (tp->t_flags & TF_ECN_PERMIT) {
if (tp->t_flags2 & TF2_ECN_PERMIT) {
if (thflags & TH_CWR)
tp->t_flags &= ~TF_ECN_SND_ECE;
tp->t_flags2 &= ~TF2_ECN_SND_ECE;
switch (iptos & IPTOS_ECN_MASK) {
case IPTOS_ECN_CE:
tp->t_flags |= TF_ECN_SND_ECE;
tp->t_flags2 |= TF2_ECN_SND_ECE;
TCPSTAT_INC(tcps_ecn_ce);
break;
case IPTOS_ECN_ECT0:
@ -9472,7 +9472,7 @@ rack_output(struct tcpcb *tp)
flags |= TH_ECE | TH_CWR;
}
if (tp->t_state == TCPS_ESTABLISHED &&
(tp->t_flags & TF_ECN_PERMIT)) {
(tp->t_flags2 & TF2_ECN_PERMIT)) {
/*
* If the peer has ECN, mark data packets with ECN capable
* transmission (ECT). Ignore pure ack packets,
@ -9491,11 +9491,11 @@ rack_output(struct tcpcb *tp)
/*
* Reply with proper ECN notifications.
*/
if (tp->t_flags & TF_ECN_SND_CWR) {
if (tp->t_flags2 & TF2_ECN_SND_CWR) {
flags |= TH_CWR;
tp->t_flags &= ~TF_ECN_SND_CWR;
tp->t_flags2 &= ~TF2_ECN_SND_CWR;
}
if (tp->t_flags & TF_ECN_SND_ECE)
if (tp->t_flags2 & TF2_ECN_SND_ECE)
flags |= TH_ECE;
}
/*

View File

@ -1023,7 +1023,7 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
}
if (sc->sc_flags & SCF_ECN)
tp->t_flags |= TF_ECN_PERMIT;
tp->t_flags2 |= TF2_ECN_PERMIT;
/*
* Set up MSS and get cached values from tcp_hostcache.

View File

@ -1572,7 +1572,7 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
ti->tcpi_snd_wscale = tp->snd_scale;
ti->tcpi_rcv_wscale = tp->rcv_scale;
}
if (tp->t_flags & TF_ECN_PERMIT)
if (tp->t_flags2 & TF2_ECN_PERMIT)
ti->tcpi_options |= TCPI_OPT_ECN;
ti->tcpi_rto = tp->t_rxtcur * tick;
@ -2610,16 +2610,25 @@ db_print_tflags(u_int t_flags)
db_printf("%sTF_TSO", comma ? ", " : "");
comma = 1;
}
if (t_flags & TF_ECN_PERMIT) {
db_printf("%sTF_ECN_PERMIT", comma ? ", " : "");
comma = 1;
}
if (t_flags & TF_FASTOPEN) {
db_printf("%sTF_FASTOPEN", comma ? ", " : "");
comma = 1;
}
}
static void
db_print_tflags2(u_int t_flags2)
{
int comma;
comma = 0;
if (t_flags2 & TF2_ECN_PERMIT) {
db_printf("%sTF2_ECN_PERMIT", comma ? ", " : "");
comma = 1;
}
}
static void
db_print_toobflags(char t_oobflags)
{
@ -2667,6 +2676,11 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent)
db_print_tflags(tp->t_flags);
db_printf(")\n");
db_print_indent(indent);
db_printf("t_flags2: 0x%x (", tp->t_flags2);
db_print_tflags2(tp->t_flags2);
db_printf(")\n");
db_print_indent(indent);
db_printf("snd_una: 0x%08x snd_max: 0x%08x snd_nxt: x0%08x\n",
tp->snd_una, tp->snd_max, tp->snd_nxt);

View File

@ -326,6 +326,8 @@ TAILQ_HEAD(tcp_funchead, tcp_function);
#define TF_NEEDFIN 0x00000800 /* send FIN (implicit state) */
#define TF_NOPUSH 0x00001000 /* don't push */
#define TF_PREVVALID 0x00002000 /* saved values for bad rxmit valid */
#define TF_UNUSED1 0x00004000 /* unused */
#define TF_UNUSED2 0x00008000 /* unused */
#define TF_MORETOCOME 0x00010000 /* More data to be appended to sock */
#define TF_LQ_OVERFLOW 0x00020000 /* listen queue overflow */
#define TF_LASTIDLE 0x00040000 /* connection was previously idle */
@ -336,9 +338,9 @@ TAILQ_HEAD(tcp_funchead, tcp_function);
#define TF_FORCEDATA 0x00800000 /* force out a byte */
#define TF_TSO 0x01000000 /* TSO enabled on this connection */
#define TF_TOE 0x02000000 /* this connection is offloaded */
#define TF_ECN_PERMIT 0x04000000 /* connection ECN-ready */
#define TF_ECN_SND_CWR 0x08000000 /* ECN CWR in queue */
#define TF_ECN_SND_ECE 0x10000000 /* ECN ECE in queue */
#define TF_UNUSED3 0x04000000 /* unused */
#define TF_UNUSED4 0x08000000 /* unused */
#define TF_UNUSED5 0x10000000 /* unused */
#define TF_CONGRECOVERY 0x20000000 /* congestion recovery mode */
#define TF_WASCRECOVERY 0x40000000 /* was in congestion recovery */
#define TF_FASTOPEN 0x80000000 /* TCP Fast Open indication */
@ -377,6 +379,10 @@ TAILQ_HEAD(tcp_funchead, tcp_function);
#define TF2_PLPMTU_MAXSEGSNT 0x00000004 /* Last seg sent was full seg. */
#define TF2_LOG_AUTO 0x00000008 /* Session is auto-logging. */
#define TF2_DROP_AF_DATA 0x00000010 /* Drop after all data ack'd */
#define TF2_ECN_PERMIT 0x00000020 /* connection ECN-ready */
#define TF2_ECN_SND_CWR 0x00000040 /* ECN CWR in queue */
#define TF2_ECN_SND_ECE 0x00000080 /* ECN ECE in queue */
#define TF2_ACE_PERMIT 0x00000100 /* Accurate ECN mode */
/*
* Structure to hold TCP options that are only used during segment