]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
RDMA/addr: Keep pointer to netdevice in struct rdma_dev_addr
authorOr Gerlitz <ogerlitz@voltaire.com>
Tue, 15 Jul 2008 06:48:53 +0000 (23:48 -0700)
committerRoland Dreier <rolandd@cisco.com>
Tue, 15 Jul 2008 06:48:53 +0000 (23:48 -0700)
Keep a pointer to the local (src) netdevice in struct rdma_dev_addr,
and copy it in as part of rdma_copy_addr().  Use rdma_translate_ip()
in cma_new_conn_id() to reduce some code duplication and also make
sure the src_dev member gets set.

In a high-availability configuration the netdevice pointer 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@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/addr.c
drivers/infiniband/core/cma.c
include/rdma/ib_addr.h

index e4eb8be3bb0c0c4baab4561d8f6d4927a7db1515..09a2bec7fd3207b65abac3f93339b7cd46a66c8e 100644 (file)
@@ -105,6 +105,7 @@ int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
        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);
+       dev_addr->src_dev = dev;
        return 0;
 }
 EXPORT_SYMBOL(rdma_copy_addr);
index 44d190f67810569f03f11778d7d56778426670eb..5fb506a417768f9510864db9a4abede83f602bcf 100644 (file)
@@ -1002,6 +1002,7 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
        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))
@@ -1026,10 +1027,11 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
        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 b42bdd0004190dc910d0d037d9513463beb3fe0d..483057b2f4b40487805d84163c5013a385dc04aa 100644 (file)
@@ -61,6 +61,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;
+       struct net_device *src_dev;
 };
 
 /**