[openib-general] Re: [PATCH] CMA: allow/require bind before connect

Sean Hefty mshefty at ichips.intel.com
Mon Mar 27 10:22:43 PST 2006


Michael S. Tsirkin wrote:
>>>>>Sean, CMA currently bails out if I bind to ANY address before connect.
>>>>>I think in TCP you bind before connect 
>>>>
>>>>It is not typical to use bind on the active side before connect. When it
>>>>is done, is when the application wants to control which local port
>>>>and/or interface to use when connecting to a remove peer. bind(2) is
>>>>typically used on the passive side before listen.
>>>
>>>Tom, I have a connection bind on a local port to control which local port
>>>to use when connecting to a remove peer.

Couldn't you specify the local port when calling rdma_resolve_addr()?  TCP 
doesn't require calling bind before connect, so I'd like to avoid requiring that 
here.

>>>At the level I work in SDP, Linux net core calls bind before connect if the
>>>socket source port is 0. I could override this but I don't think its a good
>>>idea since the point is to emulate TCP: TCP connections always have a source
>>>port and so should CMA connections.

The purpose behind the CMA is to establish connections using TCP/IP addressing, 
versus trying to emulate TCP.  On the passive side, this means that the CMA 
supports listening on a 16-bit port number on a single IP address, or across all 
IP addresses.  On the active side, there's no need to even use a port number 
(when running over IB).  The CMA doesn't need it to establish a connection or 
use it to match received data with the correct connection.

> CMA does not allocate ephemeral ports currently.
> This actually makes some sense since address families/port spaces expect
> different semantics wrt which port numbers are legal.

It's correct that the CMA currently does not do this.  I guess I'm still unsure 
of why it needs to when running over IB.  The CMA should work fine if it 
assigned every active connection the same port number.  As long as the CMA 
manages its own port spaces, does it matter if its semantics are defined this way?

- Sean



More information about the general mailing list