mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-07 03:18:31 +00:00
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>
This commit is contained in:
parent
1830ba21b9
commit
c729943a77
1 changed files with 8 additions and 5 deletions
|
@ -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);
|
unsigned int op = RDMA_NL_GET_OP(type);
|
||||||
struct netlink_callback cb = {};
|
struct netlink_callback cb = {};
|
||||||
struct netlink_dump_control c = {};
|
struct netlink_dump_control c = {};
|
||||||
|
const struct rdma_nl_cbs *cb_table;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!is_nl_valid(index, op))
|
if (!is_nl_valid(index, op))
|
||||||
return -EINVAL;
|
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))
|
!netlink_capable(skb, CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
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)) {
|
(index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
|
||||||
cb.skb = skb;
|
cb.skb = skb;
|
||||||
cb.nlh = nlh;
|
cb.nlh = nlh;
|
||||||
cb.dump = rdma_nl_types[index].cb_table[op].dump;
|
cb.dump = cb_table[op].dump;
|
||||||
return cb.dump(skb, &cb);
|
return cb.dump(skb, &cb);
|
||||||
} else {
|
} 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);
|
return netlink_dump_start(nls, skb, nlh, &c);
|
||||||
}
|
}
|
||||||
if (rdma_nl_types[index].cb_table[op].doit)
|
if (cb_table[op].doit)
|
||||||
ret = rdma_nl_types[index].cb_table[op].doit(skb, nlh, extack);
|
ret = cb_table[op].doit(skb, nlh, extack);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue