Page MenuHomeFreeBSD

D32600.id97296.diff
No OneTemporary

D32600.id97296.diff

Index: sys/netinet/ip_output.c
===================================================================
--- sys/netinet/ip_output.c
+++ sys/netinet/ip_output.c
@@ -84,6 +84,9 @@
#include <netinet/ip_options.h>
#include <netinet/ip_mroute.h>
+#include <netinet/tcp.h>
+#include <netinet/tcp_var.h>
+
#include <netinet/udp.h>
#include <netinet/udp_var.h>
@@ -1225,6 +1228,7 @@
switch (sopt->sopt_name) {
case IP_TOS:
inp->inp_ip_tos = optval;
+ tcp_codepoint_changed(inp);
break;
case IP_TTL:
Index: sys/netinet/tcp_stacks/rack.c
===================================================================
--- sys/netinet/tcp_stacks/rack.c
+++ sys/netinet/tcp_stacks/rack.c
@@ -12508,6 +12508,7 @@
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;
@@ -12527,9 +12528,38 @@
tp->t_port,
ip, rack->r_ctl.fsb.th);
}
+#endif
rack->r_fsb_inited = 1;
}
+static void
+rack_update_fsb_codepoint(struct tcpcb *tp, struct tcp_rack *rack)
+{
+#ifdef INET6
+ struct ip6_hdr *ip6 = NULL;
+#endif
+#ifdef INET
+ struct ip *ip = NULL;
+#endif
+ /*
+ * A socket option changed the outgoing TOS/TCLASS update
+ * the fast send block.
+ */
+#ifdef INET6
+ if (rack->r_is_v6) {
+ ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr;
+ ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) |
+ (rack->rc_inp->inp_flow & IPV6_FLOWINFO_MASK);
+ }
+#endif
+#ifdef INET
+ else {
+ ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr;
+ ip->ip_tos = rack->rc_inp->inp_ip_tos;
+ }
+#endif
+}
+
static int
rack_init_fsb(struct tcpcb *tp, struct tcp_rack *rack)
{
@@ -16873,6 +16903,11 @@
}
idle = 0;
}
+ if (tp->t_flags2 & TF2_CODEPOINT_CHANGED) {
+ if (rack->r_fsb_inited)
+ rack_update_fsb_codepoint(tp, rack);
+ tp->t_flags2 &= ~TF2_CODEPOINT_CHANGED;
+ }
if (rack_use_fsb && (rack->r_fsb_inited == 0) && (rack->r_state != TCPS_CLOSED))
rack_init_fsb_block(tp, rack);
again:
Index: sys/netinet/tcp_subr.c
===================================================================
--- sys/netinet/tcp_subr.c
+++ sys/netinet/tcp_subr.c
@@ -4129,3 +4129,19 @@
}
}
}
+
+void
+tcp_codepoint_changed(struct inpcb *inp)
+{
+ struct tcpcb *tp = intotcpcb(inp);
+
+ /*
+ * This is used by IP stacks to announce a
+ * change in the IP DSCP codepoint. Stacks
+ * like rack can use the flag to realize their
+ * fastpath may need an update.
+ */
+ INP_WLOCK(inp);
+ tp->t_flags2 |= TF2_CODEPOINT_CHANGED;
+ INP_WUNLOCK(inp);
+}
Index: sys/netinet/tcp_var.h
===================================================================
--- sys/netinet/tcp_var.h
+++ sys/netinet/tcp_var.h
@@ -462,6 +462,7 @@
#define TF2_ECN_SND_ECE 0x00000080 /* ECN ECE in queue */
#define TF2_ACE_PERMIT 0x00000100 /* Accurate ECN mode */
#define TF2_FBYTES_COMPLETE 0x00000400 /* We have first bytes in and out */
+#define TF2_CODEPOINT_CHANGED 0x00020000 /* An ip option changed the DSCP codepoint */
/*
* Structure to hold TCP options that are only used during segment
* processing (in tcp_input), but not held in the tcpcb.
@@ -1124,6 +1125,7 @@
size_t seed_len);
int tcp_can_enable_pacing(void);
void tcp_decrement_paced_conn(void);
+void tcp_codepoint_changed(struct inpcb *);
struct mbuf *
tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen,
Index: sys/netinet6/ip6_output.c
===================================================================
--- sys/netinet6/ip6_output.c
+++ sys/netinet6/ip6_output.c
@@ -2003,6 +2003,8 @@
(u_char *)&optval, sizeof(optval),
optp, (td != NULL) ? td->td_ucred :
NULL, uproto);
+ if (optname == IPV6_TCLASS)
+ tcp_codepoint_changed(inp);
INP_WUNLOCK(inp);
break;
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jun 15, 2:31 PM (7 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33970497
Default Alt Text
D32600.id97296.diff (3 KB)

Event Timeline