Refactor RDMA IOCTL declarations
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.
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 | 127 ++++++++++++++++++++++++++ 6 files changed, 304 insertions(+), 187 deletions(-) create mode 100644 include/uapi/rdma/hfi/hfi1_ioctl.h create mode 100644 include/uapi/rdma/rdma_user_ioctl.h
Signature · 6 lines
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 1/6 RDMA/core: Commonize RDMA IOCTL declarations location
In reply to a message not in the archiveFrom: 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
Signature · 6 lines
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 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 */
Signature · 6 lines
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 3/6 RDMA/hfi1: Avoid redeclaration error
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Plugging HFI1 IOCTL defines will cause to the following 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.
--- 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
Signature · 6 lines
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 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
Signature · 6 lines
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 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 */
Signature · 6 lines
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 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 was removed and MAD indexes were renamed. It has a potential to break application which use these defines directly.
--- include/uapi/rdma/rdma_user_ioctl.h | 98 ++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 40 deletions(-)
include/uapi/rdma/rdma_user_ioctl.h +58 -40
@@ -39,71 +39,89 @@#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_IOCTL_MAGIC RDMA_IOCTL_MAGIC -#define IB_USER_MAD_REGISTER_AGENT _IOWR(RDMA_IOCTL_MAGIC, 1, \ - struct ib_user_mad_reg_req) +/* General blocks assignments */ +#define MAD_CMD_BASE 0x00 +#define HFI1_CMD_BASE 0xE0 -#define IB_USER_MAD_UNREGISTER_AGENT _IOW(RDMA_IOCTL_MAGIC, 2, __u32) +/* MAD specific section */ +#define MAD_CMD_REG_AGENT (MAD_CMD_BASE + 0x01) +#define MAD_CMD_UNREG_AGENT (MAD_CMD_BASE + 0x02) +#define MAD_CMD_ENABLE_PKEY (MAD_CMD_BASE + 0x03) +#define MAD_CMD_REG_AGENT2 (MAD_CMD_BASE + 0x04) -#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) +#define IB_USER_MAD_REGISTER_AGENT \ + _IOWR(RDMA_IOCTL_MAGIC, MAD_CMD_REG_AGENT, struct ib_user_mad_reg_req) +#define IB_USER_MAD_UNREGISTER_AGENT \ + _IOW(RDMA_IOCTL_MAGIC, MAD_CMD_UNREG_AGENT, __u32) +#define IB_USER_MAD_ENABLE_PKEY \ + _IO(RDMA_IOCTL_MAGIC, MAD_CMD_ENABLE_PKEY) +#define IB_USER_MAD_REGISTER_AGENT2 \ + _IOWR(RDMA_IOCTL_MAGIC, MAD_CMD_REG_AGENT2, struct ib_user_mad_reg_req2) +/* HFI specific section */ /* 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 */ +/* allocate HFI and context */ +#define HFI1_CMD_ASSIGN_CTXT (HFI1_CMD_BASE + 0x01) +/* find out what resources we got */ +#define HFI1_CMD_CTXT_INFO (HFI1_CMD_BASE + 0x02) +/* set up userspace */ +#define HFI1_CMD_USER_INFO (HFI1_CMD_BASE + 0x03) +/* update expected TID entries */ +#define HFI1_CMD_TID_UPDATE (HFI1_CMD_BASE + 0x04) +/* free expected TID entries */ +#define HFI1_CMD_TID_FREE (HFI1_CMD_BASE + 0x05) +/* force an update of PIO credit */ +#define HFI1_CMD_CREDIT_UPD (HFI1_CMD_BASE + 0x06) -#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 */ +/* control receipt of packets */ +#define HFI1_CMD_RECV_CTRL (HFI1_CMD_BASE + 0x08) +/* set the kind of polling we want */ +#define HFI1_CMD_POLL_TYPE (HFI1_CMD_BASE + 0x09) +/* ack & clear user status bits */ +#define HFI1_CMD_ACK_EVENT (HFI1_CMD_BASE + 0x0A) +/* set context's pkey */ +#define HFI1_CMD_SET_PKEY (HFI1_CMD_BASE + 0x0B) +/* reset context's HW send context */ +#define HFI1_CMD_CTXT_RESET (HFI1_CMD_BASE + 0x0C) +/* read TID cache invalidations */ +#define HFI1_CMD_TID_INVAL_READ (HFI1_CMD_BASE + 0x0D) +/* get the version of the user cdev */ +#define HFI1_CMD_GET_VERS (HFI1_CMD_BASE + 0x0E)/* * 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) -#define HFI1_IOCTL_ASSIGN_CTXT \ - _IOWR(RDMA_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info) + _IOWR(RDMA_IOCTL_MAGIC, HFI1_CMD_ASSIGN_CTXT, struct hfi1_user_info)#define HFI1_IOCTL_CTXT_INFO \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(CTXT_INFO), struct hfi1_ctxt_info) + _IOW(RDMA_IOCTL_MAGIC, HFI1_CMD_CTXT_INFO, struct hfi1_ctxt_info)#define HFI1_IOCTL_USER_INFO \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(USER_INFO), struct hfi1_base_info) + _IOW(RDMA_IOCTL_MAGIC, HFI1_CMD_USER_INFO, struct hfi1_base_info)#define HFI1_IOCTL_TID_UPDATE \ - _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_UPDATE), struct hfi1_tid_info) + _IOWR(RDMA_IOCTL_MAGIC, HFI1_CMD_TID_UPDATE, struct hfi1_tid_info)#define HFI1_IOCTL_TID_FREE \ - _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_FREE), struct hfi1_tid_info) + _IOWR(RDMA_IOCTL_MAGIC, HFI1_CMD_TID_FREE, struct hfi1_tid_info)#define HFI1_IOCTL_CREDIT_UPD \ - _IO(RDMA_IOCTL_MAGIC, __NUM(CREDIT_UPD)) + _IO(RDMA_IOCTL_MAGIC, HFI1_CMD_CREDIT_UPD)#define HFI1_IOCTL_RECV_CTRL \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(RECV_CTRL), int) + _IOW(RDMA_IOCTL_MAGIC, HFI1_CMD_RECV_CTRL, int)#define HFI1_IOCTL_POLL_TYPE \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(POLL_TYPE), int) + _IOW(RDMA_IOCTL_MAGIC, HFI1_CMD_POLL_TYPE, int)#define HFI1_IOCTL_ACK_EVENT \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(ACK_EVENT), unsigned long) + _IOW(RDMA_IOCTL_MAGIC, HFI1_CMD_ACK_EVENT, unsigned long)#define HFI1_IOCTL_SET_PKEY \ - _IOW(RDMA_IOCTL_MAGIC, __NUM(SET_PKEY), __u16) + _IOW(RDMA_IOCTL_MAGIC, HFI1_CMD_SET_PKEY, __u16)#define HFI1_IOCTL_CTXT_RESET \ - _IO(RDMA_IOCTL_MAGIC, __NUM(CTXT_RESET)) + _IO(RDMA_IOCTL_MAGIC, HFI1_CMD_CTXT_RESET)#define HFI1_IOCTL_TID_INVAL_READ \ - _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_INVAL_READ), struct hfi1_tid_info) + _IOWR(RDMA_IOCTL_MAGIC, HFI1_CMD_TID_INVAL_READ, struct hfi1_tid_info)#define HFI1_IOCTL_GET_VERS \ - _IOR(RDMA_IOCTL_MAGIC, __NUM(GET_VERS), int) + _IOR(RDMA_IOCTL_MAGIC, HFI1_CMD_GET_VERS, int)#endif /* RDMA_USER_IOCTL_H */
Signature · 6 lines
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
Re: [PATCH rdma-next 6/6] RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveT24gVHVlLCAyMDE2LTA4LTE2IGF0IDE2OjQ1ICswMzAwLCBMZW9uIFJvbWFub3Zza3kgd3JvdGU6 DQo+IEZyb206IExlb24gUm9tYW5vdnNreSA8bGVvbnJvQG1lbGxhbm94LmNvbT4NCj4gDQo+IE1B RCBhbmQgSEZJMSBoYXZlIGRpZmZlcmVudCBuYW1pbmcgY29udmVudGlvbiwgdGhpcyBwYXRjaA0K PiBzaW1wbGlmaWVzIGFuZCB1bmlmaWVzIHRoZWlyIGRlZmluZXMgYW5kIG5hbWVzLg0KDQpJIGRv bid0IGtub3cgdGhhdCBJIGFncmVlIHRoYXQgaXQgc2ltcGxpZmllcyB0aGluZ3MuIEl0IGNoYW5n ZXMgYSBsb3QNCm9mIGNvZGUgZm9yIG5vdCBtdWNoIHJlYWwgdmFsdWUgaW4gbXkgb3Bpbmlvbi7C oA0KDQpXYXMgdGhpcyBzb21ldGhpbmcgdGhhdCB3YXMgZGlzY3Vzc2VkIGluIHRoZSB2ZXJicyBj YWxsPyBJIGhhdmUgbm90DQpiZWVuIGFibGUgdG8gYXR0ZW5kIHRoYXQgdGhlIGxhc3QgZmV3IHdl ZWtzLg0KDQo+IEFzIHBhcnQgb2YgY2xlYW51cCwgdGhlIEhGSTEgX05VTSgpIG1hY3JvIHdhcyBy ZW1vdmVkIGFuZCBNQUQNCj4gaW5kZXhlcyB3ZXJlIHJlbmFtZWQuIEl0IGhhcyBhIHBvdGVudGlh bCB0byBicmVhayBhcHBsaWNhdGlvbg0KPiB3aGljaCB1c2UgdGhlc2UgZGVmaW5lcyBkaXJlY3Rs eS4NCg0KV2h5IGRvIHlvdSB3YW50IHRvIHJlbW92ZSB0aGUgX05VTSgpIG1hY3JvIHRoYXQgRG91 ZyBqdXN0IHB1dCBpbj8NCg0KLURlbm55
--
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 6/6] RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveQuoted 11 lines · Dennis
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.
I don't know that I agree that it simplifies things. It changes a lot of code for not much real value in my opinion.
Was this something that was discussed in the verbs call? I have not been able to attend that the last few weeks.
It was discussed over mails, for example Jason's opinion [1], Christopher Lameter's opinion [2], Christoph Hellwig's opinion [3].
Quoted 6 lines
Quoted 4 lines
As part of cleanup, the HFI1
_NUM()macro was removed and MAD indexes were renamed. It has a potential to break application which use these defines directly.Why do you want to remove the
_NUM()macro that Doug just put in?
It is not used after refactoring and IMHO this macro doesn't
belong to UAPI, since it wouldn't in use by any users, but I'll be glad to get an examples of its usage in real user space applications (libfabric???), if any.
Quoted 2 lines
-Denny
[1] http://marc.info/?l=linux-rdma&m=146835080018352&w=2
[2] http://marc.info/?l=linux-rdma&m=146897679911490&w=2
[3] http://marc.info/?l=linux-rdma&m=146908844509592&w=2
Re: [PATCH rdma-next 6/6] RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveT24gVHVlLCAyMDE2LTA4LTE2IGF0IDE5OjUwICswMzAwLCBMZW9uIFJvbWFub3Zza3kgd3JvdGU6 DQo+IE9uIFR1ZSwgQXVnIDE2LCAyMDE2IGF0IDAyOjMxOjMyUE0gKzAwMDAsIERhbGVzc2FuZHJv LCBEZW5uaXMgd3JvdGU6DQo+ID4gT24gVHVlLCAyMDE2LTA4LTE2IGF0IDE2OjQ1ICswMzAwLCBM ZW9uIFJvbWFub3Zza3kgd3JvdGU6DQo+ID4gPiBGcm9tOiBMZW9uIFJvbWFub3Zza3kgPGxlb25y b0BtZWxsYW5veC5jb20+DQo+ID4gPiANCj4gPiA+IE1BRCBhbmQgSEZJMSBoYXZlIGRpZmZlcmVu dCBuYW1pbmcgY29udmVudGlvbiwgdGhpcyBwYXRjaA0KPiA+ID4gc2ltcGxpZmllcyBhbmQgdW5p ZmllcyB0aGVpciBkZWZpbmVzIGFuZCBuYW1lcy4NCj4gPiANCj4gPiBJIGRvbid0IGtub3cgdGhh dCBJIGFncmVlIHRoYXQgaXQgc2ltcGxpZmllcyB0aGluZ3MuIEl0IGNoYW5nZXMgYQ0KPiA+IGxv dA0KPiA+IG9mIGNvZGUgZm9yIG5vdCBtdWNoIHJlYWwgdmFsdWUgaW4gbXkgb3Bpbmlvbi7CoA0K PiA+IA0KPiA+IFdhcyB0aGlzIHNvbWV0aGluZyB0aGF0IHdhcyBkaXNjdXNzZWQgaW4gdGhlIHZl cmJzIGNhbGw/IEkgaGF2ZSBub3QNCj4gPiBiZWVuIGFibGUgdG8gYXR0ZW5kIHRoYXQgdGhlIGxh c3QgZmV3IHdlZWtzLg0KPiANCj4gSXQgd2FzIGRpc2N1c3NlZCBvdmVyIG1haWxzLCBmb3IgZXhh bXBsZSBKYXNvbidzIG9waW5pb24gWzFdLA0KPiBDaHJpc3RvcGhlciBMYW1ldGVyJ3Mgb3Bpbmlv biBbMl0sIENocmlzdG9waCBIZWxsd2lnJ3Mgb3BpbmlvbiBbM10uDQoNCkknbSBub3Qgb3Bwb3Nl ZCB0byB0cnlpbmcgdG8gdW5pZnkgdGhpbmdzLCBob3dldmVyIHRoaXMgc2VlbXMgdG8gYmUNCm1v cmUgdGhhbiBwbG9wIGRvd24gdGhlIGhmaTEgc3R1ZmYgZnJvbSBoZXJlIGFuZCBwdXQgaXQgb3Zl ciB0aGVyZS4gSXQNCmlzIGNlcnRhaW5seSBub3Qgc2ltcGxpZnlpbmcgYW55dGhpbmcuDQoNCj4g PiA+IEFzIHBhcnQgb2YgY2xlYW51cCwgdGhlIEhGSTEgX05VTSgpIG1hY3JvIHdhcyByZW1vdmVk IGFuZCBNQUQNCj4gPiA+IGluZGV4ZXMgd2VyZSByZW5hbWVkLiBJdCBoYXMgYSBwb3RlbnRpYWwg dG8gYnJlYWsgYXBwbGljYXRpb24NCj4gPiA+IHdoaWNoIHVzZSB0aGVzZSBkZWZpbmVzIGRpcmVj dGx5Lg0KPiA+IA0KPiA+IFdoeSBkbyB5b3Ugd2FudCB0byByZW1vdmUgdGhlIF9OVU0oKSBtYWNy byB0aGF0IERvdWcganVzdCBwdXQgaW4/DQo+IA0KPiBJdCBpcyBub3QgdXNlZCBhZnRlciByZWZh Y3RvcmluZyBhbmQgSU1ITyB0aGlzIG1hY3JvIGRvZXNuJ3QNCj4gYmVsb25nIHRvIFVBUEksIHNp bmNlIGl0IHdvdWxkbid0IGluIHVzZSBieSBhbnkgdXNlcnMsIGJ1dCBJJ2xsIGJlDQo+IGdsYWQg dG8NCj4gZ2V0IGFuIGV4YW1wbGVzIG9mIGl0cyB1c2FnZSBpbiByZWFsIHVzZXIgc3BhY2UgYXBw bGljYXRpb25zDQo+IChsaWJmYWJyaWM/Pz8pLCBpZiBhbnkuDQo+IA0KDQpUaGF0J3MgYSBmYWly IHBvaW50LiBJIGNhbiBzZWUgZ2V0dGluZyByaWQgb2YgaXQgbm93Lg0KDQotRGVubnk= --
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 3/6] RDMA/hfi1: Avoid redeclaration error
In reply to a message not in the archiveT24gVHVlLCAyMDE2LTA4LTE2IGF0IDE2OjQ1ICswMzAwLCBMZW9uIFJvbWFub3Zza3kgd3JvdGU6 DQo+IEZyb206IExlb24gUm9tYW5vdnNreSA8bGVvbnJvQG1lbGxhbm94LmNvbT4NCj4gDQo+IFBs dWdnaW5nIEhGSTEgSU9DVEwgZGVmaW5lcyB3aWxsIGNhdXNlIHRvIHRoZSBmb2xsb3dpbmcNCj4g YnVpbGQgZXJyb3IgZm9yIFFJQjoNCj4gwqAgQ0MgW01dIGRyaXZlcnMvaW5maW5pYmFuZC9ody9x aWIvcWliX3N5c2ZzLm8NCj4gSW4gZmlsZSBpbmNsdWRlZCBmcm9tIC4vaW5jbHVkZS91YXBpL3Jk bWEvcmRtYV91c2VyX2lvY3RsLmg6Mzk6MCwNCj4gCQnCoGZyb20gaW5jbHVkZS91YXBpL3JkbWEv aWJfdXNlcl9tYWQuaDozOCwNCj4gCQnCoGZyb20gaW5jbHVkZS9yZG1hL2liX21hZC5oOjQzLA0K PiAJCcKgZnJvbSBpbmNsdWRlL3JkbWEvaWJfcG1hLmg6MzgsDQo+IAkJwqBmcm9tIGRyaXZlcnMv aW5maW5pYmFuZC9ody9xaWIvcWliX21hZC5oOjM3LA0KPiAJCcKgZnJvbSBkcml2ZXJzL2luZmlu aWJhbmQvaHcvcWliL3FpYl9pbml0LmM6NDk6DQo+IC4vaW5jbHVkZS91YXBpL3JkbWEvaGZpL2hm aTFfdXNlci5oOjM3MDoyOiBlcnJvcjogcmVkZWNsYXJhdGlvbiBvZg0KPiBlbnVtZXJhdG9yIOKA mHVyX3JjdmhkcnRhaWzigJkNCj4gwqAgdXJfcmN2aGRydGFpbCA9IDAsDQo+IE1vdmUgSEZJMSBz dHJ1Y3R1cmVzIHRvIHNlcGFyYXRlIGZpbGUgdG8gYXZvaWQgdGhpcyBmYWlsdXJlLg0KDQpJIG5l ZWQgdG8gbG9vayBhdCB0aGlzIHNvbWUgbW9yZS4gU28gZG9lcyB0aGlzIG1lYW4gdGhpcyBwYXRj aCBzZXJpZXMNCmRvbid0IGJ1aWxkIGlmIHlvdSBqdXN0IHRha2UgdGhlIGZpcnN0IDI/IHFpYiBz aG91bGQgbm90IG5lZWQgYW55dGhpbmcNCmZyb20gaGZpMV91c2VyLmggc28gaXQgc2hvdWxkIG5v dCBiZSBpbmNsdWRpbmcgaXQuDQoNCi1EZW5ueQ0KDQo=
--
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 3/6] RDMA/hfi1: Avoid redeclaration error
In reply to a message not in the archiveQuoted 17 lines · Dennis
Quoted 11 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Plugging HFI1 IOCTL defines will cause to the following 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:Quoted 4 lines
./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.
Quoted 2 lines
I need to look at this some more. So does this mean this patch series don't build if you just take the first 2?
No, they build perfectly. This patch is needed for next patch "RDMA/core:
Move HFI1 IOCTL declarations to common file".
Quoted 2 lines
qib should not need anything
fromhfi1_user.hso it should not be including it.
It doesn't include directly, but qib includes ib_user_mad.h, which will be part of common rdma_user_ioctl.h file. This common file will call to hfi1_user.h too.
Quoted 3 lines
-Denny
Re: [PATCH rdma-next 6/6] RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveQuoted 15 lines · Dennis
Quoted 14 lines · Leon Romanovsky
Quoted 12 lines · Dennis
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.
I don't know that I agree that it simplifies things. It changes a lot
of code for not much real value in my opinion.Was this something that was discussed in the verbs call? I have not been able to attend that the last few weeks.
Quoted 6 lines
Quoted 2 lines
It was discussed over mails, for example Jason's opinion [1], Christopher Lameter's opinion [2], Christoph Hellwig's opinion [3].
I'm not opposed to trying to unify things, however this seems to be more than plop down the hfi1 stuff from here and put it over there. It is certainly not simplifying anything.
It is "dark side" of UAPI - inability to change legacy declarations. This is why I didn't remove anything except _NUM() macro.
The simplification comes from definition of one place for declaration of IOCTLs numbers and exporting it to users. It gives visibility for user space authors too.
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
As part of cleanup, the HFI1
_NUM()macro was removed and MAD indexes were renamed. It has a potential to break application which use these defines directly.Quoted 8 lines
Quoted 1 line
Why do you want to remove the
_NUM()macro that Doug just put in?It is not used after refactoring and IMHO this macro doesn't belong to UAPI, since it wouldn't in use by any users, but I'll be glad to
get an examples of its usage in real user space applications (libfabric???), if any.That's a fair point. I can see getting rid of it now.
-Denny
Re: [PATCH rdma-next 3/6] RDMA/hfi1: Avoid redeclaration error
In reply to a message not in the archiveQuoted 6 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Plugging HFI1 IOCTL defines will cause to the following 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,
Quoted 8 lines
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,
I was pretty confused about what you were doing here mainly because you reference a symbol you don't actually touch in the patch.
I see what you are doing now. But a better explanation would be:
<quote>
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:
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,
The actual move of the ioctl definitions comes in a follow on patch. </quote>
Ira
Quoted 352 lines
Move HFI1 structures to separate file to avoid this failure.
--- 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.hinclude/uapi/rdma/hfi/Kbuild +1
-0@@ -1,2 +1,3 @@ # UAPI Header export list header-y += hfi1_user.h +header-y += hfi1_ioctl.hinclude/uapi/rdma/hfi/hfi1_ioctl.h new file +173
-0@@ -0,0 +1,173 @@ +/* +* +* This file is provided under a dual BSD/GPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* GPL LICENSE SUMMARY +* +* Copyright(c) 2015 Intel Corporation. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of version 2 of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* BSD LICENSE +* +* Copyright(c) 2015 Intel Corporation. +* +* 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. +* - Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef _LINUX__HFI1_IOCTL_H +#define _LINUX__HFI1_IOCTL_H +#include <linux/types.h> + +/* +* This structure is passed to the driver to tell it where +* user code buffers are, sizes, etc. The offsets and sizes of the +* fields must remain unchanged, for binary compatibility. It can +* be extended, if userversion is changed so user code can tell, if needed +*/ +struct hfi1_user_info { +/* +* version of user software, to detect compatibility issues. +* Should be set to HFI1_USER_SWVERSION. +*/ +__u32 userversion; +__u32 pad; +/* +* If two or more processes wish to share a context, each process +* must set the subcontext_cnt and subcontext_id to the same +* values. The only restriction on the subcontext_id is that +* it be unique for a given node. +*/ +__u16 subctxt_cnt; +__u16 subctxt_id; +/* 128bit UUID passed in by PSM. */ +__u8 uuid[16 ]; +}; + +struct hfi1_ctxt_info { +__u64 runtime_flags;/* chip/drv runtime flags (HFI1_CAP_*) */ +__u32 rcvegr_size;/* size of each eager buffer */ +__u16 num_active;/* number of active units */ +__u16 unit;/* unit (chip) assigned to caller */ +__u16 ctxt;/* ctxt on unit assigned to caller */ +__u16 subctxt;/* subctxt on unit assigned to caller */ +__u16 rcvtids;/* number of Rcv TIDs for this context */ +__u16 credits;/* number of PIO credits for this context */ +__u16 numa_node;/* NUMA node of the assigned device */ +__u16 rec_cpu;/* cpu # for affinity (0xffff if none) */ +__u16 send_ctxt;/* send context in use by this user context */ +__u16 egrtids;/* number of RcvArray entries for Eager Rcvs */ +__u16 rcvhdrq_cnt;/* number of RcvHdrQ entries */ +__u16 rcvhdrq_entsize;/* size (in bytes) for each RcvHdrQ entry */ +__u16 sdma_ring_size;/* number of entries in SDMA request ring */ +}; + +struct hfi1_tid_info { +/* virtual address of first page in transfer */ +__u64 vaddr; +/* pointer to tid array. this array is big enough */ +__u64 tidlist; +/* number of tids programmed by this request */ +__u32 tidcnt; +/* length of transfer buffer programmed by this request */ +__u32 length; +}; + +/* +* This structure is returned by the driver immediately after +* open to get implementation-specific info, and info specific to this +* instance. +* +* This struct must have explicit pad fields where type sizes +* may result in different alignments between 32 and 64 bit +* programs, since the 64 bit * bit kernel requires the user code +* to have matching offsets +*/ +struct hfi1_base_info { +/* version of hardware, for feature checking. */ +__u32 hw_version; +/* version of software, for feature checking. */ +__u32 sw_version; +/* Job key */ +__u16 jkey; +__u16 padding1; +/* +* The special QP (queue pair) value that identifies PSM +* protocol packet from standard IB packets. +*/ +__u32 bthqp; +/* PIO credit return address, */ +__u64 sc_credits_addr; +/* +* Base address of write-only pio buffers for this process. +* Each buffer has sendpio_credits*64 bytes. +*/ +__u64 pio_bufbase_sop; +/* +* Base address of write-only pio buffers for this process. +* Each buffer has sendpio_credits*64 bytes. +*/ +__u64 pio_bufbase; +/* address where receive buffer queue is mapped into */ +__u64 rcvhdr_bufbase; +/* base address of Eager receive buffers. */ +__u64 rcvegr_bufbase; +/* base address of SDMA completion ring */ +__u64 sdma_comp_bufbase; +/* +* User register base for init code, not to be used directly by +* protocol or applications. Always maps real chip register space. +* the register addresses are: +* ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail, +* ur_rcvtidflow +*/ +__u64 user_regbase; +/* notification events */ +__u64 events_bufbase; +/* status page */ +__u64 status_bufbase; +/* rcvhdrtail update */ +__u64 rcvhdrtail_base; +/* +* shared memory pages for subctxts if ctxt is shared; these cover +* all the processes in the group sharing a single context. +* all have enough space for the num_subcontexts value on this job. +*/ +__u64 subctxt_uregbase; +__u64 subctxt_rcvegrbuf; +__u64 subctxt_rcvhdrbuf; +}; +#endif /* _LINIUX__HFI1_IOCTL_H */ include/uapi/rdma/hfi/hfi1_user.h +1
-119@@ -58,6 +58,7 @@#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 @@ -211,60 +212,6 @@ struct hfi1_cmd;#define HFI1_POLL_TYPE_ANYRCV 0x0#define HFI1_POLL_TYPE_URGENT 0x1 -/* -* This structure is passed to the driver to tell it where -* user code buffers are, sizes, etc. The offsets and sizes of the -* fields must remain unchanged, for binary compatibility. It can -* be extended, if userversion is changed so user code can tell, if needed -*/ -struct hfi1_user_info { -/* -* version of user software, to detect compatibility issues. -* Should be set to HFI1_USER_SWVERSION. -*/ -__u32 userversion; -__u32 pad; -/* -* If two or more processes wish to share a context, each process -* must set the subcontext_cnt and subcontext_id to the same -* values. The only restriction on the subcontext_id is that -* it be unique for a given node. -*/ -__u16 subctxt_cnt; -__u16 subctxt_id; -/* 128bit UUID passed in by PSM. */ -__u8 uuid[16 ]; -}; - -struct hfi1_ctxt_info { -__u64 runtime_flags;/* chip/drv runtime flags (HFI1_CAP_*) */ -__u32 rcvegr_size;/* size of each eager buffer */ -__u16 num_active;/* number of active units */ -__u16 unit;/* unit (chip) assigned to caller */ -__u16 ctxt;/* ctxt on unit assigned to caller */ -__u16 subctxt;/* subctxt on unit assigned to caller */ -__u16 rcvtids;/* number of Rcv TIDs for this context */ -__u16 credits;/* number of PIO credits for this context */ -__u16 numa_node;/* NUMA node of the assigned device */ -__u16 rec_cpu;/* cpu # for affinity (0xffff if none) */ -__u16 send_ctxt;/* send context in use by this user context */ -__u16 egrtids;/* number of RcvArray entries for Eager Rcvs */ -__u16 rcvhdrq_cnt;/* number of RcvHdrQ entries */ -__u16 rcvhdrq_entsize;/* size (in bytes) for each RcvHdrQ entry */ -__u16 sdma_ring_size;/* number of entries in SDMA request ring */ -}; - -struct hfi1_tid_info { -/* virtual address of first page in transfer */ -__u64 vaddr; -/* pointer to tid array. this array is big enough */ -__u64 tidlist; -/* number of tids programmed by this request */ -__u32 tidcnt; -/* length of transfer buffer programmed by this request */ -__u32 length; -}; -enum hfi1_sdma_comp_state {FREE =0 ,QUEUED ,@@ -289,71 +236,6 @@ struct hfi1_status {char freezemsg[0 ]; }; -/* -* This structure is returned by the driver immediately after -* open to get implementation-specific info, and info specific to this -* instance. -* -* This struct must have explicit pad fields where type sizes -* may result in different alignments between 32 and 64 bit -* programs, since the 64 bit * bit kernel requires the user code -* to have matching offsets -*/ -struct hfi1_base_info { -/* version of hardware, for feature checking. */ -__u32 hw_version; -/* version of software, for feature checking. */ -__u32 sw_version; -/* Job key */ -__u16 jkey; -__u16 padding1; -/* -* The special QP (queue pair) value that identifies PSM -* protocol packet from standard IB packets. -*/ -__u32 bthqp; -/* PIO credit return address, */ -__u64 sc_credits_addr; -/* -* Base address of write-only pio buffers for this process. -* Each buffer has sendpio_credits*64 bytes. -*/ -__u64 pio_bufbase_sop; -/* -* Base address of write-only pio buffers for this process. -* Each buffer has sendpio_credits*64 bytes. -*/ -__u64 pio_bufbase; -/* address where receive buffer queue is mapped into */ -__u64 rcvhdr_bufbase; -/* base address of Eager receive buffers. */ -__u64 rcvegr_bufbase; -/* base address of SDMA completion ring */ -__u64 sdma_comp_bufbase; -/* -* User register base for init code, not to be used directly by -* protocol or applications. Always maps real chip register space. -* the register addresses are: -* ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail, -* ur_rcvtidflow -*/ -__u64 user_regbase; -/* notification events */ -__u64 events_bufbase; -/* status page */ -__u64 status_bufbase; -/* rcvhdrtail update */ -__u64 rcvhdrtail_base; -/* -* shared memory pages for subctxts if ctxt is shared; these cover -* all the processes in the group sharing a single context. -* all have enough space for the num_subcontexts value on this job. -*/ -__u64 subctxt_uregbase; -__u64 subctxt_rcvegrbuf; -__u64 subctxt_rcvhdrbuf; -}; -enum sdma_req_opcode {EXPECTED =0 ,EAGER Signature · 6 lines
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
--
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 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
In reply to a message not in the archiveQuoted 3 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move HFI1 IOCTL declarations to
rdma_user_ioctl.hfile.
I have not tried with the patch but I'm 99% sure this will break the PSM2 library build which includes hfi1_user.h.
This is one of those things I have pondered in the past. Most of the rdma libraries don't actually use these definitions directly. PSM2 does.
I'm not sure what other libraries do.
In the final patch of this series you admit that the name changes in that patch will break userspace which uses the defines directly. Can we, should we, do that?
To be completely pedantic I think we need to maintain the old names at least for some time. Perhaps they are best put in an rdma_user_compat_ioctl.h which is included in the final rdma_user_ioctl.h?
For this patch I think it would be sufficient to include rdma_user_ioctl.h in hfi1_user.h but I would have to double check that.
Ira
Quoted 159 lines
--- 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 2include/uapi/rdma/rdma_user_ioctl.h +54
-0@@ -36,6 +36,7 @@#include <linux/types.h> #include <linux/ioctl.h> #include <rdma/ib_user_mad.h> +#include <rdma/hfi/hfi1_ioctl.h> /* Documentation/ioctl/ioctl-number.txt */ #define RDMA_IOCTL_MAGIC 0x1b@@ -51,4 +52,57 @@#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_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 */ + +/* +* 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) + +#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) +#endif /* RDMA_USER_IOCTL_H */ Signature · 6 lines
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
--
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 3/6] RDMA/hfi1: Avoid redeclaration error
In reply to a message not in the archiveQuoted 35 lines · ira.weiny
Quoted 6 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Plugging HFI1 IOCTL defines will cause to the following 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,Quoted 8 lines
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,I was pretty confused about what you were doing here mainly because you reference a symbol you don't actually touch in the patch.
I see what you are doing now. But a better explanation would be:
<quote>
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:
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:
Quoted 8 lines
./include/uapi/rdma/hfi/hfi1_user.h:370:2: error: redeclaration of enumerator ‘ur_rcvhdrtail’
ur_rcvhdrtail= 0,The actual move of the ioctl definitions comes in a follow on patch. </quote>
It is definitely better.
I'll update it in next version.
Re: [PATCH rdma-next 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
In reply to a message not in the archiveQuoted 10 lines · ira.weiny
Quoted 3 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move HFI1 IOCTL declarations to
rdma_user_ioctl.hfile.I have not tried with the patch but I'm 99% sure this will break the PSM2 library build which includes
hfi1_user.h.This is one of those things I have pondered in the past. Most of the rdma libraries don't actually use these definitions directly. PSM2 does.
I'm not so convinced about it.
"#include <rdma/rdma_user_ioctl.h>" was added to hfi1_user.h to share all definitions. PSM2 library will see it.
Quoted 6 lines
I'm not sure what other libraries do.
In the final patch of this series you admit that the name changes in that patch will break userspace which uses the defines directly. Can we, should we, do that?
I'm talking about __NUM() macros.
Do you really use __NUM(ASSIGN_CTXT) in user application? Why did you do it? You supposed to use HFI1_IOCTL_ASSIGN_CTXT instead.
Quoted 4 lines
To be completely pedantic I think we need to maintain the old names at least for some time. Perhaps they are best put in an
rdma_user_compat_ioctl.hwhich is included in the finalrdma_user_ioctl.h?
Except __NUM() macro, there is no change in names.
Quoted 3 lines
For this patch I think it would be sufficient to include
rdma_user_ioctl.hinhfi1_user.hbut I would have to double check that.
It is already done in patches before.
Quoted 166 lines
Ira
Quoted 159 lines
--- 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 2include/uapi/rdma/rdma_user_ioctl.h +54
-0@@ -36,6 +36,7 @@#include <linux/types.h> #include <linux/ioctl.h> #include <rdma/ib_user_mad.h> +#include <rdma/hfi/hfi1_ioctl.h> /* Documentation/ioctl/ioctl-number.txt */ #define RDMA_IOCTL_MAGIC 0x1b@@ -51,4 +52,57 @@#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_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 */ + +/* +* 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) + +#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) +#endif /* RDMA_USER_IOCTL_H */ Signature · 6 lines
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--
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 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
In reply to a message not in the archiveT24gV2VkLCAyMDE2LTA4LTE3IGF0IDA5OjU1ICswMzAwLCBMZW9uIFJvbWFub3Zza3kgd3JvdGU6 DQo+IE9uIFdlZCwgQXVnIDE3LCAyMDE2IGF0IDAyOjE2OjMxQU0gLTA0MDAsIGlyYS53ZWlueSB3 cm90ZToNCj4gPiBPbiBUdWUsIEF1ZyAxNiwgMjAxNiBhdCAwNDo0NToyMVBNICswMzAwLCBMZW9u IFJvbWFub3Zza3kgd3JvdGU6DQo+ID4gPiBGcm9tOiBMZW9uIFJvbWFub3Zza3kgPGxlb25yb0Bt ZWxsYW5veC5jb20+DQo+ID4gPiANCj4gPiA+IE1vdmUgSEZJMSBJT0NUTCBkZWNsYXJhdGlvbnMg dG8gcmRtYV91c2VyX2lvY3RsLmggZmlsZS4NCj4gPiANCj4gPiBJIGhhdmUgbm90IHRyaWVkIHdp dGggdGhlIHBhdGNoIGJ1dCBJJ20gOTklIHN1cmUgdGhpcyB3aWxsIGJyZWFrDQo+ID4gdGhlIFBT TTINCj4gPiBsaWJyYXJ5IGJ1aWxkIHdoaWNoIGluY2x1ZGVzIGhmaTFfdXNlci5oLg0KPiA+IA0K PiA+IFRoaXMgaXMgb25lIG9mIHRob3NlIHRoaW5ncyBJIGhhdmUgcG9uZGVyZWQgaW4gdGhlIHBh c3QuwqDCoE1vc3Qgb2YNCj4gPiB0aGUgcmRtYQ0KPiA+IGxpYnJhcmllcyBkb24ndCBhY3R1YWxs eSB1c2UgdGhlc2UgZGVmaW5pdGlvbnMgZGlyZWN0bHkuwqDCoFBTTTINCj4gPiBkb2VzLg0KPiAN Cj4gSSdtIG5vdCBzbyBjb252aW5jZWQgYWJvdXQgaXQuDQo+ICIjaW5jbHVkZSA8cmRtYS9yZG1h X3VzZXJfaW9jdGwuaD4iIHdhcyBhZGRlZCB0byBoZmkxX3VzZXIuaCB0byBzaGFyZQ0KPiBhbGwg ZGVmaW5pdGlvbnMuIFBTTTIgbGlicmFyeSB3aWxsIHNlZSBpdC4NCg0KT24gZmFjZSB2YWx1ZSB0 aGF0IHNob3VsZCBiZSB0cnVlLiBJIHdvdWxkIHdhbnQgdG8gcnVuIGl0IGJ5IHRoZSBQU00NCmZv bGtzIGFuZCB0ZXN0IGl0IG91dCB0aG91Z2ggdG8gYmUgc3VyZS4NCg0KDQoNCj4gPiBJJ20gbm90 IHN1cmUgd2hhdCBvdGhlciBsaWJyYXJpZXMgZG8uDQo+ID4gDQo+ID4gSW4gdGhlIGZpbmFsIHBh dGNoIG9mIHRoaXMgc2VyaWVzIHlvdSBhZG1pdCB0aGF0IHRoZSBuYW1lIGNoYW5nZXMNCj4gPiBp biB0aGF0IHBhdGNoDQo+ID4gd2lsbCBicmVhayB1c2Vyc3BhY2Ugd2hpY2ggdXNlcyB0aGUgZGVm aW5lcyBkaXJlY3RseS7CoMKgQ2FuIHdlLA0KPiA+IHNob3VsZCB3ZSwgZG8NCj4gPiB0aGF0Pw0K PiANCj4gSSdtIHRhbGtpbmcgYWJvdXQgX19OVU0oKSBtYWNyb3MuDQo+IA0KPiBEbyB5b3UgcmVh bGx5IHVzZSBfX05VTShBU1NJR05fQ1RYVCkgaW4gdXNlciBhcHBsaWNhdGlvbj8gV2h5IGRpZCB5 b3UNCj4gZG8NCj4gaXQ/IFlvdSBzdXBwb3NlZCB0byB1c2UgSEZJMV9JT0NUTF9BU1NJR05fQ1RY VCBpbnN0ZWFkLg0KDQpZZWFoIEkgdGhpbmsgd2UgY2FuIGdldCByaWQgb2YgdGhlIF9fTlVNKCkg bWFjcm8uIEl0IHNob3VsZCBub3QNCnN0cmljdGx5IGJlIG5lZWRlZCBieSB1c2VyIHNwYWNlLiBV c2VyIHNob3VsZCBiZSB1c2luZyB0aGUgdGhpbmcgdGhhdA0KX19OVU0oKSB3YXMgdXNlZCBpbiwg dGhlIElPQ1RMIG51bWJlci4NCg0KLURlbm55
--
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 6/6] RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveT24gV2VkLCAyMDE2LTA4LTE3IGF0IDA4OjE5ICswMzAwLCBMZW9uIFJvbWFub3Zza3kgd3JvdGU6 DQoNCg0KPiA+IEknbSBub3Qgb3Bwb3NlZCB0byB0cnlpbmcgdG8gdW5pZnkgdGhpbmdzLCBob3dl dmVyIHRoaXMgc2VlbXMgdG8gYmUNCj4gPiBtb3JlIHRoYW4gcGxvcCBkb3duIHRoZSBoZmkxIHN0 dWZmIGZyb20gaGVyZSBhbmQgcHV0IGl0IG92ZXIgdGhlcmUuDQo+ID4gSXQNCj4gPiBpcyBjZXJ0 YWlubHkgbm90IHNpbXBsaWZ5aW5nIGFueXRoaW5nLg0KPiANCj4gSXQgaXMgImRhcmsgc2lkZSIg b2YgVUFQSSAtIGluYWJpbGl0eSB0byBjaGFuZ2UgbGVnYWN5IGRlY2xhcmF0aW9ucy4NCj4gVGhp cyBpcyB3aHkgSSBkaWRuJ3QgcmVtb3ZlIGFueXRoaW5nIGV4Y2VwdCBfTlVNKCkgbWFjcm8uDQo+ IA0KPiBUaGUgc2ltcGxpZmljYXRpb24gY29tZXMgZnJvbSBkZWZpbml0aW9uIG9mIG9uZSBwbGFj ZSBmb3INCj4gZGVjbGFyYXRpb24gb2YgSU9DVExzIG51bWJlcnMgYW5kIGV4cG9ydGluZyBpdCB0 byB1c2Vycy4gSXQgZ2l2ZXMNCj4gdmlzaWJpbGl0eSBmb3IgdXNlciBzcGFjZSBhdXRob3JzIHRv by4NCg0KSG93IG9mdGVuIGRvZXMgYSB1c2VyIG5lZWQgdGhlIElPQ1RMIG51bWJlcnMgZm9yIE1B RCBhbmQgUFNNIGFuZA0Kd2hhdGV2ZXIgZWxzZSB3ZSBjb21lIHVwIHdpdGggYXQgdGhlIHNhbWUg dGltZT8gV2h5IHdvdWxkIHRoZXkgY2FyZQ0KYWJvdXQgdGhlIG90aGVyIElPQ1RMIG51bWJlcnM/ wqANCg0KSSBkb24ndCByZWFsbHkgc2VlIGEgcHJvYmxlbSB3aXRoIGtlZXBpbmcgdGhlbSBzZXBh cmF0ZSwgYnV0IEknbSBub3QNCnJlYWxseSBvcHBvc2VkIHRvIGNvbGxhcHNpbmcgaW50byBvbmUg cGxhY2UgZWl0aGVyLg0KDQotRGVubnk=
--
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 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
In reply to a message not in the archiveQuoted 16 lines · Dennis
Quoted 15 lines · Leon Romanovsky
Quoted 13 lines · ira.weiny
Quoted 3 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move HFI1 IOCTL declarations to
rdma_user_ioctl.hfile.I have not tried with the patch but I'm 99% sure this will break the PSM2
library build which includeshfi1_user.h.This is one of those things I have pondered in the past. Most of the rdma
libraries don't actually use these definitions directly. PSM2 does.
Quoted 6 lines
Quoted 3 lines
I'm not so convinced about it.
"#include <rdma/rdma_user_ioctl.h>" was added tohfi1_user.hto share all definitions. PSM2 library will see it.On face value that should be true. I would want to run it by the PSM folks and test it out though to be sure.
I agree,
Thanks.
Re: [PATCH rdma-next 6/6] RDMA/core: Unify style of IOCTL commands
In reply to a message not in the archiveQuoted 11 lines · Dennis
Quoted 8 lines · Leon Romanovsky
Quoted 4 lines
I'm not opposed to trying to unify things, however this seems to be more than plop down the hfi1 stuff from here and put it over there. It
is certainly not simplifying anything.It is "dark side" of UAPI - inability to change legacy declarations. This is why I didn't remove anything except
_NUM()macro.
Quoted 7 lines
Quoted 3 lines
The simplification comes from definition of one place for declaration of IOCTLs numbers and exporting it to users. It gives visibility for user space authors too.
How often does a user need the IOCTL numbers for MAD and PSM and whatever else we come up with at the same time? Why would they care about the other IOCTL numbers?
We will need new IOCTLs numbers for ABI and better if they be different from already defined.
Quoted 3 lines
I don't really see a problem with keeping them separate, but I'm not really opposed to collapsing into one place either.
Thanks
Quoted 2 lines
-Denny
Re: [PATCH rdma-next 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
In reply to a message not in the archiveQuoted 9 lines · Leon Romanovsky
Quoted 8 lines · ira.weiny
Quoted 3 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move HFI1 IOCTL declarations to
rdma_user_ioctl.hfile.I have not tried with the patch but I'm 99% sure this will break the PSM2 library build which includes
hfi1_user.h.
Quoted 6 lines
Quoted 2 lines
This is one of those things I have pondered in the past. Most of the rdma libraries don't actually use these definitions directly. PSM2 does.
I'm not so convinced about it.
"#include <rdma/rdma_user_ioctl.h>" was added tohfi1_user.hto share all definitions. PSM2 library will see it.
Ok I see it now. Sorry it was late.
Quoted 4 lines
Quoted 4 lines
I'm not sure what other libraries do.
Quoted 8 lines
Quoted 3 lines
In the final patch of this series you admit that the name changes in that patch will break userspace which uses the defines directly. Can we, should we, do that?
I'm talking about
__NUM()macros.Do you really use
__NUM(ASSIGN_CTXT)in user application? Why did you do it? You supposed to useHFI1_IOCTL_ASSIGN_CTXTinstead.
Your commit message says "... and MAD indexes were renamed. It has the potential to break application which use these defines directly."
I took that at face value. I've taken a closer look ... I see now that neither the numbers nor the define names changed so ok, my mistake.
Ira
Quoted 6 lines
Quoted 5 lines
To be completely pedantic I think we need to maintain the old names at least for some time. Perhaps they are best put in an
rdma_user_compat_ioctl.hwhich is included in the finalrdma_user_ioctl.h?
Quoted 174 lines
Except
__NUM()macro, there is no change in names.Quoted 3 lines
For this patch I think it would be sufficient to include
rdma_user_ioctl.hinhfi1_user.hbut I would have to double check that.It is already done in patches before.
Quoted 166 lines
Ira
Quoted 159 lines
--- 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 2include/uapi/rdma/rdma_user_ioctl.h +54
-0@@ -36,6 +36,7 @@#include <linux/types.h> #include <linux/ioctl.h> #include <rdma/ib_user_mad.h> +#include <rdma/hfi/hfi1_ioctl.h> /* Documentation/ioctl/ioctl-number.txt */ #define RDMA_IOCTL_MAGIC 0x1b@@ -51,4 +52,57 @@#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_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 */ + +/* +* 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) + +#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) +#endif /* RDMA_USER_IOCTL_H */ Signature · 6 lines
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--
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
--
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 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
In reply to a message not in the archiveQuoted 29 lines · ira.weiny
Quoted 9 lines · Leon Romanovsky
Quoted 8 lines · ira.weiny
Quoted 3 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move HFI1 IOCTL declarations to
rdma_user_ioctl.hfile.I have not tried with the patch but I'm 99% sure this will break the PSM2 library build which includes
hfi1_user.h.Quoted 6 lines
Quoted 2 lines
This is one of those things I have pondered in the past. Most of the rdma libraries don't actually use these definitions directly. PSM2 does.
I'm not so convinced about it.
"#include <rdma/rdma_user_ioctl.h>" was added tohfi1_user.hto share all definitions. PSM2 library will see it.Ok I see it now. Sorry it was late.
Quoted 10 lines
Quoted 7 lines
I'm not sure what other libraries do.
In the final patch of this series you admit that the name changes in that patch will break userspace which uses the defines directly. Can we, should we, do that?
I'm talking about
__NUM()macros.
Quoted 8 lines
Quoted 2 lines
Do you really use
__NUM(ASSIGN_CTXT)in user application? Why did you do it? You supposed to useHFI1_IOCTL_ASSIGN_CTXTinstead.Your commit message says "... and MAD indexes were renamed. It has the potential to break application which use these defines directly."
I took that at face value. I've taken a closer look ... I see now that neither the numbers nor the define names changed so ok, my mistake.
Sorry for inconvenience,
I'll update commit message, so it will better reflect reality.
Thanks
Quoted 9 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.
Just for my understanding - this is not an issue only with RDMA-IOCTLs, right?
(Wondering how other modules approaches this).
Quoted 32 lines
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.
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 commands
Quoted 17 lines
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 | 127 ++++++++++++++++++++++++++ 6 files changed, 304 insertions(+), 187 deletions(-) create mode 100644 include/uapi/rdma/hfi/hfi1_ioctl.h create mode 100644 include/uapi/rdma/rdma_user_ioctl.hSignature · 6 lines
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
--
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
Quoted 7 lines · Yuval Shaia
Quoted 6 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.
Quoted 7 lines
Quoted 3 lines
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.
Just for my understanding - this is not an issue only with RDMA-IOCTLs, right?
(Wondering how other modules approaches this).
I'm not familiar with all subsystems, but IMHO, we will find all possible solutions. While working on the patches, I took a look on other subsystems and they exposed structures in the same file as IOCTLs from the day one.
Re: [PATCH rdma-next 4/6] RDMA/core: Move HFI1 IOCTL declarations to common file
In reply to a message not in the archiveQuoted 5 lines · ira.weiny
Quoted 3 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Move HFI1 IOCTL declarations to
rdma_user_ioctl.hfile.
Quoted 7 lines
I have not tried with the patch but I'm 99% sure this will break the PSM2 library build which includes
hfi1_user.h.This is one of those things I have pondered in the past. Most of the rdma libraries don't actually use these definitions directly. PSM2 does.
I'm not sure what other libraries do.
They should all be fixed to use the new uapi headers instead of cloning them privately. If we go ahead with the rdma-plumbing I might even do it..
Quoted 3 lines
In the final patch of this series you admit that the name changes in that patch will break userspace which uses the defines directly. Can we, should we, do that?
This happens from time to time, userspace should gain a build-time test to deal with it, if it is a big enough deal, IMHO.
We don't guarentee 100% source compatibility..
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