IB/uverbs: Enable ioctl() uAPI by default for new verbs

Enable the ioctl() uAPI for IB by default if the standard write()
uAPI (INFINIBAND_USER_ACCESS) is enabled. Verbs that are
also available under the old write() uAPI are put inside a new
INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI Kconfig.

Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Matan Barak 2018-03-19 15:02:40 +02:00 committed by Jason Gunthorpe
parent 3d64addd43
commit 185899ee8d
3 changed files with 7 additions and 10 deletions

View File

@ -35,14 +35,13 @@ config INFINIBAND_USER_ACCESS
libibverbs, libibcm and a hardware driver library from libibverbs, libibcm and a hardware driver library from
rdma-core <https://github.com/linux-rdma/rdma-core>. rdma-core <https://github.com/linux-rdma/rdma-core>.
config INFINIBAND_EXP_USER_ACCESS config INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI
bool "Enable the full uverbs ioctl interface (EXPERIMENTAL)" bool "Allow experimental legacy verbs in new ioctl uAPI (EXPERIMENTAL)"
depends on INFINIBAND_USER_ACCESS depends on INFINIBAND_USER_ACCESS
---help--- ---help---
IOCTL based ABI support for Infiniband. This allows userspace IOCTL based uAPI support for Infiniband is enabled by default for
to invoke the experimental IOCTL based ABI. new verbs only. This allows userspace to invoke the IOCTL based uAPI
These commands are parsed via per-device parsing tree and for current legacy verbs too.
enables per-device features.
config INFINIBAND_USER_MEM config INFINIBAND_USER_MEM
bool bool

View File

@ -933,10 +933,8 @@ static const struct file_operations uverbs_fops = {
.open = ib_uverbs_open, .open = ib_uverbs_open,
.release = ib_uverbs_close, .release = ib_uverbs_close,
.llseek = no_llseek, .llseek = no_llseek,
#if IS_ENABLED(CONFIG_INFINIBAND_EXP_USER_ACCESS)
.unlocked_ioctl = ib_uverbs_ioctl, .unlocked_ioctl = ib_uverbs_ioctl,
.compat_ioctl = ib_uverbs_ioctl, .compat_ioctl = ib_uverbs_ioctl,
#endif
}; };
static const struct file_operations uverbs_mmap_fops = { static const struct file_operations uverbs_mmap_fops = {
@ -946,10 +944,8 @@ static const struct file_operations uverbs_mmap_fops = {
.open = ib_uverbs_open, .open = ib_uverbs_open,
.release = ib_uverbs_close, .release = ib_uverbs_close,
.llseek = no_llseek, .llseek = no_llseek,
#if IS_ENABLED(CONFIG_INFINIBAND_EXP_USER_ACCESS)
.unlocked_ioctl = ib_uverbs_ioctl, .unlocked_ioctl = ib_uverbs_ioctl,
.compat_ioctl = ib_uverbs_ioctl, .compat_ioctl = ib_uverbs_ioctl,
#endif
}; };
static struct ib_client uverbs_client = { static struct ib_client uverbs_client = {

View File

@ -202,7 +202,9 @@ static DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_CQ_DESTROY,
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_CQ, DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_CQ,
&UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_ucq_object), 0, &UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_ucq_object), 0,
uverbs_free_cq), uverbs_free_cq),
#if IS_ENABLED(CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI)
&UVERBS_METHOD(UVERBS_METHOD_CQ_CREATE), &UVERBS_METHOD(UVERBS_METHOD_CQ_CREATE),
&UVERBS_METHOD(UVERBS_METHOD_CQ_DESTROY) &UVERBS_METHOD(UVERBS_METHOD_CQ_DESTROY)
#endif
); );