[openib-general] CMA issue: bind selects the same port after close

Krishna Kumar2 krkumar2 at in.ibm.com
Mon Sep 11 21:27:50 PDT 2006


Hi Michael,

> > The basic problem in the CMA is in cma_alloc_port().  If the port 
number (passed 
> > in as snum) is 0, the first available port starting at 
> > sysctl_local_port_range[0] is used.  We could instead start our search 
by 
> > adding an increasing counter or a random value to the lower-end of the 
port 
> > range.  Then expand the code to handle searching below our starting 
value if we 
> > failed to find one above it.
> 
> Sounds good.
> 
> > Are the port numbers assigned by TCP sequential or more random?
> 
> TCP ports seem to be sequential.

Are you getting sequential port numbers ? inet_csk_get_port() is actually 
using random
number to get the *starting* value between sysctl_local_port_range[0] and
sysctl_local_port_range[2]. Once it gets this starting number, it goes 
sequentially all the
way to the high limit (sysctl*[1]) and then loops back from low 
(sysctl*[0]) limit until all
the numbers in the middle are looked at.

I think we can easily use the same logic. Sean's second option seems to be 
followed
here "> > adding a random value to the lower-end of the port range"

Thanks,

- KK





More information about the general mailing list