summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs_main.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2018-02-21 18:12:43 +0200
committerDoug Ledford <dledford@redhat.com>2018-02-22 22:31:18 -0500
commit372e15c5db5f3f15423a2e6e6a71b77b39026ecf (patch)
tree49f0ba8cab49c69da0ea801d12dabe4f616ffb15 /drivers/infiniband/core/uverbs_main.c
parentcd35cf4b40f351fc9e53c2e2877a56da87dcd46d (diff)
downloadlinux-372e15c5db5f3f15423a2e6e6a71b77b39026ecf.tar.gz
linux-372e15c5db5f3f15423a2e6e6a71b77b39026ecf.tar.bz2
linux-372e15c5db5f3f15423a2e6e6a71b77b39026ecf.zip
RDMA/uverbs: Reduce number of command header flags checks
Simplify the code by directly checking the availability of extended command flog instead of doing multiple shift operations. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/uverbs_main.c')
-rw-r--r--drivers/infiniband/core/uverbs_main.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 2a6deecf6f76..fbba831f879e 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -657,19 +657,12 @@ static bool verify_command_idx(u32 command, bool extended)
static ssize_t process_hdr(struct ib_uverbs_cmd_hdr *hdr,
u32 *command, bool *extended)
{
- u32 flags;
-
- if (hdr->command & ~(u32)(IB_USER_VERBS_CMD_FLAGS_MASK |
+ if (hdr->command & ~(u32)(IB_USER_VERBS_CMD_FLAG_EXTENDED |
IB_USER_VERBS_CMD_COMMAND_MASK))
return -EINVAL;
*command = hdr->command & IB_USER_VERBS_CMD_COMMAND_MASK;
- flags = (hdr->command &
- IB_USER_VERBS_CMD_FLAGS_MASK) >> IB_USER_VERBS_CMD_FLAGS_SHIFT;
-
- *extended = flags & IB_USER_VERBS_CMD_FLAG_EXTENDED;
- if (flags & ~IB_USER_VERBS_CMD_FLAG_EXTENDED)
- return -EINVAL;
+ *extended = hdr->command & IB_USER_VERBS_CMD_FLAG_EXTENDED;
if (!verify_command_idx(*command, *extended))
return -EOPNOTSUPP;