aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/core_priv.h
diff options
context:
space:
mode:
authorMatan Barak <matanb@mellanox.com>2015-12-23 14:56:52 +0200
committerDoug Ledford <dledford@redhat.com>2015-12-23 10:35:12 -0500
commit6020d7e5004cc8591d61d449e9285a6f08279541 (patch)
treeb37568ba7c8c3180ca1de0791bcea3286f4fcb06 /drivers/infiniband/core/core_priv.h
parentIB/core: Add rdma_network_type to wc (diff)
downloadlinux-dev-6020d7e5004cc8591d61d449e9285a6f08279541.tar.xz
linux-dev-6020d7e5004cc8591d61d449e9285a6f08279541.zip
IB/core: Move rdma_is_upper_dev_rcu to header file
In order to validate the route, we need an easy way to check if a net-device belongs to our RDMA device. Move this helper function to a header file in order to make this check easier. Signed-off-by: Matan Barak <matanb@mellanox.com> Reviewed-by: Haggai Eran <haggaie@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/core_priv.h')
-rw-r--r--drivers/infiniband/core/core_priv.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index d531f91b63b0..3b250a2f86b4 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -96,4 +96,17 @@ int ib_cache_setup_one(struct ib_device *device);
void ib_cache_cleanup_one(struct ib_device *device);
void ib_cache_release_one(struct ib_device *device);
+static inline bool rdma_is_upper_dev_rcu(struct net_device *dev,
+ struct net_device *upper)
+{
+ struct net_device *_upper = NULL;
+ struct list_head *iter;
+
+ netdev_for_each_all_upper_dev_rcu(dev, _upper, iter)
+ if (_upper == upper)
+ break;
+
+ return _upper == upper;
+}
+
#endif /* _CORE_PRIV_H */