[ofa-general] librdmacm port selection for rdma_bind_addr()

Steve Wise swise at opengridcomputing.com
Wed Oct 17 07:38:06 PDT 2007



Tang, Changqing wrote:
> Below is the piece of rping.c code, how do I pick the returned port ? Do
> you reset sin.sin_port inside rdma_bind_addr() if I pass 0 to
> sin.sin_port ?
> 

Yes.

> I need the returned port to tell client side to call
> rdma_resolve_addr(). If I am right, rdma_resolve_addr() needs dest port
> number.
>

Sean, Does resolve_addr really need anything more than the ip address? 
For iWARP it doesn't.


> 
> static int rping_bind_server(struct rping_cb *cb)
> {
> 	struct sockaddr_in sin;
> 	int ret;
> 
> 	memset(&sin, 0, sizeof(sin));
> 	sin.sin_family = AF_INET;
> 	sin.sin_addr.s_addr = cb->addr;
> 	sin.sin_port = 0;	///////////cb->port;
> 
> 	ret = rdma_bind_addr(cb->cm_id, (struct sockaddr *) &sin);
> 	if (ret) {
> 		fprintf(stderr, "rdma_bind_addr error %d\n", ret);
> 		return ret;
> 	}
> 	DEBUG_LOG("rdma_bind_addr successful\n");
> 
> --CQ 
> 
>> -----Original Message-----
>> From: Sean Hefty [mailto:mshefty at ichips.intel.com] 
>> Sent: Tuesday, October 16, 2007 11:40 AM
>> To: Tang, Changqing
>> Cc: general at lists.openfabrics.org
>> Subject: Re: [ofa-general] librdmacm port selection for 
>> rdma_bind_addr()
>>
>>> 	Is there a way to let system choose a port for me ? 
>> like TCP/IP, if 
>>> port is set to 0, system will return an unused port.
>> Yes - binding to port 0 will return a usable port.
>>
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general



More information about the general mailing list