svn commit: r360961 - head/sys/netinet6

Andrew Gallatin gallatin at FreeBSD.org
Tue May 12 14:01:13 UTC 2020


Author: gallatin
Date: Tue May 12 14:01:12 2020
New Revision: 360961
URL: https://svnweb.freebsd.org/changeset/base/360961

Log:
  IPv6: sync IP_NO_SND_TAG_RL support from IPv4
  
  The IP_NO_SND_TAG_RL flag to ip{,6}_output() means that the packets
  being sent should bypass hardware rate limiting. This is typically used
  by modern TCP stacks for rexmits.
  
  This support was added to IPv4 in r352657, but never added to IPv6, even
  though rack and bbr call ip6_output() with this flag.
  
  Reviewed by:	rrs
  Sponsored by:	Netflix
  Differential Revision:	https://reviews.freebsd.org/D24822

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c	Tue May 12 13:23:25 2020	(r360960)
+++ head/sys/netinet6/ip6_output.c	Tue May 12 14:01:12 2020	(r360961)
@@ -322,7 +322,8 @@ ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int h
 
 static int
 ip6_output_send(struct inpcb *inp, struct ifnet *ifp, struct ifnet *origifp,
-    struct mbuf *m, struct sockaddr_in6 *dst, struct route_in6 *ro)
+    struct mbuf *m, struct sockaddr_in6 *dst, struct route_in6 *ro,
+    bool stamp_tag)
 {
 #ifdef KERN_TLS
 	struct ktls_session *tls = NULL;
@@ -353,6 +354,10 @@ ip6_output_send(struct inpcb *inp, struct ifnet *ifp, 
 			error = EAGAIN;
 			goto done;
 		}
+		/*
+		 * Always stamp tags that include NIC ktls.
+		 */
+		stamp_tag = true;
 	}
 #endif
 #ifdef RATELIMIT
@@ -366,7 +371,7 @@ ip6_output_send(struct inpcb *inp, struct ifnet *ifp, 
 			mst = inp->inp_snd_tag;
 	}
 #endif
-	if (mst != NULL) {
+	if (stamp_tag && mst != NULL) {
 		KASSERT(m->m_pkthdr.rcvif == NULL,
 		    ("trying to add a send tag to a forwarded packet"));
 		if (mst->ifp != ifp) {
@@ -1165,7 +1170,8 @@ passout:
 			    m->m_pkthdr.len);
 			ifa_free(&ia6->ia_ifa);
 		}
-		error = ip6_output_send(inp, ifp, origifp, m, dst, ro);
+		error = ip6_output_send(inp, ifp, origifp, m, dst, ro,
+		    (flags & IP_NO_SND_TAG_RL) ? false : true);
 		goto done;
 	}
 
@@ -1256,7 +1262,8 @@ sendorfree:
 				counter_u64_add(ia->ia_ifa.ifa_obytes,
 				    m->m_pkthdr.len);
 			}
-			error = ip6_output_send(inp, ifp, origifp, m, dst, ro);
+			error = ip6_output_send(inp, ifp, origifp, m, dst, ro,
+			    true);
 		} else
 			m_freem(m);
 	}


More information about the svn-src-head mailing list