From owner-p4-projects@FreeBSD.ORG Tue Aug 16 14:52:08 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E53631065673; Tue, 16 Aug 2011 14:52:07 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7F8E106566C for ; Tue, 16 Aug 2011 14:52:07 +0000 (UTC) (envelope-from cnicutar@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 7C3088FC08 for ; Tue, 16 Aug 2011 14:52:07 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GEq7Pr097783 for ; Tue, 16 Aug 2011 14:52:07 GMT (envelope-from cnicutar@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p7GEq74h097780 for perforce@freebsd.org; Tue, 16 Aug 2011 14:52:07 GMT (envelope-from cnicutar@freebsd.org) Date: Tue, 16 Aug 2011 14:52:07 GMT Message-Id: <201108161452.p7GEq74h097780@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to cnicutar@freebsd.org using -f From: Catalin Nicutar To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 197726 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 14:52:08 -0000 http://p4web.freebsd.org/@@197726?ac=10 Change 197726 by cnicutar@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);