aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/nldev.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2019-02-18 22:25:47 +0200
committerJason Gunthorpe <jgg@mellanox.com>2019-02-18 21:04:36 -0700
commit41eda65c6100930d95bb854a0114f3544593070c (patch)
tree64ae996d521909ccb72a35ba4a5485cfcc125aa9 /drivers/infiniband/core/nldev.c
parentRDMA/restrack: Reduce scope of synchronization lock while updating DB (diff)
downloadlinux-dev-41eda65c6100930d95bb854a0114f3544593070c.tar.xz
linux-dev-41eda65c6100930d95bb854a0114f3544593070c.zip
RDMA/restrack: Hide restrack DB from IB/core
There is no need to expose internals of restrack DB to IB/core. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/nldev.c')
-rw-r--r--drivers/infiniband/core/nldev.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 0cd95f80f7b4..54312f9626a1 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -39,6 +39,7 @@
#include "core_priv.h"
#include "cma_priv.h"
+#include "restrack.h"
static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
[RDMA_NLDEV_ATTR_DEV_INDEX] = { .type = NLA_U32 },
@@ -1027,6 +1028,7 @@ static int res_get_common_dumpit(struct sk_buff *skb,
unsigned long id;
u32 index, port = 0;
bool filled = false;
+ struct xarray *xa;
err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
nldev_policy, NULL);
@@ -1074,13 +1076,14 @@ static int res_get_common_dumpit(struct sk_buff *skb,
has_cap_net_admin = netlink_capable(cb->skb, CAP_NET_ADMIN);
- down_read(&device->res.rwsem);
+ xa = &device->res->xa[res_type];
+ down_read(&device->res->rwsem);
/*
* FIXME: if the skip ahead is something common this loop should
* use xas_for_each & xas_pause to optimize, we can have a lot of
* objects.
*/
- xa_for_each(&device->res.xa[res_type], id, res) {
+ xa_for_each(xa, id, res) {
if (idx < start)
goto next;
@@ -1101,13 +1104,13 @@ static int res_get_common_dumpit(struct sk_buff *skb,
if (!entry_attr) {
ret = -EMSGSIZE;
rdma_restrack_put(res);
- up_read(&device->res.rwsem);
+ up_read(&device->res->rwsem);
break;
}
- up_read(&device->res.rwsem);
+ up_read(&device->res->rwsem);
ret = fe->fill_res_func(skb, has_cap_net_admin, res, port);
- down_read(&device->res.rwsem);
+ down_read(&device->res->rwsem);
/*
* Return resource back, but it won't be released till
* the &device->res.rwsem will be released for write.
@@ -1125,7 +1128,7 @@ static int res_get_common_dumpit(struct sk_buff *skb,
nla_nest_end(skb, entry_attr);
next: idx++;
}
- up_read(&device->res.rwsem);
+ up_read(&device->res->rwsem);
nla_nest_end(skb, table_attr);
nlmsg_end(skb, nlh);
@@ -1143,7 +1146,7 @@ next: idx++;
res_err:
nla_nest_cancel(skb, table_attr);
- up_read(&device->res.rwsem);
+ up_read(&device->res->rwsem);
err:
nlmsg_cancel(skb, nlh);