Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* RE: [PATCH 05/13] Have cmake run man pages through text substitution
From: Hefty, Sean @ 2016-09-23 21:23 UTC (permalink / raw)
  To: Jason Gunthorpe,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <1474658228-5390-6-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

> rsocket.7 had an errant text substitution that never worked, it is
> a good idea to have the man pages use the correct paths, so let
> us have cmake run them through.
> 
> Any man page ending in '.in' will be substituted automatically.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Acked-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

FWIW, I'm in favor of replacing the man pages with markdown and then generating the man pages from that.  I volunteer someone else to do that work.
--
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

* RE: [PATCH 06/13] Consolidate definitions for paths into config.h
From: Hefty, Sean @ 2016-09-23 21:22 UTC (permalink / raw)
  To: Jason Gunthorpe,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: Nikolova, Tatyana E, Bart Van Assche
In-Reply-To: <1474658228-5390-7-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

> config.h is the only place we pass through cmake substitution,
> so it is the only place that can define the various filesystem
> paths.
> 
> This patch handles the C code portions that use paths.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Acked-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@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

* Re: [RFC PATCH 10/11] IB/srpt: Increase lid and sm_lid to 32 bits
From: Bart Van Assche @ 2016-09-23 21:01 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Dasaratharaman Chandramouli, Don Hiatt
In-Reply-To: <1474652674-13110-11-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On 09/23/2016 10:44 AM, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> srpt contains lid and sm_lid fields which are 16 bits in
> length, increase them to 32 bits.

Reviewed-by: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@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

* [PATCH 13/13] Remove ibsupport-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org from MAINTAINERS
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Turns out this is not a mailing list.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 MAINTAINERS | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index b39529feec9b..7a31376056e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -69,7 +69,6 @@ F:	ibacm/*
 IPATH/QIB USERSPACE PROVIDER (for ib_qib.ko)
 M:	Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
 S:	Supported
-L:	ibsupport-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
 F:	libipathverbs/
 
 IWARP PORT MAPPER DAEMON (for iwarp kernel providers)
-- 
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

* [PATCH 12/13] Document a versioning strategy and use it
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Hefty, Hal Rosenstock, Doug Ledford, Yishai Hadas
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

This is particularly important for the three shared libraries, and
we haven't been doing it right historically, perhaps due to libtool
braindamage.

The names of the shlibs are updated to:
  libibcm 1.0.11
  libibumad 3.1.11
  libibverbs 1.3.11
  librdmacm 1.1.11

The SONAME remains the same.

The overall package release is set to 11 due to libibumad having got up
to a .10 release.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt                |   5 +-
 Documentation/versioning.md   | 108 ++++++++++++++++++++++++++++++++++++++++++
 libibcm/src/CMakeLists.txt    |   4 +-
 libibcm/src/libibcm.map       |   1 +
 libibumad/src/CMakeLists.txt  |   4 +-
 libibumad/src/libibumad.map   |   1 +
 libibverbs/src/CMakeLists.txt |   4 +-
 libibverbs/src/libibverbs.map |   1 +
 librdmacm/src/CMakeLists.txt  |   4 +-
 librdmacm/src/librdmacm.map   |   1 +
 10 files changed, 127 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/versioning.md

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 805b25bb8669..8d58db0b9c07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,8 +32,9 @@ else()
 endif()
 
 set(PACKAGE_NAME "RDMA")
-# FIXME versioning strategy?
-set(PACKAGE_VERSION "1")
+
+# See Documentation/versioning.md
+set(PACKAGE_VERSION "11")
 
 #-------------------------
 # Basic standard paths
diff --git a/Documentation/versioning.md b/Documentation/versioning.md
new file mode 100644
index 000000000000..0cc542aa6b79
--- /dev/null
+++ b/Documentation/versioning.md
@@ -0,0 +1,108 @@
+# Overall Package Version
+
+This version number is set in the top level CMakeLists.txt:
+
+```sh
+set(PACKAGE_VERSION "11")
+````
+
+For upstream releases this is a single integer showing the release
+ordering. We do not attempt to encode any 'ABI' information in this version.
+
+Branched stabled releases can append an additional counter eg `11.2`.
+
+Unofficial releases should include a distributor tag, eg '11.vendor2'.
+
+When the PACKAGE_VERSION is changed, the packaging files should be updated:
+
+```diff
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 389feee1e0f9..63854fe8f07f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,7 +26,7 @@ project(RDMA C)
+ set(PACKAGE_NAME "RDMA")
+ 
+ # See Documentation/versioning.md
+-set(PACKAGE_VERSION "11")
++set(PACKAGE_VERSION "12")
+ 
+ #-------------------------
+ # Basic standard paths
+```
+
+# Shared Library Versions
+
+The shared libraries use the typical semantic versioning scheme, eg
+*libibumad* has a version like `3.1.11`.
+
+The version number is broken up into three fields:
+- '3' is called the SONAME and is embedded into the ELF:
+   ```sh
+   $ readelf -ds build/lib/libibumad.so.3.1.11
+    0x000000000000000e (SONAME)             Library soname: [libibumad.so.3]
+   ```
+
+   We do not expect this value to ever change for our libraries. It indicates
+   the overall ABI, changing it means the library will not dynamically to old
+   programs link anymore.
+
+- '1' is called the ABI level and is used within the ELF as the last component
+   symbol version tag.  This version must be changed every time a new symbol
+   is introduced. It allows the user to see what version of the ABI the
+   library provides.
+
+- '11' is the overall release number and is copied from `PACKAGE_VERSION` This
+  version increases with every package release, even if the library code did
+  not change. It allows the user to see what upstream source was used to build
+  the library.
+
+This version is encoded into the filename `build/lib/libibumad.so.3.1.11` and
+a symlink from `libibumad.so.3` to `build/lib/libibumad.so.3.1.11` is created.
+
+## Shared Library Symbol Versions
+
+Symbol versions are a linker technique that lets the library author provide
+two symbols with different ABIs that have the same API name. The linker
+differentiates the two cases internally. This allows the library author to
+change the ABI that the API uses. This project typically does not make use of
+this feature.
+
+As a secondary feature, the symbol version is also used by package managers
+like RPM to manage the ABI level. To make this work properly the ABI level
+must be correctly encoded into the symbol version.
+
+## Adding a new symbol
+
+First, increase the ABI level of the library. It is safe to re-use the ABI
+level for multiple new functions within a single release, but once a release
+is tagged the ABI level becomes *immutable*. The maintainer can provide
+guidence on what ABI level to use for each series.
+
+```diff
+ rdma_library(ibumad libibumad.map
+   # See Documentation/versioning.md
+-  3 3.1.${PACKAGE_VERSION}
++  3 3.2.${PACKAGE_VERSION}
+```
+
+Next, add your new symbol to the symbol version file:
+
+```diff
++ IBUMAD_3.2 {
++ 	global:
++ 		umad_new_symbol;
++ } IBUMAD_1.0;
+```
+
+NOTE: Once a release is made the stanzas in the map file are *immutable* and
+cannot be changed. Do not add your new symbol to old stanzas.
+
+The new symbol should appear in the ELF:
+
+```sh
+$ readelf -s build/lib/libibumad.so.3.1.11
+ 35: 00000000000031e0   450 FUNC    GLOBAL DEFAULT   12 umad_new_symbol@@IBUMAD_3.2
+```
+
+Finally update the `debian/libibumad3.symbols` file.
diff --git a/libibcm/src/CMakeLists.txt b/libibcm/src/CMakeLists.txt
index 2479886c6238..66b3362ec7a0 100644
--- a/libibcm/src/CMakeLists.txt
+++ b/libibcm/src/CMakeLists.txt
@@ -3,7 +3,9 @@ publish_headers(infiniband
   ../include/infiniband/cm_abi.h
   )
 
-rdma_library(ibcm libibcm.map 1 1.0.0
+rdma_library(ibcm libibcm.map
+  # See Documentation/versioning.md
+  1 1.0.${PACKAGE_VERSION}
   cm.c
   )
 target_link_libraries(ibcm LINK_PUBLIC ibverbs)
diff --git a/libibcm/src/libibcm.map b/libibcm/src/libibcm.map
index 3d83e481a6bb..c94e420a6cc8 100644
--- a/libibcm/src/libibcm.map
+++ b/libibcm/src/libibcm.map
@@ -1,3 +1,4 @@
+/* Do not change this file without reading Documentation/versioning.md */
 IBCM_1.0 {
 	global:
 		ib_cm_open_device;
diff --git a/libibumad/src/CMakeLists.txt b/libibumad/src/CMakeLists.txt
index b7b5d03bc53e..fbd15893d973 100644
--- a/libibumad/src/CMakeLists.txt
+++ b/libibumad/src/CMakeLists.txt
@@ -7,7 +7,9 @@ publish_headers(infiniband
   ../include/infiniband/umad_types.h
   )
 
-rdma_library(ibumad libibumad.map 3 3.1.0
+rdma_library(ibumad libibumad.map
+  # See Documentation/versioning.md
+  3 3.1.${PACKAGE_VERSION}
   sysfs.c
   umad.c
   umad_str.c
diff --git a/libibumad/src/libibumad.map b/libibumad/src/libibumad.map
index e42dc799d69e..8bf474e26ae2 100644
--- a/libibumad/src/libibumad.map
+++ b/libibumad/src/libibumad.map
@@ -1,3 +1,4 @@
+/* Do not change this file without reading Documentation/versioning.md */
 IBUMAD_1.0 {
 	global:
 		umad_init;
diff --git a/libibverbs/src/CMakeLists.txt b/libibverbs/src/CMakeLists.txt
index e1a54345c537..6989f7730c5e 100644
--- a/libibverbs/src/CMakeLists.txt
+++ b/libibverbs/src/CMakeLists.txt
@@ -17,7 +17,9 @@ else()
   set(NEIGH "")
 endif()
 
-rdma_library(ibverbs libibverbs.map 1 1.0.0
+rdma_library(ibverbs libibverbs.map
+  # See Documentation/versioning.md
+  1 1.3.${PACKAGE_VERSION}
   cmd.c
   compat-1_0.c
   device.c
diff --git a/libibverbs/src/libibverbs.map b/libibverbs/src/libibverbs.map
index 46744e551068..33cd6b63917b 100644
--- a/libibverbs/src/libibverbs.map
+++ b/libibverbs/src/libibverbs.map
@@ -1,3 +1,4 @@
+/* Do not change this file without reading Documentation/versioning.md */
 IBVERBS_1.0 {
 	global:
 		ibv_get_device_list;
diff --git a/librdmacm/src/CMakeLists.txt b/librdmacm/src/CMakeLists.txt
index 5324f625616d..0a60786c5f7a 100644
--- a/librdmacm/src/CMakeLists.txt
+++ b/librdmacm/src/CMakeLists.txt
@@ -8,7 +8,9 @@ publish_headers(infiniband
   ../include/infiniband/ib.h
   )
 
-rdma_library(rdmacm librdmacm.map 1 1.0.0
+rdma_library(rdmacm librdmacm.map
+  # See Documentation/versioning.md
+  1 1.1.${PACKAGE_VERSION}
   acm.c
   addrinfo.c
   cma.c
diff --git a/librdmacm/src/librdmacm.map b/librdmacm/src/librdmacm.map
index ffbd199d3119..65c049211c65 100644
--- a/librdmacm/src/librdmacm.map
+++ b/librdmacm/src/librdmacm.map
@@ -1,3 +1,4 @@
+/* Do not change this file without reading Documentation/versioning.md */
 RDMACM_1.0 {
 	global:
 		rdma_create_event_channel;
-- 
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

* [PATCH 11/13] srp_daemon: Add the debian initscripts as an option
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Bart Van Assche
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Necessary to reproduce the Debian packaging.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt                       |  3 ++
 srp_daemon/srp_daemon/CMakeLists.txt | 29 ++++++++----
 srp_daemon/srptools.default          | 14 ++++++
 srp_daemon/srptools.init             | 89 ++++++++++++++++++++++++++++++++++++
 4 files changed, 126 insertions(+), 9 deletions(-)
 create mode 100644 srp_daemon/srptools.default
 create mode 100644 srp_daemon/srptools.init

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ae236f88f67..805b25bb8669 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,6 +69,9 @@ else()
   set(CMAKE_INSTALL_FULL_RUNDIR "${CMAKE_INSTALL_RUNDIR}")
 endif()
 
+set(DISTRO_FLAVOUR "None" CACHE
+  STRING "Flavour of distribution to install for. This primarily impacts the init.d scripts installed.")
+
 #-------------------------
 # Load CMake components
 set(BUILDLIB "${CMAKE_SOURCE_DIR}/buildlib")
diff --git a/srp_daemon/srp_daemon/CMakeLists.txt b/srp_daemon/srp_daemon/CMakeLists.txt
index fe6b41811b92..4ad4edaf8c33 100644
--- a/srp_daemon/srp_daemon/CMakeLists.txt
+++ b/srp_daemon/srp_daemon/CMakeLists.txt
@@ -23,12 +23,23 @@ install(FILES logrotate-srp_daemon DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/logr
 install(FILES rsyslog-srp_daemon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/rsyslog.d" RENAME "srp_daemon.conf")
 install(FILES srp_daemon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")
 
-# FIXME: The ib init.d file should really be included in rdma-core as well.
-set(RDMA_SERVICE "openibd" CACHE STRING "init.d file service name to order srpd after")
-# NOTE: These defaults are for CentOS, packagers should override.
-set(SRP_DEFAULT_START "2 3 4 5" CACHE STRING "Default-Start service data for srpd")
-set(SRP_DEFAULT_STOP "0 1 6" CACHE STRING "Default-Stop service data for srpd")
-configure_file(srpd.in "${CMAKE_CURRENT_BINARY_DIR}/srpd")
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/srpd"
-  DESTINATION "${CMAKE_INSTALL_INITDDIR}"
-  PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+if ("${DISTRO_FLAVOUR}" STREQUAL "Debian")
+  # Debian version of the initscript system
+  install(FILES "srptools.init"
+    DESTINATION "${CMAKE_INSTALL_INITDDIR}"
+    RENAME "srptools"
+    PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+  install(FILES "srptools.default"
+    DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/default/"
+    RENAME "srptools")
+else()
+  # FIXME: The ib init.d file should really be included in rdma-core as well.
+  set(RDMA_SERVICE "openibd" CACHE STRING "init.d file service name to order srpd after")
+  # NOTE: These defaults are for CentOS, packagers should override.
+  set(SRP_DEFAULT_START "2 3 4 5" CACHE STRING "Default-Start service data for srpd")
+  set(SRP_DEFAULT_STOP "0 1 6" CACHE STRING "Default-Stop service data for srpd")
+  configure_file(srpd.in "${CMAKE_CURRENT_BINARY_DIR}/srpd")
+  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/srpd"
+    DESTINATION "${CMAKE_INSTALL_INITDDIR}"
+    PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+endif()
diff --git a/srp_daemon/srptools.default b/srp_daemon/srptools.default
new file mode 100644
index 000000000000..81e84f4a5cba
--- /dev/null
+++ b/srp_daemon/srptools.default
@@ -0,0 +1,14 @@
+#How often should srpdeamon  rescan the fabric (seconds)
+RETRIES=60
+
+#Where should srp-deamon log to
+LOG=/var/log/srp_daemon.log
+
+# What ports should srp-deamon be started on.
+# Format is CA:port
+# ALL or NONE will run on all ports on none
+# respectively
+
+PORTS=NONE
+#PORTS=ALL
+#PORTS="mthca0:1 mlx4_0:2"
diff --git a/srp_daemon/srptools.init b/srp_daemon/srptools.init
new file mode 100644
index 000000000000..2c1a140ccbc3
--- /dev/null
+++ b/srp_daemon/srptools.init
@@ -0,0 +1,89 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides:          srptools
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Discovers SRP scsi targets.
+# Description:       Discovers SRP scsi over infiniband targets.
+### END INIT INFO
+
+[ -x /usr/sbin/srp_daemon ] || exit 0
+
+IBDIR=/sys/class/infiniband
+
+PORTS=""
+RETRIES=""
+LOG=""
+
+[ -f /etc/default/srptools ] &&  . /etc/default/srptools
+
+start_daemon () {
+
+if [ "$PORTS" = "NONE" ] ; then
+echo "srptools disabled."
+exit 0
+fi
+
+
+if [ "$PORTS" = "ALL" ]  ; then
+    for HCA_ID in `/bin/ls -1 ${IBDIR}`
+      do
+      for PORT in `/bin/ls -1 ${IBDIR}/${HCA_ID}/ports/`
+        do
+        run_daemon
+      done
+    done
+fi
+
+
+for ADAPTER in $PORTS ; do
+    HCA_ID=`echo $ADAPTER | awk -F: '{print $1}'`
+    PORT=`echo $ADAPTER | awk -F:  '{print $2}'`
+    run_daemon
+done
+}
+
+
+run_daemon() {
+# SRP deamon wedges if we start it on a port which is not up
+
+        STATUS=`/usr/sbin/ibstat $HCA_ID $PORT | grep "State:"`
+
+        if [ "$STATUS" = "State: Active" ] ; then
+            echo "Starting srp on $HCA_ID $PORT"
+
+# srp does not background itself; using the start-stop-daemon background function
+# causes us to lose stdout, which is where it logs to
+            nohup start-stop-daemon --start --quiet -m --pidfile /var/run/srp_daemon.${HCA_ID}.${PORT} \
+            --exec  /usr/sbin/srp_daemon -- -e -c -n -i ${HCA_ID} -p ${PORT} -R ${RETRIES}   >> $LOG 2>&1 &
+            RETVAL=$?
+        fi
+}
+
+stop_daemon () {
+     for HCA_ID in `/bin/ls -1 ${IBDIR}`
+      do
+      for PORT in `/bin/ls -1 ${IBDIR}/${HCA_ID}/ports/`
+        do
+        start-stop-daemon --stop --quiet --oknodo -m --pidfile /var/run/srp_daemon.${HCA_ID}.${PORT}
+        RETVAL=$?
+      done
+    done
+}
+
+
+case "$1" in
+
+start)
+start_daemon
+;;
+stop)
+stop_daemon
+;;
+restart | reload | force-reload )
+stop_daemon
+start_daemon
+;;
+esac
-- 
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

* [PATCH 10/13] ipathverbs: Move truescale-serdes.cmds to /usr/libexec/
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Mike Marciniszyn
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

This is the FHS defined place for non-user runnable helper
programs.

Debian forbids the use of /usr/libexec/ so we provide
substitution support to let cmake customize this.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libipathverbs/CMakeLists.txt    | 6 ++++--
 libipathverbs/dracut_install    | 2 +-
 libipathverbs/truescale.conf    | 1 -
 libipathverbs/truescale.conf.in | 1 +
 4 files changed, 6 insertions(+), 4 deletions(-)
 delete mode 100644 libipathverbs/truescale.conf
 create mode 100644 libipathverbs/truescale.conf.in

diff --git a/libipathverbs/CMakeLists.txt b/libipathverbs/CMakeLists.txt
index 359438ef0e49..bde405d0d776 100644
--- a/libipathverbs/CMakeLists.txt
+++ b/libipathverbs/CMakeLists.txt
@@ -1,4 +1,6 @@
-install(FILES truescale.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/")
+rdma_subst_install(FILES "truescale.conf.in"
+  DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/"
+  RENAME "truescale.conf")
 install(FILES truescale-serdes.cmds
-  DESTINATION "${CMAKE_INSTALL_SBINDIR}"
+  DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}"
   PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
diff --git a/libipathverbs/dracut_install b/libipathverbs/dracut_install
index 131adfa036b8..a7ef490ea40f 100644
--- a/libipathverbs/dracut_install
+++ b/libipathverbs/dracut_install
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 inst /etc/modprobe.d/truescale.conf
-inst /usr/sbin/truescale-serdes.cmds
+inst /usr/libexec/truescale-serdes.cmds
 
 # All files needed by truescale-serdes.cmds need to be present here
 inst /sbin/lspci
diff --git a/libipathverbs/truescale.conf b/libipathverbs/truescale.conf
deleted file mode 100644
index 8ed227c91f86..000000000000
diff --git a/libipathverbs/truescale.conf.in b/libipathverbs/truescale.conf.in
new file mode 100644
index 000000000000..e2827d956015
--- /dev/null
+++ b/libipathverbs/truescale.conf.in
@@ -0,0 +1 @@
+install ib_qib modprobe -i ib_qib $CMDLINE_OPTS && @CMAKE_INSTALL_FULL_LIBEXECDIR@/truescale-serdes.cmds start
-- 
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

* [PATCH 09/13] verbs: Move the providers into /usr/lib.../libibverbs by default
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Doug Ledford, Yishai Hadas
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

The Debian packaging has always used this path, provide
official support for this configuration so Debian does not
rely on the absolute path in the .driver file, which breaks biarch.

Since there is no reason for the providers to be in the system
library search path (they export no symbols, and have no soname)
make this the default configuration.

The old behaviour can be restored by using:

 cmake -DVERBS_PROVIDER_DIR=''

This continues to support out-of-tree drivers by searching both
the provider path and the system library path if an unqualified
name is given in the .driver file.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt                |  6 +++++
 buildlib/config.h.in          |  2 ++
 buildlib/rdma_functions.cmake | 16 ++++++++-----
 libibverbs/src/init.c         | 55 ++++++++++++++++++++++++++++++-------------
 4 files changed, 57 insertions(+), 22 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 713788f188e3..7ae236f88f67 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,8 @@
 #      and do not build iwpmd.
 #  -DENABLE_STATIC=1 (default disabled)
 #      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.
 
 cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
 project(RDMA C)
@@ -53,6 +55,10 @@ set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_PREFIX}/lib/systemd"
 set(ACM_PROVIDER_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/ibacm"
   CACHE PATH "Location for ibacm provider plugin shared library files.")
 
+# Location to find the provider plugin shared library files
+set(VERBS_PROVIDER_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/libibverbs"
+  CACHE PATH "Location for provider plugin shared library files. If set to empty the system search path is used.")
+
 # Allow the 'run' dir to be configurable, this historically has been /var/run, but
 # some systems now use /run/
 set(CMAKE_INSTALL_RUNDIR "var/run"
diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index 78994a39d7ad..8ae2a4e536c0 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -31,6 +31,8 @@
 #define IBACM_PORT_FILE "@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.port"
 #define IBACM_LOG_FILE "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/ibacm.log"
 
+#define VERBS_PROVIDER_DIR "@VERBS_PROVIDER_DIR@"
+
 // FIXME This has been supported in compilers forever, we should just fail to build on such old systems.
 #cmakedefine HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE 1
 
diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index 260dd18d78df..06ccd518c81d 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -78,11 +78,6 @@ function(rdma_provider DEST)
   file(MAKE_DIRECTORY "${BUILD_LIB}/libibverbs.d/")
   file(WRITE "${BUILD_LIB}/libibverbs.d/${DEST}.driver" "driver ${BUILD_LIB}/${DEST}\n")
 
-  # FIXME: This symlink is provided for compat with the old build, but it
-  # never should have existed in the first place, nothing should use this
-  # name, we can probably remove it.
-  rdma_install_symlink("lib${DEST}-rdmav2.so" "${CMAKE_INSTALL_LIBDIR}/lib${DEST}.so")
-
   # Create a static provider library
   # FIXME: This is probably pointless, the provider library has no symbols so
   # what good is it? Presumably it should be used with -Wl,--whole-archive,
@@ -108,7 +103,16 @@ function(rdma_provider DEST)
   # Provider Plugins do not use SONAME versioning, there is no reason to
   # create the usual symlinks.
 
-  install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+  if (VERBS_PROVIDER_DIR)
+    install(TARGETS ${DEST} DESTINATION "${VERBS_PROVIDER_DIR}")
+  else()
+    install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+
+    # FIXME: This symlink is provided for compat with the old build, but it
+    # never should have existed in the first place, nothing should use this
+    # name, we can probably remove it.
+    rdma_install_symlink("lib${DEST}-rdmav2.so" "${CMAKE_INSTALL_LIBDIR}/lib${DEST}.so")
+  endif()
 endfunction()
 
  # Create an installed executable
diff --git a/libibverbs/src/init.c b/libibverbs/src/init.c
index bca0e02d11e1..7ae0fc87d332 100644
--- a/libibverbs/src/init.c
+++ b/libibverbs/src/init.c
@@ -190,33 +190,56 @@ void verbs_register_driver(const char *name, verbs_driver_init_func init_func)
 	register_driver(name, NULL, init_func);
 }
 
+#define __IBV_QUOTE(x)	#x
+#define IBV_QUOTE(x)	__IBV_QUOTE(x)
+#define DLOPEN_TRAILER "-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so"
+
 static void load_driver(const char *name)
 {
 	char *so_name;
 	void *dlhandle;
 
-#define __IBV_QUOTE(x)	#x
-#define IBV_QUOTE(x)	__IBV_QUOTE(x)
-
-	if (asprintf(&so_name,
-		     name[0] == '/' ?
-		     "%s-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so" :
-		     "lib%s-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so",
-		     name) < 0) {
-		fprintf(stderr, PFX "Warning: couldn't load driver '%s'.\n",
-			name);
+	/* If the name is an absolute path then open that path after appending
+	   the trailer suffix */
+	if (name[0] == '/') {
+		if (asprintf(&so_name, "%s" DLOPEN_TRAILER, name) < 0)
+			goto out_asprintf;
+		dlhandle = dlopen(so_name, RTLD_NOW);
+		if (!dlhandle)
+			goto out_dlopen;
+		free(so_name);
 		return;
 	}
 
-	dlhandle = dlopen(so_name, RTLD_NOW);
-	if (!dlhandle) {
-		fprintf(stderr, PFX "Warning: couldn't load driver '%s': %s\n",
-			name, dlerror());
-		goto out;
+	/* If configured with a provider plugin path then try that next */
+	if (sizeof(VERBS_PROVIDER_DIR) >= 1) {
+		if (asprintf(&so_name, VERBS_PROVIDER_DIR "/lib%s" DLOPEN_TRAILER, name) <
+		    0)
+			goto out_asprintf;
+		dlhandle = dlopen(so_name, RTLD_NOW);
+		free(so_name);
+		if (dlhandle)
+			return;
 	}
 
-out:
+	/* Otherwise use the system libary search path. This is the historical
+	   behavior of libibverbs */
+	if (asprintf(&so_name, "lib%s" DLOPEN_TRAILER, name) < 0)
+		goto out_asprintf;
+	dlhandle = dlopen(so_name, RTLD_NOW);
+	if (!dlhandle)
+		goto out_dlopen;
+	free(so_name);
+	return;
+
+out_asprintf:
+	fprintf(stderr, PFX "Warning: couldn't load driver '%s'.\n", name);
+	return;
+out_dlopen:
+	fprintf(stderr, PFX "Warning: couldn't load driver '%s': %s\n", so_name,
+		dlerror());
 	free(so_name);
+	return;
 }
 
 static void load_drivers(void)
-- 
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

* [PATCH 08/13] srp_daemon: Move lock file into /var/run/
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Bart Van Assche
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

'/var/tmp' is an inappropriate places for lock files of this nature,
they belong in /var/run. /var/lock does not seem suitable because
this lock is not against a basic device node.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 buildlib/config.h.in               | 1 +
 srp_daemon/srp_daemon/srp_daemon.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index bbc279d3c9c3..78994a39d7ad 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -22,6 +22,7 @@
 #define IWPM_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf"
 
 #define SRP_DEAMON_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf"
+#define SRP_DEAMON_LOCK_PREFIX "@CMAKE_INSTALL_FULL_RUNDIR@/srp_daemon"
 
 #define ACM_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma"
 #define IBACM_LIB_PATH "@ACM_PROVIDER_DIR@"
diff --git a/srp_daemon/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon/srp_daemon.c
index 70764e00f851..f16674dbfafa 100644
--- a/srp_daemon/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon/srp_daemon.c
@@ -131,7 +131,7 @@ static int check_process_uniqueness(struct config_t *conf)
 	char path[256];
 	int fd;
 
-	snprintf(path, sizeof(path), "/var/tmp/srp_daemon_%s_%d",
+	snprintf(path, sizeof(path), SRP_DEAMON_LOCK_PREFIX "_%s_%d",
 		 conf->dev_name, conf->port_num);
 
 	if ((fd = open(path, O_CREAT|O_RDWR,
-- 
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

* [PATCH 07/13] Pass ancillary files that use paths through cmake substitution
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Hefty, Tatyana Nikolova, Bart Van Assche
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

This removes hardwired paths from the documentation and broadly
makes the documentation and scripts match what the C code is now
doing.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 ibacm/CMakeLists.txt                                      | 2 +-
 ibacm/ibacm.init.in                                       | 2 +-
 ibacm/man/{ibacm_prov.7 => ibacm_prov.7.in}               | 4 ++--
 iwpmd/CMakeLists.txt                                      | 4 ++--
 iwpmd/{iwpmd.1 => iwpmd.1.in}                             | 2 +-
 iwpmd/{iwpmd.conf.5 => iwpmd.conf.5.in}                   | 2 +-
 srp_daemon/man/CMakeLists.txt                             | 2 +-
 srp_daemon/man/{srp_daemon.1 => srp_daemon.1.in}          | 8 ++++----
 srp_daemon/srp_daemon/CMakeLists.txt                      | 4 +++-
 srp_daemon/srp_daemon/{srp_daemon.sh => srp_daemon.sh.in} | 4 ++--
 srp_daemon/srp_daemon/srpd.in                             | 6 +++---
 11 files changed, 21 insertions(+), 19 deletions(-)
 rename ibacm/man/{ibacm_prov.7 => ibacm_prov.7.in} (95%)
 rename iwpmd/{iwpmd.1 => iwpmd.1.in} (98%)
 rename iwpmd/{iwpmd.conf.5 => iwpmd.conf.5.in} (92%)
 rename srp_daemon/man/{srp_daemon.1 => srp_daemon.1.in} (90%)
 rename srp_daemon/srp_daemon/{srp_daemon.sh => srp_daemon.sh.in} (95%)

diff --git a/ibacm/CMakeLists.txt b/ibacm/CMakeLists.txt
index 857a6e82320a..376a3a89ddae 100644
--- a/ibacm/CMakeLists.txt
+++ b/ibacm/CMakeLists.txt
@@ -52,7 +52,7 @@ rdma_man_pages(
   man/ib_acme.1
   man/ibacm.1
   man/ibacm.7
-  man/ibacm_prov.7
+  man/ibacm_prov.7.in
   )
 
 # FIXME: update the .init.in
diff --git a/ibacm/ibacm.init.in b/ibacm/ibacm.init.in
index aea262b6768a..0fb0011f3953 100644
--- a/ibacm/ibacm.init.in
+++ b/ibacm/ibacm.init.in
@@ -19,7 +19,7 @@
 #	host route lookups.
 ### END INIT INFO
 
-pidfile=/var/run/ibacm.pid
+pidfile=@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.pid
 subsys=/var/lock/subsys/ibacm
 
 daemon() { /sbin/daemon   ${1+"$@"}; }
diff --git a/ibacm/man/ibacm_prov.7 b/ibacm/man/ibacm_prov.7.in
similarity index 95%
rename from ibacm/man/ibacm_prov.7
rename to ibacm/man/ibacm_prov.7.in
index d04617e837c8..9e79d58f639e 100644
--- a/ibacm/man/ibacm_prov.7
+++ b/ibacm/man/ibacm_prov.7.in
@@ -12,7 +12,7 @@ To add a provider to the ibacm core service, the provider must
 .TP
 1. be implemented as a shared library;
 .TP
-2. be installed under a configured directory, eg., /usr/lib64/ibacm/;
+2. be installed under a configured directory, eg., @ACM_PROVIDER_DIR@;
 .TP
 3  export a function provider_query() that returns a pointer to its provider info 
 and version info.
@@ -66,7 +66,7 @@ Non-related sections should be ignored.
 .P
 Some helper functions are also exported by the ibacm core. For example, the
 acm_log define (or the acm_write() function) can be used to log messages into
-ibacm's log file (default /var/log/ibacm.log).  For details, refer to
+ibacm's log file (default @CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/ibacm.log).  For details, refer to
 the acm_prov.h file.
 .SH "NOTES"
 A provider should always set the version in its provider info structure as the
diff --git a/iwpmd/CMakeLists.txt b/iwpmd/CMakeLists.txt
index 21208dd5b82a..89a715128076 100644
--- a/iwpmd/CMakeLists.txt
+++ b/iwpmd/CMakeLists.txt
@@ -1,4 +1,4 @@
 rdma_man_pages(
-  iwpmd.1
-  iwpmd.conf.5
+  iwpmd.1.in
+  iwpmd.conf.5.in
   )
diff --git a/iwpmd/iwpmd.1 b/iwpmd/iwpmd.1.in
similarity index 98%
rename from iwpmd/iwpmd.1
rename to iwpmd/iwpmd.1.in
index a4948c509f3b..88eece7f6522 100644
--- a/iwpmd/iwpmd.1
+++ b/iwpmd/iwpmd.1.in
@@ -51,6 +51,6 @@ to the system message log.
 .P
 SIGTERM/SIGHUP will force iwpmd to exit.
 .SH "FILES"
-/etc/iwpmd.conf
+@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf
 .SH "SEE ALSO"
 rdma_cm(7)
diff --git a/iwpmd/iwpmd.conf.5 b/iwpmd/iwpmd.conf.5.in
similarity index 92%
rename from iwpmd/iwpmd.conf.5
rename to iwpmd/iwpmd.conf.5.in
index 9dfe137d3fab..1baae82b76da 100644
--- a/iwpmd/iwpmd.conf.5
+++ b/iwpmd/iwpmd.conf.5.in
@@ -15,6 +15,6 @@ to communicate with the kernel port map client.  The default is 400MB.
 .SH "EXAMPLES"
 nl_sock_rbuf_size=419430400
 .SH "FILES"
-/etc/iwpmd.conf
+@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf
 .SH "SEE ALSO"
 iwpmd(1)
diff --git a/srp_daemon/man/CMakeLists.txt b/srp_daemon/man/CMakeLists.txt
index f05de60b97aa..cd644a6bd836 100644
--- a/srp_daemon/man/CMakeLists.txt
+++ b/srp_daemon/man/CMakeLists.txt
@@ -1,4 +1,4 @@
 rdma_man_pages(
   ibsrpdm.1
-  srp_daemon.1
+  srp_daemon.1.in
   )
diff --git a/srp_daemon/man/srp_daemon.1 b/srp_daemon/man/srp_daemon.1.in
similarity index 90%
rename from srp_daemon/man/srp_daemon.1
rename to srp_daemon/man/srp_daemon.1.in
index 6117e3679a25..6ee114284780 100644
--- a/srp_daemon/man/srp_daemon.1
+++ b/srp_daemon/man/srp_daemon.1.in
@@ -15,7 +15,7 @@ Each srp_daemon instance operates on one local port. Upon boot it performs a ful
 
 When a new machine joins the fabric, srp_daemon checks if it is a target. When there is a change of capabilities, srp_daemon checks if the machine has turned into a target. When there is an SA change or a timeout expiration, srp_daemon performs a full rescan of the fabric.
 
-For each target srp_daemon finds, it checks if it should connect to this target according to its rules (default rules file is /etc/srp_daemon.conf) and if it is already connected to the local port. If it should connect to this target and if it is not connected yet, srp_daemon can either print the target details or connect to it.
+For each target srp_daemon finds, it checks if it should connect to this target according to its rules (default rules file is @CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf) and if it is already connected to the local port. If it should connect to this target and if it is not connected yet, srp_daemon can either print the target details or connect to it.
 
 .SH OPTIONS
 
@@ -57,7 +57,7 @@ Retries to connect to existing target after \fIretry-Timeout\fR seconds. If -R i
 .TP
 \fB\-f\fR \fIrules-File\fR
 Decide to which targets to connect according to the rules in \fIrules-File\fR. 
-If \fB\-f\fR is not specified, uses the default rules file /etc/srp_daemon.conf.
+If \fB\-f\fR is not specified, uses the default rules file @CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf.
 Each line in the \fIrules-File\fR is a rule which can be either an allow connection or a disallow connection according to 
 the first character in the line (a or d accordingly). The rest of the line is values for id_ext, ioc_guid, dgid, 
 service_id. Please take a look at the example section for an example of the file. srp_daemon decide whether to allow or disallow each target according  to first rule that match the target. If no rule matches the target, the target is allowed and will be connected. In an allow rule it is possible to set attributes for the connection to the target. Supported attributes are max_cmd_per_lun and max_sect.
@@ -72,7 +72,7 @@ Perform \fIretries\fR retries on each send to MAD (default: 3 retries).
 New format - use also initiator_ext in the connection command.
 
 .SH FILES
-/etc/srp_daemon.conf -
+@CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf -
 Default rules configuration file that indicates to which targets to connect. Can be overridden using the \fB\-f\fR \fIrules-File\fR option. 
 Each line in this file is a rule which can be either an allow connection or a disallow connection according to 
 the first character in the line (a or d accordingly). The rest of the line is values for id_ext, ioc_guid, dgid, 
@@ -86,7 +86,7 @@ srp_daemon -o -c -a		    (Prints the connection commands for the targets in the
 srp_daemon -e -f rules.txt	    (Connects to the targets allowed in the rules file rules.txt)
 
 .nf
-An example for a rules configuration file (such as /etc/srp_daemon.conf)
+An example for a rules configuration file (such as @CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf)
 ------------------------------------------------------------------------
 # Rules file example
 # This is a comment
diff --git a/srp_daemon/srp_daemon/CMakeLists.txt b/srp_daemon/srp_daemon/CMakeLists.txt
index 84d74044186a..fe6b41811b92 100644
--- a/srp_daemon/srp_daemon/CMakeLists.txt
+++ b/srp_daemon/srp_daemon/CMakeLists.txt
@@ -15,7 +15,9 @@ target_link_libraries(srp_daemon
 rdma_install_symlink(srp_daemon "${CMAKE_INSTALL_SBINDIR}/ibsrpdm")
 # FIXME: Why?
 rdma_install_symlink(srp_daemon "${CMAKE_INSTALL_SBINDIR}/run_srp_daemon")
-install(FILES srp_daemon.sh DESTINATION "${CMAKE_INSTALL_SBINDIR}")
+rdma_subst_install(FILES "srp_daemon.sh.in"
+  DESTINATION "${CMAKE_INSTALL_SBINDIR}"
+  RENAME "srp_daemon.sh")
 
 install(FILES logrotate-srp_daemon DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/logrotate.d" RENAME "srp_daemon")
 install(FILES rsyslog-srp_daemon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/rsyslog.d" RENAME "srp_daemon.conf")
diff --git a/srp_daemon/srp_daemon/srp_daemon.sh b/srp_daemon/srp_daemon/srp_daemon.sh.in
similarity index 95%
rename from srp_daemon/srp_daemon/srp_daemon.sh
rename to srp_daemon/srp_daemon/srp_daemon.sh.in
index 3981a0d4b586..cb0b81efe6e6 100755
--- a/srp_daemon/srp_daemon/srp_daemon.sh
+++ b/srp_daemon/srp_daemon/srp_daemon.sh.in
@@ -30,12 +30,12 @@
 
 shopt -s nullglob
 
-prog=/usr/sbin/srp_daemon
+prog=@CMAKE_INSTALL_FULL_SBINDIR@/srp_daemon
 params=$@
 ibdir="/sys/class/infiniband"
 rescan_interval=60
 pids=""
-pidfile=/var/run/srp_daemon.sh.pid
+pidfile=@CMAKE_INSTALL_FULL_RUNDIR@/srp_daemon.sh.pid
 mypid=$$
 
 trap_handler()
diff --git a/srp_daemon/srp_daemon/srpd.in b/srp_daemon/srp_daemon/srpd.in
index 10692e7e0f05..d77579170a3b 100755
--- a/srp_daemon/srp_daemon/srpd.in
+++ b/srp_daemon/srp_daemon/srpd.in
@@ -4,7 +4,7 @@
 #
 # chkconfig: - 25 75
 # description: Starts/Stops InfiniBand SRP client service
-# config:	/etc/srp_daemon.conf
+# config:	@CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf
 #
 ### BEGIN INIT INFO
 # Provides:       srpd
@@ -32,8 +32,8 @@ fi
 if [ -f $RDMA_CONFIG ]; then
     . $RDMA_CONFIG
 fi
-pidfile=/var/run/srp_daemon.sh.pid
-prog=/usr/sbin/srp_daemon.sh
+pidfile=@CMAKE_INSTALL_FULL_RUNDIR@/srp_daemon.sh.pid
+prog=@CMAKE_INSTALL_FULL_SBINDIR@/srp_daemon.sh
 
 checkpid() {
     [ -e "/proc/$1" ]
-- 
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

* [PATCH 06/13] Consolidate definitions for paths into config.h
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Hefty, Tatyana Nikolova, Bart Van Assche
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

config.h is the only place we pass through cmake substitution,
so it is the only place that can define the various filesystem
paths.

This patch handles the C code portions that use paths.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt                     | 10 ++++++++++
 buildlib/config.h.in               | 13 +++++++++++--
 ibacm/CMakeLists.txt               |  5 -----
 ibacm/linux/osd.h                  |  2 +-
 ibacm/src/acm.c                    |  6 +++---
 ibacm/src/acme.c                   | 10 +++++-----
 ibacm/src/libacm.c                 |  2 +-
 iwpmd/src/iwarp_pm.h               |  1 -
 iwpmd/src/iwarp_pm_server.c        |  1 +
 librdmacm/src/acm.c                |  2 +-
 librdmacm/src/cma.h                |  9 ---------
 srp_daemon/srp_daemon/srp_daemon.c |  4 ++--
 12 files changed, 35 insertions(+), 30 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b9e34e5cd9d..713788f188e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,16 @@ set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_PREFIX}/lib/systemd"
 set(ACM_PROVIDER_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/ibacm"
   CACHE PATH "Location for ibacm provider plugin shared library files.")
 
+# Allow the 'run' dir to be configurable, this historically has been /var/run, but
+# some systems now use /run/
+set(CMAKE_INSTALL_RUNDIR "var/run"
+  CACHE PATH "Location for runtime information, typically /var/run, or /run")
+if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_RUNDIR})
+  set(CMAKE_INSTALL_FULL_RUNDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_RUNDIR}")
+else()
+  set(CMAKE_INSTALL_FULL_RUNDIR "${CMAKE_INSTALL_RUNDIR}")
+endif()
+
 #-------------------------
 # Load CMake components
 set(BUILDLIB "${CMAKE_SOURCE_DIR}/buildlib")
diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index 984d51bfaa09..bbc279d3c9c3 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -17,9 +17,18 @@
 #define HAVE_VALGRIND_MEMCHECK_H 1
 #define INCLUDE_VALGRIND 1
 
-#define SYSCONFDIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@"
-
 #define IBV_CONFIG_DIR "@CONFIG_DIR@"
+#define RS_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma/rsocket"
+#define IWPM_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf"
+
+#define SRP_DEAMON_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf"
+
+#define ACM_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma"
+#define IBACM_LIB_PATH "@ACM_PROVIDER_DIR@"
+#define IBACM_BIN_PATH "@CMAKE_INSTALL_FULL_BINDIR@"
+#define IBACM_PID_FILE "@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.pid"
+#define IBACM_PORT_FILE "@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.port"
+#define IBACM_LOG_FILE "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/ibacm.log"
 
 // FIXME This has been supported in compilers forever, we should just fail to build on such old systems.
 #cmakedefine HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE 1
diff --git a/ibacm/CMakeLists.txt b/ibacm/CMakeLists.txt
index 8887c13af463..857a6e82320a 100644
--- a/ibacm/CMakeLists.txt
+++ b/ibacm/CMakeLists.txt
@@ -3,11 +3,6 @@ publish_headers(infiniband
   include/infiniband/acm_prov.h
   )
 
-# FIXME: To config.h
-add_definitions("-DIBACM_CONFIG_PATH=\"${CMAKE_INSTALL_FULL_SYSCONFDIR}/rdma\"")
-add_definitions("-DIBACM_LIB_PATH=\"${ACM_PROVIDER_DIR}\"")
-add_definitions("-DIBACM_BIN_PATH=\"${CMAKE_INSTALL_FULL_BINDIR}\"")
-
 # FIXME: Fixup the include scheme to not require all these -Is
 include_directories("include")
 include_directories("src")
diff --git a/ibacm/linux/osd.h b/ibacm/linux/osd.h
index 5ca4c6f554c5..83d31b3589c5 100644
--- a/ibacm/linux/osd.h
+++ b/ibacm/linux/osd.h
@@ -31,6 +31,7 @@
 #if !defined(OSD_H)
 #define OSD_H
 
+#include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -46,7 +47,6 @@
 #include <sys/time.h>
 #include <netinet/in.h>
 
-#define ACM_CONF_DIR  IBACM_CONFIG_PATH
 #define ACM_ADDR_FILE "ibacm_addr.cfg"
 #define ACM_OPTS_FILE "ibacm_opts.cfg"
 
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index ab1269f71d02..4650421b81b7 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -226,9 +226,9 @@ static struct sa_data {
 static char *acme = IBACM_BIN_PATH "/ib_acme -A";
 static char *opts_file = ACM_CONF_DIR "/" ACM_OPTS_FILE;
 static char *addr_file = ACM_CONF_DIR "/" ACM_ADDR_FILE;
-static char log_file[128] = "/var/log/ibacm.log";
+static char log_file[128] = IBACM_LOG_FILE;
 static int log_level = 0;
-static char lock_file[128] = "/var/run/ibacm.pid";
+static char lock_file[128] = IBACM_PID_FILE;
 static short server_port = 6125;
 static int support_ips_in_addr_cfg = 0;
 static char prov_lib_path[256] = IBACM_LIB_PATH;
@@ -578,7 +578,7 @@ static void acm_init_server(void)
 		atomic_init(&client_array[i].refcnt);
 	}
 
-	if (!(f = fopen("/var/run/ibacm.port", "w"))) {
+	if (!(f = fopen(IBACM_PORT_FILE, "w"))) {
 		acm_log(0, "notice - cannot publish ibacm port number\n");
 		return;
 	}
diff --git a/ibacm/src/acme.c b/ibacm/src/acme.c
index f1b0d010625e..4d9003047506 100644
--- a/ibacm/src/acme.c
+++ b/ibacm/src/acme.c
@@ -130,9 +130,9 @@ static void gen_opts_temp(FILE *f)
 	fprintf(f, "# Examples:\n");
 	fprintf(f, "# log_file stdout\n");
 	fprintf(f, "# log_file stderr\n");
-	fprintf(f, "# log_file /var/log/ibacm.log\n");
+	fprintf(f, "# log_file %s\n", IBACM_LOG_FILE);
 	fprintf(f, "\n");
-	fprintf(f, "log_file /var/log/ibacm.log\n");
+	fprintf(f, "log_file %s\n", IBACM_LOG_FILE);
 	fprintf(f, "\n");
 	fprintf(f, "# log_level:\n");
 	fprintf(f, "# Indicates the amount of detailed data written to the log file.  Log levels\n");
@@ -147,7 +147,7 @@ static void gen_opts_temp(FILE *f)
 	fprintf(f, "# Specifies the location of the ACM lock file used to ensure that only a\n");
 	fprintf(f, "# single instance of ACM is running.\n");
 	fprintf(f, "\n");
-	fprintf(f, "lock_file /var/run/ibacm.pid\n");
+	fprintf(f, "lock_file %s\n", IBACM_PID_FILE);
 	fprintf(f, "\n");
 	fprintf(f, "# addr_prot:\n");
 	fprintf(f, "# Default resolution protocol to resolve IP addresses into IB GIDs.\n");
@@ -276,7 +276,7 @@ static void gen_opts_temp(FILE *f)
 	fprintf(f, "# the ACM cache.  This option is only valid if route_preload\n");
 	fprintf(f, "# indicates that routing data should be read from a file.\n");
 	fprintf(f, "# Default is %s/ibacm_route.data\n", ACM_CONF_DIR);
-	fprintf(f, "# route_data_file /etc/rdma/ibacm_route.data\n");
+	fprintf(f, "# route_data_file %s/ibacm_route.data\n", ACM_CONF_DIR);
 	fprintf(f, "\n");
 	fprintf(f, "# addr_preload:\n");
 	fprintf(f, "# Specifies if the ACM address cache should be preloaded, or built on demand.\n");
@@ -292,7 +292,7 @@ static void gen_opts_temp(FILE *f)
 	fprintf(f, "# the ACM cache.  This option is only valid if addr_preload\n");
 	fprintf(f, "# indicates that address data should be read from a file.\n");
 	fprintf(f, "# Default is %s/ibacm_hosts.data\n", ACM_CONF_DIR);
-	fprintf(f, "# addr_data_file /etc/rdma/ibacm_hosts.data\n");
+	fprintf(f, "# addr_data_file %s/ibacm_hosts.data\n", ACM_CONF_DIR);
 	fprintf(f, "\n");
 	fprintf(f, "# support_ips_in_addr_cfg:\n");
 	fprintf(f, "# If 1 continue to read IP addresses from ibacm_addr.cfg\n");
diff --git a/ibacm/src/libacm.c b/ibacm/src/libacm.c
index 95e562deb031..3ad1db1d307b 100644
--- a/ibacm/src/libacm.c
+++ b/ibacm/src/libacm.c
@@ -48,7 +48,7 @@ static void acm_set_server_port(void)
 {
 	FILE *f;
 
-	if ((f = fopen("/var/run/ibacm.port", "r"))) {
+	if ((f = fopen(IBACM_PORT_FILE, "r"))) {
 		if (fscanf(f, "%hu", (unsigned short *) &server_port) != 1) 
 			printf("Failed to read server port\n"); 
 		fclose(f);
diff --git a/iwpmd/src/iwarp_pm.h b/iwpmd/src/iwarp_pm.h
index bcf88ca30433..5b7c6136f386 100644
--- a/iwpmd/src/iwarp_pm.h
+++ b/iwpmd/src/iwarp_pm.h
@@ -85,7 +85,6 @@
 #define IWPM_IFNAME_SIZE   16
 #define IWPM_IPADDR_SIZE   16
 
-#define IWPM_CONFIG_FILE "/etc/iwpmd.conf"
 #define IWPM_PARAM_NUM 1
 #define IWPM_PARAM_NAME_LEN 64
 
diff --git a/iwpmd/src/iwarp_pm_server.c b/iwpmd/src/iwarp_pm_server.c
index e1c2a9c660bb..39e0aa2c3a36 100644
--- a/iwpmd/src/iwarp_pm_server.c
+++ b/iwpmd/src/iwarp_pm_server.c
@@ -31,6 +31,7 @@
  *
  */
 
+#include "config.h"
 #include "iwarp_pm.h"
 
 const char iwpm_ulib_name [] = "iWarpPortMapperUser";
diff --git a/librdmacm/src/acm.c b/librdmacm/src/acm.c
index f0da01e6d286..75d9d8cf487e 100644
--- a/librdmacm/src/acm.c
+++ b/librdmacm/src/acm.c
@@ -120,7 +120,7 @@ static int ucma_set_server_port(void)
 {
 	FILE *f;
 
-	if ((f = fopen("/var/run/ibacm.port", "r" STREAM_CLOEXEC))) {
+	if ((f = fopen(IBACM_PORT_FILE, "r" STREAM_CLOEXEC))) {
 		fscanf(f, "%" SCNu16, &server_port);
 		fclose(f);
 	}
diff --git a/librdmacm/src/cma.h b/librdmacm/src/cma.h
index 98eba8dc21e1..091d104655c5 100644
--- a/librdmacm/src/cma.h
+++ b/librdmacm/src/cma.h
@@ -179,13 +179,4 @@ struct ib_connect_hdr {
 #define cma_dst_ip6 dst_addr[0]
 };
 
-#ifndef SYSCONFDIR
-#define SYSCONFDIR "/etc"
-#endif
-#ifndef RDMADIR
-#define RDMADIR "rdma"
-#endif
-#define RDMA_CONF_DIR  SYSCONFDIR "/" RDMADIR
-#define RS_CONF_DIR RDMA_CONF_DIR "/rsocket"
-
 #endif /* CMA_H */
diff --git a/srp_daemon/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon/srp_daemon.c
index dfc976b8f6db..70764e00f851 100644
--- a/srp_daemon/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon/srp_daemon.c
@@ -226,7 +226,7 @@ static void usage(const char *argv0)
 	fprintf(stderr, "-R <rescan time>	perform complete Rescan every <rescan time> seconds\n");
 	fprintf(stderr, "-T <retry timeout>	Retries to connect to existing target after Timeout of <retry timeout> seconds\n");
 	fprintf(stderr, "-l <tl_retry timeout>	Transport retry count before failing IO. should be in range [2..7], (default 2)\n");
-	fprintf(stderr, "-f <rules file>	use rules File to set to which target(s) to connect (default: /etc/srp_daemon.conf\n");
+	fprintf(stderr, "-f <rules file>	use rules File to set to which target(s) to connect (default: " SRP_DEAMON_CONFIG_FILE ")\n");
 	fprintf(stderr, "-t <timeout>		Timeout for mad response in milliseconds\n");
 	fprintf(stderr, "-r <retries>		number of send Retries for each mad\n");
 	fprintf(stderr, "-n 			New connection command format - use also initiator extension\n");
@@ -1622,7 +1622,7 @@ static int get_config(struct config_t *conf, int argc, char *argv[])
 	conf->retry_timeout 		= 20;
 	conf->add_target_file  		= NULL;
 	conf->print_initiator_ext	= 0;
-	conf->rules_file		= "/etc/srp_daemon.conf";
+	conf->rules_file		= SRP_DEAMON_CONFIG_FILE;
 	conf->rules			= NULL;
 	conf->tl_retry_count		= 0;
 
-- 
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

* [PATCH 05/13] Have cmake run man pages through text substitution
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Sean Hefty
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

rsocket.7 had an errant text substitution that never worked, it is
a good idea to have the man pages use the correct paths, so let
us have cmake run them through.

Any man page ending in '.in' will be substituted automatically.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 buildlib/rdma_functions.cmake             | 13 +++++++++++--
 librdmacm/man/CMakeLists.txt              |  2 +-
 librdmacm/man/{rsocket.7 => rsocket.7.in} |  4 ++--
 3 files changed, 14 insertions(+), 5 deletions(-)
 rename librdmacm/man/{rsocket.7 => rsocket.7.in} (97%)

diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index a4ecd7d4f2fe..260dd18d78df 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -135,8 +135,17 @@ endfunction()
 # filename
 function(rdma_man_pages)
   foreach(I ${ARGN})
-    string(REGEX REPLACE "^.+[.](.+)$" "\\1" MAN_SECT ${I})
-    install(FILES ${I} DESTINATION "${CMAKE_INSTALL_MANDIR}/man${MAN_SECT}/")
+    if ("${I}" MATCHES "\\.in$")
+      string(REGEX REPLACE "^.+[.](.+)\\.in$" "\\1" MAN_SECT "${I}")
+      string(REGEX REPLACE "^(.+)\\.in$" "\\1" BASE_NAME "${I}")
+      get_filename_component(BASE_NAME "${BASE_NAME}" NAME)
+      rdma_subst_install(FILES "${I}"
+	DESTINATION "${CMAKE_INSTALL_MANDIR}/man${MAN_SECT}/"
+	RENAME "${BASE_NAME}")
+    else()
+      string(REGEX REPLACE "^.+[.](.+)$" "\\1" MAN_SECT "${I}")
+      install(FILES "${I}" DESTINATION "${CMAKE_INSTALL_MANDIR}/man${MAN_SECT}/")
+    endif()
   endforeach()
 endfunction()
 
diff --git a/librdmacm/man/CMakeLists.txt b/librdmacm/man/CMakeLists.txt
index 791c98265ad0..d6cc106751a4 100644
--- a/librdmacm/man/CMakeLists.txt
+++ b/librdmacm/man/CMakeLists.txt
@@ -58,7 +58,7 @@ rdma_man_pages(
   riostream.1
   rping.1
   # FIXME: rsocket has a text substitution but nothing ever filled it in.
-  rsocket.7
+  rsocket.7.in
   rstream.1
   ucmatose.1
   udaddy.1
diff --git a/librdmacm/man/rsocket.7 b/librdmacm/man/rsocket.7.in
similarity index 97%
rename from librdmacm/man/rsocket.7
rename to librdmacm/man/rsocket.7.in
index dfb9804d849a..6adf156f4062 100644
--- a/librdmacm/man/rsocket.7
+++ b/librdmacm/man/rsocket.7.in
@@ -129,7 +129,7 @@ fork off a process to handle the new connection.
 .P
 rsockets uses configuration files that give an administrator control
 over the default settings used by rsockets.  Use files under
-%sysconfig%/rdma/rsocket as shown:
+@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma/rsocket as shown:
 .P
 .P
 mem_default - default size of receive buffer(s)
@@ -149,7 +149,7 @@ polling_time - default number of microseconds to poll for data before waiting
 All configuration files should contain a single integer value.  Values may
 be set by issuing a command similar to the following example.
 .P
-echo 1000000 > /etc/rdma/rsocket/mem_default
+echo 1000000 > @CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma/rsocket/mem_default
 .P
 If configuration files are not available, rsockets uses internal defaults.
 Applications can override default values programmatically through the
-- 
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

* [PATCH 04/13] Do not produce static libraries by default
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

We no longer recommend that static libraries are distributed, this
never worked sanely for libibverbs.

Use:
 cmake -DENABLE_STATIC=1

To restore the old behaviour

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt                |  6 ++++++
 buildlib/rdma_functions.cmake | 34 +++++++++++++++++++++-------------
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index be82c2896d75..9b9e34e5cd9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,8 @@
 #  -DENABLE_RESOLVE_NEIGH=0 (default enabled)
 #      Do not link to libnl and do not resolve neighbours internally for Ethernet,
 #      and do not build iwpmd.
+#  -DENABLE_STATIC=1 (default disabled)
+#      Produce static libraries along with the usual shared libraries.
 
 cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
 project(RDMA C)
@@ -66,6 +68,10 @@ include(RDMA_DoFixup)
 include(publish_headers)
 include(rdma_functions)
 
+if (NOT DEFINED ENABLE_STATIC)
+  set(ENABLE_STATIC "OFF" CACHE BOOL "Produce static linking libraries as well as shared libraries.")
+endif()
+
 #-------------------------
 # Setup the basic C compiler
 RDMA_BuildType()
diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index 8fe8828c0e84..a4ecd7d4f2fe 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -47,14 +47,16 @@ endfunction()
 # Basic function to produce a standard libary with a GNU LD version script.
 function(rdma_library DEST VERSION_SCRIPT SOVERSION VERSION)
   # Create a static library
-  add_library(${DEST}-static STATIC ${ARGN})
-  set_target_properties(${DEST}-static PROPERTIES
-    OUTPUT_NAME ${DEST}
-    LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
-  install(TARGETS ${DEST}-static DESTINATION "${CMAKE_INSTALL_LIBDIR}")
-
-  list(APPEND RDMA_STATIC_LIBS ${DEST} ${DEST}-static)
-  set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
+  if (ENABLE_STATIC)
+    add_library(${DEST}-static STATIC ${ARGN})
+    set_target_properties(${DEST}-static PROPERTIES
+      OUTPUT_NAME ${DEST}
+      LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
+    install(TARGETS ${DEST}-static DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+
+    list(APPEND RDMA_STATIC_LIBS ${DEST} ${DEST}-static)
+    set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
+  endif()
 
   # Create a shared library
   add_library(${DEST} SHARED ${ARGN})
@@ -85,12 +87,14 @@ function(rdma_provider DEST)
   # FIXME: This is probably pointless, the provider library has no symbols so
   # what good is it? Presumably it should be used with -Wl,--whole-archive,
   # but we don't have any directions on how to make static linking work..
-  add_library(${DEST} STATIC ${ARGN})
-  set_target_properties(${DEST} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
-  install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+  if (ENABLE_STATIC)
+    add_library(${DEST} STATIC ${ARGN})
+    set_target_properties(${DEST} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
+    install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
 
-  list(APPEND RDMA_STATIC_LIBS ${DEST}-rdmav2 ${DEST})
-  set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
+    list(APPEND RDMA_STATIC_LIBS ${DEST}-rdmav2 ${DEST})
+    set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
+  endif()
 
   # Create the plugin shared library
   set(DEST ${DEST}-rdmav2)
@@ -155,6 +159,10 @@ endfunction()
 # from the shared and setting up the libtool .la files.
 function(rdma_finalize_libs)
   list(LENGTH RDMA_STATIC_LIBS LEN)
+  if (LEN LESS 2)
+    return()
+  endif()
+
   math(EXPR LEN ${LEN}-1)
   foreach(I RANGE 0 ${LEN} 2)
     list(GET RDMA_STATIC_LIBS ${I} SHARED)
-- 
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

* [PATCH 03/13] Do not produce libtool .la files
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

These were preserved as part of the cmake transition, but no distributor
uses them and we don't need them internally, so time for them to go.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 buildlib/rdma_functions.cmake | 99 -------------------------------------------
 1 file changed, 99 deletions(-)

diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index ea53f382553f..8fe8828c0e84 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -151,103 +151,6 @@ function(rdma_alias_man_pages)
   endforeach()
 endfunction()
 
-# For compatability write out a libtool .la file. This is only meaningful if
-# the end user is statically linking, and only if the library has dependent
-# libraries.
-
-# FIXME: it isn't clear how this is actually useful for provider libraries and
-# libibverbs itself, the user must do some trick to get the constructor to run
-# in the provider, at least how to do that should be documented someplace..
-function(rdma_make_libtool_la SHARED STATIC LIBS)
-  get_property(LIB TARGET ${STATIC} PROPERTY OUTPUT_NAME SET)
-  if (LIB)
-    get_target_property(LIB ${STATIC} OUTPUT_NAME)
-  else()
-    set(LIB ${STATIC})
-  endif()
-
-  set(BARE_LAFN "${CMAKE_STATIC_LIBRARY_PREFIX}${LIB}.la")
-  set(BARE_LIBFN "${CMAKE_STATIC_LIBRARY_PREFIX}${LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}")
-
-  get_property(SOLIB TARGET ${SHARED} PROPERTY OUTPUT_NAME SET)
-  if (SOLIB)
-    get_target_property(SOLIB ${SHARED} OUTPUT_NAME)
-  else()
-    set(SOLIB ${SHARED})
-  endif()
-
-  set(DLNAME "${CMAKE_SHARED_LIBRARY_PREFIX}${SOLIB}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-  get_property(TMP TARGET ${SHARED} PROPERTY SOVERSION SET)
-  if (TMP)
-    get_target_property(VERSION ${SHARED} VERSION)
-    get_target_property(SOVERSION ${SHARED} SOVERSION)
-    set(NAMES "${DLNAME}.${VERSION} ${DLNAME}.${SOVERSION} ${DLNAME}")
-    set(DLNAME "${DLNAME}.${SOVERSION}")
-  else()
-    set(NAMES "${DLNAME}")
-    set(DLNAME "${CMAKE_SHARED_LIBRARY_PREFIX}${SOLIB}${CMAKE_SHARED_LIBRARY_SUFFIX}")
-  endif()
-
-  if (LIBS)
-    list(REMOVE_DUPLICATES LIBS)
-    foreach(I ${LIBS})
-      if (I MATCHES "^-l")
-	list(APPEND DEPS "${I}")
-      else()
-	list(APPEND DEPS "-l${I}")
-      endif()
-    endforeach()
-    string(REPLACE ";" " " DEPS "${DEPS}")
-  endif()
-
-  set(LAFN "${BUILD_LIB}/${BARE_LAFN}")
-  file(WRITE ${LAFN}
-    "# ${BARE_LAFN} - a libtool library file\n"
-    "# Generated by cmake\n"
-    "#\n"
-    "# Please DO NOT delete this file!\n"
-    "# It is necessary for linking the library.\n"
-    "\n"
-    "# The name that we can dlopen(3).\n"
-    "dlname='${DLNAME}'\n"
-    "\n"
-    "# Names of this library.\n"
-    "library_names='${NAMES}'\n"
-    "\n"
-    "# The name of the static archive.\n"
-    "old_library='${BARE_LIBFN}'\n"
-    "\n"
-    "# Linker flags that can not go in dependency_libs.\n"
-    "inherited_linker_flags=''\n"
-    "\n"
-    "# Libraries that this one depends upon.\n"
-    "dependency_libs='${DEPS}'\n"
-    "\n"
-    "# Names of additional weak libraries provided by this library\n"
-    "weak_library_names=''\n"
-    "\n"
-    "# Version information for ${CMAKE_STATIC_LIBRARY_PREFIX}${LIB}.\n"
-    # We don't try very hard to emulate this, it isn't used for static linking anyhow
-    "current=${SOVERSION}\n"
-    "age=0\n"
-    "revision=0\n"
-    "\n"
-    "# Is this an already installed library?\n"
-    "installed=yes\n"
-    "\n"
-    "# Should we warn about portability when linking against -modules?\n"
-    "shouldnotlink=no\n"
-    "\n"
-    "# Files to dlopen/dlpreopen\n"
-    "dlopen=''\n"
-    "dlpreopen=''\n"
-    "\n"
-    "# Directory that this library needs to be installed in:\n"
-    "libdir='${CMAKE_INSTALL_FULL_LIBDIR}'\n"
-    )
-  install(FILES ${LAFN} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
-endfunction()
-
 # Finalize the setup of the static libraries by copying the meta information
 # from the shared and setting up the libtool .la files.
 function(rdma_finalize_libs)
@@ -274,7 +177,5 @@ function(rdma_finalize_libs)
       set_target_properties(${STATIC} PROPERTIES LINK_LIBRARIES "${TMP}")
       list(APPEND LIBS "${TMP}")
     endif()
-
-    rdma_make_libtool_la(${SHARED} ${STATIC} "${LIBS}")
   endforeach()
 endfunction()
-- 
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

* [PATCH 02/13] Switch valgrind memcheck.h to on by default
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

We now recommend that this source be built with valgrind memcheck.h
present, so use it automatically if it is available. Users looking
to remove this tiny overhead can build with -DENABLE_VALGRIND=0

Downstream packagers should ensure the build is done with valgrind
headers available.

NOTE: Fedora/CentOS have shipped with valgrind turn on in their
packaging, so for most users this is no change.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06dd98203349..be82c2896d75 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,8 +10,8 @@
 #  -DCMAKE_BUILD_TYPE=RelWithDebInfo
 #      Change the optimization level, Debug disables optimization,
 #      Release is for packagers
-#  -DENABLE_VALGRIND=1 (default disabled)
-#      Embed valgrind notations, this has a tiny negative performance impact
+#  -DENABLE_VALGRIND=0 (default enabled)
+#      Disable valgrind notations, this has a tiny positive performance impact
 #  -DENABLE_RESOLVE_NEIGH=0 (default enabled)
 #      Do not link to libnl and do not resolve neighbours internally for Ethernet,
 #      and do not build iwpmd.
@@ -189,9 +189,11 @@ RDMA_DoFixup("${HAVE_RDMA_USER_RXE}" "rdma/rdma_user_rxe.h")
 #-------------------------
 # Apply fixups
 
-# FIXME: We should probably always enable memcheck.h, and only selectively
-# turn it off in the real high performance paths. There is no reason umad
-# should ever have memcheck disabled for instance.
+# We prefer to build with valgrind memcheck.h present, but if not, or the user
+# requested valgrind disabled, then replace it with our dummy stub.
+if (NOT DEFINED ENABLE_VALGRIND)
+  set(ENABLE_VALGRIND "ON" CACHE BOOL "Enable use of valgrind annotations")
+endif()
 if (ENABLE_VALGRIND)
   CHECK_INCLUDE_FILE("valgrind/memcheck.h" HAVE_VALGRIND_MEMCHECK)
   CHECK_INCLUDE_FILE("valgrind/drd.h" HAVE_VALGRIND_DRD)
-- 
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

* [PATCH 01/13] Be consistent about defining NDEBUG
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

We setup the two standard CMake build_types so that Release includes
NDEBUG and RelWithDebInfo does not (by default CMake sets it in both).

The recommendation is for packagers to use Release (by setting
-DCMAKE_BUILD_TYPE=Release) and developers use RelWithDebInfo
(the default)

This also replaces the default flags for Release with the RelWithDebInfo,
flags (-O2 -g -DNDEBUG) which is what we consider suitable for packaging.
The CMake default of -O3 is not tested.

Note that all the packaging systems I looked at force NDEBUG into the
CFLAGS.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 CMakeLists.txt                |  5 +++++
 buildlib/RDMA_BuildType.cmake | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 buildlib/RDMA_BuildType.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a829cd477c52..06dd98203349 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,9 @@
 # Common options passed to cmake are:
 #  -DCMAKE_EXPORT_COMPILE_COMMANDS=1
 #      Write a compile_commands.json file for clang tooling
+#  -DCMAKE_BUILD_TYPE=RelWithDebInfo
+#      Change the optimization level, Debug disables optimization,
+#      Release is for packagers
 #  -DENABLE_VALGRIND=1 (default disabled)
 #      Embed valgrind notations, this has a tiny negative performance impact
 #  -DENABLE_RESOLVE_NEIGH=0 (default enabled)
@@ -58,12 +61,14 @@ include(CheckCCompilerFlag)
 include(CheckIncludeFile)
 include(CheckTypeSize)
 include(RDMA_EnableCStd)
+include(RDMA_BuildType)
 include(RDMA_DoFixup)
 include(publish_headers)
 include(rdma_functions)
 
 #-------------------------
 # Setup the basic C compiler
+RDMA_BuildType()
 include_directories(${BUILD_INCLUDE})
 # FIXME: Eliminate HAVE_CONFIG_H, we always have it.
 add_definitions(-DHAVE_CONFIG_H)
diff --git a/buildlib/RDMA_BuildType.cmake b/buildlib/RDMA_BuildType.cmake
new file mode 100644
index 000000000000..4f7485c397a0
--- /dev/null
+++ b/buildlib/RDMA_BuildType.cmake
@@ -0,0 +1,41 @@
+# COPYRIGHT (c) 2015 Obsidian Research Corporation. See COPYING file
+
+function(RDMA_BuildType)
+  set(build_types Debug Release RelWithDebInfo MinSizeRel)
+
+  # Set the default build type to RelWithDebInfo. Since RDMA is typically used
+  # in performance contexts it doesn't make much sense to have the default build
+  # turn off the optimizer.
+  if(NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE String
+      "Options are ${build_types}"
+      FORCE
+      )
+    set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${build_types})
+  endif()
+
+  # Release should be used by packagers, it is the same as the default RelWithDebInfo,
+  # this means it uses -O2 and -DNDEBUG (not -O3)
+  foreach (language CXX C)
+    set(VAR_TO_MODIFY "CMAKE_${language}_FLAGS_RELEASE")
+    if ("${${VAR_TO_MODIFY}}" STREQUAL "${${VAR_TO_MODIFY}_INIT}")
+      set(${VAR_TO_MODIFY} "${CMAKE_${language}_FLAGS_RELWITHDEBINFO_INIT}"
+	  CACHE STRING "Default flags for Release configuration" FORCE)
+    endif()
+  endforeach()
+
+  # RelWithDebInfo should be used by developers, it is the same as Release but
+  # with the -DNDEBUG removed
+  foreach (language CXX C)
+    set(VAR_TO_MODIFY "CMAKE_${language}_FLAGS_RELWITHDEBINFO")
+    if (${${VAR_TO_MODIFY}} STREQUAL ${${VAR_TO_MODIFY}_INIT})
+	string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )"
+	  " "
+	  replacement
+	  "${${VAR_TO_MODIFY}}"
+	  )
+	set(${VAR_TO_MODIFY} "${replacement}"
+	    CACHE STRING "Default flags for RelWithDebInfo configuration" FORCE)
+    endif()
+  endforeach()
+endfunction()
-- 
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

* [PATCH 00/13] Policy changes and packaging support
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Jarod Wilson, John Jolly, Honggang Li

This is the next batch of rdma-core updates, these 13 patches deal primarily
with how the package is built and the install paths afterwards. Most likely
these changes are mainly of interest to packagers.

The discussion here is informative for some of the patches:
 http://www.spinics.net/lists/linux-rdma/msg39578.html

View the commits on github:

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

Please forward Acks and I will update the commits.

One important thing to note is that this series pretty much eliminates all
hard coded paths from the tree. While this is a good thing, it means the
default behavior is to set SYSCONFDIR to /usr/local/etc/, which is probably
not what people testing the daemons really want. Compile with:

 cmake -GNinja .. -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc

Which is similar to the configure --sysconfdir option

Jason Gunthorpe (13):
  Be consistent about defining NDEBUG
  Switch valgrind memcheck.h to on by default
  Do not produce libtool .la files
  Do not produce static libraries by default
  Have cmake run man pages through text substitution
  Consolidate definitions for paths into config.h
  Pass ancillary files that use paths through cmake substitution
  srp_daemon: Move lock file into /var/run/
  verbs: Move the providers into /usr/lib.../libibverbs by default
  ipathverbs: Move truescale-serdes.cmds to /usr/libexec/
  srp_daemon: Add the debian initscripts as an option
  Document a versioning strategy and use it
  Remove ibsupport-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org from MAINTAINERS

 CMakeLists.txt                                     |  47 +++++-
 Documentation/versioning.md                        | 108 ++++++++++++++
 MAINTAINERS                                        |   1 -
 buildlib/RDMA_BuildType.cmake                      |  41 ++++++
 buildlib/config.h.in                               |  16 +-
 buildlib/rdma_functions.cmake                      | 162 ++++++---------------
 ibacm/CMakeLists.txt                               |   7 +-
 ibacm/ibacm.init.in                                |   2 +-
 ibacm/linux/osd.h                                  |   2 +-
 ibacm/man/{ibacm_prov.7 => ibacm_prov.7.in}        |   4 +-
 ibacm/src/acm.c                                    |   6 +-
 ibacm/src/acme.c                                   |  10 +-
 ibacm/src/libacm.c                                 |   2 +-
 iwpmd/CMakeLists.txt                               |   4 +-
 iwpmd/{iwpmd.1 => iwpmd.1.in}                      |   2 +-
 iwpmd/{iwpmd.conf.5 => iwpmd.conf.5.in}            |   2 +-
 iwpmd/src/iwarp_pm.h                               |   1 -
 iwpmd/src/iwarp_pm_server.c                        |   1 +
 libibcm/src/CMakeLists.txt                         |   4 +-
 libibcm/src/libibcm.map                            |   1 +
 libibumad/src/CMakeLists.txt                       |   4 +-
 libibumad/src/libibumad.map                        |   1 +
 libibverbs/src/CMakeLists.txt                      |   4 +-
 libibverbs/src/init.c                              |  55 +++++--
 libibverbs/src/libibverbs.map                      |   1 +
 libipathverbs/CMakeLists.txt                       |   6 +-
 libipathverbs/dracut_install                       |   2 +-
 libipathverbs/truescale.conf                       |   1 -
 libipathverbs/truescale.conf.in                    |   1 +
 librdmacm/man/CMakeLists.txt                       |   2 +-
 librdmacm/man/{rsocket.7 => rsocket.7.in}          |   4 +-
 librdmacm/src/CMakeLists.txt                       |   4 +-
 librdmacm/src/acm.c                                |   2 +-
 librdmacm/src/cma.h                                |   9 --
 librdmacm/src/librdmacm.map                        |   1 +
 srp_daemon/man/CMakeLists.txt                      |   2 +-
 srp_daemon/man/{srp_daemon.1 => srp_daemon.1.in}   |   8 +-
 srp_daemon/srp_daemon/CMakeLists.txt               |  33 +++--
 srp_daemon/srp_daemon/srp_daemon.c                 |   6 +-
 .../srp_daemon/{srp_daemon.sh => srp_daemon.sh.in} |   4 +-
 srp_daemon/srp_daemon/srpd.in                      |   6 +-
 srp_daemon/srptools.default                        |  14 ++
 srp_daemon/srptools.init                           |  89 +++++++++++
 43 files changed, 468 insertions(+), 214 deletions(-)
 create mode 100644 Documentation/versioning.md
 create mode 100644 buildlib/RDMA_BuildType.cmake
 rename ibacm/man/{ibacm_prov.7 => ibacm_prov.7.in} (95%)
 rename iwpmd/{iwpmd.1 => iwpmd.1.in} (98%)
 rename iwpmd/{iwpmd.conf.5 => iwpmd.conf.5.in} (92%)
 delete mode 100644 libipathverbs/truescale.conf
 create mode 100644 libipathverbs/truescale.conf.in
 rename librdmacm/man/{rsocket.7 => rsocket.7.in} (97%)
 rename srp_daemon/man/{srp_daemon.1 => srp_daemon.1.in} (90%)
 rename srp_daemon/srp_daemon/{srp_daemon.sh => srp_daemon.sh.in} (95%)
 create mode 100644 srp_daemon/srptools.default
 create mode 100644 srp_daemon/srptools.init

-- 
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

* Re: [RFC PATCH 03/11] IB/sa: Modify SM Address handle to program GRH when using large lids
From: Jason Gunthorpe @ 2016-09-23 18:32 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Don Hiatt,
	Dasaratharaman Chandramouli
In-Reply-To: <1474652674-13110-4-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Fri, Sep 23, 2016 at 01:44:26PM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> When either the port lid or the sm lid is above the ib unicast lid
> space, the SMI creates an address handle with the revelant GRH
> information.

Woah, I though you were only using that horrible GID hack for the
uABI.

Don't do such crazy things in the kernel. Fix the internal kernel to
support your larger lid.

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

* Re: [PATCH rdma-core] Improve global COPYING files
From: Jason Gunthorpe @ 2016-09-23 17:48 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: Leon Romanovsky,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Doug Ledford
In-Reply-To: <1828884A29C6694DAF28B7E6B8A82373AB08E66F-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>

On Fri, Sep 23, 2016 at 05:23:29PM +0000, Hefty, Sean wrote:

> If this combined repo is intended to support the plumbing for the
> linux-rdma subsystem, then I think it must support code that is
> submitted under GPL only.

Hum, I don't think that follows.

My expectation in the kernel is that the entire RDMA subystem and
drivers follows the overall licensing model of the kernel and does not
require userspace to follow any specific license, and certainly does
not require userspace to follow the GPLv2.

> Much of the tradition code can remain dual-license, but new provider
> code, for example, should be submit-able under GPL.

I do not support that recommendation.

The FSF has made very clear their position on GPL licensing of plugins
(see https://www.gnu.org/licenses/gpl-faq.en.html), and allowing a
GPLv2 only plugin or library code would break our community's promise
to our customers - that the library core is usable in any application.

It would be a complicated discussion if someone proposed a GPLv2 only
provider.

A LGPLv2-only provider would be more acceptable, and I would encourage
anyone who wishes to have the protections of the GPLv2 in their
provider to go that route. I suspect it would still be controversial.

I would prefer to see us continue with the dual license approach, and
obviously all OFA member companies have agreed to do that.

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

* Re: move unsafe global rkey handling to the RDMA core V2
From: Doug Ledford @ 2016-09-23 17:48 UTC (permalink / raw)
  To: Christoph Hellwig, Christoph Hellwig
  Cc: bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20160919155459.GA5547-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 274 bytes --]

On 9/19/2016 11:54 AM, Christoph Hellwig wrote:
> Doug, any comments on this series?  I'd really like to get it in for
> this merge window.
> 

Series applied, thanks.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG Key ID: 0E572FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply

* [RFC PATCH 11/11] IB/rdmavt: Modify rvt_check_ah() to account for extended LIDs
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-09-23 17:44 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Don Hiatt, Dasaratharaman Chandramouli
In-Reply-To: <1474652674-13110-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

rvt_check_ah() delegates lid verification to underlying
driver. Underlying driver uses different conditions to
check for dlid depending on whether the device supports
extended LIDs

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/hfi.h      |  1 +
 drivers/infiniband/hw/hfi1/verbs.c    | 13 +++++++++++++
 drivers/infiniband/hw/qib/qib_verbs.c |  9 +++++++++
 drivers/infiniband/sw/rdmavt/ah.c     | 10 ----------
 drivers/infiniband/sw/rdmavt/qp.c     |  9 ++++++---
 5 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h
index 57ebbec2840c..fe4aa7eacc5e 100644
--- a/drivers/infiniband/hw/hfi1/hfi.h
+++ b/drivers/infiniband/hw/hfi1/hfi.h
@@ -67,6 +67,7 @@
 #include <rdma/ib_hdrs.h>
 #include <linux/rhashtable.h>
 #include <rdma/rdma_vt.h>
+#include <rdma/ib_addr.h>
 
 #include "chip_registers.h"
 #include "common.h"
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
index 1f193340dac0..468faf0e2b10 100644
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
@@ -1510,7 +1510,20 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)
 	struct hfi1_pportdata *ppd;
 	struct hfi1_devdata *dd;
 	u8 sc5;
+	u32 lid;
 
+	if ((ah_attr->ah_flags & IB_AH_GRH) &&
+	    ib_is_opa_gid(&ah_attr->grh.dgid)) {
+		lid = opa_get_lid_from_gid(&ah_attr->grh.dgid);
+		if (lid != OPA_LID_PERMISSIVE)
+			return -EINVAL;
+	} else {
+		lid = ah_attr->dlid;
+		if ((lid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) &&
+		    (lid != be16_to_cpu(IB_LID_PERMISSIVE)) &&
+		    (!(ah_attr->ah_flags & IB_AH_GRH)))
+			return -EINVAL;
+	}
 	/* test the mapping for validity */
 	ibp = to_iport(ibdev, ah_attr->port_num);
 	ppd = ppd_from_ibp(ibp);
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c
index 876ebb442d38..ebb30fce030c 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.c
+++ b/drivers/infiniband/hw/qib/qib_verbs.c
@@ -1426,6 +1426,15 @@ int qib_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)
 	if (ah_attr->sl > 15)
 		return -EINVAL;
 
+	if (ah_attr->dlid == 0)
+		return -EINVAL;
+	if (ah_attr->dlid >=
+		be16_to_cpu(IB_MULTICAST_LID_BASE) &&
+	    ah_attr->dlid !=
+		be16_to_cpu(IB_LID_PERMISSIVE) &&
+	    !(ah_attr->ah_flags & IB_AH_GRH))
+		return -EINVAL;
+
 	return 0;
 }
 
diff --git a/drivers/infiniband/sw/rdmavt/ah.c b/drivers/infiniband/sw/rdmavt/ah.c
index 16c446142c2a..9521294a28f1 100644
--- a/drivers/infiniband/sw/rdmavt/ah.c
+++ b/drivers/infiniband/sw/rdmavt/ah.c
@@ -65,8 +65,6 @@ int rvt_check_ah(struct ib_device *ibdev,
 	int err;
 	struct ib_port_attr port_attr;
 	struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
-	enum rdma_link_layer link = rdma_port_get_link_layer(ibdev,
-							     ah_attr->port_num);
 
 	err = ib_query_port(ibdev, ah_attr->port_num, &port_attr);
 	if (err)
@@ -80,14 +78,6 @@ int rvt_check_ah(struct ib_device *ibdev,
 	if ((ah_attr->ah_flags & IB_AH_GRH) &&
 	    ah_attr->grh.sgid_index >= port_attr.gid_tbl_len)
 		return -EINVAL;
-	if (link != IB_LINK_LAYER_ETHERNET) {
-		if (ah_attr->dlid == 0)
-			return -EINVAL;
-		if (ah_attr->dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE) &&
-		    ah_attr->dlid != be16_to_cpu(IB_LID_PERMISSIVE) &&
-		    !(ah_attr->ah_flags & IB_AH_GRH))
-			return -EINVAL;
-	}
 	if (rdi->driver_f.check_ah)
 		return rdi->driver_f.check_ah(ibdev, ah_attr);
 	return 0;
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 7fe0d7e3ba46..d41c7f7748da 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -1035,6 +1035,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	int mig = 0;
 	int pmtu = 0; /* for gcc warning only */
 	enum rdma_link_layer link;
+	int opa_ah;
 
 	link = rdma_port_get_link_layer(ibqp->device, qp->port_num);
 
@@ -1045,6 +1046,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	cur_state = attr_mask & IB_QP_CUR_STATE ?
 		attr->cur_qp_state : qp->state;
 	new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state;
+	opa_ah = rdma_cap_opa_ah(ibqp->device, qp->port_num);
 
 	if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type,
 				attr_mask, link))
@@ -1055,15 +1057,16 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 		goto inval;
 
 	if (attr_mask & IB_QP_AV) {
-		if (attr->ah_attr.dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE))
+		if (!opa_ah && (attr->ah_attr.dlid >=
+				be16_to_cpu(IB_MULTICAST_LID_BASE)))
 			goto inval;
 		if (rvt_check_ah(qp->ibqp.device, &attr->ah_attr))
 			goto inval;
 	}
 
 	if (attr_mask & IB_QP_ALT_PATH) {
-		if (attr->alt_ah_attr.dlid >=
-		    be16_to_cpu(IB_MULTICAST_LID_BASE))
+		if (!opa_ah && (attr->alt_ah_attr.dlid >=
+			be16_to_cpu(IB_MULTICAST_LID_BASE)))
 			goto inval;
 		if (rvt_check_ah(qp->ibqp.device, &attr->alt_ah_attr))
 			goto inval;
-- 
1.8.2

--
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

* [RFC PATCH 10/11] IB/srpt: Increase lid and sm_lid to 32 bits
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-09-23 17:44 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Dasaratharaman Chandramouli, Don Hiatt
In-Reply-To: <1474652674-13110-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

srpt contains lid and sm_lid fields which are 16 bits in
length, increase them to 32 bits.

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 4 ++--
 drivers/infiniband/ulp/srpt/ib_srpt.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index c14071afc78a..883bbfe08e0e 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -514,8 +514,8 @@ static int srpt_refresh_port(struct srpt_port *sport)
 	if (ret)
 		goto err_query_port;
 
-	sport->sm_lid = (u16)port_attr.sm_lid;
-	sport->lid = (u16)port_attr.lid;
+	sport->sm_lid = port_attr.sm_lid;
+	sport->lid = port_attr.lid;
 
 	ret = ib_query_gid(sport->sdev->device, sport->port, 0, &sport->gid,
 			   NULL);
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h
index 581878782854..580bb75a8815 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.h
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.h
@@ -322,8 +322,8 @@ struct srpt_port {
 	bool			enabled;
 	u8			port_guid[64];
 	u8			port;
-	u16			sm_lid;
-	u16			lid;
+	u32			sm_lid;
+	u32			lid;
 	union ib_gid		gid;
 	struct work_struct	work;
 	struct se_portal_group	port_tpg_1;
-- 
1.8.2

--
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

* [RFC PATCH 09/11] IB/IPoIB: Modify ipoib_get_net_dev_by_params to lookup gid table
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-09-23 17:44 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Dasaratharaman Chandramouli, Don Hiatt
In-Reply-To: <1474652674-13110-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

ipoib_get_net_dev_by_params compares incoming gid with local_gid
which is gid at index 0 of the gid table. OPA devices using larger
LIDs may have a different GID format than whats setup in the local_gid
field. Do a search of the gid table in those cases.

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 37 +++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 2bcde9822e3a..76da1430b415 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -328,6 +328,40 @@ out:
 	return result;
 }
 
+/* retuns true if the incoming gid is assigned to the IPoIB
+ * netdev interface
+ *
+ * OPA devices may have the incoming GID in the OPA GID
+ * format which might not necessarily be assigned to the
+ * netdev interface. This necessitates searching the GID
+ * table to match this OPA GID.
+ */
+static bool ipoib_check_gid(struct ipoib_dev_priv *priv,
+			    const union ib_gid *gid)
+{
+	bool is_local_gid;
+	struct ib_port_attr attr;
+	union ib_gid port_gid;
+	int i;
+
+	if (!gid)
+		return true;
+
+	is_local_gid = !memcmp(gid, &priv->local_gid, sizeof(*gid));
+
+	if (!rdma_cap_opa_ah(priv->ca, priv->port) || is_local_gid)
+		return is_local_gid;
+
+	if (ib_query_port(priv->ca, priv->port, &attr))
+		return false;
+	for (i = 1; i < attr.gid_tbl_len; i++) {
+		if (ib_query_gid(priv->ca, priv->port, i, &port_gid, NULL))
+			return false;
+		if (!memcmp(gid, &port_gid, sizeof(*gid)))
+			return true;
+	}
+	return false;
+}
 /* returns the number of IPoIB netdevs on top a given ipoib device matching a
  * pkey_index and address, if one exists.
  *
@@ -344,8 +378,7 @@ static int ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv,
 	struct net_device *net_dev = NULL;
 	int matches = 0;
 
-	if (priv->pkey_index == pkey_index &&
-	    (!gid || !memcmp(gid, &priv->local_gid, sizeof(*gid)))) {
+	if (priv->pkey_index == pkey_index && ipoib_check_gid(priv, gid)) {
 		if (!addr) {
 			net_dev = ipoib_get_master_net_dev(priv->dev);
 		} else {
-- 
1.8.2

--
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

* [RFC PATCH 08/11] IB/IPoIB: Retrieve 32 bit LIDs from path records when running on OPA devices
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-09-23 17:44 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Dasaratharaman Chandramouli, Don Hiatt
In-Reply-To: <1474652674-13110-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Path record responses will contain the 32 bit LID information in the
SGID and DGID field of the responses. Modify IPoIB to use these extended
LIDs in datagram and connected mode communication.

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/ulp/ipoib/ipoib.h           |  4 +++-
 drivers/infiniband/ulp/ipoib/ipoib_cm.c        | 11 +++++++++++
 drivers/infiniband/ulp/ipoib/ipoib_main.c      | 26 ++++++++++++++++++++++++++
 drivers/infiniband/ulp/ipoib/ipoib_multicast.c |  2 +-
 4 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 9dbfcc0ab577..448a46bec769 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -352,7 +352,7 @@ struct ipoib_dev_priv {
 	u32		  qkey;
 
 	union ib_gid local_gid;
-	u16	     local_lid;
+	u32	     local_lid;
 
 	unsigned int admin_mtu;
 	unsigned int mcast_mtu;
@@ -421,6 +421,8 @@ struct ipoib_path {
 	struct rb_node	      rb_node;
 	struct list_head      list;
 	int  		      valid;
+	u32		      dlid;
+	u32		      slid;
 };
 
 struct ipoib_neigh {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 4ad297d3de89..3499171913ef 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -38,6 +38,7 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/moduleparam.h>
+#include <rdma/ib_addr.h>
 
 #include "ipoib.h"
 
@@ -1356,6 +1357,16 @@ static void ipoib_cm_tx_start(struct work_struct *work)
 		}
 		memcpy(&pathrec, &p->path->pathrec, sizeof pathrec);
 
+		if (rdma_cap_opa_ah(priv->ca, priv->port)) {
+			if (p->path->dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE))
+				pathrec.dgid.global.interface_id =
+					OPA_MAKE_ID(p->path->dlid);
+
+			if (p->path->slid >= be16_to_cpu(IB_MULTICAST_LID_BASE))
+				pathrec.sgid.global.interface_id =
+					OPA_MAKE_ID(p->path->slid);
+		}
+
 		spin_unlock_irqrestore(&priv->lock, flags);
 		netif_tx_unlock_bh(dev);
 
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index cc1c1b062ea5..2bcde9822e3a 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -52,6 +52,7 @@
 #include <linux/inetdevice.h>
 #include <rdma/ib_cache.h>
 #include <linux/pci.h>
+#include <rdma/ib_addr.h>
 
 #define DRV_VERSION "1.0.0"
 
@@ -766,6 +767,31 @@ static void path_rec_completion(int status,
 	spin_lock_irqsave(&priv->lock, flags);
 
 	if (!IS_ERR_OR_NULL(ah)) {
+		/*
+		 * Extended LIDs might get programmed into GIDs in the
+		 * case of OPA devices. Since we have created the ah
+		 * above which would have made use of the lids, now is
+		 * a good time to change them back to regular GIDs after
+		 * saving the extended LIDs.
+		 */
+		if (rdma_cap_opa_ah(priv->ca, priv->port) &&
+		    ib_is_opa_gid(&pathrec->sgid)) {
+			path->slid = opa_get_lid_from_gid(&pathrec->sgid);
+			pathrec->sgid = path->pathrec.sgid;
+		} else {
+			path->slid = be16_to_cpu(pathrec->slid);
+		}
+
+		if (rdma_cap_opa_ah(priv->ca, priv->port) &&
+		    ib_is_opa_gid(&pathrec->dgid)) {
+			path->dlid = opa_get_lid_from_gid(&pathrec->dgid);
+			pathrec->dgid = path->pathrec.dgid;
+		} else {
+			path->dlid = be16_to_cpu(pathrec->dlid);
+		}
+		ipoib_dbg(priv, "PathRec SGID %pI6 DGID %pI6\n",
+			  pathrec->sgid.raw, pathrec->dgid.raw);
+
 		path->pathrec = *pathrec;
 
 		old_ah   = path->ah;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index bff73b53bff8..d3394b6add24 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -581,7 +581,7 @@ void ipoib_mcast_join_task(struct work_struct *work)
 			  port_attr.state);
 		return;
 	}
-	priv->local_lid = (u16)port_attr.lid;
+	priv->local_lid = port_attr.lid;
 	netif_addr_lock_bh(dev);
 
 	if (!test_bit(IPOIB_FLAG_DEV_ADDR_SET, &priv->flags)) {
-- 
1.8.2

--
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

* [RFC PATCH 07/11] IB/mad: Change slid in RMPP recv from 16 to 32 bits
From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w @ 2016-09-23 17:44 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Don Hiatt, Dasaratharaman Chandramouli
In-Reply-To: <1474652674-13110-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

OPA devices will contain larger lids in the wc.slid
which is now 32 bits. This change ensures RMPP handler
is able to retrieve the correct lid.

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/core/mad_rmpp.c | 22 ++++++++++++++++++----
 include/rdma/ib_addr.h             | 12 ++++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c
index 1fc9469b5e66..1cc452c2e03d 100644
--- a/drivers/infiniband/core/mad_rmpp.c
+++ b/drivers/infiniband/core/mad_rmpp.c
@@ -33,6 +33,7 @@
  */
 
 #include <linux/slab.h>
+#include <rdma/ib_addr.h>
 
 #include "mad_priv.h"
 #include "mad_rmpp.h"
@@ -64,7 +65,7 @@ struct mad_rmpp_recv {
 
 	__be64 tid;
 	u32 src_qp;
-	u16 slid;
+	u32 slid;
 	u8 mgmt_class;
 	u8 class_version;
 	u8 method;
@@ -316,7 +317,7 @@ create_rmpp_recv(struct ib_mad_agent_private *agent,
 	mad_hdr = &mad_recv_wc->recv_buf.mad->mad_hdr;
 	rmpp_recv->tid = mad_hdr->tid;
 	rmpp_recv->src_qp = mad_recv_wc->wc->src_qp;
-	rmpp_recv->slid = (u16)mad_recv_wc->wc->slid;
+	rmpp_recv->slid = mad_recv_wc->wc->slid;
 	rmpp_recv->mgmt_class = mad_hdr->mgmt_class;
 	rmpp_recv->class_version = mad_hdr->class_version;
 	rmpp_recv->method  = mad_hdr->method;
@@ -337,7 +338,7 @@ find_rmpp_recv(struct ib_mad_agent_private *agent,
 	list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) {
 		if (rmpp_recv->tid == mad_hdr->tid &&
 		    rmpp_recv->src_qp == mad_recv_wc->wc->src_qp &&
-		    rmpp_recv->slid == (u16)mad_recv_wc->wc->slid &&
+		    rmpp_recv->slid == mad_recv_wc->wc->slid &&
 		    rmpp_recv->mgmt_class == mad_hdr->mgmt_class &&
 		    rmpp_recv->class_version == mad_hdr->class_version &&
 		    rmpp_recv->method == mad_hdr->method)
@@ -850,11 +851,14 @@ out:
 static int init_newwin(struct ib_mad_send_wr_private *mad_send_wr)
 {
 	struct ib_mad_agent_private *agent = mad_send_wr->mad_agent_priv;
+	struct ib_device *ib_dev = agent->qp_info->port_priv->device;
+	u8 port = agent->qp_info->port_priv->port_num;
 	struct ib_mad_hdr *mad_hdr = mad_send_wr->send_buf.mad;
 	struct mad_rmpp_recv *rmpp_recv;
 	struct ib_ah_attr ah_attr;
 	unsigned long flags;
 	int newwin = 1;
+	u32 dlid;
 
 	if (!(mad_hdr->method & IB_MGMT_METHOD_RESP))
 		goto out;
@@ -870,7 +874,17 @@ static int init_newwin(struct ib_mad_send_wr_private *mad_send_wr)
 		if (ib_query_ah(mad_send_wr->send_buf.ah, &ah_attr))
 			continue;
 
-		if (rmpp_recv->slid == ah_attr.dlid) {
+		if (rdma_cap_opa_ah(ib_dev, port)) {
+			if ((ah_attr.ah_flags & IB_AH_GRH) &&
+			    (ib_is_opa_gid(&ah_attr.grh.dgid)))
+				dlid = opa_get_lid_from_gid(&ah_attr.grh.dgid);
+			else
+				dlid = OPA_TO_IB_UCAST_LID(ah_attr.dlid);
+		} else {
+			dlid = ah_attr.dlid;
+		}
+
+		if (rmpp_recv->slid == dlid) {
 			newwin = rmpp_recv->repwin;
 			break;
 		}
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 0d4fa0cdf0ab..fbd532652655 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -347,4 +347,16 @@ static inline bool ib_is_opa_gid(union ib_gid *gid)
 		OPA_STL_OUI);
 }
 
+/**
+ * opa_get_lid_from_gid: Returns the last 32 bits of the gid.
+ * OPA devices use one of the gids in the gid table to also
+ * store the lid.
+ *
+ * @gid: The Global identifier
+ */
+static inline u32 opa_get_lid_from_gid(union ib_gid *gid)
+{
+	return be64_to_cpu(gid->global.interface_id) & 0xFFFFFFFF;
+}
+
 #endif /* IB_ADDR_H */
-- 
1.8.2

--
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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox