diff options
author | Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> | 2017-04-27 19:05:59 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-05-01 14:37:28 -0400 |
commit | dfa834e1d97e24c7d6b7c5b102728d69d6361501 (patch) | |
tree | 9e713bef0935093568dad32ca96c1c92f19fff10 /drivers/infiniband/core/sa_query.c | |
parent | IB/SA: Rename ib_sa_path_rec to sa_path_rec (diff) | |
download | linux-dev-dfa834e1d97e24c7d6b7c5b102728d69d6361501.tar.xz linux-dev-dfa834e1d97e24c7d6b7c5b102728d69d6361501.zip |
IB/SA: Introduce path record specific types
struct sa_path_rec has a gid_type field. This patch introduces a more
generic path record specific type 'rec_type' which is either IB, ROCE v1
or ROCE v2. The patch also provides conversion functions to get
a gid type from a path record type and vice versa
Reviewed-by: Don Hiatt <don.hiatt@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/sa_query.c')
-rw-r--r-- | drivers/infiniband/core/sa_query.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index ee82aab8f7d9..e16536b31422 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -1144,7 +1144,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, if ((dev_addr.network == RDMA_NETWORK_IPV4 || dev_addr.network == RDMA_NETWORK_IPV6) && - rec->gid_type != IB_GID_TYPE_ROCE_UDP_ENCAP) + rec->rec_type != SA_PATH_REC_TYPE_ROCE_V2) return -EINVAL; idev = device->get_netdev(device, port_num); @@ -1175,9 +1175,10 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, } if (rec->hop_limit > 0 || use_roce) { - ret = ib_find_cached_gid_by_port(device, &rec->sgid, - rec->gid_type, port_num, ndev, - &gid_index); + enum ib_gid_type type = sa_conv_pathrec_to_gid_type(rec); + + ret = ib_find_cached_gid_by_port(device, &rec->sgid, type, + port_num, ndev, &gid_index); if (ret) { if (ndev) dev_put(ndev); @@ -1327,7 +1328,7 @@ static void ib_sa_path_rec_callback(struct ib_sa_query *sa_query, mad->data, &rec); rec.net = NULL; rec.ifindex = 0; - rec.gid_type = IB_GID_TYPE_IB; + rec.rec_type = SA_PATH_REC_TYPE_IB; eth_zero_addr(rec.dmac); query->callback(status, &rec, query->context); } else @@ -1385,6 +1386,9 @@ int ib_sa_path_rec_get(struct ib_sa_client *client, if (!sa_dev) return -ENODEV; + if (rec->rec_type != SA_PATH_REC_TYPE_IB) + return -EINVAL; + port = &sa_dev->port[port_num - sa_dev->start_port]; agent = port->agent; |