[ewg] [PATCH RFC v3] RDMA/CMA: Allocate PS_TCP ports from the host TCP port space.

Or Gerlitz ogerlitz at voltaire.com
Tue Nov 11 22:54:55 PST 2008


Chien Tung wrote:
> This is needed for iwarp providers that support native and rdma connections over the same interface. V3 change: cma_get_tcp_port does not fill in the port number for the allocated socket when 0 is passed in for active open.  Call getname to fill in the port number.
>   
I understand that now the value of the port allocated by the network 
stack is being kept by the rdma-cm, can you clarify what was the outcome 
of not keeping it?

Or.


>  drivers/infiniband/core/cma.c |   43 ++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 42 insertions(+), 1 deletions(-)
>
> Index: ofed_kernel/drivers/infiniband/core/cma.c
> ===================================================================
> --- ofed_kernel.orig/drivers/infiniband/core/cma.c
> +++ ofed_kernel/drivers/infiniband/core/cma.c
> @@ -58,6 +58,11 @@ static int tavor_quirk = 0;
>  module_param_named(tavor_quirk, tavor_quirk, int, 0644);
>  MODULE_PARM_DESC(tavor_quirk, "Tavor performance quirk: limit MTU to 1K if > 0");
>  
> +int unify_tcp_port_space = 0;
> +module_param(unify_tcp_port_space, int, 0644);
> +MODULE_PARM_DESC(unify_tcp_port_space, "Unify the host TCP and RDMA port "
> +		 "space allocation (default=0)");
> +
>  #define CMA_CM_RESPONSE_TIMEOUT 20
>  #define CMA_MAX_CM_RETRIES 15
>  #define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
> @@ -125,6 +130,7 @@ struct rdma_id_private {
>  	struct rdma_cm_id	id;
>  
>  	struct rdma_bind_list	*bind_list;
> +	struct socket		*sock;
>  	struct hlist_node	node;
>  	struct list_head	list; /* listen_any_list or cma_device.list */
>  	struct list_head	listen_list; /* per device listens */
> @@ -815,6 +821,8 @@ static void cma_release_port(struct rdma_id_private *id_priv)
>  		kfree(bind_list);
>  	}
>  	mutex_unlock(&lock);
> +	if (id_priv->sock)
> +		sock_release(id_priv->sock);
>  }
>  
>  static void cma_leave_mc_groups(struct rdma_id_private *id_priv)
> @@ -2049,6 +2057,34 @@ static int cma_use_port(struct idr *ps, struct rdma_id_private *id_priv)
>  	return 0;
>  }
>  
> +static int cma_get_tcp_port(struct rdma_id_private *id_priv)
> +{
> +	int ret;
> +	int size;
> +	struct socket *sock;
> +
> +	ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
> +	if (ret)
> +		return ret;
> +	ret = sock->ops->bind(sock,
> +			(struct sockaddr *) &id_priv->id.route.addr.src_addr,
> +			ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr));
> +	if (ret) {
> +		sock_release(sock);
> +		return ret;
> +	}
> +	size = ip_addr_size(&id_priv->id.route.addr.src_addr);
> +	ret = sock->ops->getname(sock,
> +			(struct sockaddr *) &id_priv->id.route.addr.src_addr,
> +			&size, 0);
> +	if (ret) {
> +		sock_release(sock);
> +		return ret;
> +	}
> +	id_priv->sock = sock;
> +	return 0;
> +}
> +
>  static int cma_get_port(struct rdma_id_private *id_priv)
>  {
>  	struct idr *ps;
> @@ -2060,6 +2096,11 @@ static int cma_get_port(struct rdma_id_private *id_priv)
>  		break;
>  	case RDMA_PS_TCP:
>  		ps = &tcp_ps;
> +		if (unify_tcp_port_space) {
> +			ret = cma_get_tcp_port(id_priv);
> +			if (ret)
> +				goto out;
> +		}
>  		break;
>  	case RDMA_PS_UDP:
>  		ps = &udp_ps;
> @@ -2077,7 +2118,7 @@ static int cma_get_port(struct rdma_id_private *id_priv)
>  	else
>  		ret = cma_use_port(ps, id_priv);
>  	mutex_unlock(&lock);
> -
> +out:
>  	return ret;
>  }
>  
> _______________________________________________
> ewg mailing list
> ewg at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg
>   





More information about the ewg mailing list