[ofa-general] [RFC v2 PATCH 2/5] rdma/addr: keep the name of the netdevice in struct rdma_dev_addr

Or Gerlitz ogerlitz at voltaire.com
Thu May 15 07:22:35 PDT 2008


Keep also the local (src) device name in struct rdma_dev_addr. Under bonding HA
scheme this can be used by the rdma-cm to align RDMA sessions to use the same links
as the IP stack does under fail-over and route change cases.

Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>

Index: linux-2.6.26-rc2/drivers/infiniband/core/addr.c
===================================================================
--- linux-2.6.26-rc2.orig/drivers/infiniband/core/addr.c	2008-05-15 12:19:42.000000000 +0300
+++ linux-2.6.26-rc2/drivers/infiniband/core/addr.c	2008-05-15 14:49:31.000000000 +0300
@@ -100,6 +100,7 @@ int rdma_copy_addr(struct rdma_dev_addr
 	memcpy(dev_addr->broadcast, dev->broadcast, MAX_ADDR_LEN);
 	if (dst_dev_addr)
 		memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN);
+	memcpy(dev_addr->src_dev_name, dev->name, IFNAMSIZ);
 	return 0;
 }
 EXPORT_SYMBOL(rdma_copy_addr);
Index: linux-2.6.26-rc2/drivers/infiniband/core/cma.c
===================================================================
--- linux-2.6.26-rc2.orig/drivers/infiniband/core/cma.c	2008-05-15 12:19:42.000000000 +0300
+++ linux-2.6.26-rc2/drivers/infiniband/core/cma.c	2008-05-15 14:48:44.000000000 +0300
@@ -998,6 +998,7 @@ static struct rdma_id_private *cma_new_c
 	union cma_ip_addr *src, *dst;
 	__be16 port;
 	u8 ip_ver;
+	int ret;

 	if (cma_get_net_info(ib_event->private_data, listen_id->ps,
 			     &ip_ver, &port, &src, &dst))
@@ -1022,10 +1023,11 @@ static struct rdma_id_private *cma_new_c
 	if (rt->num_paths == 2)
 		rt->path_rec[1] = *ib_event->param.req_rcvd.alternate_path;

-	ib_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid);
 	ib_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid);
-	ib_addr_set_pkey(&rt->addr.dev_addr, be16_to_cpu(rt->path_rec[0].pkey));
-	rt->addr.dev_addr.dev_type = RDMA_NODE_IB_CA;
+	ret = rdma_translate_ip(&id->route.addr.src_addr,
+				&id->route.addr.dev_addr);
+	if (ret)
+		goto destroy_id;

 	id_priv = container_of(id, struct rdma_id_private, id);
 	id_priv->state = CMA_CONNECT;
Index: linux-2.6.26-rc2/include/rdma/ib_addr.h
===================================================================
--- linux-2.6.26-rc2.orig/include/rdma/ib_addr.h	2008-05-15 12:19:42.000000000 +0300
+++ linux-2.6.26-rc2/include/rdma/ib_addr.h	2008-05-15 14:49:08.000000000 +0300
@@ -57,6 +57,7 @@ struct rdma_dev_addr {
 	unsigned char dst_dev_addr[MAX_ADDR_LEN];
 	unsigned char broadcast[MAX_ADDR_LEN];
 	enum rdma_node_type dev_type;
+	char src_dev_name[IFNAMSIZ];
 };

 /**



More information about the general mailing list