diff mbox

[rdma-core,1/2] verbs: Change ioctl uapi header files

Message ID 1521030595-20821-2-git-send-email-yishaih@mellanox.com (mailing list archive)
State Not Applicable
Delegated to: Leon Romanovsky
Headers show

Commit Message

Yishai Hadas March 14, 2018, 12:29 p.m. UTC
From: Matan Barak <matanb@mellanox.com>

The last ioctl series in the kernel changed the uAPI header.
After this change, the headers are split to two files:
1. ib_user_ioctl_cmds.h
   Represents enums for commands. This should be used internally
   in order to form ioctl() commands.
2. rdma_user_ioctl_verbs.h
   Generic ioctl command headers

Names were changed too in order to clearly mark which enums and
structs are used internally and which are used by applications.
In addition, each element is clearly named with its role.

This synchronize the user-space with the following kernel commit:
("IB/uverbs: Move to new headers and make naming consistent")

Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
---
 kernel-headers/CMakeLists.txt              |  3 +-
 kernel-headers/rdma/ib_user_ioctl_cmds.h   | 83 +++++++++++++++++++++++++
 kernel-headers/rdma/ib_user_ioctl_verbs.h  | 84 -------------------------
 kernel-headers/rdma/rdma_user_ioctl.h      | 36 +----------
 kernel-headers/rdma/rdma_user_ioctl_cmds.h | 99 ++++++++++++++++++++++++++++++
 libibverbs/cmd_cq.c                        | 28 ++++-----
 libibverbs/cmd_fallback.c                  | 12 ++--
 libibverbs/cmd_ioctl.c                     | 13 ++--
 libibverbs/cmd_ioctl.h                     |  3 +-
 libibverbs/cmd_write.h                     |  1 +
 10 files changed, 215 insertions(+), 147 deletions(-)
 create mode 100644 kernel-headers/rdma/ib_user_ioctl_cmds.h
 delete mode 100644 kernel-headers/rdma/ib_user_ioctl_verbs.h
 create mode 100644 kernel-headers/rdma/rdma_user_ioctl_cmds.h

Comments

Jason Gunthorpe March 14, 2018, 5:18 p.m. UTC | #1
On Wed, Mar 14, 2018 at 02:29:54PM +0200, Yishai Hadas wrote:
> From: Matan Barak <matanb@mellanox.com>
> 
> The last ioctl series in the kernel changed the uAPI header.
> After this change, the headers are split to two files:
> 1. ib_user_ioctl_cmds.h
>    Represents enums for commands. This should be used internally
>    in order to form ioctl() commands.
> 2. rdma_user_ioctl_verbs.h
>    Generic ioctl command headers
> 
> Names were changed too in order to clearly mark which enums and
> structs are used internally and which are used by applications.
> In addition, each element is clearly named with its role.
> 
> This synchronize the user-space with the following kernel commit:
> ("IB/uverbs: Move to new headers and make naming consistent")

So these updates are suppposed to copy all the headers from the
kernel. The chance we get out of sync is much higher if stuff is
cherry-picked like this. But since things are so very complicated
right now, we can relax that a bit..

This is also out of order with the driver_id stuff, since this series
adds the field but leaves it filled with garbage:

> @@ -126,7 +128,8 @@ int execute_ioctl(struct ibv_context *context, struct ibv_command_buffer *cmd)
>  	prepare_attrs(cmd);
>  	cmd->hdr.length = sizeof(cmd->hdr) +
>  		sizeof(cmd->hdr.attrs[0]) * cmd->hdr.num_attrs;
> -	cmd->hdr.reserved = 0;
> +	cmd->hdr.reserved1 = 0;
> +	cmd->hdr.reserved2 = 0;

Either do the driver_id series first (preferred) or zero it here.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yishai Hadas March 15, 2018, 11:40 a.m. UTC | #2
On 3/14/2018 7:18 PM, Jason Gunthorpe wrote:
> On Wed, Mar 14, 2018 at 02:29:54PM +0200, Yishai Hadas wrote:
>> From: Matan Barak <matanb@mellanox.com>
>>
>> The last ioctl series in the kernel changed the uAPI header.
>> After this change, the headers are split to two files:
>> 1. ib_user_ioctl_cmds.h
>>     Represents enums for commands. This should be used internally
>>     in order to form ioctl() commands.
>> 2. rdma_user_ioctl_verbs.h
>>     Generic ioctl command headers
>>
>> Names were changed too in order to clearly mark which enums and
>> structs are used internally and which are used by applications.
>> In addition, each element is clearly named with its role.
>>
>> This synchronize the user-space with the following kernel commit:
>> ("IB/uverbs: Move to new headers and make naming consistent")
> 
> So these updates are suppposed to copy all the headers from the
> kernel. The chance we get out of sync is much higher if stuff is
> cherry-picked like this. But since things are so very complicated
> right now, we can relax that a bit..
> 
> This is also out of order with the driver_id stuff, since this series
> adds the field but leaves it filled with garbage:
> 
>> @@ -126,7 +128,8 @@ int execute_ioctl(struct ibv_context *context, struct ibv_command_buffer *cmd)
>>   	prepare_attrs(cmd);
>>   	cmd->hdr.length = sizeof(cmd->hdr) +
>>   		sizeof(cmd->hdr.attrs[0]) * cmd->hdr.num_attrs;
>> -	cmd->hdr.reserved = 0;
>> +	cmd->hdr.reserved1 = 0;
>> +	cmd->hdr.reserved2 = 0;
> 
> Either do the driver_id series first (preferred) or zero it here.

I have updated the PR with the second option to set as zero in the first 
patch.

I preferred this option as it touches the uAPI only once as part of the 
first patch which its target was to sync rdma-core with the latest 
kernel changes around this area.


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe March 19, 2018, 11:05 p.m. UTC | #3
On Wed, Mar 14, 2018 at 02:29:54PM +0200, Yishai Hadas wrote:
> From: Matan Barak <matanb@mellanox.com>
> 
> The last ioctl series in the kernel changed the uAPI header.
> After this change, the headers are split to two files:
> 1. ib_user_ioctl_cmds.h
>    Represents enums for commands. This should be used internally
>    in order to form ioctl() commands.
> 2. rdma_user_ioctl_verbs.h
>    Generic ioctl command headers
> 
> Names were changed too in order to clearly mark which enums and
> structs are used internally and which are used by applications.
> In addition, each element is clearly named with its role.
> 
> This synchronize the user-space with the following kernel commit:
> ("IB/uverbs: Move to new headers and make naming consistent")
> 
> Signed-off-by: Matan Barak <matanb@mellanox.com>
> Reviewed-by: Yishai Hadas <yishaih@mellanox.com>

This is missing your signed-off-by Yishai, and same for the packet
pacing series..

Leon: Why didn't the DCO checker notice this?

I have fixed it up and revised the commits, see the github.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky March 20, 2018, 4:49 a.m. UTC | #4
On Mon, Mar 19, 2018 at 05:05:07PM -0600, Jason Gunthorpe wrote:
> On Wed, Mar 14, 2018 at 02:29:54PM +0200, Yishai Hadas wrote:
> > From: Matan Barak <matanb@mellanox.com>
> >
> > The last ioctl series in the kernel changed the uAPI header.
> > After this change, the headers are split to two files:
> > 1. ib_user_ioctl_cmds.h
> >    Represents enums for commands. This should be used internally
> >    in order to form ioctl() commands.
> > 2. rdma_user_ioctl_verbs.h
> >    Generic ioctl command headers
> >
> > Names were changed too in order to clearly mark which enums and
> > structs are used internally and which are used by applications.
> > In addition, each element is clearly named with its role.
> >
> > This synchronize the user-space with the following kernel commit:
> > ("IB/uverbs: Move to new headers and make naming consistent")
> >
> > Signed-off-by: Matan Barak <matanb@mellanox.com>
> > Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
>
> This is missing your signed-off-by Yishai, and same for the packet
> pacing series..
>
> Leon: Why didn't the DCO checker notice this?

DCO checks that patch has SOB exactly as author's name and email.
In this patch, author is Matan and not Yishai, so from DCO point of view
everything is correct.

>
> I have fixed it up and revised the commits, see the github.

More powerful solution will be if Yishai use proper signature, instead
of ROB. He is supposed to use SOB for his work.

Thanks

>
> Jason
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yishai Hadas March 20, 2018, 7:11 a.m. UTC | #5
On 3/20/2018 6:49 AM, Leon Romanovsky wrote:
> On Mon, Mar 19, 2018 at 05:05:07PM -0600, Jason Gunthorpe wrote:
>> On Wed, Mar 14, 2018 at 02:29:54PM +0200, Yishai Hadas wrote:
>>> From: Matan Barak <matanb@mellanox.com>
>>>
>>> The last ioctl series in the kernel changed the uAPI header.
>>> After this change, the headers are split to two files:
>>> 1. ib_user_ioctl_cmds.h
>>>     Represents enums for commands. This should be used internally
>>>     in order to form ioctl() commands.
>>> 2. rdma_user_ioctl_verbs.h
>>>     Generic ioctl command headers
>>>
>>> Names were changed too in order to clearly mark which enums and
>>> structs are used internally and which are used by applications.
>>> In addition, each element is clearly named with its role.
>>>
>>> This synchronize the user-space with the following kernel commit:
>>> ("IB/uverbs: Move to new headers and make naming consistent")
>>>
>>> Signed-off-by: Matan Barak <matanb@mellanox.com>
>>> Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
>>
>> This is missing your signed-off-by Yishai, and same for the packet
>> pacing series..
>>
>> Leon: Why didn't the DCO checker notice this?
> 
> DCO checks that patch has SOB exactly as author's name and email.
> In this patch, author is Matan and not Yishai, so from DCO point of view
> everything is correct.
> 
>>
>> I have fixed it up and revised the commits, see the github.
> 
> More powerful solution will be if Yishai use proper signature, instead
> of ROB. He is supposed to use SOB for his work.
> 

Once I'm doing the detailed review I'm adding the Reviewed-by signature 
instead of SOB to point on, why to change that ? in any case there is 
SOB of the author and the DCO checker is fine with that.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yishai Hadas March 20, 2018, 1:45 p.m. UTC | #6
On 3/20/2018 1:05 AM, Jason Gunthorpe wrote:
> On Wed, Mar 14, 2018 at 02:29:54PM +0200, Yishai Hadas wrote:
>> From: Matan Barak <matanb@mellanox.com>
>>
>> The last ioctl series in the kernel changed the uAPI header.
>> After this change, the headers are split to two files:
>> 1. ib_user_ioctl_cmds.h
>>     Represents enums for commands. This should be used internally
>>     in order to form ioctl() commands.
>> 2. rdma_user_ioctl_verbs.h
>>     Generic ioctl command headers
>>
>> Names were changed too in order to clearly mark which enums and
>> structs are used internally and which are used by applications.
>> In addition, each element is clearly named with its role.
>>
>> This synchronize the user-space with the following kernel commit:
>> ("IB/uverbs: Move to new headers and make naming consistent")
>>
>> Signed-off-by: Matan Barak <matanb@mellanox.com>
>> Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
> 
> This is missing your signed-off-by Yishai, and same for the packet
> pacing series..
> 
> Leon: Why didn't the DCO checker notice this?
> 
> I have fixed it up and revised the commits, see the github.
> 

The series looks fine, the PR was merged from github.
Yishai
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe March 20, 2018, 2:01 p.m. UTC | #7
On Tue, Mar 20, 2018 at 09:11:25AM +0200, Yishai Hadas wrote:

> Once I'm doing the detailed review I'm adding the Reviewed-by signature
> instead of SOB to point on, why to change that ? in any case there is SOB of
> the author and the DCO checker is fine with that.

If you handle the patch eg rebase it or something, you must add your
signed off by.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe March 20, 2018, 2:39 p.m. UTC | #8
On Tue, Mar 20, 2018 at 06:49:58AM +0200, Leon Romanovsky wrote:
> On Mon, Mar 19, 2018 at 05:05:07PM -0600, Jason Gunthorpe wrote:
> > On Wed, Mar 14, 2018 at 02:29:54PM +0200, Yishai Hadas wrote:
> > > From: Matan Barak <matanb@mellanox.com>
> > >
> > > The last ioctl series in the kernel changed the uAPI header.
> > > After this change, the headers are split to two files:
> > > 1. ib_user_ioctl_cmds.h
> > >    Represents enums for commands. This should be used internally
> > >    in order to form ioctl() commands.
> > > 2. rdma_user_ioctl_verbs.h
> > >    Generic ioctl command headers
> > >
> > > Names were changed too in order to clearly mark which enums and
> > > structs are used internally and which are used by applications.
> > > In addition, each element is clearly named with its role.
> > >
> > > This synchronize the user-space with the following kernel commit:
> > > ("IB/uverbs: Move to new headers and make naming consistent")
> > >
> > > Signed-off-by: Matan Barak <matanb@mellanox.com>
> > > Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
> >
> > This is missing your signed-off-by Yishai, and same for the packet
> > pacing series..
> >
> > Leon: Why didn't the DCO checker notice this?
> 
> DCO checks that patch has SOB exactly as author's name and email.
> In this patch, author is Matan and not Yishai, so from DCO point of view
> everything is correct.

Ideally, DCO should check like StephenR does, that the committer and
author have a SOB.

> > I have fixed it up and revised the commits, see the github.
> 
> More powerful solution will be if Yishai use proper signature, instead
> of ROB. He is supposed to use SOB for his work.

Yes

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/kernel-headers/CMakeLists.txt b/kernel-headers/CMakeLists.txt
index 64bc5e6..219e029 100644
--- a/kernel-headers/CMakeLists.txt
+++ b/kernel-headers/CMakeLists.txt
@@ -4,7 +4,7 @@  publish_internal_headers(rdma
   rdma/cxgb4-abi.h
   rdma/hns-abi.h
   rdma/ib_user_cm.h
-  rdma/ib_user_ioctl_verbs.h
+  rdma/ib_user_ioctl_cmds.h
   rdma/ib_user_mad.h
   rdma/ib_user_sa.h
   rdma/ib_user_verbs.h
@@ -17,6 +17,7 @@  publish_internal_headers(rdma
   rdma/rdma_netlink.h
   rdma/rdma_user_cm.h
   rdma/rdma_user_ioctl.h
+  rdma/rdma_user_ioctl_cmds.h
   rdma/rdma_user_rxe.h
   rdma/vmw_pvrdma-abi.h
   )
diff --git a/kernel-headers/rdma/ib_user_ioctl_cmds.h b/kernel-headers/rdma/ib_user_ioctl_cmds.h
new file mode 100644
index 0000000..77bbbed
--- /dev/null
+++ b/kernel-headers/rdma/ib_user_ioctl_cmds.h
@@ -0,0 +1,83 @@ 
+/*
+ * Copyright (c) 2018, Mellanox Technologies inc.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef IB_USER_IOCTL_CMDS_H
+#define IB_USER_IOCTL_CMDS_H
+
+#define UVERBS_ID_NS_MASK 0xF000
+#define UVERBS_ID_NS_SHIFT 12
+
+#define UVERBS_UDATA_DRIVER_DATA_NS	1
+#define UVERBS_UDATA_DRIVER_DATA_FLAG	(1UL << UVERBS_ID_NS_SHIFT)
+
+enum uverbs_default_objects {
+	UVERBS_OBJECT_DEVICE, /* No instances of DEVICE are allowed */
+	UVERBS_OBJECT_PD,
+	UVERBS_OBJECT_COMP_CHANNEL,
+	UVERBS_OBJECT_CQ,
+	UVERBS_OBJECT_QP,
+	UVERBS_OBJECT_SRQ,
+	UVERBS_OBJECT_AH,
+	UVERBS_OBJECT_MR,
+	UVERBS_OBJECT_MW,
+	UVERBS_OBJECT_FLOW,
+	UVERBS_OBJECT_XRCD,
+	UVERBS_OBJECT_RWQ_IND_TBL,
+	UVERBS_OBJECT_WQ,
+};
+
+enum {
+	UVERBS_ATTR_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG,
+	UVERBS_ATTR_UHW_OUT,
+};
+
+enum uverbs_attrs_create_cq_cmd_attr_ids {
+	UVERBS_ATTR_CREATE_CQ_HANDLE,
+	UVERBS_ATTR_CREATE_CQ_CQE,
+	UVERBS_ATTR_CREATE_CQ_USER_HANDLE,
+	UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL,
+	UVERBS_ATTR_CREATE_CQ_COMP_VECTOR,
+	UVERBS_ATTR_CREATE_CQ_FLAGS,
+	UVERBS_ATTR_CREATE_CQ_RESP_CQE,
+};
+
+enum uverbs_attrs_destroy_cq_cmd_attr_ids {
+	UVERBS_ATTR_DESTROY_CQ_HANDLE,
+	UVERBS_ATTR_DESTROY_CQ_RESP,
+};
+
+enum uverbs_methods_cq {
+	UVERBS_METHOD_CQ_CREATE,
+	UVERBS_METHOD_CQ_DESTROY,
+};
+
+#endif
diff --git a/kernel-headers/rdma/ib_user_ioctl_verbs.h b/kernel-headers/rdma/ib_user_ioctl_verbs.h
deleted file mode 100644
index 842792e..0000000
--- a/kernel-headers/rdma/ib_user_ioctl_verbs.h
+++ /dev/null
@@ -1,84 +0,0 @@ 
-/*
- * Copyright (c) 2017, Mellanox Technologies inc.  All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses.  You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- *     Redistribution and use in source and binary forms, with or
- *     without modification, are permitted provided that the following
- *     conditions are met:
- *
- *      - Redistributions of source code must retain the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer.
- *
- *      - Redistributions in binary form must reproduce the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer in the documentation and/or other materials
- *        provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef IB_USER_IOCTL_VERBS_H
-#define IB_USER_IOCTL_VERBS_H
-
-#include <rdma/rdma_user_ioctl.h>
-
-#define UVERBS_UDATA_DRIVER_DATA_NS	1
-#define UVERBS_UDATA_DRIVER_DATA_FLAG	(1UL << UVERBS_ID_NS_SHIFT)
-
-enum uverbs_default_objects {
-	UVERBS_OBJECT_DEVICE, /* No instances of DEVICE are allowed */
-	UVERBS_OBJECT_PD,
-	UVERBS_OBJECT_COMP_CHANNEL,
-	UVERBS_OBJECT_CQ,
-	UVERBS_OBJECT_QP,
-	UVERBS_OBJECT_SRQ,
-	UVERBS_OBJECT_AH,
-	UVERBS_OBJECT_MR,
-	UVERBS_OBJECT_MW,
-	UVERBS_OBJECT_FLOW,
-	UVERBS_OBJECT_XRCD,
-	UVERBS_OBJECT_RWQ_IND_TBL,
-	UVERBS_OBJECT_WQ,
-	UVERBS_OBJECT_LAST,
-};
-
-enum {
-	UVERBS_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG,
-	UVERBS_UHW_OUT,
-};
-
-enum uverbs_create_cq_cmd_attr_ids {
-	CREATE_CQ_HANDLE,
-	CREATE_CQ_CQE,
-	CREATE_CQ_USER_HANDLE,
-	CREATE_CQ_COMP_CHANNEL,
-	CREATE_CQ_COMP_VECTOR,
-	CREATE_CQ_FLAGS,
-	CREATE_CQ_RESP_CQE,
-};
-
-enum uverbs_destroy_cq_cmd_attr_ids {
-	DESTROY_CQ_HANDLE,
-	DESTROY_CQ_RESP,
-};
-
-enum uverbs_actions_cq_ops {
-	UVERBS_CQ_CREATE,
-	UVERBS_CQ_DESTROY,
-};
-
-#endif
-
diff --git a/kernel-headers/rdma/rdma_user_ioctl.h b/kernel-headers/rdma/rdma_user_ioctl.h
index 03557b5..93dda56 100644
--- a/kernel-headers/rdma/rdma_user_ioctl.h
+++ b/kernel-headers/rdma/rdma_user_ioctl.h
@@ -38,45 +38,11 @@ 
 #include <linux/ioctl.h>
 #include <rdma/ib_user_mad.h>
 #include <rdma/hfi/hfi1_ioctl.h>
+#include <rdma/rdma_user_ioctl_cmds.h>
 
-/* Documentation/ioctl/ioctl-number.txt */
-#define RDMA_IOCTL_MAGIC	0x1b
 /* Legacy name, for user space application which already use it */
 #define IB_IOCTL_MAGIC		RDMA_IOCTL_MAGIC
 
-#define RDMA_VERBS_IOCTL \
-	_IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr)
-
-#define UVERBS_ID_NS_MASK 0xF000
-#define UVERBS_ID_NS_SHIFT 12
-
-enum {
-	/* User input */
-	UVERBS_ATTR_F_MANDATORY = 1U << 0,
-	/*
-	 * Valid output bit should be ignored and considered set in
-	 * mandatory fields. This bit is kernel output.
-	 */
-	UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1,
-};
-
-struct ib_uverbs_attr {
-	__u16 attr_id;		/* command specific type attribute */
-	__u16 len;		/* only for pointers */
-	__u16 flags;		/* combination of UVERBS_ATTR_F_XXXX */
-	__u16 reserved;
-	__u64 data;		/* ptr to command, inline data or idr/fd */
-};
-
-struct ib_uverbs_ioctl_hdr {
-	__u16 length;
-	__u16 object_id;
-	__u16 method_id;
-	__u16 num_attrs;
-	__u64 reserved;
-	struct ib_uverbs_attr  attrs[0];
-};
-
 /*
  * General blocks assignments
  * It is closed on purpose do not expose it it user space
diff --git a/kernel-headers/rdma/rdma_user_ioctl_cmds.h b/kernel-headers/rdma/rdma_user_ioctl_cmds.h
new file mode 100644
index 0000000..1da5a1e
--- /dev/null
+++ b/kernel-headers/rdma/rdma_user_ioctl_cmds.h
@@ -0,0 +1,99 @@ 
+/*
+ * Copyright (c) 2018, Mellanox Technologies inc.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef RDMA_USER_IOCTL_CMDS_H
+#define RDMA_USER_IOCTL_CMDS_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* Documentation/ioctl/ioctl-number.txt */
+#define RDMA_IOCTL_MAGIC	0x1b
+#define RDMA_VERBS_IOCTL \
+	_IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr)
+
+enum {
+	/* User input */
+	UVERBS_ATTR_F_MANDATORY = 1U << 0,
+	/*
+	 * Valid output bit should be ignored and considered set in
+	 * mandatory fields. This bit is kernel output.
+	 */
+	UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1,
+};
+
+struct ib_uverbs_attr {
+	__u16 attr_id;		/* command specific type attribute */
+	__u16 len;		/* only for pointers */
+	__u16 flags;		/* combination of UVERBS_ATTR_F_XXXX */
+	union {
+		struct {
+			__u8 elem_id;
+			__u8 reserved;
+		} enum_data;
+		__u16 reserved;
+	} attr_data;
+	__aligned_u64 data;	/* ptr to command, inline data or idr/fd */
+};
+
+struct ib_uverbs_ioctl_hdr {
+	__u16 length;
+	__u16 object_id;
+	__u16 method_id;
+	__u16 num_attrs;
+	__aligned_u64 reserved1;
+	__u32 driver_id;
+	__u32 reserved2;
+	struct ib_uverbs_attr  attrs[0];
+};
+
+enum rdma_driver_id {
+	RDMA_DRIVER_UNKNOWN,
+	RDMA_DRIVER_MLX5,
+	RDMA_DRIVER_MLX4,
+	RDMA_DRIVER_CXGB3,
+	RDMA_DRIVER_CXGB4,
+	RDMA_DRIVER_MTHCA,
+	RDMA_DRIVER_BNXT_RE,
+	RDMA_DRIVER_OCRDMA,
+	RDMA_DRIVER_NES,
+	RDMA_DRIVER_I40IW,
+	RDMA_DRIVER_VMW_PVRDMA,
+	RDMA_DRIVER_QEDR,
+	RDMA_DRIVER_HNS,
+	RDMA_DRIVER_USNIC,
+	RDMA_DRIVER_RXE,
+	RDMA_DRIVER_HFI1,
+	RDMA_DRIVER_QIB,
+};
+
+#endif
diff --git a/libibverbs/cmd_cq.c b/libibverbs/cmd_cq.c
index 5c98f90..e4f68d4 100644
--- a/libibverbs/cmd_cq.c
+++ b/libibverbs/cmd_cq.c
@@ -37,25 +37,25 @@  static int ibv_icmd_create_cq(struct ibv_context *context, int cqe,
 			      uint32_t flags, struct ibv_cq *cq,
 			      struct ibv_command_buffer *link)
 {
-	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_CQ, UVERBS_CQ_CREATE, 7, link);
+	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_CQ, UVERBS_METHOD_CQ_CREATE, 7, link);
 	struct ib_uverbs_attr *handle;
 	uint32_t resp_cqe;
 	int ret;
 
 	cq->context = context;
 
-	handle = fill_attr_out_obj(cmdb, CREATE_CQ_HANDLE);
-	fill_attr_out_ptr(cmdb, CREATE_CQ_RESP_CQE, &resp_cqe);
+	handle = fill_attr_out_obj(cmdb, UVERBS_ATTR_CREATE_CQ_HANDLE);
+	fill_attr_out_ptr(cmdb, UVERBS_ATTR_CREATE_CQ_RESP_CQE, &resp_cqe);
 
-	fill_attr_in_uint32(cmdb, CREATE_CQ_CQE, cqe);
-	fill_attr_in_uint64(cmdb, CREATE_CQ_USER_HANDLE, (uintptr_t)cq);
+	fill_attr_in_uint32(cmdb, UVERBS_ATTR_CREATE_CQ_CQE, cqe);
+	fill_attr_in_uint64(cmdb, UVERBS_ATTR_CREATE_CQ_USER_HANDLE, (uintptr_t)cq);
 	if (channel)
-		fill_attr_in_fd(cmdb, CREATE_CQ_COMP_CHANNEL, channel->fd);
-	fill_attr_in_uint32(cmdb, CREATE_CQ_COMP_VECTOR, comp_vector);
+		fill_attr_in_fd(cmdb, UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL, channel->fd);
+	fill_attr_in_uint32(cmdb, UVERBS_ATTR_CREATE_CQ_COMP_VECTOR, comp_vector);
 
 	if (flags) {
 		fallback_require_ex(cmdb);
-		fill_attr_in_uint32(cmdb, CREATE_CQ_FLAGS, flags);
+		fill_attr_in_uint32(cmdb, UVERBS_ATTR_CREATE_CQ_FLAGS, flags);
 	}
 
 	switch (execute_ioctl_fallback(cq->context, create_cq, cmdb, &ret)) {
@@ -108,7 +108,7 @@  static int ibv_icmd_create_cq(struct ibv_context *context, int cqe,
 		break;
 	}
 
-	cq->handle = read_attr_obj(CREATE_CQ_HANDLE, handle);
+	cq->handle = read_attr_obj(UVERBS_ATTR_CREATE_CQ_HANDLE, handle);
 	cq->cqe = resp_cqe;
 
 	return 0;
@@ -120,7 +120,7 @@  int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
 		      size_t cmd_size, struct ib_uverbs_create_cq_resp *resp,
 		      size_t resp_size)
 {
-	DECLARE_CMD_BUFFER_COMPAT(cmdb, UVERBS_OBJECT_CQ, UVERBS_CQ_CREATE);
+	DECLARE_CMD_BUFFER_COMPAT(cmdb, UVERBS_OBJECT_CQ, UVERBS_METHOD_CQ_CREATE);
 
 	return ibv_icmd_create_cq(context, cqe, channel, comp_vector, 0, cq,
 				  cmdb);
@@ -134,7 +134,7 @@  int ibv_cmd_create_cq_ex(struct ibv_context *context,
 			 struct ib_uverbs_ex_create_cq_resp *resp,
 			 size_t resp_size)
 {
-	DECLARE_CMD_BUFFER_COMPAT(cmdb, UVERBS_OBJECT_CQ, UVERBS_CQ_CREATE);
+	DECLARE_CMD_BUFFER_COMPAT(cmdb, UVERBS_OBJECT_CQ, UVERBS_METHOD_CQ_CREATE);
 	uint32_t flags = 0;
 
 	if (!check_comp_mask(cq_attr->comp_mask, IBV_CQ_INIT_ATTR_MASK_FLAGS))
@@ -150,13 +150,13 @@  int ibv_cmd_create_cq_ex(struct ibv_context *context,
 
 int ibv_cmd_destroy_cq(struct ibv_cq *cq)
 {
-	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_CQ, UVERBS_CQ_DESTROY, 2,
+	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_CQ, UVERBS_METHOD_CQ_DESTROY, 2,
 			     NULL);
 	DECLARE_LEGACY_CORE_BUFS(destroy_cq);
 	int ret;
 
-	fill_attr_out_ptr(cmdb, DESTROY_CQ_RESP, &resp);
-	fill_attr_in_obj(cmdb, DESTROY_CQ_HANDLE, cq->handle);
+	fill_attr_out_ptr(cmdb, UVERBS_ATTR_DESTROY_CQ_RESP, &resp);
+	fill_attr_in_obj(cmdb, UVERBS_ATTR_DESTROY_CQ_HANDLE, cq->handle);
 
 	switch (execute_ioctl_fallback(cq->context, destroy_cq, cmdb, &ret)) {
 	case TRY_WRITE: {
diff --git a/libibverbs/cmd_fallback.c b/libibverbs/cmd_fallback.c
index 1c217df..2d5dfe0 100644
--- a/libibverbs/cmd_fallback.c
+++ b/libibverbs/cmd_fallback.c
@@ -53,8 +53,8 @@  enum write_fallback _check_legacy(struct ibv_command_buffer *cmdb, int *ret)
 
 	for (cmdb = cmdb->next; cmdb; cmdb = cmdb->next) {
 		for (cur = cmdb->hdr.attrs; cur != cmdb->next_attr; cur++) {
-			if (cur->attr_id != UVERBS_UHW_IN &&
-			    cur->attr_id != UVERBS_UHW_OUT &&
+			if (cur->attr_id != UVERBS_ATTR_UHW_IN &&
+			    cur->attr_id != UVERBS_ATTR_UHW_OUT &&
 			    cur->flags & UVERBS_ATTR_F_MANDATORY)
 				goto not_supp;
 		}
@@ -133,7 +133,7 @@  void *_write_get_req(struct ibv_command_buffer *link, void *onstack,
 	if (link->uhw_in_idx != _UHW_NO_INDEX) {
 		struct ib_uverbs_attr *uhw = &link->hdr.attrs[link->uhw_in_idx];
 
-		assert(uhw->attr_id == UVERBS_UHW_IN);
+		assert(uhw->attr_id == UVERBS_ATTR_UHW_IN);
 		assert(link->uhw_in_headroom_dwords * 4 >= size);
 		hdr = (void *)((uintptr_t)uhw->data - size);
 		hdr->in_words = __check_divide(size + uhw->len, 4);
@@ -154,7 +154,7 @@  void *_write_get_req_ex(struct ibv_command_buffer *link, void *onstack,
 	if (link->uhw_in_idx != _UHW_NO_INDEX) {
 		struct ib_uverbs_attr *uhw = &link->hdr.attrs[link->uhw_in_idx];
 
-		assert(uhw->attr_id == UVERBS_UHW_IN);
+		assert(uhw->attr_id == UVERBS_ATTR_UHW_IN);
 		assert(link->uhw_in_headroom_dwords * 4 >= full_size);
 		hdr = (void *)((uintptr_t)uhw->data - full_size);
 		hdr->hdr.in_words = __check_divide(size, 8);
@@ -178,7 +178,7 @@  void *_write_get_resp(struct ibv_command_buffer *link,
 		struct ib_uverbs_attr *uhw =
 			&link->hdr.attrs[link->uhw_out_idx];
 
-		assert(uhw->attr_id == UVERBS_UHW_OUT);
+		assert(uhw->attr_id == UVERBS_ATTR_UHW_OUT);
 		assert(link->uhw_out_headroom_dwords * 4 >= resp_size);
 		resp_start = (void *)((uintptr_t)uhw->data - resp_size);
 		hdr->out_words = __check_divide(resp_size + uhw->len, 4);
@@ -200,7 +200,7 @@  void *_write_get_resp_ex(struct ibv_command_buffer *link,
 		struct ib_uverbs_attr *uhw =
 			&link->hdr.attrs[link->uhw_out_idx];
 
-		assert(uhw->attr_id == UVERBS_UHW_OUT);
+		assert(uhw->attr_id == UVERBS_ATTR_UHW_OUT);
 		assert(link->uhw_out_headroom_dwords * 4 >= resp_size);
 		resp_start = (void *)((uintptr_t)uhw->data - resp_size);
 		hdr->hdr.out_words = __check_divide(resp_size, 8);
diff --git a/libibverbs/cmd_ioctl.c b/libibverbs/cmd_ioctl.c
index fbd97ba..5bc2b59 100644
--- a/libibverbs/cmd_ioctl.c
+++ b/libibverbs/cmd_ioctl.c
@@ -36,6 +36,8 @@ 
 
 #include <sys/ioctl.h>
 
+#include <rdma/ib_user_ioctl_cmds.h>
+
 /* Number of attrs in this and all the link'd buffers */
 unsigned int __ioctl_final_num_attrs(unsigned int num_attrs,
 				     struct ibv_command_buffer *link)
@@ -83,7 +85,7 @@  static void prepare_attrs(struct ibv_command_buffer *cmd)
 	if (!VERBS_IOCTL_ONLY && cmd->uhw_in_idx != _UHW_NO_INDEX) {
 		struct ib_uverbs_attr *uhw = &cmd->hdr.attrs[cmd->uhw_in_idx];
 
-		assert(uhw->attr_id == UVERBS_UHW_IN);
+		assert(uhw->attr_id == UVERBS_ATTR_UHW_IN);
 
 		if (uhw->len <= sizeof(uhw->data))
 			memcpy(&uhw->data, (void *)(uintptr_t)uhw->data,
@@ -126,7 +128,8 @@  int execute_ioctl(struct ibv_context *context, struct ibv_command_buffer *cmd)
 	prepare_attrs(cmd);
 	cmd->hdr.length = sizeof(cmd->hdr) +
 		sizeof(cmd->hdr.attrs[0]) * cmd->hdr.num_attrs;
-	cmd->hdr.reserved = 0;
+	cmd->hdr.reserved1 = 0;
+	cmd->hdr.reserved2 = 0;
 
 	if (ioctl(context->cmd_fd, RDMA_VERBS_IOCTL, &cmd->hdr))
 		return errno;
@@ -166,13 +169,13 @@  void _write_set_uhw(struct ibv_command_buffer *cmdb, const void *req,
 	if (req && core_req_size < req_size) {
 		if (VERBS_IOCTL_ONLY)
 			cmdb->uhw_in_idx =
-				fill_attr_in(cmdb, UVERBS_UHW_IN,
+				fill_attr_in(cmdb, UVERBS_ATTR_UHW_IN,
 					     (uint8_t *)req + core_req_size,
 					     req_size - core_req_size) -
 				cmdb->hdr.attrs;
 		else
 			cmdb->uhw_in_idx =
-				_fill_attr_in_uhw(cmdb, UVERBS_UHW_IN,
+				_fill_attr_in_uhw(cmdb, UVERBS_ATTR_UHW_IN,
 						  (uint8_t *)req +
 							  core_req_size,
 						  req_size - core_req_size) -
@@ -183,7 +186,7 @@  void _write_set_uhw(struct ibv_command_buffer *cmdb, const void *req,
 
 	if (resp && core_resp_size < resp_size) {
 		cmdb->uhw_out_idx =
-			fill_attr_out(cmdb, UVERBS_UHW_OUT,
+			fill_attr_out(cmdb, UVERBS_ATTR_UHW_OUT,
 				      (uint8_t *)resp + core_resp_size,
 				      resp_size - core_resp_size) -
 			cmdb->hdr.attrs;
diff --git a/libibverbs/cmd_ioctl.h b/libibverbs/cmd_ioctl.h
index 4bdd312..2b6d12a 100644
--- a/libibverbs/cmd_ioctl.h
+++ b/libibverbs/cmd_ioctl.h
@@ -37,8 +37,7 @@ 
 
 #include <stdint.h>
 #include <assert.h>
-#include <rdma/rdma_user_ioctl.h>
-#include <rdma/ib_user_ioctl_verbs.h>
+#include <rdma/rdma_user_ioctl_cmds.h>
 #include <infiniband/verbs.h>
 
 static inline uint64_t ioctl_ptr_to_u64(const void *ptr)
diff --git a/libibverbs/cmd_write.h b/libibverbs/cmd_write.h
index 25846bd..cd0f371 100644
--- a/libibverbs/cmd_write.h
+++ b/libibverbs/cmd_write.h
@@ -36,6 +36,7 @@ 
 #include <infiniband/cmd_ioctl.h>
 #include <infiniband/driver.h>
 #include <rdma/ib_user_verbs.h>
+#include <rdma/ib_user_ioctl_cmds.h>
 
 #include <stdbool.h>