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

Tom Tucker tom at opengridcomputing.com
Tue Mar 28 14:45:53 PST 2006


On Tue, 2006-03-28 at 12:35 -0800, Sean Hefty wrote:
> >Whether it's a separate port space or not is as simple as defining a
> >different hash_info structure.
> >
> >struct inet_hashinfo __cachline_aligned ib_hashinfo = {
> >	.lhash_lock	= RW_LOCK_UNLOCKED,
> >	.lhash_users	= ATOMIC_INIT(0),
> >	.lhash_wait	= _WAIT_QUEUE_HEAD_INITIALIZER(ib_hashinfo.lhash_wait);
> >};
> >
> >#ifndef I_WANT_SHARED_TCP_PORTSPACE
> >struct inet_hashinfo __cachline_aligned __iw_hashinfo = {
> >	.lhash_lock	= RW_LOCK_UNLOCKED,
> >	.lhash_users	= ATOMIC_INIT(0),
> >	.lhash_wait	= _WAIT_QUEUE_HEAD_INITIALIZER(ib_hashinfo.lhash_wait);
> >};
> >struct inet_hashinfo *iw_hashinfo = &__iw_hashinfo;
> >#else
> >struct inet_hashinfo *iw_hashinfo = &tcp_hashinfo;
> >#endif
> 
> Sweet!  :)
> 
> >struct sock dummy {
> >	/* initialized for REUSE port, etc... */
> >};
> >struct sock *ib_sock = &dummy;
> >
> >int ib_get_port(unsigned short snum)
> >{
> >	return inet_csk_get_port(&ib_hashinfo, ib_sock, snum)
> >}
> >
> >int iw_get_port(unsigned short snum)
> >{
> >	return inet_csk_get_port(&iw_hashinfo, iw_sock, snum);
> >}
> 
> Is it safe to re-use the same socket each time?  

Unfortunately...no. I apologize if I presented this as a fait-
accomplis...it's just an approach. The reason is that the code adds the
socket to an 'owners' list at get time and removes it from the list at
put time. To reuse the code as-is, we would need to have a 'dummy'
struct inet_connection_sock for each cm_id -- and this is a big messy
structure.

The simplest thing is to steal the get and put code and modify it to use
rdma_cm_id instead of sockets.

inet_csk_get_port --> rdma_get_port
inet_put_port --> rdma_put_port

How about if I add the port management code to the next IWCM patch along
with the provider changes?

> - Sean




More information about the general mailing list