Refactor RDMA IOCTL declarations
v3 cover Refactor RDMA IOCTL declarations
Hi Doug,
This patch set refactors RDMA IOCTL declarations, unifies their location, moves all current IOCTL exporters to one place and renames them to fix the differences in coding style.
IOCTLs commands need to export the size of their data for their transfer which is usually declared as a struct defined in relevant submodule. These structures should be visible at the linkage stage.
There are number of possible solutions to overcome this limitations.
One of the options is to declare anonymous variable which will be visible during the linkage. As a downside, such option won't allow direct use of this header by other parts of code without their specific includes of other logically unrelated submodules.
Another possible option will be to move declarations of that structures to that common header file. Such move will cause to bloat this file with different submodules declarations.
Our decision was to choose direct include of other exported files with declarations of such structures to simplify future usage of this file. There is no change for legacy applications and libraries.
Changes v2->v3:
* Added Jason's Reviewed-by
* Open-ceded ioctl indexes
Changes v0->v2 (v1 was skipped):
* Update commit messages of patch number 3 and 6.
Available in the "topic/ioctl-header" topic branch of this git repo:git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/ioctl-header
Thanks
Leon Romanovsky (6):
RDMA/core: Commonize RDMA IOCTL declarations location RDMA/core: Move legacy MAD IOCTL declarations to common file RDMA/hfi1: Avoid redeclaration error
RDMA/core: Move HFI1 IOCTL declarations to common file RDMA/core: Rename RDMA magic number
RDMA/core: Unify style of IOCTL commands
include/uapi/rdma/Kbuild | 1 + include/uapi/rdma/hfi/Kbuild | 1 + include/uapi/rdma/hfi/hfi1_ioctl.h | 173 +++++++++++++++++++++++++++++++++++ include/uapi/rdma/hfi/hfi1_user.h | 175 +----------------------------------- include/uapi/rdma/ib_user_mad.h | 14 +-- include/uapi/rdma/rdma_user_ioctl.h | 87 ++++++++++++++++++ 6 files changed, 264 insertions(+), 187 deletions(-) create mode 100644 include/uapi/rdma/hfi/hfi1_ioctl.h create mode 100644 include/uapi/rdma/rdma_user_ioctl.h
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1472988635-31463-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
PATCH v3 1/6 RDMA/core: Commonize RDMA IOCTL declarations location
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
This patch provides one common file (rdma_user_ioctl.h) for all RDMA UAPI IOCTLs.
--- include/uapi/rdma/Kbuild | 1 + include/uapi/rdma/hfi/hfi1_user.h | 2 +- include/uapi/rdma/ib_user_mad.h | 4 +--- include/uapi/rdma/rdma_user_ioctl.h | 43 +++++++++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 include/uapi/rdma/rdma_user_ioctl.h
include/uapi/rdma/Kbuild +1 -0
@@ -1,5 +1,6 @@ # UAPI Header export list header-y += ib_user_cm.h +header-y += rdma_user_ioctl.h header-y += ib_user_mad.h header-y += ib_user_sa.h header-y += ib_user_verbs.h
include/uapi/rdma/hfi/hfi1_user.h +1 -1
@@ -57,6 +57,7 @@#define _LINUX__HFI1_USER_H#include <linux/types.h> +#include <rdma/rdma_user_ioctl.h> /* * This version number is given to the driver by the user code during
@@ -132,7 +133,6 @@* User IOCTLs can not go above 128 if they do then see common.h and change the * base for the snoop ioctl */ -#define IB_IOCTL_MAGIC 0x1b/* See Documentation/ioctl/ioctl-number.txt */ /* * Make the ioctls occupy the last 0xf0-0xff portion of the IB range
include/uapi/rdma/ib_user_mad.h +1 -3
@@ -35,7 +35,7 @@#define IB_USER_MAD_H #include <linux/types.h> -#include <linux/ioctl.h> +#include <rdma/rdma_user_ioctl.h> /* * Increment this value if any changes that break userspace ABI
@@ -230,8 +230,6 @@ struct ib_user_mad_reg_req2 {__u8 reserved[3 ]; }; -#define IB_IOCTL_MAGIC 0x1b -#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ struct ib_user_mad_reg_req)
include/uapi/rdma/rdma_user_ioctl.h new file +43 -0
43 lines not on this page · raw message
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/6 RDMA/core: Move legacy MAD IOCTL declarations to common file
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move legacy MAD IOCTL declarations to rdma_user_ioctl.h file.
--- include/uapi/rdma/ib_user_mad.h | 10 ---------- include/uapi/rdma/rdma_user_ioctl.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-)
include/uapi/rdma/ib_user_mad.h +0 -10
@@ -230,14 +230,4 @@ struct ib_user_mad_reg_req2 { __u8 reserved[3]; }; -#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ - struct ib_user_mad_reg_req) - -#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32) - -#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) - -#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_IOCTL_MAGIC, 4, \ - struct ib_user_mad_reg_req2) -#endif /* IB_USER_MAD_H */
include/uapi/rdma/rdma_user_ioctl.h +11 -0
@@ -35,9 +35,20 @@#include <linux/types.h> #include <linux/ioctl.h> +#include <rdma/ib_user_mad.h> /* Documentation/ioctl/ioctl-number.txt */ #define RDMA_IOCTL_MAGIC 0x1b#define IB_IOCTL_MAGIC RDMA_IOCTL_MAGIC +#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ + struct ib_user_mad_reg_req) + +#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32) + +#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) + +#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_IOCTL_MAGIC, 4, \ + struct ib_user_mad_reg_req2) +#endif /* RDMA_USER_IOCTL_H */
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 3/6 RDMA/hfi1: Avoid redeclaration error
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move hfi1 ioctl definitions to a new header which can be included by both the hfi1 and qib drivers to avoid a duplicate enum definition as shown in this build error for qib:
CC [M] drivers/infiniband/hw/qib/qib_sysfs.o
In file included from ./include/uapi/rdma/rdma_user_ioctl.h:39:0,
from include/uapi/rdma/ib_user_mad.h:38, from include/rdma/ib_mad.h:43, from include/rdma/ib_pma.h:38, from drivers/infiniband/hw/qib/qib_mad.h:37, from drivers/infiniband/hw/qib/qib_init.c:49:
./include/uapi/rdma/hfi/hfi1_user.h:370:2: error: redeclaration of enumerator ‘ur_rcvhdrtail’
ur_rcvhdrtail = 0,
Move hfi1 structures to separate file to avoid this failure.
The actual move of the ioctl definitions comes in a follow on patch.
--- include/uapi/rdma/hfi/Kbuild | 1 + include/uapi/rdma/hfi/hfi1_ioctl.h | 173 +++++++++++++++++++++++++++++++++++++ include/uapi/rdma/hfi/hfi1_user.h | 120 +------------------------ 3 files changed, 175 insertions(+), 119 deletions(-) create mode 100644 include/uapi/rdma/hfi/hfi1_ioctl.h
include/uapi/rdma/hfi/Kbuild +1 -0
@@ -1,2 +1,3 @@ # UAPI Header export list header-y += hfi1_user.h +header-y += hfi1_ioctl.h
include/uapi/rdma/hfi/hfi1_ioctl.h new file +173 -0
173 lines not on this page · raw message
include/uapi/rdma/hfi/hfi1_user.h +1 -119
138 lines not on this page · raw message
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 4/6 RDMA/core: Move HFI1 IOCTL declarations to common file
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move HFI1 IOCTL declarations to rdma_user_ioctl.h file.
--- include/uapi/rdma/hfi/hfi1_user.h | 55 ------------------------------------- include/uapi/rdma/rdma_user_ioctl.h | 54 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 55 deletions(-)
include/uapi/rdma/hfi/hfi1_user.h +0 -55
@@ -58,7 +58,6 @@#include <linux/types.h> #include <rdma/rdma_user_ioctl.h> -#include <rdma/hfi/hfi1_ioctl.h> /* * This version number is given to the driver by the user code during
@@ -114,60 +113,6 @@#define HFI1_RCVHDR_ENTSIZE_16 (1UL << 1)#define HFI1_RCVDHR_ENTSIZE_32 (1UL << 2) -/* User commands. */ -#define HFI1_CMD_ASSIGN_CTXT 1/* allocate HFI and context */ -#define HFI1_CMD_CTXT_INFO 2/* find out what resources we got */ -#define HFI1_CMD_USER_INFO 3/* set up userspace */ -#define HFI1_CMD_TID_UPDATE 4/* update expected TID entries */ -#define HFI1_CMD_TID_FREE 5/* free expected TID entries */ -#define HFI1_CMD_CREDIT_UPD 6/* force an update of PIO credit */ - -#define HFI1_CMD_RECV_CTRL 8/* control receipt of packets */ -#define HFI1_CMD_POLL_TYPE 9/* set the kind of polling we want */ -#define HFI1_CMD_ACK_EVENT 10/* ack & clear user status bits */ -#define HFI1_CMD_SET_PKEY 11/* set context's pkey */ -#define HFI1_CMD_CTXT_RESET 12/* reset context's HW send context */ -#define HFI1_CMD_TID_INVAL_READ 13/* read TID cache invalidations */ -#define HFI1_CMD_GET_VERS 14/* get the version of the user cdev */ - -/* -* User IOCTLs can not go above 128 if they do then see common.h and change the -* base for the snoop ioctl -*/ - -/* -* Make the ioctls occupy the last 0xf0-0xff portion of the IB range -*/ -#define __NUM (cmd) (HFI1_CMD_##cmd + 0xe0) - -struct hfi1_cmd ; -#define HFI1_IOCTL_ASSIGN_CTXT \ - _IOWR(IB_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info) -#define HFI1_IOCTL_CTXT_INFO \ - _IOW(IB_IOCTL_MAGIC, __NUM(CTXT_INFO), struct hfi1_ctxt_info) -#define HFI1_IOCTL_USER_INFO \ - _IOW(IB_IOCTL_MAGIC, __NUM(USER_INFO), struct hfi1_base_info) -#define HFI1_IOCTL_TID_UPDATE \ - _IOWR(IB_IOCTL_MAGIC, __NUM(TID_UPDATE), struct hfi1_tid_info) -#define HFI1_IOCTL_TID_FREE \ - _IOWR(IB_IOCTL_MAGIC, __NUM(TID_FREE), struct hfi1_tid_info) -#define HFI1_IOCTL_CREDIT_UPD \ - _IO(IB_IOCTL_MAGIC, __NUM(CREDIT_UPD)) -#define HFI1_IOCTL_RECV_CTRL \ - _IOW(IB_IOCTL_MAGIC, __NUM(RECV_CTRL), int) -#define HFI1_IOCTL_POLL_TYPE \ - _IOW(IB_IOCTL_MAGIC, __NUM(POLL_TYPE), int) -#define HFI1_IOCTL_ACK_EVENT \ - _IOW(IB_IOCTL_MAGIC, __NUM(ACK_EVENT), unsigned long) -#define HFI1_IOCTL_SET_PKEY \ - _IOW(IB_IOCTL_MAGIC, __NUM(SET_PKEY), __u16) -#define HFI1_IOCTL_CTXT_RESET \ - _IO(IB_IOCTL_MAGIC, __NUM(CTXT_RESET)) -#define HFI1_IOCTL_TID_INVAL_READ \ - _IOWR(IB_IOCTL_MAGIC, __NUM(TID_INVAL_READ), struct hfi1_tid_info) -#define HFI1_IOCTL_GET_VERS \ - _IOR(IB_IOCTL_MAGIC, __NUM(GET_VERS), int) -#define _HFI1_EVENT_FROZEN_BIT 0#define _HFI1_EVENT_LINKDOWN_BIT 1#define _HFI1_EVENT_LID_CHANGE_BIT 2
include/uapi/rdma/rdma_user_ioctl.h +54 -0
64 lines not on this page · raw message
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1472988635-31463-5-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Re: [PATCH rdma-next V3 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
include/uapi/rdma/rdma_user_ioctl.h line 82
Quoted 5 lines · Leon Romanovsky
include/uapi/rdma/rdma_user_ioctl.h +4
-0+/* User commands. */ +#define HFI1_CMD_ASSIGN_CTXT 1/* allocate HFI and context */ +#define HFI1_IOCTL_ASSIGN_CTXT \ + _IOWR(IB_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info)
I still vote for dropping the HFI1_CMD_ASSIGN_CTXT defines. Inlining the number is far more readable than that ugly __NUM macro.
If it was done consistently you might have an arugment, but just doing it in one place with no purpose is silly.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20160905024158.GE21542-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Re: [PATCH rdma-next V3 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
Quoted 5 lines · Jason Gunthorpe
Quoted 2 lines · Leon Romanovsky
include/uapi/rdma/rdma_user_ioctl.h +2
-0+/* User commands. */ +#define HFI1_CMD_ASSIGN_CTXT 1/* allocate HFI and context */
Quoted 8 lines
include/uapi/rdma/rdma_user_ioctl.h line 82
Quoted 2 lines
include/uapi/rdma/rdma_user_ioctl.h +2
-0+#define HFI1_IOCTL_ASSIGN_CTXT \ + _IOWR(IB_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info)I still vote for dropping the
HFI1_CMD_ASSIGN_CTXTdefines. Inlining the number is far more readable than that ugly__NUMmacro.If it was done consistently you might have an arugment, but just doing it in one place with no purpose is silly.
It is done in patch 6. It is here to preserve one-change->one-patch flow.
Quoted 2 lines
Jason
PATCH v3 5/6 RDMA/core: Rename RDMA magic number
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Rename RDMA magic number to better describe IOCTLs.
--- include/uapi/rdma/rdma_user_ioctl.h | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
include/uapi/rdma/rdma_user_ioctl.h +18 -17
@@ -40,16 +40,17 @@/* 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 IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ +#define IB_USER_MAD_REGISTER_AGENT _IOWR(RDMA_IOCTL_MAGIC, 1, \ struct ib_user_mad_reg_req) -#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32) +#define IB_USER_MAD_UNREGISTER_AGENT _IOW(RDMA_IOCTL_MAGIC, 2, __u32) -#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) +#define IB_USER_MAD_ENABLE_PKEY _IO(RDMA_IOCTL_MAGIC, 3) -#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_IOCTL_MAGIC, 4, \ +#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(RDMA_IOCTL_MAGIC, 4, \ struct ib_user_mad_reg_req2)/* User commands. */
@@ -79,30 +80,30 @@#define __NUM (cmd) (HFI1_CMD_##cmd + 0xe0)#define HFI1_IOCTL_ASSIGN_CTXT \ - _IOWR(IB_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info) + _IOWR(RDMA_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info)#define HFI1_IOCTL_CTXT_INFO \ - _IOW(IB_IOCTL_MAGIC, __NUM(CTXT_INFO), struct hfi1_ctxt_info) + _IOW(RDMA_IOCTL_MAGIC, __NUM(CTXT_INFO), struct hfi1_ctxt_info)#define HFI1_IOCTL_USER_INFO \ - _IOW(IB_IOCTL_MAGIC, __NUM(USER_INFO), struct hfi1_base_info) + _IOW(RDMA_IOCTL_MAGIC, __NUM(USER_INFO), struct hfi1_base_info)#define HFI1_IOCTL_TID_UPDATE \ - _IOWR(IB_IOCTL_MAGIC, __NUM(TID_UPDATE), struct hfi1_tid_info) + _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_UPDATE), struct hfi1_tid_info)#define HFI1_IOCTL_TID_FREE \ - _IOWR(IB_IOCTL_MAGIC, __NUM(TID_FREE), struct hfi1_tid_info) + _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_FREE), struct hfi1_tid_info)#define HFI1_IOCTL_CREDIT_UPD \ - _IO(IB_IOCTL_MAGIC, __NUM(CREDIT_UPD)) + _IO(RDMA_IOCTL_MAGIC, __NUM(CREDIT_UPD))#define HFI1_IOCTL_RECV_CTRL \ - _IOW(IB_IOCTL_MAGIC, __NUM(RECV_CTRL), int) + _IOW(RDMA_IOCTL_MAGIC, __NUM(RECV_CTRL), int)#define HFI1_IOCTL_POLL_TYPE \ - _IOW(IB_IOCTL_MAGIC, __NUM(POLL_TYPE), int) + _IOW(RDMA_IOCTL_MAGIC, __NUM(POLL_TYPE), int)#define HFI1_IOCTL_ACK_EVENT \ - _IOW(IB_IOCTL_MAGIC, __NUM(ACK_EVENT), unsigned long) + _IOW(RDMA_IOCTL_MAGIC, __NUM(ACK_EVENT), unsigned long)#define HFI1_IOCTL_SET_PKEY \ - _IOW(IB_IOCTL_MAGIC, __NUM(SET_PKEY), __u16) + _IOW(RDMA_IOCTL_MAGIC, __NUM(SET_PKEY), __u16)#define HFI1_IOCTL_CTXT_RESET \ - _IO(IB_IOCTL_MAGIC, __NUM(CTXT_RESET)) + _IO(RDMA_IOCTL_MAGIC, __NUM(CTXT_RESET))#define HFI1_IOCTL_TID_INVAL_READ \ - _IOWR(IB_IOCTL_MAGIC, __NUM(TID_INVAL_READ), struct hfi1_tid_info) + _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_INVAL_READ), struct hfi1_tid_info)#define HFI1_IOCTL_GET_VERS \ - _IOR(IB_IOCTL_MAGIC, __NUM(GET_VERS), int) + _IOR(RDMA_IOCTL_MAGIC, __NUM(GET_VERS), int)#endif /* RDMA_USER_IOCTL_H */
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 6/6 RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
MAD and HFI1 have different naming convention, this patch simplifies and unifies their defines and names.
As part of cleanup, the HFI1 _NUM() macro and command indexes were removed. It has a potential to break applications which use these defines directly, while shouldn't.
--- include/uapi/rdma/rdma_user_ioctl.h | 98 ++++++++++++++----------------------- 1 file changed, 38 insertions(+), 60 deletions(-)
include/uapi/rdma/rdma_user_ioctl.h +38 -60
@@ -39,71 +39,49 @@#include <rdma/hfi/hfi1_ioctl.h> /* Documentation/ioctl/ioctl-number.txt */ -#define RDMA_IOCTL_MAGIC 0x1b +#define RDMA_IOCTL_MAGIC 0x1b/* Legacy name, for user space application which already use it */ -#define IB_IOCTL_MAGIC RDMA_IOCTL_MAGIC - -#define IB_USER_MAD_REGISTER_AGENT _IOWR(RDMA_IOCTL_MAGIC, 1, \ - struct ib_user_mad_reg_req) - -#define IB_USER_MAD_UNREGISTER_AGENT _IOW(RDMA_IOCTL_MAGIC, 2, __u32) - -#define IB_USER_MAD_ENABLE_PKEY _IO(RDMA_IOCTL_MAGIC, 3) - -#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(RDMA_IOCTL_MAGIC, 4, \ - struct ib_user_mad_reg_req2) - -/* User commands. */ -#define HFI1_CMD_ASSIGN_CTXT 1/* allocate HFI and context */ -#define HFI1_CMD_CTXT_INFO 2/* find out what resources we got */ -#define HFI1_CMD_USER_INFO 3/* set up userspace */ -#define HFI1_CMD_TID_UPDATE 4/* update expected TID entries */ -#define HFI1_CMD_TID_FREE 5/* free expected TID entries */ -#define HFI1_CMD_CREDIT_UPD 6/* force an update of PIO credit */ - -#define HFI1_CMD_RECV_CTRL 8/* control receipt of packets */ -#define HFI1_CMD_POLL_TYPE 9/* set the kind of polling we want */ -#define HFI1_CMD_ACK_EVENT 10/* ack & clear user status bits */ -#define HFI1_CMD_SET_PKEY 11/* set context's pkey */ -#define HFI1_CMD_CTXT_RESET 12/* reset context's HW send context */ -#define HFI1_CMD_TID_INVAL_READ 13/* read TID cache invalidations */ -#define HFI1_CMD_GET_VERS 14/* get the version of the user cdev */ +#define IB_IOCTL_MAGIC RDMA_IOCTL_MAGIC/* -* User IOCTLs can not go above 128 if they do then see common.h and change the -* base for the snoop ioctl +* General blocks assignments +* It is closed on purpose do not expose it it user space +* #define MAD_CMD_BASE 0x00 +* #define HFI1_CMD_BAS 0xE0 */ -/* -* Make the ioctls occupy the last 0xf0-0xff portion of the IB range -*/ -#define __NUM (cmd) (HFI1_CMD_##cmd + 0xe0) +/* MAD specific section */ +#define IB_USER_MAD_REGISTER_AGENT _IOWR(RDMA_IOCTL_MAGIC, 0x01, struct ib_user_mad_reg_req) +#define IB_USER_MAD_UNREGISTER_AGENT _IOW(RDMA_IOCTL_MAGIC, 0x02, __u32) +#define IB_USER_MAD_ENABLE_PKEY _IO(RDMA_IOCTL_MAGIC, 0x03) +#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(RDMA_IOCTL_MAGIC, 0x04, struct ib_user_mad_reg_req2) -#define HFI1_IOCTL_ASSIGN_CTXT \ - _IOWR(RDMA_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info) -#define HFI1_IOCTL_CTXT_INFO \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(CTXT_INFO), struct hfi1_ctxt_info) -#define HFI1_IOCTL_USER_INFO \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(USER_INFO), struct hfi1_base_info) -#define HFI1_IOCTL_TID_UPDATE \ - _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_UPDATE), struct hfi1_tid_info) -#define HFI1_IOCTL_TID_FREE \ - _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_FREE), struct hfi1_tid_info) -#define HFI1_IOCTL_CREDIT_UPD \ - _IO(RDMA_IOCTL_MAGIC, __NUM(CREDIT_UPD)) -#define HFI1_IOCTL_RECV_CTRL \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(RECV_CTRL), int) -#define HFI1_IOCTL_POLL_TYPE \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(POLL_TYPE), int) -#define HFI1_IOCTL_ACK_EVENT \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(ACK_EVENT), unsigned long) -#define HFI1_IOCTL_SET_PKEY \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(SET_PKEY), __u16) -#define HFI1_IOCTL_CTXT_RESET \ - _IO(RDMA_IOCTL_MAGIC, __NUM(CTXT_RESET)) -#define HFI1_IOCTL_TID_INVAL_READ \ - _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_INVAL_READ), struct hfi1_tid_info) -#define HFI1_IOCTL_GET_VERS \ - _IOR(RDMA_IOCTL_MAGIC, __NUM(GET_VERS), int) +/* HFI specific section */ +/* allocate HFI and context */ +#define HFI1_IOCTL_ASSIGN_CTXT _IOWR(RDMA_IOCTL_MAGIC, 0xE1, struct hfi1_user_info) +/* find out what resources we got */ +#define HFI1_IOCTL_CTXT_INFO _IOW(RDMA_IOCTL_MAGIC, 0xE2, struct hfi1_ctxt_info) +/* set up userspace */ +#define HFI1_IOCTL_USER_INFO _IOW(RDMA_IOCTL_MAGIC, 0xE3, struct hfi1_base_info) +/* update expected TID entries */ +#define HFI1_IOCTL_TID_UPDATE _IOWR(RDMA_IOCTL_MAGIC, 0xE4, struct hfi1_tid_info) +/* free expected TID entries */ +#define HFI1_IOCTL_TID_FREE _IOWR(RDMA_IOCTL_MAGIC, 0xE5, struct hfi1_tid_info) +/* force an update of PIO credit */ +#define HFI1_IOCTL_CREDIT_UPD _IO(RDMA_IOCTL_MAGIC, 0xE6) +/* control receipt of packets */ +#define HFI1_IOCTL_RECV_CTRL _IOW(RDMA_IOCTL_MAGIC, 0xE8, int) +/* set the kind of polling we want */ +#define HFI1_IOCTL_POLL_TYPE _IOW(RDMA_IOCTL_MAGIC, 0xE9, int) +/* ack & clear user status bits */ +#define HFI1_IOCTL_ACK_EVENT _IOW(RDMA_IOCTL_MAGIC, 0xEA, unsigned long) +/* set context's pkey */ +#define HFI1_IOCTL_SET_PKEY _IOW(RDMA_IOCTL_MAGIC, 0xEB, __u16) +/* reset context's HW send context */ +#define HFI1_IOCTL_CTXT_RESET _IO(RDMA_IOCTL_MAGIC, 0xEC) +/* read TID cache invalidations */ +#define HFI1_IOCTL_TID_INVAL_READ _IOWR(RDMA_IOCTL_MAGIC, 0xED, struct hfi1_tid_info) +/* get the version of the user cdev */ +#define HFI1_IOCTL_GET_VERS _IOR(RDMA_IOCTL_MAGIC, 0xEE, int)#endif /* RDMA_USER_IOCTL_H */
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1472988635-31463-7-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Jason Gunthorpe
Reviewed-byRe: [PATCH rdma-next V3 6/6] RDMA/core: Unify style of IOCTL commands
Quoted 4 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
MAD and HFI1 have different naming convention, this patch simplifies and unifies their defines and names.
Ah, well, nevermind then :)
Whole thing looks good to me:
Thanks,
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH rdma-next V3 6/6] RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveQuoted 17 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
MAD and HFI1 have different naming convention, this patch simplifies and unifies their defines and names.
As part of cleanup, the HFI1
_NUM()macro and command indexes were removed. It has a potential to break applications which use these defines directly, while shouldn't.--- include/uapi/rdma/rdma_user_ioctl.h | 98 ++++++++++++++----------------------- 1 file changed, 38 insertions(+), 60 deletions(-)
<....>
Quoted 5 lines
/*
- * User IOCTLs can not go above 128 if they do then seecommon.hand change the
- * base for the snoop ioctl
+ * General blocks assignments
+ * It is closed on purpose do not expose it it user space
Doug,
Do you mind to change "it it" to be "it to" and save to everyone respin?
Thanks
A message that is not in the archive (sent off-list or not yet received): 20160905053342.GW21847-2ukJVAZIZ/[email protected]
Re: [PATCH rdma-next V3 6/6] RDMA/core: Unify style of IOCTL commands
Quoted 27 lines · Leon Romanovsky
Quoted 17 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
MAD and HFI1 have different naming convention, this patch simplifies and unifies their defines and names.
As part of cleanup, the HFI1
_NUM()macro and command indexes were removed. It has a potential to break applications which use these defines directly, while shouldn't.--- include/uapi/rdma/rdma_user_ioctl.h | 98 ++++++++++++++----------------------- 1 file changed, 38 insertions(+), 60 deletions(-)<....>
Quoted 5 lines
/*
- * User IOCTLs can not go above 128 if they do then seecommon.hand change the
- * base for the snoop ioctl
+ * General blocks assignments
+ * It is closed on purpose do not expose it it user space
Quoted 3 lines
Doug,
Do you mind to change "it it" to be "it to" and save to everyone respin?
Fixed.
Signature · 2 lines
Doug Ledford <[email protected]> GPG Key ID: 0E572FDD
Re: [PATCH rdma-next V3 6/6] RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveT24gU3VuLCAyMDE2LTA5LTA0IGF0IDE0OjMwICswMzAwLCBMZW9uIFJvbWFub3Zza3kgd3JvdGU6 DQo+IEZyb206IExlb24gUm9tYW5vdnNreSA8bGVvbnJvQG1lbGxhbm94LmNvbT4NCj4gDQo+IE1B RCBhbmQgSEZJMSBoYXZlIGRpZmZlcmVudCBuYW1pbmcgY29udmVudGlvbiwgdGhpcyBwYXRjaA0K PiBzaW1wbGlmaWVzIGFuZCB1bmlmaWVzIHRoZWlyIGRlZmluZXMgYW5kIG5hbWVzLg0KPiANCj4g QXMgcGFydCBvZiBjbGVhbnVwLCB0aGUgSEZJMSBfTlVNKCkgbWFjcm8gYW5kIGNvbW1hbmQgaW5k ZXhlcw0KPiB3ZXJlIHJlbW92ZWQuIEl0IGhhcyBhIHBvdGVudGlhbCB0byBicmVhayBhcHBsaWNh dGlvbnMgd2hpY2ggdXNlDQo+IHRoZXNlIGRlZmluZXMgZGlyZWN0bHksIHdoaWxlIHNob3VsZG4n dC4NCg0KUGxlYXNlIGJlIGV4cGxpY2l0LiBJdCdzIG5vdCB0aGF0IGl0IGhhcyBwb3RlbnRpYWwu IEl0ICp3aWxsKiBicmVhaw0KYXBwbGljYXRpb25zIHdoaWNoIHVzZSB0aGVzZSBkZWZpbmVzIGRp cmVjdGx5Lg0KDQotRGVubnkNCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH rdma-next V3 6/6] RDMA/core: Unify style of IOCTL commands
Quoted 6 lines · Dennis
Quoted 5 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
MAD and HFI1 have different naming convention, this patch simplifies and unifies their defines and names.
Quoted 6 lines
Quoted 3 lines
As part of cleanup, the HFI1
_NUM()macro and command indexes were removed. It has a potential to break applications which use these defines directly, while shouldn't.Please be explicit. It's not that it has potential. It *will* break applications which use these defines directly.
Yes, you are right.
Doug,
What do you expect from me? Respin?
Thanks
Quoted 4 lines
-Denny
N?????r??y????b?X??ǧv?^?){.n?+????{??ٚ?{ay?ʇڙ?,j??f???h???z??w??????j:+v???w?j?m????????zZ+?????ݢj"??!
A message that is not in the archive (sent off-list or not yet received): 20160907070109.GC3639-2ukJVAZIZ/[email protected]
Re: [PATCH rdma-next V3 6/6] RDMA/core: Unify style of IOCTL commands
Quoted 11 lines · Leon Romanovsky
Quoted 10 lines · Dennis
Quoted 8 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
MAD and HFI1 have different naming convention, this patch simplifies and unifies their defines and names.
As part of cleanup, the HFI1
_NUM()macro and command indexes were removed. It has a potential to break applications which use these defines directly, while shouldn't.
Quoted 7 lines
Quoted 2 lines
Please be explicit. It's not that it has potential. It *will* break applications which use these defines directly.
Yes, you are right.
Doug,
What do you expect from me? Respin?
No, I reworded the commit message myself:
RDMA/core: Unify style of IOCTL commands
MAD and HFI1 have different naming convention, this patch simplifies and unifies their defines and names.
As part of cleanup, the HFI1 _NUM() macro and command indexes were removed (controversial). This will cause intentional (and arguably unnecessary) breakage to the PSM user space library.
Signature · 2 lines
Doug Ledford <[email protected]> GPG Key ID: 0E572FDD
Quoted 58 lines · Leon Romanovsky
Hi Doug,
This patch set refactors RDMA IOCTL declarations, unifies their location, moves all current IOCTL exporters to one place and renames them to fix the differences in coding style.
IOCTLs commands need to export the size of their data for their transfer which is usually declared as a struct defined in relevant submodule. These structures should be visible at the linkage stage.
There are number of possible solutions to overcome this limitations.
One of the options is to declare anonymous variable which will be visible during the linkage. As a downside, such option won't allow direct use of this header by other parts of code without their specific includes of other logically unrelated submodules.
Another possible option will be to move declarations of that structures to that common header file. Such move will cause to bloat this file with different submodules declarations.
Our decision was to choose direct include of other exported files with declarations of such structures to simplify future usage of this file. There is no change for legacy applications and libraries.
Changes
v2->v3:
* Added Jason's Reviewed-by
* Open-ceded ioctl indexesChanges
v0->v2(v1 was skipped):
* Update commit messages of patch number 3 and 6.Available in the "topic/ioctl-header" topic branch of this git repo:
git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.gitOr for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/ioctl-headerThanks
Leon Romanovsky (6):
RDMA/core: Commonize RDMA IOCTL declarations location RDMA/core: Move legacy MAD IOCTL declarations to common file RDMA/hfi1: Avoid redeclaration error
RDMA/core: Move HFI1 IOCTL declarations to common file RDMA/core: Rename RDMA magic number
RDMA/core: Unify style of IOCTL commandsinclude/uapi/rdma/Kbuild | 1 + include/uapi/rdma/hfi/Kbuild | 1 + include/uapi/rdma/hfi/hfi1_ioctl.h | 173 +++++++++++++++++++++++++++++++++++ include/uapi/rdma/hfi/hfi1_user.h | 175 +----------------------------------- include/uapi/rdma/ib_user_mad.h | 14 +-- include/uapi/rdma/rdma_user_ioctl.h | 87 ++++++++++++++++++ 6 files changed, 264 insertions(+), 187 deletions(-) create mode 100644 include/uapi/rdma/hfi/hfi1_ioctl.h create mode 100644 include/uapi/rdma/rdma_user_ioctl.h
Quoted 3 lines
--
2.7.4
Series applied.
Signature · 2 lines
Doug Ledford <[email protected]> GPG Key ID: 0E572FDD