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

Tang, Changqing changquing.tang at hp.com
Tue Oct 16 21:05:18 PDT 2007


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 ?

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.


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.
> 



More information about the general mailing list