Received: with ECARTIS (v1.0.0; list netdev); Mon, 01 Nov 2004 09:19:10 -0800 (PST) Received: from fire-1.osdl.org (fire.osdl.org [65.172.181.4]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA1HJ3Pj030004 for ; Mon, 1 Nov 2004 09:19:04 -0800 Received: from zqx3.pdx.osdl.net (fw.osdl.org [65.172.181.6]) (authenticated bits=0) by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id iA1HIbPE007190 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 1 Nov 2004 09:18:37 -0800 Date: Mon, 1 Nov 2004 09:20:27 -0800 From: Stephen Hemminger To: Michael Vittrup Larsen Cc: "David S. Miller" , netdev@oss.sgi.com Subject: Re: [PATCH] tcp: efficient port randomisation Message-Id: <20041101092027.2a741e82@zqx3.pdx.osdl.net> In-Reply-To: <200411011058.23141.michael.vittrup.larsen@ericsson.com> References: <20041027092531.78fe438c@guest-251-240.pdx.osdl.net> <200410291048.01955.michael.vittrup.larsen@ericsson.com> <20041029102828.123502e7@zqx3.pdx.osdl.net> <200411011058.23141.michael.vittrup.larsen@ericsson.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i686-suse-linux) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-MIMEDefang-Filter: osdl$Revision: 1.93 $ X-Scanned-By: MIMEDefang 2.36 X-archive-position: 11283 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev Content-Length: 1346 Lines: 31 On Mon, 1 Nov 2004 11:58:23 +0200 Michael Vittrup Larsen wrote: > On Friday 29 October 2004 19:28, Stephen Hemminger wrote: > > Provide port randomization for incoming connections using variation of > > existing sequence number hash. Replace tcp_portalloc_lock and > > tcp_port_rover with atomic operation to allow better parallelism. > > > > This is based on > > http://www.ietf.org/internet-drafts/draft-larsen-tsvwg-port-randomisation-0 > >0.txt (with confirmation of of no IPR issues). > > I have looked through this, and have a few comments: > > * It is probably a good strategy to set 'tcp_rover_next' such that > the next search is resumed from the previous port found to be free. > (similar to the old algorithm). I don't see this in your patch, > but of course I could have missed it. It was intentional since it would require holding a lock around the search. The tradeoff is better SMP performance in the sparsely filled port space (more typical) vs. better UP performance in the case of a mostly full port space. > * connect_port_offset() does not (at least from an algorithm point > of view) need to return an u32, an u16 is sufficient. If it is truncated to u16, then compiler has to take extra effort to truncate is unnecessary given later modulo operation. > Michael Larsen