netdev
[Top] [All Lists]

Re: [PATCH] tcp: efficient port randomisation

To: Michael Vittrup Larsen <michael.vittrup.larsen@xxxxxxxxxxxx>
Subject: Re: [PATCH] tcp: efficient port randomisation
From: Stephen Hemminger <shemminger@xxxxxxxx>
Date: Mon, 1 Nov 2004 09:20:27 -0800
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <200411011058.23141.michael.vittrup.larsen@xxxxxxxxxxxx>
Organization: Open Source Development Lab
References: <20041027092531.78fe438c@xxxxxxxxxxxxxxxxxxxxxxxxxx> <200410291048.01955.michael.vittrup.larsen@xxxxxxxxxxxx> <20041029102828.123502e7@xxxxxxxxxxxxxxxxx> <200411011058.23141.michael.vittrup.larsen@xxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Mon, 1 Nov 2004 11:58:23 +0200
Michael Vittrup Larsen <michael.vittrup.larsen@xxxxxxxxxxxx> 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

<Prev in Thread] Current Thread [Next in Thread>