diff options
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_provider.c | 20 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 1 |
3 files changed, 23 insertions, 1 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 3a887006b253..6a5e5084db7a 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -514,7 +514,8 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, | |||
514 | 514 | ||
515 | if (hdr.command < 0 || | 515 | if (hdr.command < 0 || |
516 | hdr.command >= ARRAY_SIZE(uverbs_cmd_table) || | 516 | hdr.command >= ARRAY_SIZE(uverbs_cmd_table) || |
517 | !uverbs_cmd_table[hdr.command]) | 517 | !uverbs_cmd_table[hdr.command] || |
518 | !(file->device->ib_dev->uverbs_cmd_mask & (1ull << hdr.command))) | ||
518 | return -EINVAL; | 519 | return -EINVAL; |
519 | 520 | ||
520 | if (!file->ucontext && | 521 | if (!file->ucontext && |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 46864d18827d..9e911a1ea415 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -37,6 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include <rdma/ib_smi.h> | 39 | #include <rdma/ib_smi.h> |
40 | #include <rdma/ib_user_verbs.h> | ||
40 | #include <linux/mm.h> | 41 | #include <linux/mm.h> |
41 | 42 | ||
42 | #include "mthca_dev.h" | 43 | #include "mthca_dev.h" |
@@ -1077,6 +1078,25 @@ int mthca_register_device(struct mthca_dev *dev) | |||
1077 | dev->ib_dev.owner = THIS_MODULE; | 1078 | dev->ib_dev.owner = THIS_MODULE; |
1078 | 1079 | ||
1079 | dev->ib_dev.uverbs_abi_ver = MTHCA_UVERBS_ABI_VERSION; | 1080 | dev->ib_dev.uverbs_abi_ver = MTHCA_UVERBS_ABI_VERSION; |
1081 | dev->ib_dev.uverbs_cmd_mask = | ||
1082 | (1ull << IB_USER_VERBS_CMD_GET_CONTEXT) | | ||
1083 | (1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) | | ||
1084 | (1ull << IB_USER_VERBS_CMD_QUERY_PORT) | | ||
1085 | (1ull << IB_USER_VERBS_CMD_ALLOC_PD) | | ||
1086 | (1ull << IB_USER_VERBS_CMD_DEALLOC_PD) | | ||
1087 | (1ull << IB_USER_VERBS_CMD_REG_MR) | | ||
1088 | (1ull << IB_USER_VERBS_CMD_DEREG_MR) | | ||
1089 | (1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) | | ||
1090 | (1ull << IB_USER_VERBS_CMD_CREATE_CQ) | | ||
1091 | (1ull << IB_USER_VERBS_CMD_DESTROY_CQ) | | ||
1092 | (1ull << IB_USER_VERBS_CMD_CREATE_QP) | | ||
1093 | (1ull << IB_USER_VERBS_CMD_MODIFY_QP) | | ||
1094 | (1ull << IB_USER_VERBS_CMD_DESTROY_QP) | | ||
1095 | (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | | ||
1096 | (1ull << IB_USER_VERBS_CMD_DETACH_MCAST) | | ||
1097 | (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) | | ||
1098 | (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) | | ||
1099 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ); | ||
1080 | dev->ib_dev.node_type = IB_NODE_CA; | 1100 | dev->ib_dev.node_type = IB_NODE_CA; |
1081 | dev->ib_dev.phys_port_cnt = dev->limits.num_ports; | 1101 | dev->ib_dev.phys_port_cnt = dev->limits.num_ports; |
1082 | dev->ib_dev.dma_device = &dev->pdev->dev; | 1102 | dev->ib_dev.dma_device = &dev->pdev->dev; |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index d13f25a78192..a5a963cb5676 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -951,6 +951,7 @@ struct ib_device { | |||
951 | IB_DEV_UNREGISTERED | 951 | IB_DEV_UNREGISTERED |
952 | } reg_state; | 952 | } reg_state; |
953 | 953 | ||
954 | u64 uverbs_cmd_mask; | ||
954 | int uverbs_abi_ver; | 955 | int uverbs_abi_ver; |
955 | 956 | ||
956 | u8 node_type; | 957 | u8 node_type; |