All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core 0/4] Migrate to use kernel uAPI headers
@ 2016-10-27 23:06 Jason Gunthorpe
       [not found] ` <1477609570-8087-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Gunthorpe @ 2016-10-27 23:06 UTC (permalink / raw)
  To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA

This is a start on this process, verbs will be quite challenging.

https://github.com/linux-rdma/rdma-core/pull/29

Jason Gunthorpe (4):
  Support -DKERNEL_DIR to use kernel UAPI headers directly
  Move rdma_netlink compat into CMake
  verbs: Replace infiniband/sa-kern-abi.h with the kernel's
    uapi/rdma/ib_user_sa.h
  ibcm: Replace infiniband/cm_abi.h with the kernel's
    uapi/rdma/ib_user_cm.h

 CMakeLists.txt                             |  11 +-
 buildlib/RDMA_LinuxHeaders.cmake           |  85 +++++++
 buildlib/fixup-include/rdma-rdma_netlink.h | 225 ++++++++++++++++++
 ibacm/src/acm.c                            |   3 -
 ibacm/src/acm_netlink.h                    | 128 -----------
 iwpmd/iwarp_pm.h                           |   2 +-
 iwpmd/iwarp_pm_common.c                    |   5 -
 iwpmd/iwarp_pm_server.c                    |   4 +-
 iwpmd/iwpm_netlink.h                       | 214 ------------------
 libibcm/cm.c                               |  78 ++++---
 libibcm/cm_abi.h                           | 351 ++++-------------------------
 libibverbs/marshall.c                      |   4 +-
 libibverbs/marshall.h                      |   6 +-
 libibverbs/sa-kern-abi.h                   |  34 +--
 librdmacm/rdma_cma_abi.h                   |   4 +-
 15 files changed, 416 insertions(+), 738 deletions(-)
 create mode 100644 buildlib/RDMA_LinuxHeaders.cmake
 create mode 100644 buildlib/fixup-include/rdma-rdma_netlink.h
 delete mode 100644 ibacm/src/acm_netlink.h
 delete mode 100644 iwpmd/iwpm_netlink.h

-- 
2.1.4

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH rdma-core 1/4] Support -DKERNEL_DIR to use kernel UAPI headers directly
       [not found] ` <1477609570-8087-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-10-27 23:06   ` Jason Gunthorpe
  2016-10-27 23:06   ` [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake Jason Gunthorpe
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Jason Gunthorpe @ 2016-10-27 23:06 UTC (permalink / raw)
  To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA

This is useful to painlessly test if the kernel headers work with the
build. All the kernel header shimming is moved into
buildlib/RDMA_LinuxHeaders.cmake, new headers can be added to the list.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt                   | 11 ++----
 buildlib/RDMA_LinuxHeaders.cmake | 85 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+), 7 deletions(-)
 create mode 100644 buildlib/RDMA_LinuxHeaders.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 230aab5ee01f..7abaa895c173 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,8 @@
 #      Produce static libraries along with the usual shared libraries.
 #  -DVERBS_PROVIDER_DIR='' (default /usr/lib.../libibverbs)
 #      Use the historical search path for providers, in the standard system library.
+#  -DKERNEL_DIR='.../linux' (default '')
+#      If set use the kernel UAPI headers from this kernel source tree.
 
 cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
 project(RDMA C)
@@ -241,10 +243,7 @@ endif()
 # should rely on this.
 check_type_size("long" SIZEOF_LONG BUILTIN_TYPES_ONLY LANGUAGE C)
 
-# Are our kernel headers new enough?
-# If not replace them with built-in copies so we can continue to build.
-CHECK_INCLUDE_FILE("rdma/rdma_user_rxe.h" HAVE_RDMA_USER_RXE)
-RDMA_DoFixup("${HAVE_RDMA_USER_RXE}" "rdma/rdma_user_rxe.h")
+include(RDMA_LinuxHeaders)
 
 #-------------------------
 # Apply fixups
@@ -375,9 +374,7 @@ else()
     message(STATUS " netlink/route/link.h and net/if.h NOT co-includable (old headers)")
   endif()
 endif()
-if (NOT HAVE_RDMA_USER_RXE)
-  message(STATUS " rdma/rdma_user_rxe.h NOT found (old system kernel headers)")
-endif()
+rdma_report_missing_kheaders()
 if (NOT HAVE_C_WARNINGS)
   message(STATUS " extended C warnings NOT supported")
 endif()
diff --git a/buildlib/RDMA_LinuxHeaders.cmake b/buildlib/RDMA_LinuxHeaders.cmake
new file mode 100644
index 000000000000..bd16d8deca72
--- /dev/null
+++ b/buildlib/RDMA_LinuxHeaders.cmake
@@ -0,0 +1,85 @@
+# COPYRIGHT (c) 2016 Obsidian Research Corporation. See COPYING file
+
+# Check that the system kernel headers are new enough, if not replace the
+# headers with our internal copy.
+
+set(DEFAULT_TEST "int main(int argc,const char *argv[]) {return 1;}")
+set(MISSING_HEADERS "")
+
+function(rdma_canon_header PATH OUT_VAR)
+  string(TOUPPER "${PATH}" HAVE)
+  string(REPLACE " " "_" HAVE "${HAVE}")
+  string(REPLACE "/" "_" HAVE "${HAVE}")
+  string(REPLACE "." "_" HAVE "${HAVE}")
+  set("${OUT_VAR}" "HAVE_${HAVE}" PARENT_SCOPE)
+endfunction()
+
+function(rdma_check_kheader PATH C_TEST)
+  rdma_canon_header("${PATH}" HAVE)
+
+  if(KERNEL_DIR)
+    # Drop a symlink back to the kernel into our include/ directory
+    if (EXISTS "${KERNEL_DIR}/include/uapi/${PATH}")
+      set(DEST "${BUILD_INCLUDE}/${PATH}")
+
+      if(CMAKE_VERSION VERSION_LESS "2.8.12")
+	get_filename_component(DIR ${DEST} PATH)
+      else()
+	get_filename_component(DIR ${DEST} DIRECTORY)
+      endif()
+      file(MAKE_DIRECTORY "${DIR}")
+
+      # We cannot just -I the kernel UAPI dir, it depends on some
+      # post-processing of things like linux/stddef.h. Instead we symlink the
+      # kernel headers into our tree and rely on the distro's fixup of
+      # non-rdma headers.  The RDMA headers are all compatible with this
+      # scheme.
+      execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink"
+	"${KERNEL_DIR}/include/uapi/${PATH}"
+	"${DEST}")
+    else()
+      message(FATAL_ERROR "Kernel tree does not contain expected UAPI header"
+	"${KERNEL_DIR}/include/uapi/${PATH}")
+    endif()
+
+    set(CMAKE_REQUIRED_INCLUDES "${BUILD_INCLUDE}")
+  endif()
+
+  # Note: The RDMA kernel headers use sockaddr{_in,_in6,}/etc so we have to
+  # include system headers to define sockaddrs before testing any of them.
+  CHECK_C_SOURCE_COMPILES("
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <${PATH}>
+${C_TEST}" "${HAVE}")
+
+  if(KERNEL_DIR)
+    if (NOT "${${HAVE}}")
+      # Run the compile test against the linked kernel header, this is to help
+      # make sure the compile tests work before the headers hit the distro
+      message(FATAL_ERROR "Kernel UAPI header failed compile test"
+	"${PATH}")
+    endif()
+  else()
+    RDMA_DoFixup("${${HAVE}}" "${PATH}")
+    if (NOT "${${HAVE}}")
+      list(APPEND MISSING_HEADERS "${PATH}")
+      set(MISSING_HEADERS "${MISSING_HEADERS}" PARENT_SCOPE)
+    endif()
+  endif()
+endfunction()
+
+function(rdma_report_missing_kheaders)
+  foreach(I IN LISTS MISSING_HEADERS)
+    message(STATUS " ${I} NOT found (old system kernel headers)")
+  endforeach()
+endfunction()
+
+# This list is topologically sorted
+rdma_check_kheader("rdma/ib_user_verbs.h" "${DEFAULT_TEST}")
+rdma_check_kheader("rdma/ib_user_sa.h" "${DEFAULT_TEST}")
+rdma_check_kheader("rdma/ib_user_cm.h" "${DEFAULT_TEST}")
+rdma_check_kheader("rdma/ib_user_mad.h" "${DEFAULT_TEST}")
+rdma_check_kheader("rdma/rdma_netlink.h" "${DEFAULT_TEST}")
+rdma_check_kheader("rdma/rdma_user_cm.h" "${DEFAULT_TEST}")
+rdma_check_kheader("rdma/rdma_user_rxe.h" "${DEFAULT_TEST}")
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake
       [not found] ` <1477609570-8087-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2016-10-27 23:06   ` [PATCH rdma-core 1/4] Support -DKERNEL_DIR to use kernel UAPI headers directly Jason Gunthorpe
@ 2016-10-27 23:06   ` Jason Gunthorpe
       [not found]     ` <1477609570-8087-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2016-10-27 23:06   ` [PATCH rdma-core 3/4] verbs: Replace infiniband/sa-kern-abi.h with the kernel's uapi/rdma/ib_user_sa.h Jason Gunthorpe
  2016-10-27 23:06   ` [PATCH rdma-core 4/4] ibcm: Replace infiniband/cm_abi.h with the kernel's uapi/rdma/ib_user_cm.h Jason Gunthorpe
  3 siblings, 1 reply; 11+ messages in thread
From: Jason Gunthorpe @ 2016-10-27 23:06 UTC (permalink / raw)
  To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Steve Wise

Detect if the distro's rdma_netlink.h is new enough, if not replace
it with the built in copy, and eliminate the two loose copies of the
header.

The built in copy is from v4.8

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 buildlib/RDMA_LinuxHeaders.cmake           |   2 +-
 buildlib/fixup-include/rdma-rdma_netlink.h | 225 +++++++++++++++++++++++++++++
 ibacm/src/acm.c                            |   3 -
 ibacm/src/acm_netlink.h                    | 128 ----------------
 iwpmd/iwarp_pm.h                           |   2 +-
 iwpmd/iwarp_pm_common.c                    |   5 -
 iwpmd/iwarp_pm_server.c                    |   4 +-
 iwpmd/iwpm_netlink.h                       | 214 ---------------------------
 8 files changed, 229 insertions(+), 354 deletions(-)
 create mode 100644 buildlib/fixup-include/rdma-rdma_netlink.h
 delete mode 100644 ibacm/src/acm_netlink.h
 delete mode 100644 iwpmd/iwpm_netlink.h

Steve,

Can you check if the changes to iwpmd/iwarp_pm_server.c make sense?
Should we do something to fix the kernel header?

diff --git a/buildlib/RDMA_LinuxHeaders.cmake b/buildlib/RDMA_LinuxHeaders.cmake
index bd16d8deca72..c67b0a6113d2 100644
--- a/buildlib/RDMA_LinuxHeaders.cmake
+++ b/buildlib/RDMA_LinuxHeaders.cmake
@@ -80,6 +80,6 @@ rdma_check_kheader("rdma/ib_user_verbs.h" "${DEFAULT_TEST}")
 rdma_check_kheader("rdma/ib_user_sa.h" "${DEFAULT_TEST}")
 rdma_check_kheader("rdma/ib_user_cm.h" "${DEFAULT_TEST}")
 rdma_check_kheader("rdma/ib_user_mad.h" "${DEFAULT_TEST}")
-rdma_check_kheader("rdma/rdma_netlink.h" "${DEFAULT_TEST}")
+rdma_check_kheader("rdma/rdma_netlink.h" "int main(int argc,const char *argv[]) { return RDMA_NL_IWPM_REMOTE_INFO && RDMA_NL_IWCM; }")
 rdma_check_kheader("rdma/rdma_user_cm.h" "${DEFAULT_TEST}")
 rdma_check_kheader("rdma/rdma_user_rxe.h" "${DEFAULT_TEST}")
diff --git a/buildlib/fixup-include/rdma-rdma_netlink.h b/buildlib/fixup-include/rdma-rdma_netlink.h
new file mode 100644
index 000000000000..02fe8390c18f
--- /dev/null
+++ b/buildlib/fixup-include/rdma-rdma_netlink.h
@@ -0,0 +1,225 @@
+#ifndef _UAPI_RDMA_NETLINK_H
+#define _UAPI_RDMA_NETLINK_H
+
+#include <linux/types.h>
+
+enum {
+	RDMA_NL_RDMA_CM = 1,
+	RDMA_NL_IWCM,
+	RDMA_NL_RSVD,
+	RDMA_NL_LS,	/* RDMA Local Services */
+	RDMA_NL_I40IW,
+	RDMA_NL_NUM_CLIENTS
+};
+
+enum {
+	RDMA_NL_GROUP_CM = 1,
+	RDMA_NL_GROUP_IWPM,
+	RDMA_NL_GROUP_LS,
+	RDMA_NL_NUM_GROUPS
+};
+
+#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
+#define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
+#define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
+
+enum {
+	RDMA_NL_RDMA_CM_ID_STATS = 0,
+	RDMA_NL_RDMA_CM_NUM_OPS
+};
+
+enum {
+	RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
+	RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
+	RDMA_NL_RDMA_CM_NUM_ATTR,
+};
+
+/* iwarp port mapper op-codes */
+enum {
+	RDMA_NL_IWPM_REG_PID = 0,
+	RDMA_NL_IWPM_ADD_MAPPING,
+	RDMA_NL_IWPM_QUERY_MAPPING,
+	RDMA_NL_IWPM_REMOVE_MAPPING,
+	RDMA_NL_IWPM_REMOTE_INFO,
+	RDMA_NL_IWPM_HANDLE_ERR,
+	RDMA_NL_IWPM_MAPINFO,
+	RDMA_NL_IWPM_MAPINFO_NUM,
+	RDMA_NL_IWPM_NUM_OPS
+};
+
+struct rdma_cm_id_stats {
+	__u32	qp_num;
+	__u32	bound_dev_if;
+	__u32	port_space;
+	__s32	pid;
+	__u8	cm_state;
+	__u8	node_type;
+	__u8	port_num;
+	__u8	qp_type;
+};
+
+enum {
+	IWPM_NLA_REG_PID_UNSPEC = 0,
+	IWPM_NLA_REG_PID_SEQ,
+	IWPM_NLA_REG_IF_NAME,
+	IWPM_NLA_REG_IBDEV_NAME,
+	IWPM_NLA_REG_ULIB_NAME,
+	IWPM_NLA_REG_PID_MAX
+};
+
+enum {
+	IWPM_NLA_RREG_PID_UNSPEC = 0,
+	IWPM_NLA_RREG_PID_SEQ,
+	IWPM_NLA_RREG_IBDEV_NAME,
+	IWPM_NLA_RREG_ULIB_NAME,
+	IWPM_NLA_RREG_ULIB_VER,
+	IWPM_NLA_RREG_PID_ERR,
+	IWPM_NLA_RREG_PID_MAX
+
+};
+
+enum {
+	IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
+	IWPM_NLA_MANAGE_MAPPING_SEQ,
+	IWPM_NLA_MANAGE_ADDR,
+	IWPM_NLA_MANAGE_MAPPED_LOC_ADDR,
+	IWPM_NLA_RMANAGE_MAPPING_ERR,
+	IWPM_NLA_RMANAGE_MAPPING_MAX
+};
+
+#define IWPM_NLA_MANAGE_MAPPING_MAX 3
+#define IWPM_NLA_QUERY_MAPPING_MAX  4
+#define IWPM_NLA_MAPINFO_SEND_MAX   3
+
+enum {
+	IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
+	IWPM_NLA_QUERY_MAPPING_SEQ,
+	IWPM_NLA_QUERY_LOCAL_ADDR,
+	IWPM_NLA_QUERY_REMOTE_ADDR,
+	IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
+	IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
+	IWPM_NLA_RQUERY_MAPPING_ERR,
+	IWPM_NLA_RQUERY_MAPPING_MAX
+};
+
+enum {
+	IWPM_NLA_MAPINFO_REQ_UNSPEC = 0,
+	IWPM_NLA_MAPINFO_ULIB_NAME,
+	IWPM_NLA_MAPINFO_ULIB_VER,
+	IWPM_NLA_MAPINFO_REQ_MAX
+};
+
+enum {
+	IWPM_NLA_MAPINFO_UNSPEC = 0,
+	IWPM_NLA_MAPINFO_LOCAL_ADDR,
+	IWPM_NLA_MAPINFO_MAPPED_ADDR,
+	IWPM_NLA_MAPINFO_MAX
+};
+
+enum {
+	IWPM_NLA_MAPINFO_NUM_UNSPEC = 0,
+	IWPM_NLA_MAPINFO_SEQ,
+	IWPM_NLA_MAPINFO_SEND_NUM,
+	IWPM_NLA_MAPINFO_ACK_NUM,
+	IWPM_NLA_MAPINFO_NUM_MAX
+};
+
+enum {
+	IWPM_NLA_ERR_UNSPEC = 0,
+	IWPM_NLA_ERR_SEQ,
+	IWPM_NLA_ERR_CODE,
+	IWPM_NLA_ERR_MAX
+};
+
+/*
+ * Local service operations:
+ *   RESOLVE - The client requests the local service to resolve a path.
+ *   SET_TIMEOUT - The local service requests the client to set the timeout.
+ *   IP_RESOLVE - The client requests the local service to resolve an IP to GID.
+ */
+enum {
+	RDMA_NL_LS_OP_RESOLVE = 0,
+	RDMA_NL_LS_OP_SET_TIMEOUT,
+	RDMA_NL_LS_OP_IP_RESOLVE,
+	RDMA_NL_LS_NUM_OPS
+};
+
+/* Local service netlink message flags */
+#define RDMA_NL_LS_F_ERR	0x0100	/* Failed response */
+
+/*
+ * Local service resolve operation family header.
+ * The layout for the resolve operation:
+ *    nlmsg header
+ *    family header
+ *    attributes
+ */
+
+/*
+ * Local service path use:
+ * Specify how the path(s) will be used.
+ *   ALL - For connected CM operation (6 pathrecords)
+ *   UNIDIRECTIONAL - For unidirectional UD (1 pathrecord)
+ *   GMP - For miscellaneous GMP like operation (at least 1 reversible
+ *         pathrecord)
+ */
+enum {
+	LS_RESOLVE_PATH_USE_ALL = 0,
+	LS_RESOLVE_PATH_USE_UNIDIRECTIONAL,
+	LS_RESOLVE_PATH_USE_GMP,
+	LS_RESOLVE_PATH_USE_MAX
+};
+
+#define LS_DEVICE_NAME_MAX 64
+
+struct rdma_ls_resolve_header {
+	__u8 device_name[LS_DEVICE_NAME_MAX];
+	__u8 port_num;
+	__u8 path_use;
+};
+
+struct rdma_ls_ip_resolve_header {
+	__u32 ifindex;
+};
+
+/* Local service attribute type */
+#define RDMA_NLA_F_MANDATORY	(1 << 13)
+#define RDMA_NLA_TYPE_MASK	(~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \
+				  RDMA_NLA_F_MANDATORY))
+
+/*
+ * Local service attributes:
+ *   Attr Name       Size                       Byte order
+ *   -----------------------------------------------------
+ *   PATH_RECORD     struct ib_path_rec_data
+ *   TIMEOUT         u32                        cpu
+ *   SERVICE_ID      u64                        cpu
+ *   DGID            u8[16]                     BE
+ *   SGID            u8[16]                     BE
+ *   TCLASS          u8
+ *   PKEY            u16                        cpu
+ *   QOS_CLASS       u16                        cpu
+ *   IPV4            u32                        BE
+ *   IPV6            u8[16]                     BE
+ */
+enum {
+	LS_NLA_TYPE_UNSPEC = 0,
+	LS_NLA_TYPE_PATH_RECORD,
+	LS_NLA_TYPE_TIMEOUT,
+	LS_NLA_TYPE_SERVICE_ID,
+	LS_NLA_TYPE_DGID,
+	LS_NLA_TYPE_SGID,
+	LS_NLA_TYPE_TCLASS,
+	LS_NLA_TYPE_PKEY,
+	LS_NLA_TYPE_QOS_CLASS,
+	LS_NLA_TYPE_IPV4,
+	LS_NLA_TYPE_IPV6,
+	LS_NLA_TYPE_MAX
+};
+
+/* Local service DGID/SGID attribute: big endian */
+struct rdma_nla_ls_gid {
+	__u8		gid[16];
+};
+
+#endif /* _UAPI_RDMA_NETLINK_H */
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index cc7dd065f69c..5f4068f619b4 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -61,9 +61,6 @@
 #include <ccan/list.h>
 #include "acm_mad.h"
 #include "acm_util.h"
-#if !defined(RDMA_NL_LS_F_ERR)
-	#include "acm_netlink.h"
-#endif
 
 #define src_out     data[0]
 #define src_index   data[1]
diff --git a/ibacm/src/acm_netlink.h b/ibacm/src/acm_netlink.h
deleted file mode 100644
index 867ae8c838fc..000000000000
diff --git a/iwpmd/iwarp_pm.h b/iwpmd/iwarp_pm.h
index b5a5a457a423..fc09e4fd752a 100644
--- a/iwpmd/iwarp_pm.h
+++ b/iwpmd/iwarp_pm.h
@@ -53,7 +53,7 @@
 #include <syslog.h>
 #include <netlink/msg.h>
 #include <ccan/list.h>
-#include "iwpm_netlink.h"
+#include <rdma/rdma_netlink.h>
 
 #define IWARP_PM_PORT          3935
 #define IWARP_PM_VER_SHIFT     6
diff --git a/iwpmd/iwarp_pm_common.c b/iwpmd/iwarp_pm_common.c
index 58b1089a1998..941e0406ade7 100644
--- a/iwpmd/iwarp_pm_common.c
+++ b/iwpmd/iwarp_pm_common.c
@@ -33,11 +33,6 @@
 
 #include "iwarp_pm.h"
 
-/* Necessary only for SLES11 */
-#if !defined (NETLINK_RDMA)
-	#define NETLINK_RDMA	        20
-#endif
-
 /* iwpm config params */
 static const char * iwpm_param_names[IWPM_PARAM_NUM] =
 	{ "nl_sock_rbuf_size" };
diff --git a/iwpmd/iwarp_pm_server.c b/iwpmd/iwarp_pm_server.c
index ab90c6c4b077..ef541c8175ed 100644
--- a/iwpmd/iwarp_pm_server.c
+++ b/iwpmd/iwarp_pm_server.c
@@ -1214,8 +1214,8 @@ static int init_iwpm_clients(__u32 iwarp_clients[])
 {
 	int client_num = 2;
 
-	iwarp_clients[0] = RDMA_NL_NES;
-	iwarp_clients[1] = RDMA_NL_C4IW;
+	iwarp_clients[0] = RDMA_NL_IWCM;
+	iwarp_clients[1] = RDMA_NL_IWCM+1; /* Legacy RDMA_NL_C4IW for old kernels */
 
 	return client_num;
 }
diff --git a/iwpmd/iwpm_netlink.h b/iwpmd/iwpm_netlink.h
deleted file mode 100644
index 0edcb620de99..000000000000
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH rdma-core 3/4] verbs: Replace infiniband/sa-kern-abi.h with the kernel's uapi/rdma/ib_user_sa.h
       [not found] ` <1477609570-8087-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2016-10-27 23:06   ` [PATCH rdma-core 1/4] Support -DKERNEL_DIR to use kernel UAPI headers directly Jason Gunthorpe
  2016-10-27 23:06   ` [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake Jason Gunthorpe
@ 2016-10-27 23:06   ` Jason Gunthorpe
       [not found]     ` <1477609570-8087-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2016-10-27 23:06   ` [PATCH rdma-core 4/4] ibcm: Replace infiniband/cm_abi.h with the kernel's uapi/rdma/ib_user_cm.h Jason Gunthorpe
  3 siblings, 1 reply; 11+ messages in thread
From: Jason Gunthorpe @ 2016-10-27 23:06 UTC (permalink / raw)
  To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA

Using the system header from the kernel is now the expected way to export
definitions to user space. Tree wide update to shift from the local
header and deal with the name changes.

Unfortunately this was exposed as a public installed header, for
now drop in a compat header with a #warning not to use it. Some
day we can delete it.

Apps are expected to also migrate to rdma/ib_user_sa.h as their
source for this information.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibcm/cm.c             |  8 ++++----
 libibverbs/marshall.c    |  4 ++--
 libibverbs/marshall.h    |  6 +++---
 libibverbs/sa-kern-abi.h | 34 +++++-----------------------------
 librdmacm/rdma_cma_abi.h |  4 ++--
 5 files changed, 16 insertions(+), 40 deletions(-)

diff --git a/libibcm/cm.c b/libibcm/cm.c
index f775923aa73c..5bc521be5e3a 100644
--- a/libibcm/cm.c
+++ b/libibcm/cm.c
@@ -380,8 +380,8 @@ int ib_cm_listen(struct ib_cm_id *cm_id,
 
 int ib_cm_send_req(struct ib_cm_id *cm_id, struct ib_cm_req_param *param)
 {
-	struct ibv_kern_path_rec p_path;
-	struct ibv_kern_path_rec *a_path;
+	struct ib_user_path_rec p_path;
+	struct ib_user_path_rec *a_path;
 	struct cm_abi_req *cmd;
 	void *msg;
 	int result;
@@ -646,7 +646,7 @@ int ib_cm_send_lap(struct ib_cm_id *cm_id,
 		   void *private_data,
 		   uint8_t private_data_len)
 {
-	struct ibv_kern_path_rec abi_path;
+	struct ib_user_path_rec abi_path;
 	struct cm_abi_lap *cmd;
 	void *msg;
 	int result;
@@ -673,7 +673,7 @@ int ib_cm_send_lap(struct ib_cm_id *cm_id,
 int ib_cm_send_sidr_req(struct ib_cm_id *cm_id,
 			struct ib_cm_sidr_req_param *param)
 {
-	struct ibv_kern_path_rec abi_path;
+	struct ib_user_path_rec abi_path;
 	struct cm_abi_sidr_req *cmd;
 	void *msg;
 	int result;
diff --git a/libibverbs/marshall.c b/libibverbs/marshall.c
index a33048404d35..5b0260832ca7 100644
--- a/libibverbs/marshall.c
+++ b/libibverbs/marshall.c
@@ -90,7 +90,7 @@ void ibv_copy_qp_attr_from_kern(struct ibv_qp_attr *dst,
 }
 
 void ibv_copy_path_rec_from_kern(struct ibv_sa_path_rec *dst,
-				 struct ibv_kern_path_rec *src)
+				 struct ib_user_path_rec *src)
 {
 	memcpy(dst->dgid.raw, src->dgid, sizeof dst->dgid);
 	memcpy(dst->sgid.raw, src->sgid, sizeof dst->sgid);
@@ -114,7 +114,7 @@ void ibv_copy_path_rec_from_kern(struct ibv_sa_path_rec *dst,
 	dst->packet_life_time_selector = src->packet_life_time_selector;
 }
 
-void ibv_copy_path_rec_to_kern(struct ibv_kern_path_rec *dst,
+void ibv_copy_path_rec_to_kern(struct ib_user_path_rec *dst,
 			       struct ibv_sa_path_rec *src)
 {
 	memcpy(dst->dgid, src->dgid.raw, sizeof src->dgid);
diff --git a/libibverbs/marshall.h b/libibverbs/marshall.h
index 8be76c5444d2..1dab1114a58c 100644
--- a/libibverbs/marshall.h
+++ b/libibverbs/marshall.h
@@ -36,7 +36,7 @@
 #include <infiniband/verbs.h>
 #include <infiniband/sa.h>
 #include <infiniband/kern-abi.h>
-#include <infiniband/sa-kern-abi.h>
+#include <rdma/ib_user_sa.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -55,9 +55,9 @@ void ibv_copy_ah_attr_from_kern(struct ibv_ah_attr *dst,
 				struct ibv_kern_ah_attr *src);
 
 void ibv_copy_path_rec_from_kern(struct ibv_sa_path_rec *dst,
-				 struct ibv_kern_path_rec *src);
+				 struct ib_user_path_rec *src);
 
-void ibv_copy_path_rec_to_kern(struct ibv_kern_path_rec *dst,
+void ibv_copy_path_rec_to_kern(struct ib_user_path_rec *dst,
 			       struct ibv_sa_path_rec *src);
 
 END_C_DECLS
diff --git a/libibverbs/sa-kern-abi.h b/libibverbs/sa-kern-abi.h
index 4927d114ea0f..134aeccb4a0a 100644
--- a/libibverbs/sa-kern-abi.h
+++ b/libibverbs/sa-kern-abi.h
@@ -1,6 +1,4 @@
 /*
- * Copyright (c) 2005 Intel Corporation.  All rights reserved.
- *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
  * General Public License (GPL) Version 2, available from the file
@@ -33,33 +31,11 @@
 #ifndef INFINIBAND_SA_KERN_ABI_H
 #define INFINIBAND_SA_KERN_ABI_H
 
-#include <linux/types.h>
+#warning "This header is obsolete, use rdma/ib_user_sa.h instead"
 
-/*
- * Obsolete, deprecated names.  Will be removed in libibverbs 1.1.
- */
-#define ib_kern_path_rec	ibv_kern_path_rec
+#include <rdma/ib_user_sa.h>
 
-struct ibv_kern_path_rec {
-	__u8  dgid[16];
-	__u8  sgid[16];
-	__u16 dlid;
-	__u16 slid;
-	__u32 raw_traffic;
-	__u32 flow_label;
-	__u32 reversible;
-	__u32 mtu;
-	__u16 pkey;
-	__u8  hop_limit;
-	__u8  traffic_class;
-	__u8  numb_path;
-	__u8  sl;
-	__u8  mtu_selector;
-	__u8  rate_selector;
-	__u8  rate;
-	__u8  packet_life_time_selector;
-	__u8  packet_life_time;
-	__u8  preference;
-};
+#define ib_kern_path_rec ib_user_path_rec
+#define ibv_kern_path_rec ib_user_path_rec
 
-#endif /* INFINIBAND_SA_KERN_ABI_H */
+#endif
diff --git a/librdmacm/rdma_cma_abi.h b/librdmacm/rdma_cma_abi.h
index b72f33080b42..71b93f888cc8 100644
--- a/librdmacm/rdma_cma_abi.h
+++ b/librdmacm/rdma_cma_abi.h
@@ -34,7 +34,7 @@
 #define RDMA_CMA_ABI_H
 
 #include <infiniband/kern-abi.h>
-#include <infiniband/sa-kern-abi.h>
+#include <rdma/ib_user_sa.h>
 #include <infiniband/sa.h>
 
 /*
@@ -173,7 +173,7 @@ struct ucma_abi_query {
 
 struct ucma_abi_query_route_resp {
 	__u64 node_guid;
-	struct ibv_kern_path_rec ib_route[2];
+	struct ib_user_path_rec ib_route[2];
 	struct sockaddr_in6 src_addr;
 	struct sockaddr_in6 dst_addr;
 	__u32 num_paths;
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH rdma-core 4/4] ibcm: Replace infiniband/cm_abi.h with the kernel's uapi/rdma/ib_user_cm.h
       [not found] ` <1477609570-8087-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-10-27 23:06   ` [PATCH rdma-core 3/4] verbs: Replace infiniband/sa-kern-abi.h with the kernel's uapi/rdma/ib_user_sa.h Jason Gunthorpe
@ 2016-10-27 23:06   ` Jason Gunthorpe
  3 siblings, 0 replies; 11+ messages in thread
From: Jason Gunthorpe @ 2016-10-27 23:06 UTC (permalink / raw)
  To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Sean Hefty

Using the system header from the kernel is now the expected way to export
definitions to user space.

Unfortunately this was exposed as a public installed header, for
now drop in a compat header with a #warning not to use it. Some
day we can delete it.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibcm/cm.c     |  70 ++++++-----
 libibcm/cm_abi.h | 351 +++++++------------------------------------------------
 2 files changed, 83 insertions(+), 338 deletions(-)

diff --git a/libibcm/cm.c b/libibcm/cm.c
index 5bc521be5e3a..433d6e88f8ac 100644
--- a/libibcm/cm.c
+++ b/libibcm/cm.c
@@ -45,7 +45,7 @@
 #include <stddef.h>
 
 #include <infiniband/cm.h>
-#include <infiniband/cm_abi.h>
+#include <rdma/ib_user_cm.h>
 #include <infiniband/driver.h>
 #include <infiniband/marshall.h>
 
@@ -53,6 +53,9 @@
 
 #define PFX "libibcm: "
 
+#define IB_USER_CM_MIN_ABI_VERSION     4
+#define IB_USER_CM_MAX_ABI_VERSION     5
+
 static int abi_ver;
 static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
 
@@ -69,7 +72,7 @@ static inline int ERR(int err)
 
 #define CM_CREATE_MSG_CMD_RESP(msg, cmd, resp, type, size) \
 do {                                        \
-	struct cm_abi_cmd_hdr *hdr;         \
+	struct ib_ucm_cmd_hdr *hdr;         \
                                             \
 	size = sizeof(*hdr) + sizeof(*cmd); \
 	msg = alloca(size);                 \
@@ -89,7 +92,7 @@ do {                                        \
 
 #define CM_CREATE_MSG_CMD(msg, cmd, type, size) \
 do {                                        \
-	struct cm_abi_cmd_hdr *hdr;         \
+	struct ib_ucm_cmd_hdr *hdr;         \
                                             \
 	size = sizeof(*hdr) + sizeof(*cmd); \
 	msg = alloca(size);                 \
@@ -244,8 +247,8 @@ err:	ib_cm_free_id(cm_id_priv);
 int ib_cm_create_id(struct ib_cm_device *device,
 		    struct ib_cm_id **cm_id, void *context)
 {
-	struct cm_abi_create_id_resp *resp;
-	struct cm_abi_create_id *cmd;
+	struct ib_ucm_create_id_resp *resp;
+	struct ib_ucm_create_id *cmd;
 	struct cm_id_private *cm_id_priv;
 	void *msg;
 	int result;
@@ -274,8 +277,8 @@ err:	ib_cm_free_id(cm_id_priv);
 
 int ib_cm_destroy_id(struct ib_cm_id *cm_id)
 {
-	struct cm_abi_destroy_id_resp *resp;
-	struct cm_abi_destroy_id *cmd;
+	struct ib_ucm_destroy_id_resp *resp;
+	struct ib_ucm_destroy_id *cmd;
 	struct cm_id_private *cm_id_priv;
 	void *msg;
 	int result;
@@ -303,8 +306,8 @@ int ib_cm_destroy_id(struct ib_cm_id *cm_id)
 
 int ib_cm_attr_id(struct ib_cm_id *cm_id, struct ib_cm_attr_param *param)
 {
-	struct cm_abi_attr_id_resp *resp;
-	struct cm_abi_attr_id *cmd;
+	struct ib_ucm_attr_id_resp *resp;
+	struct ib_ucm_attr_id *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -333,7 +336,7 @@ int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
 		       int *qp_attr_mask)
 {
 	struct ibv_kern_qp_attr *resp;
-	struct cm_abi_init_qp_attr *cmd;
+	struct ib_ucm_init_qp_attr *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -361,7 +364,7 @@ int ib_cm_listen(struct ib_cm_id *cm_id,
 		 uint64_t service_id,
 		 uint64_t service_mask)
 {
-	struct cm_abi_listen *cmd;
+	struct ib_ucm_listen *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -382,7 +385,7 @@ int ib_cm_send_req(struct ib_cm_id *cm_id, struct ib_cm_req_param *param)
 {
 	struct ib_user_path_rec p_path;
 	struct ib_user_path_rec *a_path;
-	struct cm_abi_req *cmd;
+	struct ib_ucm_req *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -433,7 +436,7 @@ int ib_cm_send_req(struct ib_cm_id *cm_id, struct ib_cm_req_param *param)
 
 int ib_cm_send_rep(struct ib_cm_id *cm_id, struct ib_cm_rep_param *param)
 {
-	struct cm_abi_rep *cmd;
+	struct ib_ucm_rep *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -471,7 +474,7 @@ static inline int cm_send_private_data(struct ib_cm_id *cm_id,
 				       void *private_data,
 				       uint8_t private_data_len)
 {
-	struct cm_abi_private_data *cmd;
+	struct ib_ucm_private_data *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -517,6 +520,14 @@ int ib_cm_send_drep(struct ib_cm_id *cm_id,
 
 static int cm_establish(struct ib_cm_id *cm_id)
 {
+	/* In kernel ABI 4 ESTABLISH was repurposed as NOTIFY and gained an
+	   extra field. For some reason the compat definitions were deleted
+	   from the uapi headers :( */
+#define IB_USER_CM_CMD_ESTABLISH IB_USER_CM_CMD_NOTIFY
+	struct cm_abi_establish { /* ABI 4 support */
+		__u32 id;
+	};
+
 	struct cm_abi_establish *cmd;
 	void *msg;
 	int result;
@@ -534,7 +545,7 @@ static int cm_establish(struct ib_cm_id *cm_id)
 
 int ib_cm_notify(struct ib_cm_id *cm_id, enum ibv_event_type event)
 {
-	struct cm_abi_notify *cmd;
+	struct ib_ucm_notify *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -565,7 +576,7 @@ static inline int cm_send_status(struct ib_cm_id *cm_id,
 				 void *private_data,
 				 uint8_t private_data_len)
 {
-	struct cm_abi_info *cmd;
+	struct ib_ucm_info *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -620,7 +631,7 @@ int ib_cm_send_mra(struct ib_cm_id *cm_id,
 		   void *private_data,
 		   uint8_t private_data_len)
 {
-	struct cm_abi_mra *cmd;
+	struct ib_ucm_mra *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -647,7 +658,7 @@ int ib_cm_send_lap(struct ib_cm_id *cm_id,
 		   uint8_t private_data_len)
 {
 	struct ib_user_path_rec abi_path;
-	struct cm_abi_lap *cmd;
+	struct ib_ucm_lap *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -674,7 +685,7 @@ int ib_cm_send_sidr_req(struct ib_cm_id *cm_id,
 			struct ib_cm_sidr_req_param *param)
 {
 	struct ib_user_path_rec abi_path;
-	struct cm_abi_sidr_req *cmd;
+	struct ib_ucm_sidr_req *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -686,7 +697,6 @@ int ib_cm_send_sidr_req(struct ib_cm_id *cm_id,
 	cmd->id             = cm_id->handle;
 	cmd->sid            = param->service_id;
 	cmd->timeout        = param->timeout_ms;
-	cmd->pkey           = param->path->pkey;
 	cmd->max_cm_retries = param->max_cm_retries;
 
 	ibv_copy_path_rec_to_kern(&abi_path, param->path);
@@ -707,7 +717,7 @@ int ib_cm_send_sidr_req(struct ib_cm_id *cm_id,
 int ib_cm_send_sidr_rep(struct ib_cm_id *cm_id,
 			struct ib_cm_sidr_rep_param *param)
 {
-	struct cm_abi_sidr_rep *cmd;
+	struct ib_ucm_sidr_rep *cmd;
 	void *msg;
 	int result;
 	int size;
@@ -739,7 +749,7 @@ int ib_cm_send_sidr_rep(struct ib_cm_id *cm_id,
 }
 
 static void cm_event_req_get(struct ib_cm_req_event_param *ureq,
-			     struct cm_abi_req_event_resp *kreq)
+			     struct ib_ucm_req_event_resp *kreq)
 {
 	ureq->remote_ca_guid             = kreq->remote_ca_guid;
 	ureq->remote_qkey                = kreq->remote_qkey;
@@ -763,7 +773,7 @@ static void cm_event_req_get(struct ib_cm_req_event_param *ureq,
 }
 
 static void cm_event_rep_get(struct ib_cm_rep_event_param *urep,
-			     struct cm_abi_rep_event_resp *krep)
+			     struct ib_ucm_rep_event_resp *krep)
 {
 	urep->remote_ca_guid      = krep->remote_ca_guid;
 	urep->remote_qkey         = krep->remote_qkey;
@@ -779,7 +789,7 @@ static void cm_event_rep_get(struct ib_cm_rep_event_param *urep,
 }
 
 static void cm_event_sidr_rep_get(struct ib_cm_sidr_rep_event_param *urep,
-				  struct cm_abi_sidr_rep_event_resp *krep)
+				  struct ib_ucm_sidr_rep_event_resp *krep)
 {
 	urep->status = krep->status;
 	urep->qkey   = krep->qkey;
@@ -789,9 +799,9 @@ static void cm_event_sidr_rep_get(struct ib_cm_sidr_rep_event_param *urep,
 int ib_cm_get_event(struct ib_cm_device *device, struct ib_cm_event **event)
 {
 	struct cm_id_private *cm_id_priv;
-	struct cm_abi_cmd_hdr *hdr;
-	struct cm_abi_event_get *cmd;
-	struct cm_abi_event_resp *resp;
+	struct ib_ucm_cmd_hdr *hdr;
+	struct ib_ucm_event_get *cmd;
+	struct ib_ucm_event_resp *resp;
 	struct ib_cm_event *evt = NULL;
 	struct ibv_sa_path_rec *path_a = NULL;
 	struct ibv_sa_path_rec *path_b = NULL;
@@ -861,7 +871,7 @@ int ib_cm_get_event(struct ib_cm_device *device, struct ib_cm_event **event)
 	evt->cm_id = (void *) (uintptr_t) resp->uid;
 	evt->event = resp->event;
 
-	if (resp->present & CM_ABI_PRES_PRIMARY) {
+	if (resp->present & IB_UCM_PRES_PRIMARY) {
 		path_a = malloc(sizeof(*path_a));
 		if (!path_a) {
 			result = ERR(ENOMEM);
@@ -869,7 +879,7 @@ int ib_cm_get_event(struct ib_cm_device *device, struct ib_cm_event **event)
 		}
 	}
 
-	if (resp->present & CM_ABI_PRES_ALTERNATE) {
+	if (resp->present & IB_UCM_PRES_ALTERNATE) {
 		path_b = malloc(sizeof(*path_b));
 		if (!path_b) {
 			result = ERR(ENOMEM);
@@ -940,7 +950,7 @@ int ib_cm_get_event(struct ib_cm_device *device, struct ib_cm_event **event)
 		break;
 	}
 
-	if (resp->present & CM_ABI_PRES_DATA) {
+	if (resp->present & IB_UCM_PRES_DATA) {
 		evt->private_data = data;
 		data = NULL;
 	}
diff --git a/libibcm/cm_abi.h b/libibcm/cm_abi.h
index 8fd10dd56150..8b76dc1fba78 100644
--- a/libibcm/cm_abi.h
+++ b/libibcm/cm_abi.h
@@ -1,7 +1,4 @@
 /*
- * Copyright (c) 2005 Topspin Communications.  All rights reserved.
- * Copyright (c) 2005 Intel Corporation.  All rights reserved.
- *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
  * General Public License (GPL) Version 2, available from the file
@@ -29,310 +26,48 @@
  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
- *
- * $Id$
- */
-
-#ifndef CM_ABI_H
-#define CM_ABI_H
-
-#include <linux/types.h>
-#include <infiniband/sa.h>
-#include <infiniband/marshall.h>
-
-/*
- * This file must be kept in sync with the kernel's version of ib_user_cm.h
  */
 
-#define IB_USER_CM_MIN_ABI_VERSION	4
-#define IB_USER_CM_MAX_ABI_VERSION	5
-
-enum {
-	IB_USER_CM_CMD_CREATE_ID,
-	IB_USER_CM_CMD_DESTROY_ID,
-	IB_USER_CM_CMD_ATTR_ID,
-
-	IB_USER_CM_CMD_LISTEN,
-	IB_USER_CM_CMD_NOTIFY,
-	IB_USER_CM_CMD_ESTABLISH = IB_USER_CM_CMD_NOTIFY, /* ABI 4 support */
-	
-	IB_USER_CM_CMD_SEND_REQ,
-	IB_USER_CM_CMD_SEND_REP,
-	IB_USER_CM_CMD_SEND_RTU,
-	IB_USER_CM_CMD_SEND_DREQ,
-	IB_USER_CM_CMD_SEND_DREP,
-	IB_USER_CM_CMD_SEND_REJ,
-	IB_USER_CM_CMD_SEND_MRA,
-	IB_USER_CM_CMD_SEND_LAP,
-	IB_USER_CM_CMD_SEND_APR,
-	IB_USER_CM_CMD_SEND_SIDR_REQ,
-	IB_USER_CM_CMD_SEND_SIDR_REP,
-
-	IB_USER_CM_CMD_EVENT,
-	IB_USER_CM_CMD_INIT_QP_ATTR,
-};
-/*
- * command ABI structures.
- */
-struct cm_abi_cmd_hdr {
-	__u32 cmd;
-	__u16 in;
-	__u16 out;
-};
-
-struct cm_abi_create_id {
-	__u64 uid;
-	__u64 response;
-};
-
-struct cm_abi_create_id_resp {
-	__u32 id;
-};
-
-struct cm_abi_destroy_id {
-	__u64 response;
-	__u32 id;
-	__u32 reserved;
-};
-
-struct cm_abi_destroy_id_resp {
-	__u32 events_reported;
-};
-
-struct cm_abi_attr_id {
-	__u64 response;
-	__u32 id;
-	__u32 reserved;
-};
-
-struct cm_abi_attr_id_resp {
-	__u64 service_id;
-	__u64 service_mask;
-	__u32 local_id;
-	__u32 remote_id;
-};
-
-struct cm_abi_init_qp_attr {
-	__u64 response;
-	__u32 id;
-	__u32 qp_state;
-};
-
-struct cm_abi_listen {
-	__u64 service_id;
-	__u64 service_mask;
-	__u32 id;
-	__u32 reserved;
-};
-
-struct cm_abi_establish {	/* ABI 4 support */
-	__u32 id;
-};
-
-struct cm_abi_notify {
-	__u32 id;
-	__u32 event;
-};
-
-struct cm_abi_private_data {
-	__u64 data;
-	__u32 id;
-	__u8  len;
-	__u8  reserved[3];
-};
-
-struct cm_abi_req {
-	__u32 id;
-	__u32 qpn;
-	__u32 qp_type;
-	__u32 psn;
-	__u64 sid;
-	__u64 data;
-	__u64 primary_path;
-	__u64 alternate_path;
-	__u8  len;
-	__u8  peer_to_peer;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  remote_cm_response_timeout;
-	__u8  flow_control;
-	__u8  local_cm_response_timeout;
-	__u8  retry_count;
-	__u8  rnr_retry_count;
-	__u8  max_cm_retries;
-	__u8  srq;
-	__u8  reserved[5];
-};
-
-struct cm_abi_rep {
-	__u64 uid;
-	__u64 data;
-	__u32 id;
-	__u32 qpn;
-	__u32 psn;
-	__u8  len;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  target_ack_delay;
-	__u8  failover_accepted;
-	__u8  flow_control;
-	__u8  rnr_retry_count;
-	__u8  srq;
-	__u8  reserved[4];
-};
-
-struct cm_abi_info {
-	__u32 id;
-	__u32 status;
-	__u64 info;
-	__u64 data;
-	__u8  info_len;
-	__u8  data_len;
-	__u8  reserved[6];
-};
-
-struct cm_abi_mra {
-	__u64 data;
-	__u32 id;
-	__u8  len;
-	__u8  timeout;
-	__u8  reserved[2];
-};
-
-struct cm_abi_lap {
-	__u64 path;
-	__u64 data;
-	__u32 id;
-	__u8  len;
-	__u8  reserved[3];
-};
-
-struct cm_abi_sidr_req {
-	__u32 id;
-	__u32 timeout;
-	__u64 sid;
-	__u64 data;
-	__u64 path;
-	__u16 pkey;
-	__u8  len;
-	__u8  max_cm_retries;
-	__u8  reserved[4];
-};
-
-struct cm_abi_sidr_rep {
-	__u32 id;
-	__u32 qpn;
-	__u32 qkey;
-	__u32 status;
-	__u64 info;
-	__u64 data;
-	__u8  info_len;
-	__u8  data_len;
-	__u8  reserved[6];
-};
-/*
- * event notification ABI structures.
- */
-struct cm_abi_event_get {
-	__u64 response;
-	__u64 data;
-	__u64 info;
-	__u8  data_len;
-	__u8  info_len;
-	__u8  reserved[6];
-};
-
-struct cm_abi_req_event_resp {
-	struct ibv_kern_path_rec primary_path;
-	struct ibv_kern_path_rec alternate_path;
-	__u64                  remote_ca_guid;
-	__u32                  remote_qkey;
-	__u32                  remote_qpn;
-	__u32                  qp_type;
-	__u32                  starting_psn;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  local_cm_response_timeout;
-	__u8  flow_control;
-	__u8  remote_cm_response_timeout;
-	__u8  retry_count;
-	__u8  rnr_retry_count;
-	__u8  srq;
-	__u8  port;
-	__u8  reserved[7];
-};
-
-struct cm_abi_rep_event_resp {
-	__u64 remote_ca_guid;
-	__u32 remote_qkey;
-	__u32 remote_qpn;
-	__u32 starting_psn;
-	__u8  responder_resources;
-	__u8  initiator_depth;
-	__u8  target_ack_delay;
-	__u8  failover_accepted;
-	__u8  flow_control;
-	__u8  rnr_retry_count;
-	__u8  srq;
-	__u8  reserved[5];
-};
-
-struct cm_abi_rej_event_resp {
-	__u32 reason;
-	/* ari in cm_abi_event_get info field. */
-};
-
-struct cm_abi_mra_event_resp {
-	__u8  timeout;
-	__u8  reserved[3];
-};
-
-struct cm_abi_lap_event_resp {
-	struct ibv_kern_path_rec path;
-};
-
-struct cm_abi_apr_event_resp {
-	__u32 status;
-	/* apr info in cm_abi_event_get info field. */
-};
-
-struct cm_abi_sidr_req_event_resp {
-	__u16 pkey;
-	__u8  port;
-	__u8  reserved;
-};
-
-struct cm_abi_sidr_rep_event_resp {
-	__u32 status;
-	__u32 qkey;
-	__u32 qpn;
-	/* info in cm_abi_event_get info field. */
-};
-
-#define CM_ABI_PRES_DATA      0x01
-#define CM_ABI_PRES_INFO      0x02
-#define CM_ABI_PRES_PRIMARY   0x04
-#define CM_ABI_PRES_ALTERNATE 0x08
-
-struct cm_abi_event_resp {
-	__u64 uid;
-	__u32 id;
-	__u32 event;
-	__u32 present;
-	__u32 reserved;
-	union {
-		struct cm_abi_req_event_resp req_resp;
-		struct cm_abi_rep_event_resp rep_resp;
-		struct cm_abi_rej_event_resp rej_resp;
-		struct cm_abi_mra_event_resp mra_resp;
-		struct cm_abi_lap_event_resp lap_resp;
-		struct cm_abi_apr_event_resp apr_resp;
-
-		struct cm_abi_sidr_req_event_resp sidr_req_resp;
-		struct cm_abi_sidr_rep_event_resp sidr_rep_resp;
-
-		__u32                             send_status;
-	} u;
-};
-
-#endif /* CM_ABI_H */
+#ifndef INFINIBAND_CM_ABI_H
+#define INFINIBAND_CM_ABI_H
+
+#warning "This header is obsolete, use rdma/ib_user_cm.h instead"
+
+#include <rdma/ib_user_cm.h>
+
+#define cm_abi_cmd_hdr ib_ucm_cmd_hdr
+#define cm_abi_create_id ib_ucm_create_id
+#define cm_abi_create_id_resp ib_ucm_create_id_resp
+#define cm_abi_destroy_id ib_ucm_destroy_id
+#define cm_abi_destroy_id_resp ib_ucm_destroy_id_resp
+#define cm_abi_attr_id ib_ucm_attr_id
+#define cm_abi_attr_id_resp ib_ucm_attr_id_resp
+#define cm_abi_init_qp_attr ib_ucm_init_qp_attr
+#define cm_abi_listen ib_ucm_listen
+#define cm_abi_establish ib_ucm_establish
+#define cm_abi_notify ib_ucm_notify
+#define cm_abi_private_data ib_ucm_private_data
+#define cm_abi_req ib_ucm_req
+#define cm_abi_rep ib_ucm_rep
+#define cm_abi_info ib_ucm_info
+#define cm_abi_mra ib_ucm_mra
+#define cm_abi_lap ib_ucm_lap
+#define cm_abi_sidr_req ib_ucm_sidr_req
+#define cm_abi_sidr_rep ib_ucm_sidr_rep
+#define cm_abi_event_get ib_ucm_event_get
+#define cm_abi_req_event_resp ib_ucm_req_event_resp
+#define cm_abi_rep_event_resp ib_ucm_rep_event_resp
+#define cm_abi_rej_event_resp ib_ucm_rej_event_resp
+#define cm_abi_mra_event_resp ib_ucm_mra_event_resp
+#define cm_abi_lap_event_resp ib_ucm_lap_event_resp
+#define cm_abi_apr_event_resp ib_ucm_apr_event_resp
+#define cm_abi_sidr_req_event_resp ib_ucm_sidr_req_event_resp
+#define cm_abi_sidr_rep_event_resp ib_ucm_sidr_rep_event_resp
+#define cm_abi_event_resp ib_ucm_event_resp
+
+#define CM_ABI_PRES_DATA IB_UCM_PRES_DATA
+#define CM_ABI_PRES_INFO IB_UCM_PRES_INFO
+#define CM_ABI_PRES_PRIMARY IB_UCM_PRES_PRIMARY
+#define CM_ABI_PRES_ALTERNATE IB_UCM_PRES_ALTERNATE
+
+#endif
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH rdma-core 3/4] verbs: Replace infiniband/sa-kern-abi.h with the kernel's uapi/rdma/ib_user_sa.h
       [not found]     ` <1477609570-8087-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-10-28  6:53       ` Christoph Hellwig
       [not found]         ` <20161028065344.GA28303-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2016-10-28  6:53 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA

I can't see how this is supposed to work, there is no copy at all
of ib_user_sa.h in the tree.

Having to rely on system headers is a sure way to make the build
break most of the time.

What we need is a canonical copy of the kernel heades in the rdma-core
tree, with the option of just pointing to a kernel tree instead.

E.g. by default use headers from rdma-core/kernel/headers, but
optionally allow the build systems to use those from a kernel tree
explicitly specified.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake
       [not found]     ` <1477609570-8087-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-10-28 14:59       ` Steve Wise
  2016-10-28 15:44         ` Jason Gunthorpe
  2016-10-28 18:00       ` Nikolova, Tatyana E
  1 sibling, 1 reply; 11+ messages in thread
From: Steve Wise @ 2016-10-28 14:59 UTC (permalink / raw)
  To: 'Jason Gunthorpe', 'Doug Ledford',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: 'Tatyana Nikolova', 'Latif, Faisal'

+Tatyana
+Faisal

Intel, please have a look.

> 
> Steve,
> 
> Can you check if the changes to iwpmd/iwarp_pm_server.c make sense?

I was confused at first, but I see that the iwarp_clients array still has
clients 2 and 3, so it should work fine and still preserve compatibility with
older drivers that embedded the iwarp port mapping in iw_cxgb4 and iw_nes.  And
the RDMA_NL_* enum is consistent with the local header and the kernel uapi
header.  So it looks fine.  I should test this though to make sure...

>
> Should we do something to fix the kernel header?
>

What is wrong with the kernel header exactly?

Steve.


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH rdma-core 3/4] verbs: Replace infiniband/sa-kern-abi.h with the kernel's uapi/rdma/ib_user_sa.h
       [not found]         ` <20161028065344.GA28303-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
@ 2016-10-28 15:42           ` Jason Gunthorpe
  0 siblings, 0 replies; 11+ messages in thread
From: Jason Gunthorpe @ 2016-10-28 15:42 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Thu, Oct 27, 2016 at 11:53:44PM -0700, Christoph Hellwig wrote:
> I can't see how this is supposed to work, there is no copy at all
> of ib_user_sa.h in the tree.

It uses the one that comes with the distro. Which is new enough on all
supported distros..

In this specific case because ib_user_sa.h is included by a public
header we really don't have much choice, it has to work with the
distro-version.

Fortunately ib_user_sa.h has not changed in a long time, so this is
not a problem and I didn't include an in-tree copy. Several of the
other headers are like that too.

rxe and netlink are counter examples, where we need really new headers
and they are not used in public headers so they have in-tree copies.

> E.g. by default use headers from rdma-core/kernel/headers, but
> optionally allow the build systems to use those from a kernel tree
> explicitly specified.

I've done both of these things, with the twist that the build tests
the distro-header first and uses it before the in-tree copy if it is
new enough.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake
  2016-10-28 14:59       ` Steve Wise
@ 2016-10-28 15:44         ` Jason Gunthorpe
       [not found]           ` <20161028154455.GB10441-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Gunthorpe @ 2016-10-28 15:44 UTC (permalink / raw)
  To: Steve Wise
  Cc: 'Doug Ledford',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Tatyana Nikolova',
	'Latif, Faisal'

On Fri, Oct 28, 2016 at 09:59:16AM -0500, Steve Wise wrote:
> +Tatyana
> +Faisal
> 
> Intel, please have a look.
> 
> > 
> > Steve,
> > 
> > Can you check if the changes to iwpmd/iwarp_pm_server.c make sense?
> 
> I was confused at first, but I see that the iwarp_clients array still has
> clients 2 and 3, so it should work fine and still preserve compatibility with
> older drivers that embedded the iwarp port mapping in iw_cxgb4 and iw_nes.  And
> the RDMA_NL_* enum is consistent with the local header and the kernel uapi
> header.  So it looks fine.  I should test this though to make sure...
> 
> >
> > Should we do something to fix the kernel header?
> 
> What is wrong with the kernel header exactly?

RDMA_NL_RSVD, should perhaps be called RDMA_NL_IWCM_COMPAT since user
space still need to use that value for compat with old kernels.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake
       [not found]           ` <20161028154455.GB10441-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-10-28 15:46             ` Steve Wise
  0 siblings, 0 replies; 11+ messages in thread
From: Steve Wise @ 2016-10-28 15:46 UTC (permalink / raw)
  To: 'Jason Gunthorpe'
  Cc: 'Doug Ledford',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Tatyana Nikolova',
	'Latif, Faisal'

> > > Can you check if the changes to iwpmd/iwarp_pm_server.c make sense?
> >
> > I was confused at first, but I see that the iwarp_clients array still has
> > clients 2 and 3, so it should work fine and still preserve compatibility
with
> > older drivers that embedded the iwarp port mapping in iw_cxgb4 and iw_nes.
> And
> > the RDMA_NL_* enum is consistent with the local header and the kernel uapi
> > header.  So it looks fine.  I should test this though to make sure...
> >
> > >
> > > Should we do something to fix the kernel header?
> >
> > What is wrong with the kernel header exactly?
> 
> RDMA_NL_RSVD, should perhaps be called RDMA_NL_IWCM_COMPAT since user
> space still need to use that value for compat with old kernels.

Sounds reasonable.

For this patch:

Acked-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake
       [not found]     ` <1477609570-8087-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2016-10-28 14:59       ` Steve Wise
@ 2016-10-28 18:00       ` Nikolova, Tatyana E
  1 sibling, 0 replies; 11+ messages in thread
From: Nikolova, Tatyana E @ 2016-10-28 18:00 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Steve Wise

Hi Jason,

The patch looks good.

I don't think that RDMA_NL_I40IW enum bellow is necessary.

+enum {
+	RDMA_NL_RDMA_CM = 1,
+	RDMA_NL_IWCM,
+	RDMA_NL_RSVD,
+	RDMA_NL_LS,	/* RDMA Local Services */
+	RDMA_NL_I40IW,
+	RDMA_NL_NUM_CLIENTS
+};

Thank you,
Tatyana

-----Original Message-----
From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Jason Gunthorpe
Sent: Thursday, October 27, 2016 6:06 PM
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Subject: [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake

Detect if the distro's rdma_netlink.h is new enough, if not replace it with the built in copy, and eliminate the two loose copies of the header.

The built in copy is from v4.8

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 buildlib/RDMA_LinuxHeaders.cmake           |   2 +-
 buildlib/fixup-include/rdma-rdma_netlink.h | 225 +++++++++++++++++++++++++++++
 ibacm/src/acm.c                            |   3 -
 ibacm/src/acm_netlink.h                    | 128 ----------------
 iwpmd/iwarp_pm.h                           |   2 +-
 iwpmd/iwarp_pm_common.c                    |   5 -
 iwpmd/iwarp_pm_server.c                    |   4 +-
 iwpmd/iwpm_netlink.h                       | 214 ---------------------------
 8 files changed, 229 insertions(+), 354 deletions(-)  create mode 100644 buildlib/fixup-include/rdma-rdma_netlink.h
 delete mode 100644 ibacm/src/acm_netlink.h  delete mode 100644 iwpmd/iwpm_netlink.h

Steve,

Can you check if the changes to iwpmd/iwarp_pm_server.c make sense?
Should we do something to fix the kernel header?

diff --git a/buildlib/RDMA_LinuxHeaders.cmake b/buildlib/RDMA_LinuxHeaders.cmake
index bd16d8deca72..c67b0a6113d2 100644
--- a/buildlib/RDMA_LinuxHeaders.cmake
+++ b/buildlib/RDMA_LinuxHeaders.cmake
@@ -80,6 +80,6 @@ rdma_check_kheader("rdma/ib_user_verbs.h" "${DEFAULT_TEST}")  rdma_check_kheader("rdma/ib_user_sa.h" "${DEFAULT_TEST}")  rdma_check_kheader("rdma/ib_user_cm.h" "${DEFAULT_TEST}")  rdma_check_kheader("rdma/ib_user_mad.h" "${DEFAULT_TEST}") -rdma_check_kheader("rdma/rdma_netlink.h" "${DEFAULT_TEST}")
+rdma_check_kheader("rdma/rdma_netlink.h" "int main(int argc,const char 
+*argv[]) { return RDMA_NL_IWPM_REMOTE_INFO && RDMA_NL_IWCM; }")
 rdma_check_kheader("rdma/rdma_user_cm.h" "${DEFAULT_TEST}")  rdma_check_kheader("rdma/rdma_user_rxe.h" "${DEFAULT_TEST}") diff --git a/buildlib/fixup-include/rdma-rdma_netlink.h b/buildlib/fixup-include/rdma-rdma_netlink.h
new file mode 100644
index 000000000000..02fe8390c18f
--- /dev/null
+++ b/buildlib/fixup-include/rdma-rdma_netlink.h
@@ -0,0 +1,225 @@
+#ifndef _UAPI_RDMA_NETLINK_H
+#define _UAPI_RDMA_NETLINK_H
+
+#include <linux/types.h>
+
+enum {
+	RDMA_NL_RDMA_CM = 1,
+	RDMA_NL_IWCM,
+	RDMA_NL_RSVD,
+	RDMA_NL_LS,	/* RDMA Local Services */
+	RDMA_NL_I40IW,
+	RDMA_NL_NUM_CLIENTS
+};
+
+enum {
+	RDMA_NL_GROUP_CM = 1,
+	RDMA_NL_GROUP_IWPM,
+	RDMA_NL_GROUP_LS,
+	RDMA_NL_NUM_GROUPS
+};
+
+#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 
+10) #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1)) #define 
+RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
+
+enum {
+	RDMA_NL_RDMA_CM_ID_STATS = 0,
+	RDMA_NL_RDMA_CM_NUM_OPS
+};
+
+enum {
+	RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
+	RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
+	RDMA_NL_RDMA_CM_NUM_ATTR,
+};
+
+/* iwarp port mapper op-codes */
+enum {
+	RDMA_NL_IWPM_REG_PID = 0,
+	RDMA_NL_IWPM_ADD_MAPPING,
+	RDMA_NL_IWPM_QUERY_MAPPING,
+	RDMA_NL_IWPM_REMOVE_MAPPING,
+	RDMA_NL_IWPM_REMOTE_INFO,
+	RDMA_NL_IWPM_HANDLE_ERR,
+	RDMA_NL_IWPM_MAPINFO,
+	RDMA_NL_IWPM_MAPINFO_NUM,
+	RDMA_NL_IWPM_NUM_OPS
+};
+
+struct rdma_cm_id_stats {
+	__u32	qp_num;
+	__u32	bound_dev_if;
+	__u32	port_space;
+	__s32	pid;
+	__u8	cm_state;
+	__u8	node_type;
+	__u8	port_num;
+	__u8	qp_type;
+};
+
+enum {
+	IWPM_NLA_REG_PID_UNSPEC = 0,
+	IWPM_NLA_REG_PID_SEQ,
+	IWPM_NLA_REG_IF_NAME,
+	IWPM_NLA_REG_IBDEV_NAME,
+	IWPM_NLA_REG_ULIB_NAME,
+	IWPM_NLA_REG_PID_MAX
+};
+
+enum {
+	IWPM_NLA_RREG_PID_UNSPEC = 0,
+	IWPM_NLA_RREG_PID_SEQ,
+	IWPM_NLA_RREG_IBDEV_NAME,
+	IWPM_NLA_RREG_ULIB_NAME,
+	IWPM_NLA_RREG_ULIB_VER,
+	IWPM_NLA_RREG_PID_ERR,
+	IWPM_NLA_RREG_PID_MAX
+
+};
+
+enum {
+	IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
+	IWPM_NLA_MANAGE_MAPPING_SEQ,
+	IWPM_NLA_MANAGE_ADDR,
+	IWPM_NLA_MANAGE_MAPPED_LOC_ADDR,
+	IWPM_NLA_RMANAGE_MAPPING_ERR,
+	IWPM_NLA_RMANAGE_MAPPING_MAX
+};
+
+#define IWPM_NLA_MANAGE_MAPPING_MAX 3
+#define IWPM_NLA_QUERY_MAPPING_MAX  4
+#define IWPM_NLA_MAPINFO_SEND_MAX   3
+
+enum {
+	IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
+	IWPM_NLA_QUERY_MAPPING_SEQ,
+	IWPM_NLA_QUERY_LOCAL_ADDR,
+	IWPM_NLA_QUERY_REMOTE_ADDR,
+	IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
+	IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
+	IWPM_NLA_RQUERY_MAPPING_ERR,
+	IWPM_NLA_RQUERY_MAPPING_MAX
+};
+
+enum {
+	IWPM_NLA_MAPINFO_REQ_UNSPEC = 0,
+	IWPM_NLA_MAPINFO_ULIB_NAME,
+	IWPM_NLA_MAPINFO_ULIB_VER,
+	IWPM_NLA_MAPINFO_REQ_MAX
+};
+
+enum {
+	IWPM_NLA_MAPINFO_UNSPEC = 0,
+	IWPM_NLA_MAPINFO_LOCAL_ADDR,
+	IWPM_NLA_MAPINFO_MAPPED_ADDR,
+	IWPM_NLA_MAPINFO_MAX
+};
+
+enum {
+	IWPM_NLA_MAPINFO_NUM_UNSPEC = 0,
+	IWPM_NLA_MAPINFO_SEQ,
+	IWPM_NLA_MAPINFO_SEND_NUM,
+	IWPM_NLA_MAPINFO_ACK_NUM,
+	IWPM_NLA_MAPINFO_NUM_MAX
+};
+
+enum {
+	IWPM_NLA_ERR_UNSPEC = 0,
+	IWPM_NLA_ERR_SEQ,
+	IWPM_NLA_ERR_CODE,
+	IWPM_NLA_ERR_MAX
+};
+
+/*
+ * Local service operations:
+ *   RESOLVE - The client requests the local service to resolve a path.
+ *   SET_TIMEOUT - The local service requests the client to set the timeout.
+ *   IP_RESOLVE - The client requests the local service to resolve an IP to GID.
+ */
+enum {
+	RDMA_NL_LS_OP_RESOLVE = 0,
+	RDMA_NL_LS_OP_SET_TIMEOUT,
+	RDMA_NL_LS_OP_IP_RESOLVE,
+	RDMA_NL_LS_NUM_OPS
+};
+
+/* Local service netlink message flags */
+#define RDMA_NL_LS_F_ERR	0x0100	/* Failed response */
+
+/*
+ * Local service resolve operation family header.
+ * The layout for the resolve operation:
+ *    nlmsg header
+ *    family header
+ *    attributes
+ */
+
+/*
+ * Local service path use:
+ * Specify how the path(s) will be used.
+ *   ALL - For connected CM operation (6 pathrecords)
+ *   UNIDIRECTIONAL - For unidirectional UD (1 pathrecord)
+ *   GMP - For miscellaneous GMP like operation (at least 1 reversible
+ *         pathrecord)
+ */
+enum {
+	LS_RESOLVE_PATH_USE_ALL = 0,
+	LS_RESOLVE_PATH_USE_UNIDIRECTIONAL,
+	LS_RESOLVE_PATH_USE_GMP,
+	LS_RESOLVE_PATH_USE_MAX
+};
+
+#define LS_DEVICE_NAME_MAX 64
+
+struct rdma_ls_resolve_header {
+	__u8 device_name[LS_DEVICE_NAME_MAX];
+	__u8 port_num;
+	__u8 path_use;
+};
+
+struct rdma_ls_ip_resolve_header {
+	__u32 ifindex;
+};
+
+/* Local service attribute type */
+#define RDMA_NLA_F_MANDATORY	(1 << 13)
+#define RDMA_NLA_TYPE_MASK	(~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \
+				  RDMA_NLA_F_MANDATORY))
+
+/*
+ * Local service attributes:
+ *   Attr Name       Size                       Byte order
+ *   -----------------------------------------------------
+ *   PATH_RECORD     struct ib_path_rec_data
+ *   TIMEOUT         u32                        cpu
+ *   SERVICE_ID      u64                        cpu
+ *   DGID            u8[16]                     BE
+ *   SGID            u8[16]                     BE
+ *   TCLASS          u8
+ *   PKEY            u16                        cpu
+ *   QOS_CLASS       u16                        cpu
+ *   IPV4            u32                        BE
+ *   IPV6            u8[16]                     BE
+ */
+enum {
+	LS_NLA_TYPE_UNSPEC = 0,
+	LS_NLA_TYPE_PATH_RECORD,
+	LS_NLA_TYPE_TIMEOUT,
+	LS_NLA_TYPE_SERVICE_ID,
+	LS_NLA_TYPE_DGID,
+	LS_NLA_TYPE_SGID,
+	LS_NLA_TYPE_TCLASS,
+	LS_NLA_TYPE_PKEY,
+	LS_NLA_TYPE_QOS_CLASS,
+	LS_NLA_TYPE_IPV4,
+	LS_NLA_TYPE_IPV6,
+	LS_NLA_TYPE_MAX
+};
+
+/* Local service DGID/SGID attribute: big endian */ struct 
+rdma_nla_ls_gid {
+	__u8		gid[16];
+};
+
+#endif /* _UAPI_RDMA_NETLINK_H */
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c index cc7dd065f69c..5f4068f619b4 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -61,9 +61,6 @@
 #include <ccan/list.h>
 #include "acm_mad.h"
 #include "acm_util.h"
-#if !defined(RDMA_NL_LS_F_ERR)
-	#include "acm_netlink.h"
-#endif
 
 #define src_out     data[0]
 #define src_index   data[1]
diff --git a/ibacm/src/acm_netlink.h b/ibacm/src/acm_netlink.h deleted file mode 100644 index 867ae8c838fc..000000000000 diff --git a/iwpmd/iwarp_pm.h b/iwpmd/iwarp_pm.h index b5a5a457a423..fc09e4fd752a 100644
--- a/iwpmd/iwarp_pm.h
+++ b/iwpmd/iwarp_pm.h
@@ -53,7 +53,7 @@
 #include <syslog.h>
 #include <netlink/msg.h>
 #include <ccan/list.h>
-#include "iwpm_netlink.h"
+#include <rdma/rdma_netlink.h>
 
 #define IWARP_PM_PORT          3935
 #define IWARP_PM_VER_SHIFT     6
diff --git a/iwpmd/iwarp_pm_common.c b/iwpmd/iwarp_pm_common.c index 58b1089a1998..941e0406ade7 100644
--- a/iwpmd/iwarp_pm_common.c
+++ b/iwpmd/iwarp_pm_common.c
@@ -33,11 +33,6 @@
 
 #include "iwarp_pm.h"
 
-/* Necessary only for SLES11 */
-#if !defined (NETLINK_RDMA)
-	#define NETLINK_RDMA	        20
-#endif
-
 /* iwpm config params */
 static const char * iwpm_param_names[IWPM_PARAM_NUM] =
 	{ "nl_sock_rbuf_size" };
diff --git a/iwpmd/iwarp_pm_server.c b/iwpmd/iwarp_pm_server.c index ab90c6c4b077..ef541c8175ed 100644
--- a/iwpmd/iwarp_pm_server.c
+++ b/iwpmd/iwarp_pm_server.c
@@ -1214,8 +1214,8 @@ static int init_iwpm_clients(__u32 iwarp_clients[])  {
 	int client_num = 2;
 
-	iwarp_clients[0] = RDMA_NL_NES;
-	iwarp_clients[1] = RDMA_NL_C4IW;
+	iwarp_clients[0] = RDMA_NL_IWCM;
+	iwarp_clients[1] = RDMA_NL_IWCM+1; /* Legacy RDMA_NL_C4IW for old 
+kernels */
 
 	return client_num;
 }
diff --git a/iwpmd/iwpm_netlink.h b/iwpmd/iwpm_netlink.h deleted file mode 100644 index 0edcb620de99..000000000000
--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-10-28 18:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-27 23:06 [PATCH rdma-core 0/4] Migrate to use kernel uAPI headers Jason Gunthorpe
     [not found] ` <1477609570-8087-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-27 23:06   ` [PATCH rdma-core 1/4] Support -DKERNEL_DIR to use kernel UAPI headers directly Jason Gunthorpe
2016-10-27 23:06   ` [PATCH rdma-core 2/4] Move rdma_netlink compat into CMake Jason Gunthorpe
     [not found]     ` <1477609570-8087-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-28 14:59       ` Steve Wise
2016-10-28 15:44         ` Jason Gunthorpe
     [not found]           ` <20161028154455.GB10441-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-28 15:46             ` Steve Wise
2016-10-28 18:00       ` Nikolova, Tatyana E
2016-10-27 23:06   ` [PATCH rdma-core 3/4] verbs: Replace infiniband/sa-kern-abi.h with the kernel's uapi/rdma/ib_user_sa.h Jason Gunthorpe
     [not found]     ` <1477609570-8087-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-28  6:53       ` Christoph Hellwig
     [not found]         ` <20161028065344.GA28303-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-10-28 15:42           ` Jason Gunthorpe
2016-10-27 23:06   ` [PATCH rdma-core 4/4] ibcm: Replace infiniband/cm_abi.h with the kernel's uapi/rdma/ib_user_cm.h Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.