aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/netlink.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2017-06-15 13:14:13 +0300
committerLeon Romanovsky <leon@kernel.org>2017-08-10 13:21:56 +0300
commitc729943a77c108253c46b2d50c8a15a888facf4c (patch)
tree8341672db046ba4716194c59f81b645df710d36a /drivers/infiniband/core/netlink.c
parentRDMA/netlink: Add and implement doit netlink callback (diff)
downloadlinux-dev-c729943a77c108253c46b2d50c8a15a888facf4c.tar.xz
linux-dev-c729943a77c108253c46b2d50c8a15a888facf4c.zip
RDMA/netlink: Reduce indirection access to cb_table
Introduce intermediate variable to store access to fields of cb_table. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Diffstat (limited to 'drivers/infiniband/core/netlink.c')
-rw-r--r--drivers/infiniband/core/netlink.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 484d6a8a2811..e36c39e3cc2b 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -155,12 +155,15 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
unsigned int op = RDMA_NL_GET_OP(type);
struct netlink_callback cb = {};
struct netlink_dump_control c = {};
+ const struct rdma_nl_cbs *cb_table;
int ret;
if (!is_nl_valid(index, op))
return -EINVAL;
- if ((rdma_nl_types[index].cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
+ cb_table = rdma_nl_types[type].cb_table;
+
+ if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
!netlink_capable(skb, CAP_NET_ADMIN))
return -EPERM;
@@ -172,14 +175,14 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
(index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
cb.skb = skb;
cb.nlh = nlh;
- cb.dump = rdma_nl_types[index].cb_table[op].dump;
+ cb.dump = cb_table[op].dump;
return cb.dump(skb, &cb);
} else {
- c.dump = rdma_nl_types[index].cb_table[op].dump;
+ c.dump = cb_table[op].dump;
return netlink_dump_start(nls, skb, nlh, &c);
}
- if (rdma_nl_types[index].cb_table[op].doit)
- ret = rdma_nl_types[index].cb_table[op].doit(skb, nlh, extack);
+ if (cb_table[op].doit)
+ ret = cb_table[op].doit(skb, nlh, extack);
return ret;
}