PERFORCE change 197726 for review

Catalin Nicutar cnicutar at FreeBSD.org
Tue Aug 16 14:52:08 UTC 2011


http://p4web.freebsd.org/@@197726?ac=10

Change 197726 by cnicutar at cnicutar_cronos on 2011/08/16 14:51:25

	Add function that drops tcp connections using UTO.

Affected files ...

.. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_subr.c#3 edit
.. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_var.h#4 edit

Differences ...

==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_subr.c#3 (text+ko) ====

@@ -1034,6 +1034,48 @@
 }
 
 /*
+ * This function walks the list of TCP connections and attempts to free
+ * up space by dropping connections.
+ *
+ * XXX-CN This should be considered a work in progress. In particular
+ * it's not yet clear wether this should be merged with tcp_drain (which
+ * also iterates over TCP connections but uses a read lock for tcbinfo).
+ *
+ * In the future this function could be modified to drop more types of
+ * TCP connections.
+ */
+void
+tcp_drop_uto(void)
+{
+	VNET_ITERATOR_DECL(vnet_iter);
+	VNET_LIST_RLOCK_NOSLEEP();
+	VNET_FOREACH(vnet_iter) {
+		CURVNET_SET(vnet_iter);
+		struct inpcb *inp;
+		struct tcpcb *tp;
+
+		/*
+		 * Drop connections that wouldn't have survived without
+		 * UTO.
+		 * XXX-CN This negates the advantages of UTO for everyone
+		 * instead of just dropping misbehaving connections.
+		 */
+		INP_INFO_WLOCK(&V_tcbinfo);
+		LIST_FOREACH(inp, V_tcbinfo.ipi_listhead, inp_list) {
+			INP_WLOCK(inp);
+			if ((tp = intotcpcb(inp)) != NULL) {
+				if (tp->t_rxtshift > TCP_MAXRXTSHIFT)
+					tcp_drop(tp, ETIMEDOUT);
+			}
+			INP_WUNLOCK(inp);
+		}
+		INP_INFO_WUNLOCK(&V_tcbinfo);
+		CURVNET_RESTORE();
+	}
+	VNET_LIST_RUNLOCK_NOSLEEP();
+}
+
+/*
  * Notify a tcp user of an asynchronous error;
  * store error as soft error, but wake up user
  * (for now, won't do anything until can select for soft error).

==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_var.h#4 (text+ko) ====

@@ -678,6 +678,7 @@
 struct tcpcb *
 	 tcp_drop(struct tcpcb *, int);
 void	 tcp_drain(void);
+void	 tcp_drop_uto(void);
 void	 tcp_init(void);
 #ifdef VIMAGE
 void	 tcp_destroy(void);


More information about the p4-projects mailing list