diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2017-06-15 06:14:13 -0400 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2017-08-10 06:21:56 -0400 |
commit | c729943a77c108253c46b2d50c8a15a888facf4c (patch) | |
tree | 8341672db046ba4716194c59f81b645df710d36a /drivers/infiniband/core/netlink.c | |
parent | 1830ba21b9a475cfc6159e6cfe532c75fe7682a4 (diff) |
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.c | 13 |
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, | |||
155 | unsigned int op = RDMA_NL_GET_OP(type); | 155 | unsigned int op = RDMA_NL_GET_OP(type); |
156 | struct netlink_callback cb = {}; | 156 | struct netlink_callback cb = {}; |
157 | struct netlink_dump_control c = {}; | 157 | struct netlink_dump_control c = {}; |
158 | const struct rdma_nl_cbs *cb_table; | ||
158 | int ret; | 159 | int ret; |
159 | 160 | ||
160 | if (!is_nl_valid(index, op)) | 161 | if (!is_nl_valid(index, op)) |
161 | return -EINVAL; | 162 | return -EINVAL; |
162 | 163 | ||
163 | if ((rdma_nl_types[index].cb_table[op].flags & RDMA_NL_ADMIN_PERM) && | 164 | cb_table = rdma_nl_types[type].cb_table; |
165 | |||
166 | if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) && | ||
164 | !netlink_capable(skb, CAP_NET_ADMIN)) | 167 | !netlink_capable(skb, CAP_NET_ADMIN)) |
165 | return -EPERM; | 168 | return -EPERM; |
166 | 169 | ||
@@ -172,14 +175,14 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
172 | (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) { | 175 | (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) { |
173 | cb.skb = skb; | 176 | cb.skb = skb; |
174 | cb.nlh = nlh; | 177 | cb.nlh = nlh; |
175 | cb.dump = rdma_nl_types[index].cb_table[op].dump; | 178 | cb.dump = cb_table[op].dump; |
176 | return cb.dump(skb, &cb); | 179 | return cb.dump(skb, &cb); |
177 | } else { | 180 | } else { |
178 | c.dump = rdma_nl_types[index].cb_table[op].dump; | 181 | c.dump = cb_table[op].dump; |
179 | return netlink_dump_start(nls, skb, nlh, &c); | 182 | return netlink_dump_start(nls, skb, nlh, &c); |
180 | } | 183 | } |
181 | if (rdma_nl_types[index].cb_table[op].doit) | 184 | if (cb_table[op].doit) |
182 | ret = rdma_nl_types[index].cb_table[op].doit(skb, nlh, extack); | 185 | ret = cb_table[op].doit(skb, nlh, extack); |
183 | return ret; | 186 | return ret; |
184 | 187 | ||
185 | } | 188 | } |