aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/netlink.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2017-06-15 14:20:39 +0300
committerLeon Romanovsky <leon@kernel.org>2017-08-10 13:21:56 +0300
commit647c75ac59a48a54dafd4475d14a645a0025a4f4 (patch)
tree9d4d0ecdb59fba9abbd3022e64b99c348429339a /drivers/infiniband/core/netlink.c
parentRDMA/netlink: Reduce indirection access to cb_table (diff)
downloadlinux-dev-647c75ac59a48a54dafd4475d14a645a0025a4f4.tar.xz
linux-dev-647c75ac59a48a54dafd4475d14a645a0025a4f4.zip
RDMA/netlink: Convert LS to doit callback
RDMA_NL_LS protocol is actually does not dump anything, but sets data and it should be handled by doit callback. This patch actually converts RDMA_NL_LS to doit callback, while preserving IWCM and RDMA_CM flows through netlink_dump_start(). 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.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index e36c39e3cc2b..145ad5343780 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -153,38 +153,30 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
int type = nlh->nlmsg_type;
unsigned int index = RDMA_NL_GET_CLIENT(type);
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;
- cb_table = rdma_nl_types[type].cb_table;
+ cb_table = rdma_nl_types[index].cb_table;
if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
!netlink_capable(skb, CAP_NET_ADMIN))
return -EPERM;
- /*
- * For response or local service set_timeout request,
- * there is no need to use netlink_dump_start.
- */
- if (!(nlh->nlmsg_flags & NLM_F_REQUEST) ||
- (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
- cb.skb = skb;
- cb.nlh = nlh;
- cb.dump = cb_table[op].dump;
- return cb.dump(skb, &cb);
- } else {
- c.dump = cb_table[op].dump;
+ /* FIXME: Convert IWCM to properly handle doit callbacks */
+ if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM ||
+ index == RDMA_NL_IWCM) {
+ struct netlink_dump_control c = {
+ .dump = cb_table[op].dump,
+ };
return netlink_dump_start(nls, skb, nlh, &c);
}
+
if (cb_table[op].doit)
- ret = cb_table[op].doit(skb, nlh, extack);
- return ret;
+ return cb_table[op].doit(skb, nlh, extack);
+ return 0;
}
/*