From owner-svn-src-all@FreeBSD.ORG Fri Apr 11 21:01:00 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 063F1901; Fri, 11 Apr 2014 21:01:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6F0F1C2A; Fri, 11 Apr 2014 21:00:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3BL0xOn044492; Fri, 11 Apr 2014 21:00:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3BL0x79044491; Fri, 11 Apr 2014 21:00:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201404112100.s3BL0x79044491@svn.freebsd.org> From: John Baldwin Date: Fri, 11 Apr 2014 21:00:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264356 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Apr 2014 21:01:00 -0000 Author: jhb Date: Fri Apr 11 21:00:59 2014 New Revision: 264356 URL: http://svnweb.freebsd.org/changeset/base/264356 Log: Some whitespace and style fixes. Submitted by: bde Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Fri Apr 11 20:44:09 2014 (r264355) +++ head/sys/netinet/tcp_timewait.c Fri Apr 11 21:00:59 2014 (r264356) @@ -93,7 +93,7 @@ __FBSDID("$FreeBSD$"); #include static VNET_DEFINE(uma_zone_t, tcptw_zone); -#define V_tcptw_zone VNET(tcptw_zone) +#define V_tcptw_zone VNET(tcptw_zone) static int maxtcptw; /* @@ -103,22 +103,25 @@ static int maxtcptw; * timewait lock, which must be held over queue iteration and modification. */ static VNET_DEFINE(TAILQ_HEAD(, tcptw), twq_2msl); -#define V_twq_2msl VNET(twq_2msl) +#define V_twq_2msl VNET(twq_2msl) /* Global timewait lock */ static VNET_DEFINE(struct rwlock, tw_lock); -#define V_tw_lock VNET(tw_lock) +#define V_tw_lock VNET(tw_lock) -#define TW_LOCK_INIT(tw, d) rw_init_flags(&(tw), (d), 0) -#define TW_LOCK_DESTROY(tw) rw_destroy(&(tw)) -#define TW_RLOCK(tw) rw_rlock(&(tw)) -#define TW_WLOCK(tw) rw_wlock(&(tw)) -#define TW_RUNLOCK(tw) rw_runlock(&(tw)) -#define TW_WUNLOCK(tw) rw_wunlock(&(tw)) -#define TW_LOCK_ASSERT(tw) rw_assert(&(tw), RA_LOCKED) -#define TW_RLOCK_ASSERT(tw) rw_assert(&(tw), RA_RLOCKED) -#define TW_WLOCK_ASSERT(tw) rw_assert(&(tw), RA_WLOCKED) -#define TW_UNLOCK_ASSERT(tw) rw_assert(&(tw), RA_UNLOCKED) +#define TW_LOCK_INIT(tw, d) rw_init_flags(&(tw), (d), 0) +#define TW_LOCK_DESTROY(tw) rw_destroy(&(tw)) +#define TW_RLOCK(tw) rw_rlock(&(tw)) +#define TW_WLOCK(tw) rw_wlock(&(tw)) +#define TW_RUNLOCK(tw) rw_runlock(&(tw)) +#define TW_WUNLOCK(tw) rw_wunlock(&(tw)) +#define TW_LOCK_ASSERT(tw) rw_assert(&(tw), RA_LOCKED) +#define TW_RLOCK_ASSERT(tw) rw_assert(&(tw), RA_RLOCKED) +#define TW_WLOCK_ASSERT(tw) rw_assert(&(tw), RA_WLOCKED) +#define TW_UNLOCK_ASSERT(tw) rw_assert(&(tw), RA_UNLOCKED) + +static void tcp_tw_2msl_reset(struct tcptw *, int); +static void tcp_tw_2msl_stop(struct tcptw *, int); /* * tw_pcbref() bumps the reference count on an tw in order to maintain @@ -140,17 +143,12 @@ tw_pcbrele(struct tcptw *tw) { KASSERT(tw->tw_refcount > 0, ("%s: refcount 0", __func__)); - if (!refcount_release(&tw->tw_refcount)) return (0); - uma_zfree(V_tcptw_zone, tw); return (1); } -static void tcp_tw_2msl_reset(struct tcptw *, int ream); -static void tcp_tw_2msl_stop(struct tcptw *, int reuse); - static int tcptw_auto_size(void) { @@ -368,7 +366,7 @@ tcp_twstart(struct tcpcb *tp) * Most other new OSes use semi-randomized ISN values, so we * do not need to worry about them. */ -#define MS_ISN_BYTES_PER_SECOND 250000 +#define MS_ISN_BYTES_PER_SECOND 250000 /* * Determine if the ISN we will generate has advanced beyond the last @@ -686,11 +684,10 @@ tcp_tw_2msl_stop(struct tcptw *tw, int r struct tcptw * tcp_tw_2msl_reuse(void) { + struct tcptw *tw; INP_INFO_WLOCK_ASSERT(&V_tcbinfo); - struct tcptw *tw; - TW_WLOCK(V_tw_lock); tw = TAILQ_FIRST(&V_twq_2msl); if (tw == NULL) { @@ -708,12 +705,12 @@ tcp_tw_2msl_reuse(void) void tcp_tw_2msl_scan(void) { - struct tcptw *tw; + for (;;) { TW_RLOCK(V_tw_lock); tw = TAILQ_FIRST(&V_twq_2msl); - if (tw == NULL || ((tw->tw_time - ticks) > 0)) { + if (tw == NULL || tw->tw_time - ticks > 0) { TW_RUNLOCK(V_tw_lock); break; } @@ -729,12 +726,11 @@ tcp_tw_2msl_scan(void) KASSERT(tw->tw_inpcb != NULL, ("%s: tw->tw_inpcb == NULL", __func__)); - INP_WLOCK(tw->tw_inpcb); tcp_twclose(tw, 0); INP_INFO_WUNLOCK(&V_tcbinfo); } else { - /* INP_INFO lock is busy, continue later */ + /* INP_INFO lock is busy; continue later. */ tw_pcbrele(tw); break; }