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

Sean Hefty sean.hefty at intel.com
Tue Mar 28 12:35:08 PST 2006


>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?  When are the ports available
for re-use?

- Sean



More information about the general mailing list