]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/core: Add the core support field to METHOD_GET_CONTEXT
authorMichael Guralnik <michaelgur@mellanox.com>
Wed, 8 Jan 2020 18:05:39 +0000 (20:05 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 16 Jan 2020 19:55:46 +0000 (15:55 -0400)
Add the core support field to METHOD_GET_CONTEXT, this field should
represent capabilities that are not device-specific.

Return support for optional access flags for memory regions. User-space
will use this capability to mask the optional access flags for
unsupporting kernels.

Link: https://lore.kernel.org/r/1578506740-22188-10-git-send-email-yishaih@mellanox.com
Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/uverbs_std_types_device.c
include/uapi/rdma/ib_user_ioctl_cmds.h
include/uapi/rdma/ib_user_ioctl_verbs.h

index 2c5943548760878859573cb82a9050dd39acaa7f..ae4a59d6f9b14558c8760b1880b53f7cbd1f2ff4 100644 (file)
@@ -204,6 +204,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_GET_CONTEXT)(
        struct uverbs_attr_bundle *attrs)
 {
        u32 num_comp = attrs->ufile->device->num_comp_vectors;
+       u64 core_support = IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS;
        int ret;
 
        ret = uverbs_copy_to(attrs, UVERBS_ATTR_GET_CONTEXT_NUM_COMP_VECTORS,
@@ -211,6 +212,11 @@ static int UVERBS_HANDLER(UVERBS_METHOD_GET_CONTEXT)(
        if (IS_UVERBS_COPY_ERR(ret))
                return ret;
 
+       ret = uverbs_copy_to(attrs, UVERBS_ATTR_GET_CONTEXT_CORE_SUPPORT,
+                            &core_support, sizeof(core_support));
+       if (IS_UVERBS_COPY_ERR(ret))
+               return ret;
+
        ret = ib_alloc_ucontext(attrs);
        if (ret)
                return ret;
@@ -227,6 +233,8 @@ DECLARE_UVERBS_NAMED_METHOD(
        UVERBS_METHOD_GET_CONTEXT,
        UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_GET_CONTEXT_NUM_COMP_VECTORS,
                            UVERBS_ATTR_TYPE(u32), UA_OPTIONAL),
+       UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_GET_CONTEXT_CORE_SUPPORT,
+                           UVERBS_ATTR_TYPE(u64), UA_OPTIONAL),
        UVERBS_ATTR_UHW());
 
 DECLARE_UVERBS_NAMED_METHOD(
index da6c63c8cd329b7ce2ceca1ede5f8ded48a457e5..d4ddbe4e696c96c0c8518cfb14e99938e0c95afb 100644 (file)
@@ -84,6 +84,7 @@ enum uverbs_attrs_query_port_cmd_attr_ids {
 
 enum uverbs_attrs_get_context_attr_ids {
        UVERBS_ATTR_GET_CONTEXT_NUM_COMP_VECTORS,
+       UVERBS_ATTR_GET_CONTEXT_CORE_SUPPORT,
 };
 
 enum uverbs_attrs_create_cq_cmd_attr_ids {
index 2a165f40ee385c96d96b49e028267d822c73bc0b..a640bb814be084f45025ab6ec5fa7b4e82b34d95 100644 (file)
 #define IB_UVERBS_ACCESS_OPTIONAL_FIRST (1 << 20)
 #define IB_UVERBS_ACCESS_OPTIONAL_LAST (1 << 29)
 
+enum ib_uverbs_core_support {
+       IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS = 1 << 0,
+};
+
 enum ib_uverbs_access_flags {
        IB_UVERBS_ACCESS_LOCAL_WRITE = 1 << 0,
        IB_UVERBS_ACCESS_REMOTE_WRITE = 1 << 1,