[openib-general] [PATCH] rdma_cm: let SDP control the SDP version in the hello header

Sean Hefty sean.hefty at intel.com
Thu Apr 27 09:41:18 PDT 2006


These are the changes to the CMA that I was considering.

This patch lets SDP determine which version of the SDP headers to use.
The CMA will check that it can support that version, and set the
address fields appropriately.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
Index: cma.c
===================================================================
--- cma.c	(revision 6627)
+++ cma.c	(working copy)
@@ -1473,8 +1473,8 @@ err:
 }
 EXPORT_SYMBOL(rdma_bind_addr);
 
-static void cma_format_hdr(void *hdr, enum rdma_port_space ps,
-			   struct rdma_route *route)
+static int cma_format_hdr(void *hdr, enum rdma_port_space ps,
+			  struct rdma_route *route)
 {
 	struct sockaddr_in *src4, *dst4;
 	struct cma_hdr *cma_hdr;
@@ -1486,7 +1486,8 @@ static void cma_format_hdr(void *hdr, en
 	switch (ps) {
 	case RDMA_PS_SDP:
 		sdp_hdr = hdr;
-		sdp_hdr->sdp_version = SDP_VERSION;
+		if (sdp_hdr->sdp_version != SDP_VERSION)
+			return -EINVAL;
 		sdp_set_ip_ver(sdp_hdr, 4);
 		sdp_hdr->src_addr.ip4.addr = src4->sin_addr.s_addr;
 		sdp_hdr->dst_addr.ip4.addr = dst4->sin_addr.s_addr;
@@ -1501,6 +1502,7 @@ static void cma_format_hdr(void *hdr, en
 		cma_hdr->port = src4->sin_port;
 		break;
 	}
+	return 0;
 }
 
 static int cma_connect_ib(struct rdma_id_private *id_priv,
@@ -1530,7 +1532,9 @@ static int cma_connect_ib(struct rdma_id
 	}
 
 	route = &id_priv->id.route;
-	cma_format_hdr(private_data, id_priv->id.ps, route);
+	ret = cma_format_hdr(private_data, id_priv->id.ps, route);
+	if (ret)
+		goto out;
 	req.private_data = private_data;
 
 	req.primary_path = &route->path_rec[0];




More information about the general mailing list