[openib-general] [PATCH] RDMA CM: assign port numbers when binding a cm_id to an address

James Lentini jlentini at netapp.com
Thu Apr 20 11:56:24 PDT 2006



On Tue, 18 Apr 2006, Sean Hefty wrote:

> Assign/reserve a port number when binding a cm_id.  If no port number is
> given, assign one from the local port space.  If a port number is given,
> reserve it.
> 
> The RDMA port space is separate from that used for TCP.  iWarp devices
> will need to coordinate between the port values assigned by the rdma_cm
> and those in use by TCP.  SDP also has its own port space.


What rdma cm calls do you expect the active consumer to make? 

In NFS-RDMA we do this:

rdma_create_id()
rdma_resolve_addr()
rdma_resolve_route()
rdma_create_qp()
rdma_connect()

We don't need to call rdma_bind_addr(), and hence won't have a port 
number assigned. 

Did you consider automatically assigning a port in connect? Something 
along the lines of 

 if (cma_any_port())
	cma_alloc_port()

One comment below:

<snip>

> +static int cma_get_port(struct rdma_id_private *id_priv)
> +{
> +	struct idr *ps;
> +	int ret;
> +
> +	switch (id_priv->id.ps) {
> +	case RDMA_PS_SDP:
> +		ps = &sdp_ps;
> +		break;
> +	case RDMA_PS_TCP:
> +		ps = &tcp_ps;
> +		break;
> +	default:
> +		return -EPROTONOSUPPORT;
> +	}

Do you plan to add support for UDP and SCTP since they have 
rdma_port_space values? Is it as simple as adding a UDP and SCTP idr?

> +
> +	mutex_lock(&lock);
> +	if (cma_any_port(&id_priv->id.route.addr.src_addr))
> +		ret = cma_alloc_port(ps, id_priv, 0);
> +	else
> +		ret = cma_use_port(ps, id_priv);
> +	mutex_unlock(&lock);
> +
> +	return ret;
> +}



More information about the general mailing list