IB/Verbs: Reform rest part in IB-core cma
authorMichael Wang <yun.wang@profitbricks.com>
Tue, 5 May 2015 12:50:31 +0000 (14:50 +0200)
committerDoug Ledford <dledford@redhat.com>
Mon, 18 May 2015 17:35:05 +0000 (13:35 -0400)
Use raw management helpers to reform rest part in IB-core cma.

Signed-off-by: Michael Wang <yun.wang@profitbricks.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Tested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tested-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/cma.c

index 58eb390740f9a069576803bac1edeb8970752619..da7e55f8097fb6bbbf82ad220626eacec3171890 100644 (file)
@@ -447,10 +447,10 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
        pkey = ntohs(addr->sib_pkey);
 
        list_for_each_entry(cur_dev, &dev_list, list) {
-               if (rdma_node_get_transport(cur_dev->device->node_type) != RDMA_TRANSPORT_IB)
-                       continue;
-
                for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
+                       if (!rdma_ib_or_iboe(cur_dev->device, p))
+                               continue;
+
                        if (ib_find_cached_pkey(cur_dev->device, p, pkey, &index))
                                continue;
 
@@ -645,10 +645,9 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv,
        if (ret)
                goto out;
 
-       if (rdma_node_get_transport(id_priv->cma_dev->device->node_type)
-           == RDMA_TRANSPORT_IB &&
-           rdma_port_get_link_layer(id_priv->id.device, id_priv->id.port_num)
-           == IB_LINK_LAYER_ETHERNET) {
+       BUG_ON(id_priv->cma_dev->device != id_priv->id.device);
+
+       if (rdma_protocol_iboe(id_priv->id.device, id_priv->id.port_num)) {
                ret = rdma_addr_find_smac_by_sgid(&sgid, qp_attr.smac, NULL);
 
                if (ret)
@@ -712,11 +711,10 @@ static int cma_ib_init_qp_attr(struct rdma_id_private *id_priv,
        int ret;
        u16 pkey;
 
-       if (rdma_port_get_link_layer(id_priv->id.device, id_priv->id.port_num) ==
-           IB_LINK_LAYER_INFINIBAND)
-               pkey = ib_addr_get_pkey(dev_addr);
-       else
+       if (rdma_protocol_iboe(id_priv->id.device, id_priv->id.port_num))
                pkey = 0xffff;
+       else
+               pkey = ib_addr_get_pkey(dev_addr);
 
        ret = ib_find_cached_pkey(id_priv->id.device, id_priv->id.port_num,
                                  pkey, &qp_attr->pkey_index);