aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-07-08 13:41:17 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-07-09 15:11:53 -0600
commit07e7056aff6c4377667fe1606ae7707b375b1caa (patch)
tree0f1cdebb935b3c0d66c414b2585b5f3d9355d16b /drivers/infiniband
parentIB/mlx5: Honor cnt_set_id_valid flag instead of set_id (diff)
downloadlinux-dev-07e7056aff6c4377667fe1606ae7707b375b1caa.tar.xz
linux-dev-07e7056aff6c4377667fe1606ae7707b375b1caa.zip
IB/core: Simplify check for RoCE route resolve
roce_resolve_route_from_path() resolves the route based on the netdevice of the GID attribute, therefore there is no point in checking again if the route is resolved matches the same interface it arrived. Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/sa_query.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 7005afb8a712..f269e74a4480 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1227,13 +1227,9 @@ static u8 get_src_path_mask(struct ib_device *device, u8 port_num)
return src_path_mask;
}
-static int
-roce_resolve_route_from_path(struct ib_device *device, u8 port_num,
- struct sa_path_rec *rec,
- const struct ib_gid_attr *attr)
+static int roce_resolve_route_from_path(struct sa_path_rec *rec,
+ const struct ib_gid_attr *attr)
{
- struct net_device *resolved_dev;
- struct net_device *idev;
struct rdma_dev_addr dev_addr = {};
union {
struct sockaddr _sockaddr;
@@ -1253,9 +1249,6 @@ roce_resolve_route_from_path(struct ib_device *device, u8 port_num,
*/
dev_addr.net = &init_net;
- if (!device->get_netdev)
- return -EOPNOTSUPP;
-
rdma_gid2ip(&sgid_addr._sockaddr, &rec->sgid);
rdma_gid2ip(&dgid_addr._sockaddr, &rec->dgid);
@@ -1270,28 +1263,8 @@ roce_resolve_route_from_path(struct ib_device *device, u8 port_num,
rec->rec_type != SA_PATH_REC_TYPE_ROCE_V2)
return -EINVAL;
- idev = device->get_netdev(device, port_num);
- if (!idev)
- return -ENODEV;
-
- resolved_dev = dev_get_by_index(dev_addr.net,
- dev_addr.bound_dev_if);
- if (!resolved_dev) {
- ret = -ENODEV;
- goto done;
- }
- rcu_read_lock();
- if (attr->ndev != resolved_dev ||
- (resolved_dev != idev &&
- !rdma_is_upper_dev_rcu(idev, resolved_dev)))
- ret = -EHOSTUNREACH;
- rcu_read_unlock();
- dev_put(resolved_dev);
-done:
- dev_put(idev);
- if (!ret)
- rec->roce.route_resolved = true;
- return ret;
+ rec->roce.route_resolved = true;
+ return 0;
}
static int init_ah_attr_grh_fields(struct ib_device *device, u8 port_num,
@@ -1346,8 +1319,7 @@ int ib_init_ah_attr_from_path(struct ib_device *device, u8 port_num,
rdma_ah_set_static_rate(ah_attr, rec->rate);
if (sa_path_is_roce(rec)) {
- ret = roce_resolve_route_from_path(device, port_num, rec,
- gid_attr);
+ ret = roce_resolve_route_from_path(rec, gid_attr);
if (ret)
return ret;