* [PATCH rdma-core 3/4] glue/redhat: copy stock spec for RH customization
From: Jarod Wilson @ 2016-10-14 19:21 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Jarod Wilson
In-Reply-To: <20161014192136.11731-1-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
We're going to need to do a bit of majorly invasive surgery, and we're not
sure everyone else is going to want to package things this way, so we'll
make a copy of our own spec here, starting from the one in the tree.
Signed-off-by: Jarod Wilson <jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
glue/redhat/rdma-core.spec | 127 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 127 insertions(+)
create mode 100644 glue/redhat/rdma-core.spec
diff --git a/glue/redhat/rdma-core.spec b/glue/redhat/rdma-core.spec
new file mode 100644
index 0000000..609b910
--- /dev/null
+++ b/glue/redhat/rdma-core.spec
@@ -0,0 +1,127 @@
+Name: rdma-core
+Version: 11
+Release: 1%{?dist}
+Summary: RDMA core userspace libraries and daemons
+
+# Almost everything is licensed under the OFA dual GPLv2, 2 Clause BSD license
+# providers/ipathverbs/ Dual licensed using a BSD license with an extra patent clause
+# providers/rxe/ Incorporates code from ipathverbs and contains the patent clause
+# providers/hfi1verbs Uses the 3 Clause BSD license
+License: (GPLv2 or BSD) and (GPLv2 or PathScale-BSD)
+Url: http://openfabrics.org/
+Source: rdma-core-%{version}.tgz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+BuildRequires: binutils
+BuildRequires: cmake >= 2.8.11
+BuildRequires: gcc
+BuildRequires: pkgconfig
+BuildRequires: pkgconfig(libnl-3.0)
+BuildRequires: pkgconfig(libnl-route-3.0)
+BuildRequires: valgrind-devel
+
+# Since we recommend developers use Ninja, so should packagers, for consistency.
+%define CMAKE_FLAGS %{nil}
+%if 0%{?suse_version}
+# SuSE releases have it, and sometime around cmake 3.3.2-1.2 the macros learned to use it.
+BuildRequires: ninja,make
+%define __builder ninja
+# cmake_install,make_jobs is specified by opensuse
+
+# Tumbleweed's cmake RPM macro adds -Wl,--no-undefined to the module flags
+# which is totally inappropriate and breaks building 'ENABLE_EXPORTS' style
+# module libraries (eg ibacmp).
+%define CMAKE_FLAGS -DCMAKE_MODULE_LINKER_FLAGS=""
+%else
+%if 0%{?fedora} >= 23
+# Ninja was introduced in FC23
+BuildRequires: ninja-build
+%define CMAKE_FLAGS -GNinja
+%define make_jobs ninja -v %{?_smp_mflags}
+%define cmake_install DESTDIR=%{buildroot} ninja-build install
+%else
+# Fallback to make otherwise
+BuildRequires: make
+%define make_jobs make -v %{?_smp_mflags}
+%define cmake_install DESTDIR=%{buildroot} make install
+%endif
+%endif
+
+%description
+Temporary packaging
+
+This is a simple example without the split sub packages to get things started.
+
+%prep
+%setup
+
+%build
+
+# Detect if systemd is supported on this system
+%if 0%{?_unitdir:1}
+%define my_unitdir %{_unitdir}
+%else
+%define my_unitdir /tmp/
+%endif
+
+# New RPM defines _rundir, usually as /run
+%if 0%{?_rundir:1}
+%else
+%define _rundir /var/run
+%endif
+
+# Pass all of the rpm paths directly to GNUInstallDirs and our other defines.
+%cmake %{CMAKE_FLAGS} \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_BINDIR:PATH=%{_bindir} \
+ -DCMAKE_INSTALL_SBINDIR:PATH=%{_sbindir} \
+ -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
+ -DCMAKE_INSTALL_LIBEXECDIR:PATH=%{_libexecdir} \
+ -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=%{_localstatedir} \
+ -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=%{_sharedstatedir} \
+ -DCMAKE_INSTALL_INCLUDEDIR:PATH=%{_includedir} \
+ -DCMAKE_INSTALL_INFODIR:PATH=%{_infodir} \
+ -DCMAKE_INSTALL_MANDIR:PATH=%{_mandir} \
+ -DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \
+ -DCMAKE_INSTALL_SYSTEMD_SERVICEDIR:PATH=%{my_unitdir} \
+ -DCMAKE_INSTALL_INITDDIR:PATH=%{_initrddir} \
+ -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir}
+%make_jobs
+
+%install
+%cmake_install
+
+mkdir -p %{buildroot}/%{_docdir}/%{name}-%{version}
+install -m0644 Documentation/{ibacm,ibsrpdm,libibcm,libibverbs,librdmacm,rxe}.md %{buildroot}/%{_docdir}/%{name}-%{version}/
+
+%if 0%{?_unitdir:1}
+rm -rf %{buildroot}/%{_initrddir}/
+%else
+rm -rf %{buildroot}/%{my_unitdir}/
+%endif
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%doc %{_mandir}/man*/*
+%{_bindir}/*
+%{_includedir}/*
+%{_libdir}/lib*.so*
+%{_libdir}/libibverbs/*
+%{_libdir}/ibacm/*
+%{_libdir}/rsocket/*
+%{_sbindir}/*
+%{_libexecdir}/*
+%{_docdir}/%{name}-%{version}/*
+%if 0%{?_unitdir:1}
+%{_unitdir}/*
+%else
+%config %{_initrddir}/*
+%endif
+%config %{_sysconfdir}/iwpmd.conf
+%config %{_sysconfdir}/srp_daemon.conf
+%config %{_sysconfdir}/libibverbs.d/*
+%config %{_sysconfdir}/logrotate.d/srp_daemon
+%{_sysconfdir}/modprobe.d/*
+%config %{_sysconfdir}/rsyslog.d/srp_daemon.conf
--
2.10.0
--
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 rdma-core 4/4] glue/redhat/spec: build split rpm packages
From: Jarod Wilson @ 2016-10-14 19:21 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Jarod Wilson
In-Reply-To: <20161014192136.11731-1-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
We're thinking that the upgrade path for our users will be simpler and
less surprising if we take rdma-core and split out the end result into the
same packages we currently ship in our distributions. End result with this
spec:
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/rdma-core-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/rdma-core-devel-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libibverbs-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libibverbs-utils-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/ibacm-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/iwpmd-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libibcm-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libibumad-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/librdmacm-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/librdmacm-utils-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/srp_daemon-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libcxgb3-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libcxgb4-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libhfi1-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libi40iw-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libipathverbs-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libmlx4-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libmlx5-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libmthca-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libnes-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libocrdma-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/librxe-11-1.el7.x86_64.rpm
Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/rdma-core-debuginfo-11-1.el7.x86_64.rpm
Signed-off-by: Jarod Wilson <jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
glue/redhat/rdma-core.spec | 477 +++++++++++++++++++++++++++++++++++++++++----
1 file changed, 442 insertions(+), 35 deletions(-)
diff --git a/glue/redhat/rdma-core.spec b/glue/redhat/rdma-core.spec
index 609b910..177d78b 100644
--- a/glue/redhat/rdma-core.spec
+++ b/glue/redhat/rdma-core.spec
@@ -7,10 +7,11 @@ Summary: RDMA core userspace libraries and daemons
# providers/ipathverbs/ Dual licensed using a BSD license with an extra patent clause
# providers/rxe/ Incorporates code from ipathverbs and contains the patent clause
# providers/hfi1verbs Uses the 3 Clause BSD license
-License: (GPLv2 or BSD) and (GPLv2 or PathScale-BSD)
+License: GPLv2 or BSD
Url: http://openfabrics.org/
Source: rdma-core-%{version}.tgz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+# https://github.com/linux-rdma/rdma-core
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: binutils
BuildRequires: cmake >= 2.8.11
@@ -19,20 +20,15 @@ BuildRequires: pkgconfig
BuildRequires: pkgconfig(libnl-3.0)
BuildRequires: pkgconfig(libnl-route-3.0)
BuildRequires: valgrind-devel
+BuildRequires: libnl3-devel
+
+# Red Hat/Fedora previously shipped glue/redhat/ as a stand-alone
+# package called 'rdma', which we're supplanting here.
+Provides: rdma = %{version}-%{release}
+Obsoletes: rdma < %{version}-%{release}
# Since we recommend developers use Ninja, so should packagers, for consistency.
%define CMAKE_FLAGS %{nil}
-%if 0%{?suse_version}
-# SuSE releases have it, and sometime around cmake 3.3.2-1.2 the macros learned to use it.
-BuildRequires: ninja,make
-%define __builder ninja
-# cmake_install,make_jobs is specified by opensuse
-
-# Tumbleweed's cmake RPM macro adds -Wl,--no-undefined to the module flags
-# which is totally inappropriate and breaks building 'ENABLE_EXPORTS' style
-# module libraries (eg ibacmp).
-%define CMAKE_FLAGS -DCMAKE_MODULE_LINKER_FLAGS=""
-%else
%if 0%{?fedora} >= 23
# Ninja was introduced in FC23
BuildRequires: ninja-build
@@ -45,12 +41,225 @@ BuildRequires: make
%define make_jobs make -v %{?_smp_mflags}
%define cmake_install DESTDIR=%{buildroot} make install
%endif
+
+%define systemd_dep systemd-units
+%if 0%{?fedora} >= 18
+%define systemd_dep systemd
%endif
%description
-Temporary packaging
+RDMA core userspace infrastructure and documentation.
+
+%package devel
+Summary: RDMA core development libraries and headers
+Provides: libibcm-devel = %{version}-%{release}
+Provides: libibumad-devel = %{version}-%{release}
+Provides: libibverbs-devel = %{version}-%{release}
+Provides: librdmacm-devel = %{version}-%{release}
+
+%description devel
+RDMA core development libraries and headers.
+
+%package -n libibverbs
+Summary: A library for direct userspace use of RDMA (InfiniBand/iWARP) hardware
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+Requires: rdma-core
+
+%description -n libibverbs
+libibverbs is a library that allows userspace processes to use RDMA
+"verbs" as described in the InfiniBand Architecture Specification and
+the RDMA Protocol Verbs Specification. This includes direct hardware
+access from userspace to InfiniBand/iWARP adapters (kernel bypass) for
+fast path operations.
+
+For this library to be useful, a device-specific plug-in module should
+also be installed.
+
+%package -n libibverbs-utils
+Summary: Examples for the libibverbs library
+Requires: libibverbs%{?_isa} = %{version}-%{release}
+Requires: libibverbs-driver.%{_arch}
+
+%description -n libibverbs-utils
+Useful libibverbs example programs such as ibv_devinfo, which
+displays information about RDMA devices.
+
+%package -n ibacm
+Summary: InfiniBand Communication Manager Assistant
+Requires(post): %{systemd_dep}
+Requires(preun): %{systemd_dep}
+Requires(postun): %{systemd_dep}
+Requires: rdma-core
+
+%description -n ibacm
+The ibacm daemon helps reduce the load of managing path record lookups on
+large InfiniBand fabrics by providing a user space implementation of what
+is functionally similar to an ARP cache. The use of ibacm, when properly
+configured, can reduce the SA packet load of a large IB cluster from O(n^2)
+to O(n). The ibacm daemon is started and normally runs in the background,
+user applications need not know about this daemon as long as their app
+uses librdmacm to handle connection bring up/tear down. The librdmacm
+library knows how to talk directly to the ibacm daemon to retrieve data.
+
+%package -n iwpmd
+Summary: iWarp Port Mapper userspace daemon
+Requires(post): %{systemd_dep}
+Requires(preun): %{systemd_dep}
+Requires(postun): %{systemd_dep}
+Requires: rdma-core
+
+%description -n iwpmd
+iwpmd provides a userspace service for iWarp drivers to claim
+tcp ports through the standard socket interface.
+
+%package -n libibcm
+Summary: Userspace InfiniBand Connection Manager
+ExcludeArch: s390 s390x
+Requires: rdma-core
+
+%description -n libibcm
+libibcm provides a userspace library that handles the majority of the low
+level work required to open an RDMA connection between two machines.
+
+%package -n libibumad
+Summary: OpenFabrics Alliance InfiniBand umad (userspace management datagram) library
+Requires: rdma-core
+
+%description -n libibumad
+libibumad provides the userspace management datagram (umad) library
+functions, which sit on top of the umad modules in the kernel. These
+are used by the IB diagnostic and management tools, including OpenSM.
+
+%package -n librdmacm
+Summary: Userspace RDMA Connection Manager
+Requires: rdma-core
+
+%description -n librdmacm
+librdmacm provides a userspace RDMA Communication Managment API.
+
+%package -n librdmacm-utils
+Summary: Examples for the librdmacm library
+Requires: librdmacm%{?_isa} = %{version}-%{release}
+
+%description -n librdmacm-utils
+Example test programs for the librdmacm library.
+
+%package -n srp_daemon
+Summary: Tools for using the InfiniBand SRP protocol devices
+Obsoletes: srptools <= 1.0.3
+Provides: srptools = %{version}-%{release}
+Obsoletes: openib-srptools <= 0.0.6
+Requires(post): %{systemd_dep}
+Requires(preun): %{systemd_dep}
+Requires(postun): %{systemd_dep}
+Requires: rdma-core
+
+%description -n srp_daemon
+In conjunction with the kernel ib_srp driver, srptools allows you to
+discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
+
+%package -n libcxgb3
+Summary: Chelsio T3 iWARP HCA Userspace Driver
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libcxgb3
+Userspace hardware driver for use with the libibverbs InfiniBand/iWARP verbs
+library. This driver enables Chelsio iWARP capable ethernet devices.
+
+%package -n libcxgb4
+Summary: Chelsio T4 iWARP HCA Userspace Driver
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libcxgb4
+Userspace hardware driver for use with the libibverbs InfiniBand/iWARP verbs
+library. This driver enables Chelsio T4 based iWARP capable Ethernet devices.
+
+%package -n libhfi1
+Summary: Intel Omni-Path HFI Userspace Driver
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libhfi1
+libhfi1 provides a device-specific userspace driver for Intel Host
+Fabric interface cards. This driver is designed for use with the
+libibverbs library.
+
+%package -n libi40iw
+Summary: Intel Ethernet Connection X722 RDMA Userspace Library
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libi40iw
+libi40iw provides a device-specific RDMA userspace library for Intel
+Ethernet Connection X722 for use with the libibverbs library.
+
+%package -n libipathverbs
+Summary: QLogic InfiniPath HCA Userspace Driver
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libipathverbs
+QLogic hardware driver for use with libibverbs user space verbs access
+library. This driver supports QLogic InfiniPath based cards.
+
+%package -n libmlx4
+Summary: Mellanox ConnectX-3 InfiniBand HCA Userspace Driver
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libmlx4
+libmlx4 provides a device-specific userspace driver for Mellanox
+ConnectX-3 HCAs for use with the libibverbs library.
+
+%package -n libmlx5
+Summary: Mellanox Connect-IB/X-4+ InfiniBand HCA Userspace Driver
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libmlx5
+bmlx5 provides a device-specific userspace driver for Mellanox
+Connect-IB/X-4+ HCAs for use with the libibverbs library.
+
+%package -n libmthca
+Summary: Mellanox InfiniBand HCA Userspace Driver
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libmthca
+libmthca provides a device-specific userspace driver for Mellanox HCAs
+(MT23108 InfiniHost and MT25208 InfiniHost III Ex) for use with the
+libibverbs library.
-This is a simple example without the split sub packages to get things started.
+%package -n libnes
+Summary: NetEffect RNIC Userspace Driver
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libnes
+Userspace hardware driver for use with the libibverbs InfiniBand/iWARP verbs
+library. This driver enables NetEffect iWARP capable ethernet devices.
+
+%package -n libocrdma
+Summary: Userspace Library for Emulex OneConnect RDMA/RoCE Device
+Provides: libibverbs-driver.%{_arch}
+
+%description -n libocrdma
+libocrdma provides a device-specific userspace driver for Emulex OneConnect
+RDMA/RoCE Adapters for use with the libibverbs library.
+
+%package -n librxe
+Summary: A software implementation of the RoCE protocol
+Provides: libibverbs-driver.%{_arch}
+
+%description -n librxe
+This is a software implementation of the RoCE protocol, which transports the
+full OFED RDMA protocol set (kernel and user mode) over layer 2 Ethernet.
+Infiniband (IB) transport and GRH headers are encapsulated in Ethernet packets
+of ether type 0x8915.
+
+Once a RXE instance has been created, communicating via RXE is the same as
+communicating via any OFED compatible Infiniband HCA, albeit in some cases with
+addressing implications.
+
+In particular, while the use of a GRH header is optional within IB subnets, it
+is mandatory with RoCE. Verbs applications written over IB verbs should work
+seamlessly, but they require provisioning of GRH information when creating address
+vectors. The library and driver are modified to provide for mapping from GID to
+MAC addresses required by the hardware.
%prep
%setup
@@ -91,8 +300,55 @@ This is a simple example without the split sub packages to get things started.
%install
%cmake_install
+mkdir -p %{buildroot}/%{_sysconfdir}/rdma
mkdir -p %{buildroot}/%{_docdir}/%{name}-%{version}
-install -m0644 Documentation/{ibacm,ibsrpdm,libibcm,libibverbs,librdmacm,rxe}.md %{buildroot}/%{_docdir}/%{name}-%{version}/
+install -D -m0644 Documentation/{ibacm,ibsrpdm,libibcm,libibverbs,librdmacm,rxe}.md %{buildroot}/%{_docdir}/%{name}-%{version}/
+install -D -m0644 README.md %{buildroot}/%{_docdir}/%{name}-%{version}/
+
+# Red Hat specific glue
+%global dracutlibdir %{_prefix}/lib/dracut
+%global sysmodprobedir %{_prefix}/lib/modprobe.d
+mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts
+mkdir -p %{buildroot}%{_sysconfdir}/udev/rules.d
+mkdir -p %{buildroot}%{_libexecdir}
+mkdir -p %{buildroot}%{_udevrulesdir}
+mkdir -p %{buildroot}%{dracutlibdir}/modules.d/05rdma
+mkdir -p %{buildroot}%{sysmodprobedir}
+install -D -m0644 glue/redhat/rdma.conf %{buildroot}/%{_sysconfdir}/rdma/rdma.conf
+install -D -m0644 glue/redhat/rdma.sriov-vfs %{buildroot}/%{_sysconfdir}/rdma/sriov-vfs
+install -D -m0644 glue/redhat/rdma.mlx4.conf %{buildroot}/%{_sysconfdir}/rdma/mlx4.conf
+install -D -m0755 glue/redhat/rdma.ifup-ib %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/ifup-ib
+install -D -m0755 glue/redhat/rdma.ifdown-ib %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ib
+install -D -m0644 glue/redhat/rdma.service %{buildroot}%{_unitdir}/rdma.service
+install -D -m0644 glue/redhat/rdma.udev-ipoib-naming.rules %{buildroot}%{_sysconfdir}/udev/rules.d/70-persistent-ipoib.rules
+install -D -m0644 glue/redhat/rdma.mlx4.user.modprobe %{buildroot}%{_sysconfdir}/modprobe.d/mlx4.conf
+install -D -m0755 glue/redhat/rdma.modules-setup.sh %{buildroot}%{dracutlibdir}/modules.d/05rdma/module-setup.sh
+install -D -m0644 glue/redhat/rdma.udev-rules %{buildroot}%{_udevrulesdir}/98-rdma.rules
+install -D -m0644 glue/redhat/rdma.mlx4.sys.modprobe %{buildroot}%{sysmodprobedir}/libmlx4.conf
+install -D -m0644 glue/redhat/rdma.cxgb3.sys.modprobe %{buildroot}%{sysmodprobedir}/cxgb3.conf
+install -D -m0644 glue/redhat/rdma.cxgb4.sys.modprobe %{buildroot}%{sysmodprobedir}/cxgb4.conf
+install -D -m0755 glue/redhat/rdma.kernel-init %{buildroot}%{_libexecdir}/rdma-init-kernel
+install -D -m0755 glue/redhat/rdma.sriov-init %{buildroot}%{_libexecdir}/rdma-set-sriov-vf
+install -D -m0644 glue/redhat/rdma.fixup-mtrr.awk %{buildroot}%{_libexecdir}/rdma-fixup-mtrr.awk
+install -D -m0755 glue/redhat/rdma.mlx4-setup.sh %{buildroot}%{_libexecdir}/mlx4-setup.sh
+
+# ibacm
+%{buildroot}/%{_bindir}/ib_acme -D . -O
+# Fixup a multilib conflict in ibacm_opts.cfg:
+sed -i -e '/^# Specifies the directory of the provider libraries$/ a\
+# Use /usr/lib64/ibacm on 64bit, /usr/lib/libacm on 32bit.
+' -e 's%^\(# provider_lib_path /usr/\)lib\(64\)\?/ibacm$%\1lib64/ibacm%' ibacm_opts.cfg
+install -D -m0644 ibacm_opts.cfg %{buildroot}%{_sysconfdir}/rdma/
+install -D -m0644 glue/redhat/ibacm.service %{buildroot}%{_unitdir}/
+install -D -m0644 ibacm/man/*.1 %{buildroot}/%{_mandir}/man1/
+install -D -m0644 ibacm/man/*.7 %{buildroot}/%{_mandir}/man7/
+sed -e 's|@ACM_PROVIDER_DIR@|%{libdir}/%{name}/|g' -e 's|@CMAKE_INSTALL_FULL_LOCALSTATEDIR@|%{_localstatedir}|g' ibacm/man/ibacm_prov.7.in > %{buildroot}/%{_mandir}/man7/ibacm_prov.7
+
+# iwpmd
+install -D -m0644 glue/redhat/iwpmd.service %{buildroot}%{_unitdir}/
+
+# srp_daemon
+install -D -m0644 glue/redhat/srp_daemon.service %{buildroot}%{_unitdir}/
%if 0%{?_unitdir:1}
rm -rf %{buildroot}/%{_initrddir}/
@@ -103,25 +359,176 @@ rm -rf %{buildroot}/%{my_unitdir}/
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
+%post -n ibacm
+%systemd_post ibacm.service
+
+%preun -n ibacm
+%systemd_preun ibacm.service
+
+%postun -n ibacm
+%systemd_postun_with_restart ibacm.service
+
+%post -n libibcm -p /sbin/ldconfig
+%postun -n libibcm -p /sbin/ldconfig
+
%files
-%doc %{_mandir}/man*/*
-%{_bindir}/*
+%dir %{_sysconfdir}/rdma
+%doc %{_docdir}/%{name}-%{version}/README.md
+%config(noreplace) %{_sysconfdir}/rdma/*
+%config(noreplace) %{_sysconfdir}/udev/rules.d/*
+%config(noreplace) %{_sysconfdir}/modprobe.d/mlx4.conf
+%{_sysconfdir}/sysconfig/network-scripts/*
+%{_unitdir}/rdma.service
+%dir %{dracutlibdir}/modules.d/05rdma
+%{dracutlibdir}/modules.d/05rdma/module-setup.sh
+%{_udevrulesdir}/*
+%{sysmodprobedir}/libmlx4.conf
+%{sysmodprobedir}/cxgb3.conf
+%{sysmodprobedir}/cxgb4.conf
+%{_libexecdir}/rdma-init-kernel
+%{_libexecdir}/rdma-set-sriov-vf
+%{_libexecdir}/rdma-fixup-mtrr.awk
+%{_libexecdir}/mlx4-setup.sh
+%license COPYING.*
+
+%files devel
%{_includedir}/*
-%{_libdir}/lib*.so*
-%{_libdir}/libibverbs/*
+%{_libdir}/lib*.so
+%{_libdir}/rsocket/*.so
+%{_mandir}/man3/ibv_*
+%{_mandir}/man3/rdma*
+%{_mandir}/man3/umad*
+%{_mandir}/man3/*_to_ibv_rate.*
+%{_mandir}/man7/rdma_cm.*
+%{_mandir}/man7/rsocket.*
+
+%files -n libibverbs
+%dir %{_sysconfdir}/libibverbs.d
+%{_libdir}/libibverbs*.so.*
+%dir %{_libdir}/libibverbs
+%doc %{_docdir}/%{name}-%{version}/libibverbs.md
+
+%files -n libibverbs-utils
+%{_bindir}/ibv_*
+%{_mandir}/man1/ibv_*
+
+%files -n ibacm
+%config(noreplace) %{_sysconfdir}/rdma/ibacm_opts.cfg
+%{_bindir}/ib_acme
+%{_sbindir}/ibacm
+%{_mandir}/man1/ibacm.*
+%{_mandir}/man1/ib_acme.*
+%{_mandir}/man7/ibacm.*
+%{_mandir}/man7/ibacm_prov.*
+%{_unitdir}/ibacm.service
+%dir %{_libdir}/ibacm
%{_libdir}/ibacm/*
-%{_libdir}/rsocket/*
-%{_sbindir}/*
-%{_libexecdir}/*
-%{_docdir}/%{name}-%{version}/*
-%if 0%{?_unitdir:1}
-%{_unitdir}/*
-%else
-%config %{_initrddir}/*
-%endif
-%config %{_sysconfdir}/iwpmd.conf
-%config %{_sysconfdir}/srp_daemon.conf
-%config %{_sysconfdir}/libibverbs.d/*
-%config %{_sysconfdir}/logrotate.d/srp_daemon
-%{_sysconfdir}/modprobe.d/*
-%config %{_sysconfdir}/rsyslog.d/srp_daemon.conf
+%doc %{_docdir}/%{name}-%{version}/ibacm.md
+
+%files -n iwpmd
+%{_bindir}/iwpmd
+%{_unitdir}/iwpmd.service
+%config(noreplace) %{_sysconfdir}/iwpmd.conf
+%{_mandir}/man1/iwpmd.*
+%{_mandir}/man5/iwpmd.*
+
+%files -n libibcm
+%{_libdir}/libibcm*.so.*
+%doc %{_docdir}/%{name}-%{version}/libibcm.md
+
+%files -n libibumad
+%{_libdir}/libibumad*.so.*
+
+%files -n librdmacm
+%{_libdir}/librdmacm*.so.*
+%{_libdir}/rsocket/*.so.*
+%doc %{_docdir}/%{name}-%{version}/librdmacm.md
+
+%files -n librdmacm-utils
+%{_bindir}/cmtime
+%{_bindir}/mckey
+%{_bindir}/rcopy
+%{_bindir}/rdma_client
+%{_bindir}/rdma_server
+%{_bindir}/rdma_xclient
+%{_bindir}/rdma_xserver
+%{_bindir}/riostream
+%{_bindir}/rping
+%{_bindir}/rstream
+%{_bindir}/ucmatose
+%{_bindir}/udaddy
+%{_bindir}/udpong
+%{_mandir}/man1/mckey.*
+%{_mandir}/man1/rcopy.*
+%{_mandir}/man1/rdma_client.*
+%{_mandir}/man1/rdma_server.*
+%{_mandir}/man1/rdma_xclient.*
+%{_mandir}/man1/rdma_xserver.*
+%{_mandir}/man1/riostream.*
+%{_mandir}/man1/rping.*
+%{_mandir}/man1/rstream.*
+%{_mandir}/man1/ucmatose.*
+%{_mandir}/man1/udaddy.*
+
+%files -n srp_daemon
+%config(noreplace) %{_sysconfdir}/srp_daemon.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/srp_daemon
+%config(noreplace) %{_sysconfdir}/rsyslog.d/srp_daemon.conf
+%{_unitdir}/srp_daemon.service
+%{_sbindir}/ibsrpdm
+%{_sbindir}/srp_daemon
+%{_sbindir}/srp_daemon.sh
+%{_sbindir}/run_srp_daemon
+%{_mandir}/man1/ibsrpdm.1*
+%{_mandir}/man1/srp_daemon.1*
+%doc %{_docdir}/%{name}-%{version}/ibsrpdm.md
+
+%files -n libcxgb3
+%{_libdir}/libibverbs/libcxgb3-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/cxgb3.driver
+
+%files -n libcxgb4
+%{_libdir}/libibverbs/libcxgb4-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/cxgb4.driver
+
+%files -n libhfi1
+%{_libdir}/libibverbs/libhfi1verbs-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/hfi1verbs.driver
+
+%files -n libi40iw
+%{_libdir}/libibverbs/libi40iw-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/i40iw.driver
+
+%files -n libipathverbs
+%{_libdir}/libibverbs/libipathverbs-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/ipathverbs.driver
+%config(noreplace) %{_sysconfdir}/modprobe.d/truescale.conf
+%{_libexecdir}/truescale-serdes.cmds
+
+%files -n libmlx4
+%{_libdir}/libibverbs/libmlx4-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/mlx4.driver
+
+%files -n libmlx5
+%{_libdir}/libibverbs/libmlx5-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/mlx5.driver
+
+%files -n libmthca
+%{_libdir}/libibverbs/libmthca-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/mthca.driver
+
+%files -n libnes
+%{_libdir}/libibverbs/libnes-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/nes.driver
+
+%files -n libocrdma
+%{_libdir}/libibverbs/libocrdma-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/ocrdma.driver
+
+%files -n librxe
+%{_bindir}/rxe_cfg
+%{_mandir}/man7/rxe*
+%{_mandir}/man8/rxe*
+%{_libdir}/libibverbs/librxe-rdmav2.so
+%config(noreplace) %{_sysconfdir}/libibverbs.d/rxe.driver
+%doc %{_docdir}/%{name}-%{version}/rxe.md
--
2.10.0
--
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
* [PULL REQUEST] Please pull rdma.git (tag for-linus-2)
From: Doug Ledford @ 2016-10-14 20:25 UTC (permalink / raw)
To: Torvalds, Linus, David Miller, linux-rdma
[-- Attachment #1.1: Type: text/plain, Size: 5814 bytes --]
Hi Linus,
This is another isolated pull request. This merge window was the first
where Hauwei had to try and coordinate their patches between their net
driver and their new roce driver (similar to mlx4 and mlx5). They
didn't do horribly, but there were some issues (and we knew that because
they simply didn't know what to do in the beginning). As a result, I
had a set of patches that depended on some patches that normally would
have come to you via Dave's tree. Those patches have been on netdev@
for a while, so I got Dave to give me his approval to send them to you.
As such, the other 29 patches I had behind them are also now ready to
go. This catches the hns and hns-roce drivers up to current, and for
future patches we are working with them to get them up to speed on how
to do joint driver development so that they don't have these sorts of
cross tree dependency issues again. BTW, Dave gave me permission to add
his Acked-by: to the patches against the net tree, but I've had this
branch through 0day (but not linux-next since it was off by itself) and
I didn't want to rebase the series just to add Dave's ack for the 8
patches in the net area, so that's why I've Cc:ed him on the pull
request. Hope that was the right thing to do in that regard.
Here's the boilerplate:
The following changes since commit 528f1deb16e5b82e9fe161ebd8caa5983766f0f0:
IB/hns: Add support of ACPI to the Hisilicon RoCE driver (2016-08-25
10:05:10 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git
tags/for-linus-2
for you to fetch changes up to 1bdab400af5954932714e68ab3df0187a92916cb:
IB/hns: Fix for removal of redundant code (2016-10-03 11:43:15 -0400)
----------------------------------------------------------------
Updates to the hns drivers
- Small patch set for hns net driver that the roce patches depend on
- Various fixes to the hns-roce driver
- Add connection manager support to the hns-roce driver
----------------------------------------------------------------
Daode Huang (6):
net: hns: bug fix about setting coalsecs-usecs to 0
net: hns: add fini_process for v2 napi process
net: hns: delete repeat read fbd num after while
net: hns: fix the bug of forwarding table
net: hns: bug fix about broadcast/multicast packets
net: hns: delete redundant broadcast packet filter process
Kejian Yan (1):
net: hns: fix port not available after testing loopback
Lijun Ou (24):
IB/hns: Register HNS RoCE Driver get_netdev() with IB Core
IB/hns: Add & initialize "node_guid" parameter for RDMA CM
IB/hns: Fix the value of device_cap_flags
IB/hns: Fix two possible bugs for rdma cm
IB/hns: Add phy_port for computing GSI/QPN
IB/hns: Change the logic for allocating uar registers
IB/hns: Fix the bug of rdma cm connecting on user mode
IB/hns: Fix two bugs for rdma cm connecting
IB/hns: Add node_guid definition to the bindings document
IB/hns: Remove unused parameters in some functions
IB/hns: Remove parameters of resize cq
IB/hns: Fix bug of using uninit refcount and free
IB/hns: Simplify function of pd alloc and qp alloc
IB/hns: Remove unused parameter named qp_type
IB/hns: Modify the init of iboe lock
IB/hns: Fix bug of memory leakage for registering user mr
IB/hns: Return bad wr while post send failed
IB/hns: The Ack timeout need a lower limit value
IB/hns: Some items of qpc need to take user param
IB/hns: Validate mtu when modified qp
IB/hns: Cq has not been freed
IB/hns: Update the rq head when modify qp state
IB/hns: Fix the bug when platform_get_resource() exec fail
IB/hns: Delete the redundant lines in hns_roce_v1_m_qp()
Salil (1):
IB/hns: Fix for removal of redundant code
Wei Hu (Xavier) (3):
IB/hns: Fix bug of clear hem
IB/hns: Delete the sqp_start from the structure hns_roce_caps
IB/hns: Optimize code of aeq and ceq interrupt handle and fix the
bug of qpn
lipeng (1):
net: hns: fix port unavailable after hnae_reserve_buffer_map fail
.../bindings/infiniband/hisilicon-hns-roce.txt | 2 +
drivers/infiniband/hw/hns/hns_roce_cq.c | 23 +-
drivers/infiniband/hw/hns/hns_roce_device.h | 18 +-
drivers/infiniband/hw/hns/hns_roce_eq.c | 146 +++++-----
drivers/infiniband/hw/hns/hns_roce_eq.h | 4 +
drivers/infiniband/hw/hns/hns_roce_hem.c | 76 +-----
drivers/infiniband/hw/hns/hns_roce_hem.h | 4 +
drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 293
+++++++++++++++------
drivers/infiniband/hw/hns/hns_roce_hw_v1.h | 9 +
drivers/infiniband/hw/hns/hns_roce_main.c | 36 ++-
drivers/infiniband/hw/hns/hns_roce_mr.c | 3 +
drivers/infiniband/hw/hns/hns_roce_pd.c | 22 +-
drivers/infiniband/hw/hns/hns_roce_qp.c | 67 ++---
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 11 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 13 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h | 2 +
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 10 -
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h | 1 -
drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | 16 ++
drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 4 +
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 107 +++++---
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 7 +
22 files changed, 505 insertions(+), 369 deletions(-)
--
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
* [PULL REQUEST] Please pull rdma.git (tag for-linus)
From: Doug Ledford @ 2016-10-14 20:37 UTC (permalink / raw)
To: Torvalds, Linus, linux-rdma
[-- Attachment #1.1: Type: text/plain, Size: 3983 bytes --]
Hi Linus,
Early on in the merge window I mentioned I had a backlog of new drivers
waiting to be reviewed and that, in addition to the hns-roce driver, I
wanted to get possible a couple more reviewed. I ended up only having
the time to complete one of the additional drivers. During Dave
Miller's pull request this go around, there were a series of 9 patches
to the QLogic qed net driver that add basic support for a paired RoCE
driver. That support is currently not functional because it is missing
the matching RoCE driver in the RDMA subsystem. I managed to finish
that review. However, because it goes against part of Dave's net pull,
and a part that was accepted a day or two after the merge window opened,
to apply cleanly it has to be applied to either the tip of Dave's net
branch, or as I did in this case, I just applied it to your master after
you had taken Dave's pull request. I know this is large for the end of
the merge window, my apologies for that. I have a considerable backlog
of new drivers awaiting review and final approval (still three more even
after the hns-roce and qedr), so I would appreciate it if we could take
this so I can check it off of my list.
Here's the boilerplate:
The following changes since commit e9f8f48bcac6f6dd37ad89ad63d1d1a497332313:
Merge tag 'metag-for-v4.9-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag (2016-10-14
11:11:39 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git
tags/for-linus
for you to fetch changes up to 993d1b52615e1a549e55875c3b74308391672d9f:
qedr: Add events support and register IB device (2016-10-14 15:00:10
-0400)
----------------------------------------------------------------
Merge of the qedr RoCE driver
----------------------------------------------------------------
Ram Amrani (10):
qedr: Add RoCE driver framework
qedr: Add support for RoCE HW init
qedr: Add support for user context verbs
qedr: Add support for PD,PKEY and CQ verbs
qedr: Add support for QP verbs
qedr: Add support for memory registeration verbs
qedr: Add support for data path
qedr: Add LL2 RoCE interface
qedr: Add GSI support
qedr: Add events support and register IB device
drivers/infiniband/Kconfig | 2 +
drivers/infiniband/hw/Makefile | 1 +
drivers/infiniband/hw/qedr/Kconfig | 7 +
drivers/infiniband/hw/qedr/Makefile | 3 +
drivers/infiniband/hw/qedr/main.c | 914 +++++++
drivers/infiniband/hw/qedr/qedr.h | 495 ++++
drivers/infiniband/hw/qedr/qedr_cm.c | 622 +++++
drivers/infiniband/hw/qedr/qedr_cm.h | 61 +
drivers/infiniband/hw/qedr/qedr_hsi.h | 56 +
drivers/infiniband/hw/qedr/qedr_hsi_rdma.h | 748 ++++++
drivers/infiniband/hw/qedr/verbs.c | 3547
++++++++++++++++++++++++++++
drivers/infiniband/hw/qedr/verbs.h | 101 +
drivers/net/ethernet/qlogic/Kconfig | 11 -
include/uapi/linux/pci_regs.h | 3 +
include/uapi/rdma/qedr-abi.h | 106 +
15 files changed, 6666 insertions(+), 11 deletions(-)
create mode 100644 drivers/infiniband/hw/qedr/Kconfig
create mode 100644 drivers/infiniband/hw/qedr/Makefile
create mode 100644 drivers/infiniband/hw/qedr/main.c
create mode 100644 drivers/infiniband/hw/qedr/qedr.h
create mode 100644 drivers/infiniband/hw/qedr/qedr_cm.c
create mode 100644 drivers/infiniband/hw/qedr/qedr_cm.h
create mode 100644 drivers/infiniband/hw/qedr/qedr_hsi.h
create mode 100644 drivers/infiniband/hw/qedr/qedr_hsi_rdma.h
create mode 100644 drivers/infiniband/hw/qedr/verbs.c
create mode 100644 drivers/infiniband/hw/qedr/verbs.h
create mode 100644 include/uapi/rdma/qedr-abi.h
--
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
* Re: [PULL REQUEST] Please pull rdma.git (tag for-linus)
From: Linus Torvalds @ 2016-10-14 20:45 UTC (permalink / raw)
To: Doug Ledford; +Cc: linux-rdma
In-Reply-To: <7c0a013c-6b5a-4031-9fd7-b511b1799528-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Fri, Oct 14, 2016 at 1:37 PM, Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>
> Early on in the merge window I mentioned I had a backlog of new drivers
> waiting to be reviewed and that, in addition to the hns-roce driver, I
> wanted to get possible a couple more reviewed. I ended up only having
> the time to complete one of the additional drivers.
This had better be the last of it, because if it's not, I'm not taking any more.
Getting these kinds of updates on Friday afternoon just before the
weekedn that the merge window is closing is very annoying.
Linus
--
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: [PULL REQUEST] Please pull rdma.git (tag for-linus)
From: Doug Ledford @ 2016-10-14 21:01 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-rdma
In-Reply-To: <CA+55aFw39f5Mu38e6vrot=no8zT8Jaqq86iBJrRyX55UCq=VMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 820 bytes --]
On 10/14/2016 4:45 PM, Linus Torvalds wrote:
> On Fri, Oct 14, 2016 at 1:37 PM, Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>>
>> Early on in the merge window I mentioned I had a backlog of new drivers
>> waiting to be reviewed and that, in addition to the hns-roce driver, I
>> wanted to get possible a couple more reviewed. I ended up only having
>> the time to complete one of the additional drivers.
>
> This had better be the last of it, because if it's not, I'm not taking any more.
>
> Getting these kinds of updates on Friday afternoon just before the
> weekedn that the merge window is closing is very annoying.
>
> Linus
>
Yes, this is it.
--
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
* [PATCH rdma-core 0/8] More warning fixing
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
This batch is on top of the series from Christoph Hellwig, it turns on a few
more useful gcc warnings and fixes the fall out.
Whole batch is here now: https://github.com/linux-rdma/rdma-core/pull/19
Jason Gunthorpe (8):
rdmacm: constify rdma_getaddrinfo public function
Enable -Wwrite-strings
verbs: Use cmake to detect if net/if.h vs netling/route/link.h is
broken
Enable -Wredundant-decls
acm: Fix wrong format attributes for error
acm: Fix format string usage with acm_log
Enable -Wformat=2
Enable -Wshadow
CMakeLists.txt | 55 ++++++++++++++++++++++++++++++++
buildlib/config.h.in | 2 ++
ibacm/include/infiniband/acm_prov.h | 7 +++--
ibacm/prov/acmp/src/acmp.c | 38 ++++++++++++-----------
ibacm/src/acm.c | 25 ++++++++-------
ibacm/src/acm_util.h | 6 ++--
ibacm/src/acme.c | 8 ++---
ibacm/src/parse.c | 2 +-
iwpmd/iwarp_pm.h | 2 +-
iwpmd/iwarp_pm_common.c | 7 +++--
libibverbs/examples/srq_pingpong.c | 1 -
libibverbs/examples/xsrq_pingpong.c | 6 ++--
libibverbs/neigh.c | 8 ++---
libibverbs/sysfs.c | 13 ++++----
libibverbs/verbs.h | 6 ++--
librdmacm/acm.c | 3 +-
librdmacm/addrinfo.c | 14 +++++----
librdmacm/cma.h | 3 +-
librdmacm/examples/cmatose.c | 2 +-
librdmacm/examples/cmtime.c | 4 +--
librdmacm/examples/common.c | 2 +-
librdmacm/examples/common.h | 2 +-
librdmacm/examples/rcopy.c | 2 +-
librdmacm/examples/rdma_client.c | 4 +--
librdmacm/examples/rdma_server.c | 2 +-
librdmacm/examples/rdma_xclient.c | 2 +-
librdmacm/examples/rdma_xserver.c | 2 +-
librdmacm/examples/riostream.c | 36 ++++++++++-----------
librdmacm/examples/rping.c | 2 +-
librdmacm/examples/rstream.c | 52 +++++++++++++++----------------
librdmacm/examples/udaddy.c | 2 +-
librdmacm/examples/udpong.c | 62 ++++++++++++++++++-------------------
librdmacm/man/rdma_getaddrinfo.3 | 6 ++--
librdmacm/preload.c | 2 --
librdmacm/rdma_cma.h | 4 +--
providers/mlx4/mlx4.h | 6 ----
providers/mthca/cq.c | 2 +-
srp_daemon/srp_daemon.c | 29 ++++++++++-------
srp_daemon/srp_daemon.h | 2 +-
39 files changed, 247 insertions(+), 186 deletions(-)
--
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
* [PATCH rdma-core 1/8] rdmacm: constify rdma_getaddrinfo public function
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
In-Reply-To: <1476483257-16308-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Like getaddrinfo most of the arguments should be const.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
librdmacm/acm.c | 3 ++-
librdmacm/addrinfo.c | 14 ++++++++------
librdmacm/cma.h | 3 ++-
librdmacm/man/rdma_getaddrinfo.3 | 6 +++---
librdmacm/rdma_cma.h | 4 ++--
5 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/librdmacm/acm.c b/librdmacm/acm.c
index ad6706b2592e..ccd5494c631d 100644
--- a/librdmacm/acm.c
+++ b/librdmacm/acm.c
@@ -363,7 +363,8 @@ static int ucma_ib_addr(struct sockaddr *addr, socklen_t len)
return len && addr && (addr->sa_family == AF_IB);
}
-void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints)
+void ucma_ib_resolve(struct rdma_addrinfo **rai,
+ const struct rdma_addrinfo *hints)
{
struct acm_msg msg;
struct acm_ep_addr_data *data;
diff --git a/librdmacm/addrinfo.c b/librdmacm/addrinfo.c
index 2c515a257a27..ac346438a6d0 100644
--- a/librdmacm/addrinfo.c
+++ b/librdmacm/addrinfo.c
@@ -45,7 +45,8 @@
static struct rdma_addrinfo nohints;
-static void ucma_convert_to_ai(struct addrinfo *ai, struct rdma_addrinfo *rai)
+static void ucma_convert_to_ai(struct addrinfo *ai,
+ const struct rdma_addrinfo *rai)
{
memset(ai, 0, sizeof(*ai));
if (rai->ai_flags & RAI_PASSIVE)
@@ -141,7 +142,8 @@ static int ucma_convert_in6(int ps, struct sockaddr_ib **dst, socklen_t *dst_len
}
static int ucma_convert_to_rai(struct rdma_addrinfo *rai,
- struct rdma_addrinfo *hints, struct addrinfo *ai)
+ const struct rdma_addrinfo *hints,
+ const struct addrinfo *ai)
{
int ret;
@@ -210,8 +212,8 @@ static int ucma_convert_to_rai(struct rdma_addrinfo *rai,
return ret;
}
-static int ucma_getaddrinfo(char *node, char *service,
- struct rdma_addrinfo *hints,
+static int ucma_getaddrinfo(const char *node, const char *service,
+ const struct rdma_addrinfo *hints,
struct rdma_addrinfo *rai)
{
struct addrinfo ai_hints;
@@ -232,8 +234,8 @@ static int ucma_getaddrinfo(char *node, char *service,
return ret;
}
-int rdma_getaddrinfo(char *node, char *service,
- struct rdma_addrinfo *hints,
+int rdma_getaddrinfo(const char *node, const char *service,
+ const struct rdma_addrinfo *hints,
struct rdma_addrinfo **res)
{
struct rdma_addrinfo *rai;
diff --git a/librdmacm/cma.h b/librdmacm/cma.h
index 1610e178dfdb..6fe786052dff 100644
--- a/librdmacm/cma.h
+++ b/librdmacm/cma.h
@@ -140,7 +140,8 @@ extern int af_ib_support;
void ucma_ib_init(void);
void ucma_ib_cleanup(void);
-void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints);
+void ucma_ib_resolve(struct rdma_addrinfo **rai,
+ const struct rdma_addrinfo *hints);
struct ib_connect_hdr {
uint8_t cma_version;
diff --git a/librdmacm/man/rdma_getaddrinfo.3 b/librdmacm/man/rdma_getaddrinfo.3
index cd819c6cdf42..9e133ffea0a5 100644
--- a/librdmacm/man/rdma_getaddrinfo.3
+++ b/librdmacm/man/rdma_getaddrinfo.3
@@ -5,9 +5,9 @@ rdma_getaddrinfo \- Provides transport independent address translation.
.B "#include <rdma/rdma_cma.h>"
.P
.B "int" rdma_getaddrinfo
-.BI "(char *" node ","
-.BI "char *" service ","
-.BI "struct rdma_addrinfo *" hints ","
+.BI "(const char *" node ","
+.BI "const char *" service ","
+.BI "const struct rdma_addrinfo *" hints ","
.BI "struct rdma_addrinfo **" res ");"
.SH ARGUMENTS
.IP "node" 12
diff --git a/librdmacm/rdma_cma.h b/librdmacm/rdma_cma.h
index 2055665a1496..45c492ab6217 100644
--- a/librdmacm/rdma_cma.h
+++ b/librdmacm/rdma_cma.h
@@ -668,8 +668,8 @@ int rdma_migrate_id(struct rdma_cm_id *id, struct rdma_event_channel *channel);
/**
* rdma_getaddrinfo - RDMA address and route resolution service.
*/
-int rdma_getaddrinfo(char *node, char *service,
- struct rdma_addrinfo *hints,
+int rdma_getaddrinfo(const char *node, const char *service,
+ const struct rdma_addrinfo *hints,
struct rdma_addrinfo **res);
void rdma_freeaddrinfo(struct rdma_addrinfo *res);
--
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 rdma-core 2/8] Enable -Wwrite-strings
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
In-Reply-To: <1476483257-16308-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
The is useful to detect possible writing to read only memory.
The compiler places strings in .rodata so they are unwritable and
are technically const.
Add consts as necessary, no casts were added so this should be safe.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 1 +
ibacm/include/infiniband/acm_prov.h | 4 ++--
ibacm/prov/acmp/src/acmp.c | 2 +-
ibacm/src/acm.c | 8 ++++----
ibacm/src/acm_util.h | 2 +-
ibacm/src/acme.c | 8 ++++----
ibacm/src/parse.c | 2 +-
iwpmd/iwarp_pm.h | 2 +-
iwpmd/iwarp_pm_common.c | 7 ++++---
libibverbs/sysfs.c | 13 +++++++------
librdmacm/examples/cmatose.c | 2 +-
librdmacm/examples/cmtime.c | 4 ++--
librdmacm/examples/common.c | 2 +-
librdmacm/examples/common.h | 2 +-
librdmacm/examples/rcopy.c | 2 +-
librdmacm/examples/rdma_client.c | 4 ++--
librdmacm/examples/rdma_server.c | 2 +-
librdmacm/examples/rdma_xclient.c | 2 +-
librdmacm/examples/rdma_xserver.c | 2 +-
librdmacm/examples/riostream.c | 2 +-
librdmacm/examples/rping.c | 2 +-
librdmacm/examples/rstream.c | 2 +-
librdmacm/examples/udaddy.c | 2 +-
librdmacm/examples/udpong.c | 2 +-
srp_daemon/srp_daemon.c | 29 +++++++++++++++++------------
srp_daemon/srp_daemon.h | 2 +-
26 files changed, 60 insertions(+), 52 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21a93892c858..bede766adf4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -112,6 +112,7 @@ RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WARNINGS
"-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter")
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WMISSING_PROTOTYPES "-Wmissing-prototypes")
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WMISSING_DECLARATIONS "-Wmissing-declarations")
+RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WWRITE_STRINGS "-Wwrite-strings")
# At some point around 5.4 gcc fixed missing-field-initializers to ignore this
# common idiom we use extensively. Since this is a useful warning for
diff --git a/ibacm/include/infiniband/acm_prov.h b/ibacm/include/infiniband/acm_prov.h
index 890e6baeb5e8..00baf582b74e 100644
--- a/ibacm/include/infiniband/acm_prov.h
+++ b/ibacm/include/infiniband/acm_prov.h
@@ -61,7 +61,7 @@ struct acm_address {
struct acm_provider {
size_t size;
uint32_t version;
- char *name;
+ const char *name;
int (*open_device)(const struct acm_device *device,
void **dev_context);
void (*close_device)(void *dev_context);
@@ -113,7 +113,7 @@ acm_alloc_sa_mad(const struct acm_endpoint *endpoint, void *context,
extern void acm_free_sa_mad(struct acm_sa_mad *mad);
extern int acm_send_sa_mad(struct acm_sa_mad *mad);
-extern char * acm_get_opts_file(void);
+extern const char *acm_get_opts_file(void);
extern void acm_increment_counter(int type);
#endif /* ACM_PROV_H */
diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
index d70501aff8e8..9ec7db44b0d1 100644
--- a/ibacm/prov/acmp/src/acmp.c
+++ b/ibacm/prov/acmp/src/acmp.c
@@ -2868,7 +2868,7 @@ static void acmp_set_options(void)
FILE *f;
char s[120];
char opt[32], value[256];
- char *opts_file = acm_get_opts_file();
+ const char *opts_file = acm_get_opts_file();
if (!(f = fopen(opts_file, "r")))
return;
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index 9186677fcc6f..e512939dd765 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -221,9 +221,9 @@ static struct sa_data {
/*
* Service options - may be set through ibacm_opts.cfg file.
*/
-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 const char *acme = IBACM_BIN_PATH "/ib_acme -A";
+static const char *opts_file = ACM_CONF_DIR "/" ACM_OPTS_FILE;
+static const char *addr_file = ACM_CONF_DIR "/" ACM_ADDR_FILE;
static char log_file[128] = IBACM_LOG_FILE;
static int log_level = 0;
static char lock_file[128] = IBACM_PID_FILE;
@@ -292,7 +292,7 @@ int ib_any_gid(union ibv_gid *gid)
return ((gid->global.subnet_prefix | gid->global.interface_id) == 0);
}
-char * acm_get_opts_file(void)
+const char *acm_get_opts_file(void)
{
return opts_file;
}
diff --git a/ibacm/src/acm_util.h b/ibacm/src/acm_util.h
index 5243f8a7e750..055122cbeb86 100644
--- a/ibacm/src/acm_util.h
+++ b/ibacm/src/acm_util.h
@@ -53,6 +53,6 @@ typedef void (*acm_if_iter_cb)(char *ifname, union ibv_gid *gid, uint16_t pkey,
char *ip_str, void *ctx);
int acm_if_iter_sys(acm_if_iter_cb cb, void *ctx);
-char **parse(char *args, int *count);
+char **parse(const char *args, int *count);
#endif /* ACM_IF_H */
diff --git a/ibacm/src/acme.c b/ibacm/src/acme.c
index 6b5b2ecb7f8a..a924dad21089 100644
--- a/ibacm/src/acme.c
+++ b/ibacm/src/acme.c
@@ -44,13 +44,13 @@
#include "libacm.h"
#include "acm_util.h"
-static char *dest_dir = ACM_CONF_DIR;
-static char *addr_file = ACM_ADDR_FILE;
-static char *opts_file = ACM_OPTS_FILE;
+static const char *dest_dir = ACM_CONF_DIR;
+static const char *addr_file = ACM_ADDR_FILE;
+static const char *opts_file = ACM_OPTS_FILE;
static char *dest_addr;
static char *src_addr;
-static char *svc_arg = "localhost";
+static const char *svc_arg = "localhost";
static char *dest_arg;
static char *src_arg;
static char addr_type = 'u';
diff --git a/ibacm/src/parse.c b/ibacm/src/parse.c
index 52e66ab814e3..15aab17f8b0a 100644
--- a/ibacm/src/parse.c
+++ b/ibacm/src/parse.c
@@ -70,7 +70,7 @@ static char *expand(char *basename, char *args, int *str_cnt, int *str_size)
return str_buf;
}
-char **parse(char *args, int *count)
+char **parse(const char *args, int *count)
{
char **ptrs = NULL;
char *str_buf, *cpy, *token, *next;
diff --git a/iwpmd/iwarp_pm.h b/iwpmd/iwarp_pm.h
index 766e34fe03c7..b5a5a457a423 100644
--- a/iwpmd/iwarp_pm.h
+++ b/iwpmd/iwarp_pm.h
@@ -225,7 +225,7 @@ int send_iwpm_nlmsg(int, struct nl_msg *, int);
struct nl_msg *create_iwpm_nlmsg(__u16, int);
-void print_iwpm_sockaddr(struct sockaddr_storage *, char *, __u32);
+void print_iwpm_sockaddr(struct sockaddr_storage *, const char *, __u32);
__be16 get_sockaddr_port(struct sockaddr_storage *sockaddr);
diff --git a/iwpmd/iwarp_pm_common.c b/iwpmd/iwarp_pm_common.c
index ee9d11953018..58b1089a1998 100644
--- a/iwpmd/iwarp_pm_common.c
+++ b/iwpmd/iwarp_pm_common.c
@@ -39,7 +39,7 @@
#endif
/* iwpm config params */
-static char * iwpm_param_names[IWPM_PARAM_NUM] =
+static const char * iwpm_param_names[IWPM_PARAM_NUM] =
{ "nl_sock_rbuf_size" };
static int iwpm_param_vals[IWPM_PARAM_NUM] =
{ 0 };
@@ -609,8 +609,9 @@ int is_wcard_ipaddr(struct sockaddr_storage *search_addr)
* print_iwpm_sockaddr - Print socket address (IP address and Port)
* @sockaddr: socket address to print
* @msg: message to print
- */
-void print_iwpm_sockaddr(struct sockaddr_storage *sockaddr, char *msg, __u32 dbg_flag)
+ */
+void print_iwpm_sockaddr(struct sockaddr_storage *sockaddr, const char *msg,
+ __u32 dbg_flag)
{
struct sockaddr_in6 *sockaddr_v6;
struct sockaddr_in *sockaddr_v4;
diff --git a/libibverbs/sysfs.c b/libibverbs/sysfs.c
index d463241ade08..f45fa1a3614d 100644
--- a/libibverbs/sysfs.c
+++ b/libibverbs/sysfs.c
@@ -42,11 +42,11 @@
#include "ibverbs.h"
-static char *sysfs_path;
+static const char *sysfs_path;
const char *ibv_get_sysfs_path(void)
{
- char *env = NULL;
+ const char *env = NULL;
if (sysfs_path)
return sysfs_path;
@@ -60,12 +60,13 @@ const char *ibv_get_sysfs_path(void)
if (env) {
int len;
+ char *dup;
- sysfs_path = strndup(env, IBV_SYSFS_PATH_MAX);
- len = strlen(sysfs_path);
- while (len > 0 && sysfs_path[len - 1] == '/') {
+ sysfs_path = dup = strndup(env, IBV_SYSFS_PATH_MAX);
+ len = strlen(dup);
+ while (len > 0 && dup[len - 1] == '/') {
--len;
- sysfs_path[len] = '\0';
+ dup[len] = '\0';
}
} else
sysfs_path = "/sys";
diff --git a/librdmacm/examples/cmatose.c b/librdmacm/examples/cmatose.c
index d7bd92d72468..d9b6ca622393 100644
--- a/librdmacm/examples/cmatose.c
+++ b/librdmacm/examples/cmatose.c
@@ -75,7 +75,7 @@ static struct cmatest test;
static int connections = 1;
static int message_size = 100;
static int message_count = 10;
-static char *port = "7471";
+static const char *port = "7471";
static uint8_t set_tos = 0;
static uint8_t tos;
static uint8_t migrate = 0;
diff --git a/librdmacm/examples/cmtime.c b/librdmacm/examples/cmtime.c
index f0b4d0276288..b2a39cedd303 100644
--- a/librdmacm/examples/cmtime.c
+++ b/librdmacm/examples/cmtime.c
@@ -48,7 +48,7 @@
static struct rdma_addrinfo hints, *rai;
static struct rdma_event_channel *channel;
-static char *port = "7471";
+static const char *port = "7471";
static char *dst_addr;
static char *src_addr;
static int timeout = 2000;
@@ -66,7 +66,7 @@ enum step {
STEP_CNT
};
-static char *step_str[] = {
+static const char *step_str[] = {
"create id",
"bind addr",
"resolve addr",
diff --git a/librdmacm/examples/common.c b/librdmacm/examples/common.c
index 09468ce6a03c..8037dd830fa8 100644
--- a/librdmacm/examples/common.c
+++ b/librdmacm/examples/common.c
@@ -47,7 +47,7 @@
int use_rs = 1;
-int get_rdma_addr(char *src, char *dst, char *port,
+int get_rdma_addr(const char *src, const char *dst, const char *port,
struct rdma_addrinfo *hints, struct rdma_addrinfo **rai)
{
struct rdma_addrinfo rai_hints, *res;
diff --git a/librdmacm/examples/common.h b/librdmacm/examples/common.h
index ac2d160b0044..28b977a075e6 100644
--- a/librdmacm/examples/common.h
+++ b/librdmacm/examples/common.h
@@ -78,7 +78,7 @@ enum rs_optimization {
opt_bandwidth
};
-int get_rdma_addr(char *src, char *dst, char *port,
+int get_rdma_addr(const char *src, const char *dst, const char *port,
struct rdma_addrinfo *hints, struct rdma_addrinfo **rai);
void size_str(char *str, size_t ssize, long long size);
diff --git a/librdmacm/examples/rcopy.c b/librdmacm/examples/rcopy.c
index 38f69291b1f5..9ff7ade29261 100644
--- a/librdmacm/examples/rcopy.c
+++ b/librdmacm/examples/rcopy.c
@@ -52,7 +52,7 @@ union rsocket_address {
struct sockaddr_storage storage;
};
-static char *port = "7427";
+static const char *port = "7427";
static char *dst_addr;
static char *dst_file;
static char *src_file;
diff --git a/librdmacm/examples/rdma_client.c b/librdmacm/examples/rdma_client.c
index fd7bbc20aa6a..c27047c5124f 100644
--- a/librdmacm/examples/rdma_client.c
+++ b/librdmacm/examples/rdma_client.c
@@ -36,8 +36,8 @@
#include <rdma/rdma_cma.h>
#include <rdma/rdma_verbs.h>
-static char *server = "127.0.0.1";
-static char *port = "7471";
+static const char *server = "127.0.0.1";
+static const char *port = "7471";
static struct rdma_cm_id *id;
static struct ibv_mr *mr, *send_mr;
diff --git a/librdmacm/examples/rdma_server.c b/librdmacm/examples/rdma_server.c
index 3c7c15e0d318..bcf649febf5f 100644
--- a/librdmacm/examples/rdma_server.c
+++ b/librdmacm/examples/rdma_server.c
@@ -36,7 +36,7 @@
#include <rdma/rdma_cma.h>
#include <rdma/rdma_verbs.h>
-static char *port = "7471";
+static const char *port = "7471";
static struct rdma_cm_id *listen_id, *id;
static struct ibv_mr *mr, *send_mr;
diff --git a/librdmacm/examples/rdma_xclient.c b/librdmacm/examples/rdma_xclient.c
index d86fee1b01ee..3518db95442b 100644
--- a/librdmacm/examples/rdma_xclient.c
+++ b/librdmacm/examples/rdma_xclient.c
@@ -37,7 +37,7 @@
#include <rdma/rdma_cma.h>
#include <rdma/rdma_verbs.h>
-static char *server = "127.0.0.1";
+static const char *server = "127.0.0.1";
static char port[6] = "7471";
static struct rdma_cm_id *id;
diff --git a/librdmacm/examples/rdma_xserver.c b/librdmacm/examples/rdma_xserver.c
index f838e7d5de8b..2fbb4bf5b339 100644
--- a/librdmacm/examples/rdma_xserver.c
+++ b/librdmacm/examples/rdma_xserver.c
@@ -38,7 +38,7 @@
#include <rdma/rdma_cma.h>
#include <rdma/rdma_verbs.h>
-static char *port = "7471";
+static const char *port = "7471";
static struct rdma_cm_id *listen_id, *id;
static struct ibv_mr *mr;
diff --git a/librdmacm/examples/riostream.c b/librdmacm/examples/riostream.c
index bdc1eec04ae8..bd8c60cdcb1d 100644
--- a/librdmacm/examples/riostream.c
+++ b/librdmacm/examples/riostream.c
@@ -88,7 +88,7 @@ static int transfer_size = 1000;
static int transfer_count = 1000;
static int buffer_size, inline_size = 64;
static char test_name[10] = "custom";
-static char *port = "7471";
+static const char *port = "7471";
static char *dst_addr;
static char *src_addr;
static struct timeval start, end;
diff --git a/librdmacm/examples/rping.c b/librdmacm/examples/rping.c
index c248e66aaa83..ad38f6da7096 100644
--- a/librdmacm/examples/rping.c
+++ b/librdmacm/examples/rping.c
@@ -1138,7 +1138,7 @@ static int get_addr(char *dst, struct sockaddr *addr)
return ret;
}
-static void usage(char *name)
+static void usage(const char *name)
{
printf("%s -s [-vVd] [-S size] [-C count] [-a addr] [-p port]\n",
basename(name));
diff --git a/librdmacm/examples/rstream.c b/librdmacm/examples/rstream.c
index 98b9d3f91ecb..59a0d4351ef5 100644
--- a/librdmacm/examples/rstream.c
+++ b/librdmacm/examples/rstream.c
@@ -90,7 +90,7 @@ static int transfer_size = 1000;
static int transfer_count = 1000;
static int buffer_size, inline_size = 64;
static char test_name[10] = "custom";
-static char *port = "7471";
+static const char *port = "7471";
static int keepalive;
static char *dst_addr;
static char *src_addr;
diff --git a/librdmacm/examples/udaddy.c b/librdmacm/examples/udaddy.c
index 5e89ca1e1d75..af0d6f713ed1 100644
--- a/librdmacm/examples/udaddy.c
+++ b/librdmacm/examples/udaddy.c
@@ -72,7 +72,7 @@ static struct cmatest test;
static int connections = 1;
static int message_size = 100;
static int message_count = 10;
-static char *port = "7174";
+static const char *port = "7174";
static uint8_t set_tos = 0;
static uint8_t tos;
static char *dst_addr;
diff --git a/librdmacm/examples/udpong.c b/librdmacm/examples/udpong.c
index 0f44f50e6e88..f8d56073012a 100644
--- a/librdmacm/examples/udpong.c
+++ b/librdmacm/examples/udpong.c
@@ -93,7 +93,7 @@ static int transfer_size = 1000;
static int transfer_count = 1000;
static int buffer_size;
static char test_name[10] = "custom";
-static char *port = "7174";
+static const char *port = "7174";
static char *dst_addr;
static char *src_addr;
static union socket_addr addr;
diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
index 6cb22e4c3f21..e0e550d81ab3 100644
--- a/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon.c
@@ -82,7 +82,7 @@ enum log_dest { log_to_syslog, log_to_stderr };
static int get_lid(struct umad_resources *umad_res, ib_gid_t *gid, uint16_t *lid);
static const int node_table_response_size = 1 << 18;
-static char *sysfs_path = "/sys";
+static const char *sysfs_path = "/sys";
static enum log_dest s_log_dest = log_to_syslog;
static int wakeup_pipe[2] = { -1, -1 };
@@ -152,7 +152,7 @@ static int check_process_uniqueness(struct config_t *conf)
}
static int srpd_sys_read_string(const char *dir_name, const char *file_name,
- char *str, int max_len)
+ char *str, int max_len)
{
char path[256], *s;
int fd, r;
@@ -177,7 +177,8 @@ static int srpd_sys_read_string(const char *dir_name, const char *file_name,
return 0;
}
-static int srpd_sys_read_gid(char *dir_name, char *file_name, uint8_t *gid)
+static int srpd_sys_read_gid(const char *dir_name, const char *file_name,
+ uint8_t *gid)
{
char buf[64], *str, *s;
uint16_t *ugid = (uint16_t *)gid;
@@ -195,7 +196,8 @@ static int srpd_sys_read_gid(char *dir_name, char *file_name, uint8_t *gid)
return 0;
}
-static int srpd_sys_read_uint64(char *dir_name, char *file_name, uint64_t *u)
+static int srpd_sys_read_uint64(const char *dir_name, const char *file_name,
+ uint64_t *u)
{
char buf[32];
int r;
@@ -234,7 +236,7 @@ static void usage(const char *argv0)
}
static int
-check_equal_uint64(char *dir_name, char *attr, uint64_t val)
+check_equal_uint64(char *dir_name, const char *attr, uint64_t val)
{
uint64_t attr_value;
@@ -245,7 +247,7 @@ check_equal_uint64(char *dir_name, char *attr, uint64_t val)
}
static int
-check_equal_uint16(char *dir_name, char *attr, uint16_t val)
+check_equal_uint16(char *dir_name, const char *attr, uint16_t val)
{
uint64_t attr_value;
@@ -309,7 +311,8 @@ void pr_err(const char *fmt, ...)
}
}
-static int check_not_equal_str(char *dir_name, char *attr, char *value)
+static int check_not_equal_str(const char *dir_name, const char *attr,
+ const char *value)
{
const int MAX_ATTR_STRING_LENGTH=64;
@@ -329,7 +332,8 @@ static int check_not_equal_str(char *dir_name, char *attr, char *value)
return 0;
}
-static int check_not_equal_int(char *dir_name, char *attr, int value)
+static int check_not_equal_int(const char *dir_name, const char *attr,
+ int value)
{
const int MAX_ATTR_STRING_LENGTH=64;
@@ -654,12 +658,13 @@ static void initialize_sysfs(void)
env = getenv("SYSFS_PATH");
if (env) {
int len;
+ char *dup;
- sysfs_path = strndup(env, 256);
- len = strlen(sysfs_path);
- while (len > 0 && sysfs_path[len - 1] == '/') {
+ sysfs_path = dup = strndup(env, 256);
+ len = strlen(dup);
+ while (len > 0 && dup[len - 1] == '/') {
--len;
- sysfs_path[len] = '\0';
+ dup[len] = '\0';
}
}
}
diff --git a/srp_daemon/srp_daemon.h b/srp_daemon/srp_daemon.h
index 5d42d51e6d1c..d9d92f10f84c 100644
--- a/srp_daemon/srp_daemon.h
+++ b/srp_daemon/srp_daemon.h
@@ -324,7 +324,7 @@ struct config_t {
int timeout;
int recalc_time;
int print_initiator_ext;
- char *rules_file;
+ const char *rules_file;
struct rule *rules;
int retry_timeout;
int tl_retry_count;
--
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 rdma-core 3/8] verbs: Use cmake to detect if net/if.h vs netling/route/link.h is broken
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
In-Reply-To: <1476483257-16308-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
If not then just use the header directly, otherwise use the work around.
The issue is that old libnl libraries include linux/if.h and the
declarations there conflict with net/if.h. New libraries do not
do this.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 16 ++++++++++++++++
buildlib/config.h.in | 2 ++
libibverbs/neigh.c | 5 +++--
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bede766adf4d..58de78d6cde0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -210,6 +210,18 @@ else()
set(NL_LIBRARIES "")
endif()
+# Older stuff blows up if these headers are included together
+if (NOT NL_KIND EQUAL 0)
+ set(SAFE_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
+ set(CMAKE_REQUIRED_INCLUDES "${NL_INCLUDE_DIRS}")
+ CHECK_C_SOURCE_COMPILES("
+#include <netlink/route/link.h>
+#include <net/if.h>
+ int main(int argc,const char *argv[]) {return 0;}"
+ HAVE_WORKING_IF_H)
+ set(CMAKE_REQUIRED_INCLUDES "${SAFE_CMAKE_REQUIRED_INCLUDES}")
+endif()
+
# Statically determine sizeof(long), this is largely unnecessary, no new code
# should rely on this.
check_type_size("long" SIZEOF_LONG BUILTIN_TYPES_ONLY LANGUAGE C)
@@ -325,6 +337,10 @@ if (NL_KIND EQUAL 1)
endif()
if (NL_KIND EQUAL 0)
message(STATUS " neighbour resolution NOT enabled")
+else()
+ if (NOT HAVE_WORKING_IF_H)
+ message(STATUS " netlink/route/link.h and net/if.h NOT co-includable (old headers)")
+ endif()
endif()
if (NOT HAVE_RDMA_USER_RXE)
message(STATUS " rdma/rdma_user_rxe.h NOT found (old system kernel headers)")
diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index 99103b779baf..23781807bce8 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -31,6 +31,8 @@
// 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
+#cmakedefine HAVE_WORKING_IF_H 1
+
@SIZEOF_LONG_CODE@
#if @NL_KIND@ == 3
diff --git a/libibverbs/neigh.c b/libibverbs/neigh.c
index 5acfcf06fcde..67a83eb0fd27 100644
--- a/libibverbs/neigh.c
+++ b/libibverbs/neigh.c
@@ -20,10 +20,11 @@
#include <ifaddrs.h>
#include <netdb.h>
#include <assert.h>
-#ifndef _LINUX_IF_H
+#if HAVE_WORKING_IF_H
#include <net/if.h>
#else
-/*Workaround when there's a collision between the includes */
+/* We need this decl from net/if.h but old systems do not let use co-include
+ net/if.h and netlink/route/link.h */
extern unsigned int if_nametoindex(__const char *__ifname) __THROW;
#endif
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH rdma-core 4/8] Enable -Wredundant-decls
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
In-Reply-To: <1476483257-16308-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
This is useful to detect possible confusion/mistakes around function
prototypes.
Old libnl includes such a mistake so this warning is only turned on with
new distros.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 20 ++++++++++++++++++++
ibacm/src/acm_util.h | 4 ++--
libibverbs/neigh.c | 3 ---
librdmacm/preload.c | 2 --
providers/mlx4/mlx4.h | 6 ------
5 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58de78d6cde0..bd58a7039618 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,6 +269,23 @@ endif()
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WSTRICT_PROTOTYPES "-Wstrict-prototypes")
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WOLD_STYLE_DEFINITION "-Wold-style-definition")
+# Old versions of libnl have a duplicated rtnl_route_put, disbale the warning on those
+# systems
+if (NOT NL_KIND EQUAL 0)
+ set(SAFE_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
+ set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ set(CMAKE_REQUIRED_INCLUDES "${NL_INCLUDE_DIRS}")
+ set(CMAKE_REQUIRED_FLAGS "-Wredundant-decls")
+ CHECK_C_SOURCE_COMPILES("
+ #include <netlink/route/route.h>
+ int main(int argc,const char *argv[]) { return 0; }"
+ HAVE_C_WREDUNDANT_DECLS
+ FAIL_REGEX "warning")
+ set(CMAKE_REQUIRED_INCLUDES "${SAFE_CMAKE_REQUIRED_INCLUDES}")
+ set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+endif()
+RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WREDUNDANT_DECLS "-Wredundant-decls")
+
#-------------------------
# Build Prep
# Write out a git ignore file to the build directory if it isn't the source
@@ -354,3 +371,6 @@ endif()
if (NOT HAVE_C_WORKING_MISSING_FIELD_INITIALIZERS)
message(STATUS " -Wmissing-field-initializers does NOT work")
endif()
+if (NOT HAVE_C_WREDUNDANT_DECLS)
+ message(STATUS " -Wredundant-decls does NOT work")
+endif()
diff --git a/ibacm/src/acm_util.h b/ibacm/src/acm_util.h
index 055122cbeb86..a83d915f13e8 100644
--- a/ibacm/src/acm_util.h
+++ b/ibacm/src/acm_util.h
@@ -31,17 +31,17 @@
#define ACM_IF_H
#include <infiniband/verbs.h>
+#include <infiniband/acm_prov.h>
#ifdef ACME_PRINTS
+#undef acm_log
#define acm_log(level, format, ...) \
printf(format, ## __VA_ARGS__)
#else /* !ACME_PRINTS */
#define acm_log(level, format, ...) \
acm_write(level, "%s: "format, __func__, ## __VA_ARGS__)
-
-void acm_write(int level, const char *format, ...);
#endif /* ACME_PRINTS */
int acm_if_is_ib(char *ifname);
diff --git a/libibverbs/neigh.c b/libibverbs/neigh.c
index 67a83eb0fd27..1856aab74842 100644
--- a/libibverbs/neigh.c
+++ b/libibverbs/neigh.c
@@ -36,9 +36,6 @@ extern unsigned int if_nametoindex(__const char *__ifname) __THROW;
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
-/* Workaround - declaration missing */
-extern int rtnl_link_vlan_get_id(struct rtnl_link *);
-
#ifndef HAVE_LIBNL1
#include <netlink/route/link/vlan.h>
#endif
diff --git a/librdmacm/preload.c b/librdmacm/preload.c
index cf258bf8eb3a..c924f499b7c7 100644
--- a/librdmacm/preload.c
+++ b/librdmacm/preload.c
@@ -132,8 +132,6 @@ struct config_entry {
static struct config_entry *config;
static int config_cnt;
-extern char *program_invocation_short_name;
-
static void free_config(void)
{
diff --git a/providers/mlx4/mlx4.h b/providers/mlx4/mlx4.h
index a2d39e169c15..b851e953c36b 100644
--- a/providers/mlx4/mlx4.h
+++ b/providers/mlx4/mlx4.h
@@ -85,12 +85,6 @@ struct mlx4_xsrq_table {
int mask;
};
-void mlx4_init_xsrq_table(struct mlx4_xsrq_table *xsrq_table, int size);
-struct mlx4_srq *mlx4_find_xsrq(struct mlx4_xsrq_table *xsrq_table, uint32_t srqn);
-int mlx4_store_xsrq(struct mlx4_xsrq_table *xsrq_table, uint32_t srqn,
- struct mlx4_srq *srq);
-void mlx4_clear_xsrq(struct mlx4_xsrq_table *xsrq_table, uint32_t srqn);
-
enum {
MLX4_XRC_QPN_BIT = (1 << 23)
};
--
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 rdma-core 5/8] acm: Fix wrong format attributes for error
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
In-Reply-To: <1476483257-16308-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
The arguments were swapped, and totally crash-when-run wrong.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
ibacm/src/acm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index e512939dd765..523b78082ff8 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2483,7 +2483,7 @@ static void acm_open_dev(struct ibv_device *ibdev)
ret = ibv_query_device(verbs, &attr);
if (ret) {
- acm_log(0, "ERROR - ibv_query_device (%s) %d\n", ret, ibdev->name);
+ acm_log(0, "ERROR - ibv_query_device (%d) %s\n", ret, ibdev->name);
goto err1;
}
--
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 rdma-core 6/8] acm: Fix format string usage with acm_log
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
In-Reply-To: <1476483257-16308-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Enable format string checking for acm_write and clean up everything.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
ibacm/include/infiniband/acm_prov.h | 3 ++-
ibacm/prov/acmp/src/acmp.c | 26 ++++++++++++++------------
ibacm/src/acm.c | 15 ++++++++-------
3 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/ibacm/include/infiniband/acm_prov.h b/ibacm/include/infiniband/acm_prov.h
index 00baf582b74e..adfcf8162b8c 100644
--- a/ibacm/include/infiniband/acm_prov.h
+++ b/ibacm/include/infiniband/acm_prov.h
@@ -85,7 +85,8 @@ int provider_query(struct acm_provider **info, uint32_t *version);
/* Functions exported from core */
#define acm_log(level, format, ...) \
acm_write(level, "%s: "format, __func__, ## __VA_ARGS__)
-extern void acm_write(int level, const char *format, ...);
+extern void acm_write(int level, const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
extern void acm_format_name(int level, char *name, size_t name_size,
uint8_t addr_type, const uint8_t *addr, size_t addr_size);
diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
index 9ec7db44b0d1..fd579dff9d4e 100644
--- a/ibacm/prov/acmp/src/acmp.c
+++ b/ibacm/prov/acmp/src/acmp.c
@@ -55,6 +55,7 @@
#include <netinet/in.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
+#include <inttypes.h>
#include "acm_util.h"
#include "acm_mad.h"
@@ -383,7 +384,7 @@ acmp_acquire_dest(struct acmp_ep *ep, uint8_t addr_type, const uint8_t *addr)
acmp_remove_dest(ep, dest);
dest = NULL;
} else {
- acm_log(2, "Record valid for the next %ld minute(s)\n",
+ acm_log(2, "Record valid for the next %" PRId64 " minute(s)\n",
rec_expr_minutes);
}
}
@@ -411,7 +412,7 @@ static struct acmp_request *acmp_alloc_req(uint64_t id, struct acm_msg *msg)
req->id = id;
memcpy(&req->msg, msg, sizeof(req->msg));
- acm_log(2, "id %llu, req %p\n", id, req);
+ acm_log(2, "id %" PRIu64 ", req %p\n", id, req);
return req;
}
@@ -935,7 +936,7 @@ acmp_resolve_response(uint64_t id, struct acm_msg *req_msg,
{
struct acm_msg msg;
- acm_log(2, "client %lld, status 0x%x\n", id, status);
+ acm_log(2, "client %" PRIu64 ", status 0x%x\n", id, status);
memset(&msg, 0, sizeof msg);
if (dest) {
@@ -981,7 +982,7 @@ acmp_complete_queued_req(struct acmp_dest *dest, uint8_t status)
req = container_of(entry, struct acmp_request, entry);
lock_release(&dest->lock);
- acm_log(2, "completing request, client %d\n", req->id);
+ acm_log(2, "completing request, client %" PRIu64 "\n", req->id);
acmp_resolve_response(req->id, &req->msg, dest, status);
acmp_free_req(req);
@@ -1016,7 +1017,8 @@ acmp_dest_sa_resp(struct acm_sa_mad *mad)
acmp_init_path_av(dest->ep->port, dest);
dest->addr_timeout = time_stamp_min() + (unsigned) addr_timeout;
dest->route_timeout = time_stamp_min() + (unsigned) route_timeout;
- acm_log(2, "timeout addr %llu route %llu\n", dest->addr_timeout, dest->route_timeout);
+ acm_log(2, "timeout addr %" PRIu64 " route %" PRIu64 "\n",
+ dest->addr_timeout, dest->route_timeout);
dest->state = ACMP_READY;
} else {
dest->state = ACMP_INIT;
@@ -1726,7 +1728,7 @@ static uint8_t acmp_queue_req(struct acmp_dest *dest, uint64_t id, struct acm_ms
{
struct acmp_request *req;
- acm_log(2, "id %llu\n", id);
+ acm_log(2, "id %" PRIu64 "\n", id);
req = acmp_alloc_req(id, msg);
if (!req) {
return ACM_STATUS_ENOMEM;
@@ -2446,8 +2448,8 @@ static struct acmp_port *acmp_get_port(struct acm_endpoint *endpoint)
struct acmp_device *dev;
DLIST_ENTRY *dev_entry;
- acm_log(1, "dev 0x%llx port %d pkey 0x%x\n",
- endpoint->port->dev->dev_guid, endpoint->port->port_num,
+ acm_log(1, "dev 0x%" PRIx64 " port %d pkey 0x%x\n",
+ endpoint->port->dev->dev_guid, endpoint->port->port_num,
endpoint->pkey);
for (dev_entry = acmp_dev_list.Next; dev_entry != &acmp_dev_list;
dev_entry = dev_entry->Next) {
@@ -2466,7 +2468,7 @@ acmp_get_ep(struct acmp_port *port, struct acm_endpoint *endpoint)
struct acmp_ep *ep;
DLIST_ENTRY *entry;
- acm_log(1, "dev 0x%llx port %d pkey 0x%x\n",
+ acm_log(1, "dev 0x%" PRIx64 " port %d pkey 0x%x\n",
endpoint->port->dev->dev_guid, endpoint->port->port_num, endpoint->pkey);
for (entry = port->ep_list.Next; entry != &port->ep_list;
entry = entry->Next) {
@@ -2769,7 +2771,7 @@ static int acmp_open_dev(const struct acm_device *device, void **dev_context)
DLIST_ENTRY *dev_entry;
struct ibv_context *verbs;
- acm_log(1, "dev_guid 0x%llx %s\n", device->dev_guid,
+ acm_log(1, "dev_guid 0x%" PRIx64 " %s\n", device->dev_guid,
device->verbs->device->name);
for (dev_entry = acmp_dev_list.Next; dev_entry != &acmp_dev_list;
@@ -2777,7 +2779,7 @@ static int acmp_open_dev(const struct acm_device *device, void **dev_context)
dev = container_of(dev_entry, struct acmp_device, entry);
if (dev->guid == device->dev_guid) {
- acm_log(2, "dev_guid 0x%llx already exits\n",
+ acm_log(2, "dev_guid 0x%" PRIx64 " already exits\n",
device->dev_guid);
*dev_context = dev;
dev->device = device;
@@ -2859,7 +2861,7 @@ static void acmp_close_dev(void *dev_context)
{
struct acmp_device *dev = dev_context;
- acm_log(1, "dev_guid 0x%llx\n", dev->device->dev_guid);
+ acm_log(1, "dev_guid 0x%" PRIx64 "\n", dev->device->dev_guid);
dev->device = NULL;
}
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index 523b78082ff8..befe94203dd3 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -62,6 +62,7 @@
#include <rdma/ib_user_sa.h>
#endif
#include <poll.h>
+#include <inttypes.h>
#include "acm_mad.h"
#include "acm_util.h"
#ifdef HAVE_NETLINK
@@ -1471,7 +1472,7 @@ static int acm_nl_parse_path_attr(struct nlattr *attr,
case LS_NLA_TYPE_SERVICE_ID:
sid = (uint64_t *) NLA_DATA(attr);
if (NLA_LEN(attr) == sizeof(*sid)) {
- acm_log(2, "service_id 0x%llx\n", *sid);
+ acm_log(2, "service_id 0x%" PRIx64 "\n", *sid);
path->service_id = htonll(*sid);
} else {
ret = -1;
@@ -2207,7 +2208,7 @@ static void acm_port_get_gid_tbl(struct acmc_port *port)
&port->gid_tbl[j]);
if (ret || !port->gid_tbl[j].global.interface_id)
break;
- acm_log(2, "guid %d: 0x%llx %llx\n", j,
+ acm_log(2, "guid %d: 0x%" PRIx64 " %" PRIx64 "\n", j,
port->gid_tbl[j].global.subnet_prefix,
port->gid_tbl[j].global.interface_id);
}
@@ -2577,8 +2578,8 @@ static void acm_load_prov_config(void)
continue;
}
prefix = strtoull(p, NULL, 0);
- acm_log(2, "provider %s subnet_prefix 0x%llx\n", prov_name,
- prefix);
+ acm_log(2, "provider %s subnet_prefix 0x%" PRIx64 "\n",
+ prov_name, prefix);
/* Convert it into network byte order */
prefix = htonll(prefix);
@@ -2667,8 +2668,8 @@ static int acm_open_providers(void)
if (version != ACM_PROV_VERSION ||
provider->size != sizeof(struct acm_provider)) {
- acm_log(0, "Error -unmatched provider version 0x%08x (size %d)"
- " core 0x%08x (size %d)\n", version, provider->size,
+ acm_log(0, "Error -unmatched provider version 0x%08x (size %zd)"
+ " core 0x%08x (size %zd)\n", version, provider->size,
ACM_PROV_VERSION, sizeof(struct acm_provider));
dlclose(handle);
continue;
@@ -2863,7 +2864,7 @@ static void acmc_recv_mad(struct acmc_port *port)
}
hdr = &resp.sa_mad.mad_hdr;
- acm_log(2, "bv %x cls %x cv %x mtd %x st %d tid %llx at %x atm %x\n",
+ acm_log(2, "bv %x cls %x cv %x mtd %x st %d tid %" PRIx64 "x at %x atm %x\n",
hdr->base_version, hdr->mgmt_class, hdr->class_version,
hdr->method, hdr->status, hdr->tid, hdr->attr_id, hdr->attr_mod);
found = 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 rdma-core 7/8] Enable -Wformat=2
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
In-Reply-To: <1476483257-16308-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
This is useful to detect functions that are handling format strings but
not marked with __attribute__(format), as well as other sorts
for format related mistakes.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd58a7039618..8f21ba384c12 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,6 +113,7 @@ RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WARNINGS
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WMISSING_PROTOTYPES "-Wmissing-prototypes")
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WMISSING_DECLARATIONS "-Wmissing-declarations")
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WWRITE_STRINGS "-Wwrite-strings")
+RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WFORMAT_2 "-Wformat=2")
# At some point around 5.4 gcc fixed missing-field-initializers to ignore this
# common idiom we use extensively. Since this is a useful warning for
--
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 rdma-core 8/8] Enable -Wshadow
From: Jason Gunthorpe @ 2016-10-14 22:14 UTC (permalink / raw)
To: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Christoph Hellwig, Sean Hefty
In-Reply-To: <1476483257-16308-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Having multiple objects with the same name in the same scope is
almost always confusing. Make some trivial changes to avoid those
few cases.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 17 +++++++++++
ibacm/prov/acmp/src/acmp.c | 10 +++----
libibverbs/examples/srq_pingpong.c | 1 -
libibverbs/examples/xsrq_pingpong.c | 6 ++--
libibverbs/verbs.h | 6 ++--
librdmacm/examples/riostream.c | 34 ++++++++++-----------
librdmacm/examples/rstream.c | 50 +++++++++++++++----------------
librdmacm/examples/udpong.c | 60 ++++++++++++++++++-------------------
providers/mthca/cq.c | 2 +-
9 files changed, 101 insertions(+), 85 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f21ba384c12..375859d04914 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,6 +115,20 @@ RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WMISSING_DECLARATIONS "-Wmissing-declarati
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WWRITE_STRINGS "-Wwrite-strings")
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WFORMAT_2 "-Wformat=2")
+# At some point after 4.4 gcc fixed shadow to ignore function vs variable
+# conflicts
+set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ set(CMAKE_REQUIRED_FLAGS "-Wshadow")
+CHECK_C_SOURCE_COMPILES("
+ #include <unistd.h>
+ int main(int argc,const char *argv[]) { int access = 1; return access; }"
+ HAVE_C_WORKING_SHADOW
+ FAIL_REGEX "warning")
+if (HAVE_C_WORKING_SHADOW)
+ RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WORKING_SHADOW "-Wshadow")
+endif()
+set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+
# At some point around 5.4 gcc fixed missing-field-initializers to ignore this
# common idiom we use extensively. Since this is a useful warning for
# developers try and leave it on if the compiler supports it.
@@ -372,6 +386,9 @@ endif()
if (NOT HAVE_C_WORKING_MISSING_FIELD_INITIALIZERS)
message(STATUS " -Wmissing-field-initializers does NOT work")
endif()
+if (NOT HAVE_C_WORKING_SHADOW)
+ message(STATUS " -Wshadow does NOT work")
+endif()
if (NOT HAVE_C_WREDUNDANT_DECLS)
message(STATUS " -Wredundant-decls does NOT work")
endif()
diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
index fd579dff9d4e..806320ffffd5 100644
--- a/ibacm/prov/acmp/src/acmp.c
+++ b/ibacm/prov/acmp/src/acmp.c
@@ -252,7 +252,7 @@ static struct acm_provider def_prov = {
static DLIST_ENTRY acmp_dev_list;
static lock_t acmp_dev_lock;
-static atomic_t tid;
+static atomic_t g_tid;
static DLIST_ENTRY timeout_list;
static event_t timeout_event;
static atomic_t wait_cnt;
@@ -787,7 +787,7 @@ static void acmp_init_path_query(struct ib_sa_mad *mad)
mad->mgmt_class = IB_MGMT_CLASS_SA;
mad->class_version = 2;
mad->method = IB_METHOD_GET;
- mad->tid = htonll((uint64_t) atomic_inc(&tid));
+ mad->tid = htonll((uint64_t) atomic_inc(&g_tid));
mad->attr_id = IB_SA_ATTR_PATH_REC;
}
@@ -1378,7 +1378,7 @@ static void acmp_init_join(struct ib_sa_mad *mad, union ibv_gid *port_gid,
mad->mgmt_class = IB_MGMT_CLASS_SA;
mad->class_version = 2;
mad->method = IB_METHOD_SET;
- mad->tid = htonll((uint64_t) atomic_inc(&tid));
+ mad->tid = htonll((uint64_t) atomic_inc(&g_tid));
mad->attr_id = IB_SA_ATTR_MC_MEMBER_REC;
mad->comp_mask =
IB_COMP_MASK_MC_MGID | IB_COMP_MASK_MC_PORT_GID |
@@ -1703,7 +1703,7 @@ acmp_send_resolve(struct acmp_ep *ep, struct acmp_dest *dest,
mad->class_version = 1;
mad->method = IB_METHOD_GET;
mad->control = ACM_CTRL_RESOLVE;
- mad->tid = htonll((uint64_t) atomic_inc(&tid));
+ mad->tid = htonll((uint64_t) atomic_inc(&g_tid));
rec = (struct acm_resolve_rec *) mad->data;
rec->src_type = (uint8_t) saddr->type;
@@ -2948,7 +2948,7 @@ static void __attribute__((constructor)) acmp_init(void)
acmp_log_options();
- atomic_init(&tid);
+ atomic_init(&g_tid);
atomic_init(&wait_cnt);
DListInit(&acmp_dev_list);
lock_init(&acmp_dev_lock);
diff --git a/libibverbs/examples/srq_pingpong.c b/libibverbs/examples/srq_pingpong.c
index e2993bfdacbf..30d81f0e4f31 100644
--- a/libibverbs/examples/srq_pingpong.c
+++ b/libibverbs/examples/srq_pingpong.c
@@ -770,7 +770,6 @@ int main(int argc, char *argv[])
return 1;
}
} else {
- int i;
for (i = 0; dev_list[i]; ++i)
if (!strcmp(ibv_get_device_name(dev_list[i]), ib_devname))
break;
diff --git a/libibverbs/examples/xsrq_pingpong.c b/libibverbs/examples/xsrq_pingpong.c
index b90f0eb7e27f..5fb8827579dd 100644
--- a/libibverbs/examples/xsrq_pingpong.c
+++ b/libibverbs/examples/xsrq_pingpong.c
@@ -456,13 +456,13 @@ static int recv_remote_dest(int sockfd, int index)
return 0;
}
-static void set_ah_attr(struct ibv_ah_attr *attr, struct pingpong_context *ctx,
+static void set_ah_attr(struct ibv_ah_attr *attr, struct pingpong_context *myctx,
int index)
{
attr->is_global = 1;
attr->grh.hop_limit = 5;
- attr->grh.dgid = ctx->rem_dest[index].gid;
- attr->grh.sgid_index = ctx->gidx;
+ attr->grh.dgid = myctx->rem_dest[index].gid;
+ attr->grh.sgid_index = myctx->gidx;
}
static int connect_qps(int index)
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index e994c21c267f..a2ccaaf141ab 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -1459,9 +1459,9 @@ static inline struct verbs_context *verbs_get_ctx(struct ibv_context *ctx)
}
#define verbs_get_ctx_op(ctx, op) ({ \
- struct verbs_context *vctx = verbs_get_ctx(ctx); \
- (!vctx || (vctx->sz < sizeof(*vctx) - offsetof(struct verbs_context, op)) || \
- !vctx->op) ? NULL : vctx; })
+ struct verbs_context *__vctx = verbs_get_ctx(ctx); \
+ (!__vctx || (__vctx->sz < sizeof(*__vctx) - offsetof(struct verbs_context, op)) || \
+ !__vctx->op) ? NULL : __vctx; })
#define verbs_set_ctx_op(_vctx, op, ptr) ({ \
struct verbs_context *vctx = _vctx; \
diff --git a/librdmacm/examples/riostream.c b/librdmacm/examples/riostream.c
index bd8c60cdcb1d..d9e5fd6eb0a6 100644
--- a/librdmacm/examples/riostream.c
+++ b/librdmacm/examples/riostream.c
@@ -317,35 +317,35 @@ out:
return ret;
}
-static void set_options(int rs)
+static void set_options(int fd)
{
int val;
if (buffer_size) {
- rsetsockopt(rs, SOL_SOCKET, SO_SNDBUF, (void *) &buffer_size,
+ rsetsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *) &buffer_size,
sizeof buffer_size);
- rsetsockopt(rs, SOL_SOCKET, SO_RCVBUF, (void *) &buffer_size,
+ rsetsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *) &buffer_size,
sizeof buffer_size);
} else {
val = 1 << 19;
- rsetsockopt(rs, SOL_SOCKET, SO_SNDBUF, (void *) &val, sizeof val);
- rsetsockopt(rs, SOL_SOCKET, SO_RCVBUF, (void *) &val, sizeof val);
+ rsetsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *) &val, sizeof val);
+ rsetsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *) &val, sizeof val);
}
val = 1;
- rsetsockopt(rs, IPPROTO_TCP, TCP_NODELAY, (void *) &val, sizeof(val));
- rsetsockopt(rs, SOL_RDMA, RDMA_IOMAPSIZE, (void *) &val, sizeof val);
+ rsetsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void *) &val, sizeof(val));
+ rsetsockopt(fd, SOL_RDMA, RDMA_IOMAPSIZE, (void *) &val, sizeof val);
if (flags & MSG_DONTWAIT)
- rfcntl(rs, F_SETFL, O_NONBLOCK);
+ rfcntl(fd, F_SETFL, O_NONBLOCK);
/* Inline size based on experimental data */
if (optimization == opt_latency) {
- rsetsockopt(rs, SOL_RDMA, RDMA_INLINE, &inline_size,
+ rsetsockopt(fd, SOL_RDMA, RDMA_INLINE, &inline_size,
sizeof inline_size);
} else if (optimization == opt_bandwidth) {
val = 0;
- rsetsockopt(rs, SOL_RDMA, RDMA_INLINE, &val, sizeof val);
+ rsetsockopt(fd, SOL_RDMA, RDMA_INLINE, &val, sizeof val);
}
}
@@ -555,10 +555,10 @@ free:
return ret;
}
-static int set_test_opt(char *optarg)
+static int set_test_opt(const char *arg)
{
- if (strlen(optarg) == 1) {
- switch (optarg[0]) {
+ if (strlen(arg) == 1) {
+ switch (arg[0]) {
case 'a':
use_async = 1;
break;
@@ -575,13 +575,13 @@ static int set_test_opt(char *optarg)
return -1;
}
} else {
- if (!strncasecmp("async", optarg, 5)) {
+ if (!strncasecmp("async", arg, 5)) {
use_async = 1;
- } else if (!strncasecmp("block", optarg, 5)) {
+ } else if (!strncasecmp("block", arg, 5)) {
flags = (flags & ~MSG_DONTWAIT) | MSG_WAITALL;
- } else if (!strncasecmp("nonblock", optarg, 8)) {
+ } else if (!strncasecmp("nonblock", arg, 8)) {
flags |= MSG_DONTWAIT;
- } else if (!strncasecmp("verify", optarg, 6)) {
+ } else if (!strncasecmp("verify", arg, 6)) {
verify = 1;
} else {
return -1;
diff --git a/librdmacm/examples/rstream.c b/librdmacm/examples/rstream.c
index 59a0d4351ef5..14799c997128 100644
--- a/librdmacm/examples/rstream.c
+++ b/librdmacm/examples/rstream.c
@@ -255,62 +255,62 @@ out:
return ret;
}
-static void set_keepalive(int rs)
+static void set_keepalive(int fd)
{
int optval;
socklen_t optlen = sizeof(optlen);
optval = 1;
- if (rs_setsockopt(rs, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen)) {
+ if (rs_setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen)) {
perror("rsetsockopt SO_KEEPALIVE");
return;
}
optval = keepalive;
- if (rs_setsockopt(rs, IPPROTO_TCP, TCP_KEEPIDLE, &optval, optlen))
+ if (rs_setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &optval, optlen))
perror("rsetsockopt TCP_KEEPIDLE");
- if (!(rs_getsockopt(rs, SOL_SOCKET, SO_KEEPALIVE, &optval, &optlen)))
+ if (!(rs_getsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &optval, &optlen)))
printf("Keepalive: %s\n", (optval ? "ON" : "OFF"));
- if (!(rs_getsockopt(rs, IPPROTO_TCP, TCP_KEEPIDLE, &optval, &optlen)))
+ if (!(rs_getsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &optval, &optlen)))
printf(" time: %i\n", optval);
}
-static void set_options(int rs)
+static void set_options(int fd)
{
int val;
if (buffer_size) {
- rs_setsockopt(rs, SOL_SOCKET, SO_SNDBUF, (void *) &buffer_size,
+ rs_setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *) &buffer_size,
sizeof buffer_size);
- rs_setsockopt(rs, SOL_SOCKET, SO_RCVBUF, (void *) &buffer_size,
+ rs_setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *) &buffer_size,
sizeof buffer_size);
} else {
val = 1 << 19;
- rs_setsockopt(rs, SOL_SOCKET, SO_SNDBUF, (void *) &val, sizeof val);
- rs_setsockopt(rs, SOL_SOCKET, SO_RCVBUF, (void *) &val, sizeof val);
+ rs_setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *) &val, sizeof val);
+ rs_setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *) &val, sizeof val);
}
val = 1;
- rs_setsockopt(rs, IPPROTO_TCP, TCP_NODELAY, (void *) &val, sizeof(val));
+ rs_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void *) &val, sizeof(val));
if (flags & MSG_DONTWAIT)
- rs_fcntl(rs, F_SETFL, O_NONBLOCK);
+ rs_fcntl(fd, F_SETFL, O_NONBLOCK);
if (use_rs) {
/* Inline size based on experimental data */
if (optimization == opt_latency) {
- rs_setsockopt(rs, SOL_RDMA, RDMA_INLINE, &inline_size,
+ rs_setsockopt(fd, SOL_RDMA, RDMA_INLINE, &inline_size,
sizeof inline_size);
} else if (optimization == opt_bandwidth) {
val = 0;
- rs_setsockopt(rs, SOL_RDMA, RDMA_INLINE, &val, sizeof val);
+ rs_setsockopt(fd, SOL_RDMA, RDMA_INLINE, &val, sizeof val);
}
}
if (keepalive)
- set_keepalive(rs);
+ set_keepalive(fd);
}
static int server_listen(void)
@@ -564,10 +564,10 @@ free:
return ret;
}
-static int set_test_opt(char *optarg)
+static int set_test_opt(const char *arg)
{
- if (strlen(optarg) == 1) {
- switch (optarg[0]) {
+ if (strlen(arg) == 1) {
+ switch (arg[0]) {
case 's':
use_rs = 0;
break;
@@ -594,19 +594,19 @@ static int set_test_opt(char *optarg)
return -1;
}
} else {
- if (!strncasecmp("socket", optarg, 6)) {
+ if (!strncasecmp("socket", arg, 6)) {
use_rs = 0;
- } else if (!strncasecmp("async", optarg, 5)) {
+ } else if (!strncasecmp("async", arg, 5)) {
use_async = 1;
- } else if (!strncasecmp("block", optarg, 5)) {
+ } else if (!strncasecmp("block", arg, 5)) {
flags = (flags & ~MSG_DONTWAIT) | MSG_WAITALL;
- } else if (!strncasecmp("nonblock", optarg, 8)) {
+ } else if (!strncasecmp("nonblock", arg, 8)) {
flags |= MSG_DONTWAIT;
- } else if (!strncasecmp("resolve", optarg, 7)) {
+ } else if (!strncasecmp("resolve", arg, 7)) {
use_rgai = 1;
- } else if (!strncasecmp("verify", optarg, 6)) {
+ } else if (!strncasecmp("verify", arg, 6)) {
verify = 1;
- } else if (!strncasecmp("fork", optarg, 4)) {
+ } else if (!strncasecmp("fork", arg, 4)) {
use_fork = 1;
use_rs = 0;
} else {
diff --git a/librdmacm/examples/udpong.c b/librdmacm/examples/udpong.c
index f8d56073012a..71528f226769 100644
--- a/librdmacm/examples/udpong.c
+++ b/librdmacm/examples/udpong.c
@@ -96,10 +96,10 @@ static char test_name[10] = "custom";
static const char *port = "7174";
static char *dst_addr;
static char *src_addr;
-static union socket_addr addr;
-static socklen_t addrlen;
+static union socket_addr g_addr;
+static socklen_t g_addrlen;
static struct timeval start, end;
-static struct message msg;
+static struct message g_msg;
static void show_perf(void)
{
@@ -109,7 +109,7 @@ static void show_perf(void)
int transfers;
usec = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec);
- transfers = echo ? transfer_count * 2 : ntohl(msg.data);
+ transfers = echo ? transfer_count * 2 : ntohl(g_msg.data);
bytes = (long long) transfers * transfer_size;
/* name size transfers bytes seconds Gb/sec usec/xfer */
@@ -147,23 +147,23 @@ static void init_bandwidth_test(int size)
echo = 0;
}
-static void set_options(int rs)
+static void set_options(int fd)
{
int val;
if (buffer_size) {
- rs_setsockopt(rs, SOL_SOCKET, SO_SNDBUF, (void *) &buffer_size,
+ rs_setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *) &buffer_size,
sizeof buffer_size);
- rs_setsockopt(rs, SOL_SOCKET, SO_RCVBUF, (void *) &buffer_size,
+ rs_setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *) &buffer_size,
sizeof buffer_size);
} else {
val = 1 << 19;
- rs_setsockopt(rs, SOL_SOCKET, SO_SNDBUF, (void *) &val, sizeof val);
- rs_setsockopt(rs, SOL_SOCKET, SO_RCVBUF, (void *) &val, sizeof val);
+ rs_setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *) &val, sizeof val);
+ rs_setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *) &val, sizeof val);
}
if (flags & MSG_DONTWAIT)
- rs_fcntl(rs, F_SETFL, O_NONBLOCK);
+ rs_fcntl(fd, F_SETFL, O_NONBLOCK);
}
static ssize_t svr_send(struct message *msg, size_t size,
@@ -296,12 +296,12 @@ static int svr_run(void)
ret = svr_bind();
while (!ret) {
- addrlen = sizeof addr;
- len = svr_recv(&msg, sizeof msg, &addr, &addrlen);
+ g_addrlen = sizeof g_addr;
+ len = svr_recv(&g_msg, sizeof g_msg, &g_addr, &g_addrlen);
if (len < 0)
return len;
- ret = svr_process(&msg, len, &addr, addrlen);
+ ret = svr_process(&g_msg, len, &g_addr, g_addrlen);
}
return ret;
}
@@ -375,22 +375,22 @@ static int run_test(void)
{
int ret, i;
- msg.op = msg_op_start;
- ret = client_send_recv(&msg, CTRL_MSG_SIZE, 1000);
+ g_msg.op = msg_op_start;
+ ret = client_send_recv(&g_msg, CTRL_MSG_SIZE, 1000);
if (ret != CTRL_MSG_SIZE)
goto out;
- msg.op = echo ? msg_op_echo : msg_op_data;
+ g_msg.op = echo ? msg_op_echo : msg_op_data;
gettimeofday(&start, NULL);
for (i = 0; i < transfer_count; i++) {
- ret = echo ? client_send_recv(&msg, transfer_size, 1) :
- client_send(&msg, transfer_size);
+ ret = echo ? client_send_recv(&g_msg, transfer_size, 1) :
+ client_send(&g_msg, transfer_size);
if (ret != transfer_size)
goto out;
}
- msg.op = msg_op_end;
- ret = client_send_recv(&msg, CTRL_MSG_SIZE, 1);
+ g_msg.op = msg_op_end;
+ ret = client_send_recv(&g_msg, CTRL_MSG_SIZE, 1);
if (ret != CTRL_MSG_SIZE)
goto out;
@@ -430,8 +430,8 @@ static int client_connect(void)
goto out;
}
- msg.op = msg_op_login;
- ret = client_send_recv(&msg, CTRL_MSG_SIZE, 1000);
+ g_msg.op = msg_op_login;
+ ret = client_send_recv(&g_msg, CTRL_MSG_SIZE, 1000);
if (ret == CTRL_MSG_SIZE)
ret = 0;
@@ -468,10 +468,10 @@ static int client_run(void)
return ret;
}
-static int set_test_opt(char *optarg)
+static int set_test_opt(const char *arg)
{
- if (strlen(optarg) == 1) {
- switch (optarg[0]) {
+ if (strlen(arg) == 1) {
+ switch (arg[0]) {
case 's':
use_rs = 0;
break;
@@ -491,15 +491,15 @@ static int set_test_opt(char *optarg)
return -1;
}
} else {
- if (!strncasecmp("socket", optarg, 6)) {
+ if (!strncasecmp("socket", arg, 6)) {
use_rs = 0;
- } else if (!strncasecmp("async", optarg, 5)) {
+ } else if (!strncasecmp("async", arg, 5)) {
use_async = 1;
- } else if (!strncasecmp("block", optarg, 5)) {
+ } else if (!strncasecmp("block", arg, 5)) {
flags = 0;
- } else if (!strncasecmp("nonblock", optarg, 8)) {
+ } else if (!strncasecmp("nonblock", arg, 8)) {
flags = MSG_DONTWAIT;
- } else if (!strncasecmp("echo", optarg, 4)) {
+ } else if (!strncasecmp("echo", arg, 4)) {
echo = 1;
} else {
return -1;
diff --git a/providers/mthca/cq.c b/providers/mthca/cq.c
index d71d430c6e28..aa08e065f275 100644
--- a/providers/mthca/cq.c
+++ b/providers/mthca/cq.c
@@ -294,7 +294,6 @@ static inline int mthca_poll_one(struct mthca_cq *cq,
struct mthca_cqe *cqe;
struct mthca_srq *srq;
uint32_t qpn;
- uint32_t wqe;
int wqe_index;
int is_error;
int is_send;
@@ -339,6 +338,7 @@ static inline int mthca_poll_one(struct mthca_cq *cq,
wqe_index = ((ntohl(cqe->wqe) - (*cur_qp)->send_wqe_offset) >> wq->wqe_shift);
wc->wr_id = (*cur_qp)->wrid[wqe_index + (*cur_qp)->rq.max];
} else if ((*cur_qp)->ibv_qp.srq) {
+ uint32_t wqe;
srq = to_msrq((*cur_qp)->ibv_qp.srq);
wqe = htonl(cqe->wqe);
wq = NULL;
--
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
* RE: [PATCH rdma-core 1/8] rdmacm: constify rdma_getaddrinfo public function
From: Hefty, Sean @ 2016-10-14 22:18 UTC (permalink / raw)
To: Jason Gunthorpe, Doug Ledford,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Christoph Hellwig
In-Reply-To: <1476483257-16308-2-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> Like getaddrinfo most of the arguments should be const.
>
> 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: [PATCH rdma-core 5/8] acm: Fix wrong format attributes for error
From: Hefty, Sean @ 2016-10-14 22:18 UTC (permalink / raw)
To: Jason Gunthorpe, Doug Ledford,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Christoph Hellwig
In-Reply-To: <1476483257-16308-6-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> The arguments were swapped, and totally crash-when-run wrong.
>
> 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: [PATCH rdma-core 0/4] rdma-core infrastructure
From: Jason Gunthorpe @ 2016-10-14 22:33 UTC (permalink / raw)
To: Jarod Wilson; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20161014192136.11731-1-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Fri, Oct 14, 2016 at 03:21:32PM -0400, Jarod Wilson wrote:
> This is a set of patches to make some minor changes to the stock spec file,
> add a bunch of userspace glue that Red Hat has been shipping on it's own in
> Red Hat Enterprise Linux and Fedora for a while now, and a revised split
> package spec file that we're likely to use in at least RHEL, to preserve the
> current packaging split.
Is this just for EL7, or do you plan to keep going this way
indefinitely in EL8 and FC25?
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 8/8] Enable -Wshadow
From: Hefty, Sean @ 2016-10-14 22:50 UTC (permalink / raw)
To: Jason Gunthorpe, Doug Ledford,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Christoph Hellwig
In-Reply-To: <1476483257-16308-9-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> Having multiple objects with the same name in the same scope is
> almost always confusing. Make some trivial changes to avoid those
> few cases.
>
> 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: [PATCH rdma-core 1/4] rpm spec: install documentation too
From: Jason Gunthorpe @ 2016-10-14 22:52 UTC (permalink / raw)
To: Jarod Wilson; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20161014192136.11731-2-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Fri, Oct 14, 2016 at 03:21:33PM -0400, Jarod Wilson wrote:
> At least in the Red Hat world, we like to install the documentation files
> provided in a given source tree.
I think other distros would like to do this too, can you use this
patch instead?
>From a23838ccc05574b1975741770abcbd66f7587293 Mon Sep 17 00:00:00 2001
From: Jarod Wilson <jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Date: Fri, 14 Oct 2016 15:21:33 -0400
Subject: [PATCH] Install end user focused documentation files
We recommend that all distros ship these.
Suggested-by: Jarod Wilson <jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 3 ++-
Documentation/CMakeLists.txt | 8 ++++++++
debian/ibacm.install | 1 +
debian/ibverbs-providers.install | 1 +
debian/libibcm1.install | 1 +
debian/libibverbs1.install | 1 +
debian/librdmacm1.install | 1 +
debian/srptools.install | 1 +
rdma-core.spec | 4 +++-
9 files changed, 19 insertions(+), 2 deletions(-)
create mode 100644 Documentation/CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a23aa860e6d3f2..6d2960e22b77b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@
# Use the historical search path for providers, in the standard system library.
cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
-project(RDMA C)
+project(rdma-core C)
# CMake likes to use -rdynamic too much, they fixed it in 3.4.
if(POLICY CMP0065)
@@ -321,6 +321,7 @@ configure_file("${BUILDLIB}/config.h.in" "${BUILD_INCLUDE}/config.h" ESCAPE_QUOT
# Sub-directories
add_subdirectory(ccan)
add_subdirectory(util)
+add_subdirectory(Documentation)
# Libraries
add_subdirectory(libibumad)
add_subdirectory(libibumad/man)
diff --git a/Documentation/CMakeLists.txt b/Documentation/CMakeLists.txt
new file mode 100644
index 00000000000000..619b8587f11f11
--- /dev/null
+++ b/Documentation/CMakeLists.txt
@@ -0,0 +1,8 @@
+install(FILES
+ ibacm.md
+ ibsrpdm.md
+ libibcm.md
+ libibverbs.md
+ librdmacm.md
+ rxe.md
+ DESTINATION "${CMAKE_INSTALL_DOCDIR}")
diff --git a/debian/ibacm.install b/debian/ibacm.install
index 2bb9591c051dbe..f2a6c53eb79d02 100644
--- a/debian/ibacm.install
+++ b/debian/ibacm.install
@@ -8,3 +8,4 @@ usr/share/man/man1/ib_acme.1
usr/share/man/man1/ibacm.1
usr/share/man/man7/ibacm.7
usr/share/man/man7/ibacm_prov.7
+usr/share/doc/rdma-core/ibacm.md usr/share/doc/ibacm/
diff --git a/debian/ibverbs-providers.install b/debian/ibverbs-providers.install
index 1b4121874b2cc1..7458540b37714d 100644
--- a/debian/ibverbs-providers.install
+++ b/debian/ibverbs-providers.install
@@ -5,3 +5,4 @@ usr/lib/truescale-serdes.cmds
usr/share/man/man8/rxe_cfg.8
usr/share/man/man7/rxe.7
usr/bin/rxe_cfg
+usr/share/doc/rdma-core/rxe.md usr/share/doc/ibverbs-providers/
diff --git a/debian/libibcm1.install b/debian/libibcm1.install
index 6f270b7f3bfac3..a0ace6ebf2eac3 100644
--- a/debian/libibcm1.install
+++ b/debian/libibcm1.install
@@ -1 +1,2 @@
usr/lib/*/libibcm*.so.*
+usr/share/doc/rdma-core/libibcm.md usr/share/doc/libibcm1/
diff --git a/debian/libibverbs1.install b/debian/libibverbs1.install
index 78a7f76d39c3e4..83bdd802b48d5c 100644
--- a/debian/libibverbs1.install
+++ b/debian/libibverbs1.install
@@ -1 +1,2 @@
usr/lib/*/libibverbs*.so.*
+usr/share/doc/rdma-core/libibverbs.md usr/share/doc/libibverbs1/
diff --git a/debian/librdmacm1.install b/debian/librdmacm1.install
index c17048e6e46307..09140ab84de7dc 100644
--- a/debian/librdmacm1.install
+++ b/debian/librdmacm1.install
@@ -1,2 +1,3 @@
usr/lib/*/librdmacm*.so.*
usr/lib/*/rsocket/librspreload*.so*
+usr/share/doc/rdma-core/librdmacm.md usr/share/doc/librdmacm1/
diff --git a/debian/srptools.install b/debian/srptools.install
index 17b909d721a978..9c0701526e3cd8 100644
--- a/debian/srptools.install
+++ b/debian/srptools.install
@@ -6,3 +6,4 @@ usr/sbin/ibsrpdm
usr/sbin/srp_daemon
usr/share/man/man1/ibsrpdm.1
usr/share/man/man1/srp_daemon.1
+usr/share/doc/rdma-core/ibsrpdm.md usr/share/doc/srptools/
diff --git a/rdma-core.spec b/rdma-core.spec
index 96c86fe06f3ae9..47b7d87e403219 100644
--- a/rdma-core.spec
+++ b/rdma-core.spec
@@ -85,7 +85,8 @@ This is a simple example without the split sub packages to get things started.
-DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \
-DCMAKE_INSTALL_SYSTEMD_SERVICEDIR:PATH=%{my_unitdir} \
-DCMAKE_INSTALL_INITDDIR:PATH=%{_initrddir} \
- -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir}
+ -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
+ -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version}
%make_jobs
%install
@@ -110,6 +111,7 @@ rm -rf %{buildroot}/%{my_unitdir}/
%{_libdir}/rsocket/*
%{_sbindir}/*
%{_libexecdir}/*
+%{_docdir}/%{name}-%{version}/*
%if 0%{?_unitdir:1}
%{_unitdir}/*
%else
--
2.7.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
* Re: [PATCH rdma-core 2/4] glue/redhat: add udev/systemd/etc infrastructure bits
From: Jason Gunthorpe @ 2016-10-14 23:19 UTC (permalink / raw)
To: Jarod Wilson; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Doug Ledford
In-Reply-To: <20161014192136.11731-3-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Fri, Oct 14, 2016 at 03:21:34PM -0400, Jarod Wilson wrote:
> Red Hat has been shipping an "rdma" package, as well as it's own systemd
> unit files for some daemons for a while now, in both Fedora and Red Hat
> Enterprise Linux. Some of these are fairly RH-specific, but might be of
> use to others, so we'd like to move them into the upstream source tree.
We have a directory called 'debian', so lets just have one called
'redhat'..
The below comments are my view on what we should try and move into
common cross-distro locations..
Common stuff should be installed via cmake
> diff --git a/glue/redhat/ibacm.service b/glue/redhat/ibacm.service
> new file mode 100644
> index 0000000..1cd031a
> +++ b/glue/redhat/ibacm.service
Can we just put this in ibacm/ ?
> +Requires=rdma.service
> +After=rdma.service opensm.service
This is the only RH specific thiing I see.. Could we standardize on
something here and use it on all distros? rdma-available.target?
> +++ b/glue/redhat/iwpmd.service
> @@ -0,0 +1,12 @@
> +[Unit]
> +Description=Starts the IWPMD daemon
> +Documentation=file:///usr/share/doc/iwpmd/README
File does not exit? There is a man page now
We already have a iwpmd/iwpmd.service that is almost identical, can you
you just update it and drop this version?
> +++ b/glue/redhat/rdma.cxgb3.sys.modprobe
> @@ -0,0 +1 @@
> +install cxgb3 /sbin/modprobe --ignore-install cxgb3 $CMDLINE_OPTS && /sbin/modprobe iw_cxgb3
> diff --git a/glue/redhat/rdma.cxgb4.sys.modprobe b/glue/redhat/rdma.cxgb4.sys.modprobe
> new file mode 100644
> index 0000000..44163ab
> +++ b/glue/redhat/rdma.cxgb4.sys.modprobe
> @@ -0,0 +1 @@
> +install cxgb4 /sbin/modprobe --ignore-install cxgb4 $CMDLINE_OPTS && /sbin/modprobe iw_cxgb4
What are these for? Should they be cross distro? Why are only a few
drivers this special?
> +++ b/glue/redhat/rdma.fixup-mtrr.awk
> @@ -0,0 +1,160 @@
> +# This is a simple script that checks the contents of /proc/mtrr to see if
> +# the BIOS maker for the computer took the easy way out in terms of
> +# specifying memory regions when there is a hole below 4GB for PCI access
> +# and the machine has 4GB or more of RAM. When the contents of /proc/mtrr
> +# show a 4GB mapping of write-back cached RAM, minus punch out hole(s) of
> +# uncacheable regions (the area reserved for PCI access), then it becomes
> +# impossible for the ib_ipath driver to set write_combining on its PIO
> +# buffers. To correct the problem, remap the lower memory region in various
> +# chunks up to the start of the punch out hole(s), then delete the punch out
> +# hole(s) entirely as they aren't needed any more. That way, ib_ipath will
> +# be able to set write_combining on its PIO memory access region.
Yuk, a thousand times yuk.
I thought the mtrr cleanup built into modern kernel took care of this?
Really though, this needs to be fixed upstream in the kernel :|
> diff --git a/glue/redhat/rdma.kernel-init b/glue/redhat/rdma.kernel-init
> new file mode 100644
> index 0000000..6cb4732
> +++ b/glue/redhat/rdma.kernel-init
I wonder if this could be split into a generic 'load the modules' part
and a distro specific part? Every distro needs systemd to load the
extra modules because out auto-loading is broken - IMHO, and that is
pretty complex unfortunately.
> +errata_58()
> +{
> + # Check AMD chipset issue Errata #58
> + if test -x /sbin/lspci && test -x /sbin/setpci; then
> + if ( /sbin/lspci -nd 1022:1100 | grep "1100" > /dev/null ) &&
> + ( /sbin/lspci -nd 1022:7450 | grep "7450" > /dev/null ) &&
> + ( /sbin/lspci -nd 15b3:5a46 | grep "5a46" > /dev/null ); then
> + CURVAL=`/sbin/setpci -d 1022:1100 69`
Another yuk. Why isn't this handled upstream in drivers/pci/quirks.c
with the rest of the 8131 errata?
Fortunately I expect all 8131 hardware is long since gone, that chip
was end-of-manufacturing'd very quickly 2003ish IIRC.
> +++ b/glue/redhat/rdma.service
> @@ -0,0 +1,15 @@
> +[Unit]
> +Description=Initialize the iWARP/InfiniBand/RDMA stack in the kernel
> +Documentation=file:/etc/rdma/rdma.conf
> +RefuseManualStop=true
> +DefaultDependencies=false
> +Conflicts=emergency.target emergency.service
> +Before=network.target remote-fs-pre.target
This is an area we really need to cross-distro standardize - we really
need a set of rdma-*.targets.
eg
rdma-available.target
- RDMA hardware is available and all prep is done
opensm (if installed) is started, etc
Use in place of rdma.service
rdma-detected.target
- udev detected rdma hardware
> +++ b/glue/redhat/rdma.udev-ipoib-naming.rules
> @@ -0,0 +1,13 @@
> +# This is a sample udev rules file that demonstrates how to get udev to
> +# set the name of IPoIB interfaces to whatever you wish. There is a
> +# 16 character limit on network device names though, so don't go too nuts
> +#
> +# Important items to note: ATTR{type}=="32" is IPoIB interfaces, and the
> +# ATTR{address} match must start with ?* and only reference the last 8
> +# bytes of the address or else the address might not match on any given
> +# start of the IPoIB stack
> +#
> +# Note: as of rhel7, udev is case sensitive on the address field match
> +# and all addresses need to be in lower case.
> +#
> +# ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="?*00:02:c9:03:00:31:78:f2", NAME="mlx4_ib3"
This should be a cross distro file.
> +++ b/glue/redhat/rdma.udev-rules
> @@ -0,0 +1,18 @@
> +# We list all the various kernel modules that drive hardware in the
> +# InfiniBand stack (and a few in the network stack that might not actually
> +# be RDMA capable, but we don't know that at this time and it's safe to
> +# enable the IB stack, so do so unilaterally) and on load of any of that
> +# hardware, we trigger the rdma.service load in systemd
> +
> +SUBSYSTEM=="module", KERNEL=="cxgb*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service"
> +SUBSYSTEM=="module", KERNEL=="ib_*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service"
> +SUBSYSTEM=="module", KERNEL=="mlx*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service"
> +SUBSYSTEM=="module", KERNEL=="iw_*", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service"
> +SUBSYSTEM=="module", KERNEL=="be2net", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service"
> +SUBSYSTEM=="module", KERNEL=="enic", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="rdma.service"
Also cross distro
> +# When we detect a new verbs device is added to the system, set the node
> +# description on that device
> +# If rdma-ndd is installed, defer the setting of the node description to it.
> +SUBSYSTEM=="infiniband", KERNEL=="*", ACTION=="add", TEST!="/usr/sbin/rdma-ndd", RUN+="/bin/bash -c 'sleep 1; echo -n `hostname -s` %k > /sys/class/infiniband/%k/node_desc'"
Shouldn't this udev drop-in by in the rdma-ndd package?
> +++ b/glue/redhat/srp_daemon.service
> @@ -0,0 +1,17 @@
> +[Unit]
> +Description=Start or stop the daemon that attaches to SRP devices
> +Documentation=file:///etc/rdma/rdma.conf file:///etc/srp_daemon.conf
> +DefaultDependencies=false
> +Conflicts=emergency.target emergency.service
> +Requires=rdma.service
> +Wants=opensm.service
> +After=rdma.service opensm.service
> +After=network.target
> +Before=remote-fs-pre.target
Also should be common, why does it reference opensm.service?
> +
> +[Service]
> +Type=simple
> +ExecStart=/usr/sbin/srp_daemon.sh
Hurm, someday we have to make better systemd integration for these
daemons..
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 4/4] glue/redhat/spec: build split rpm packages
From: Jason Gunthorpe @ 2016-10-14 23:39 UTC (permalink / raw)
To: Jarod Wilson; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20161014192136.11731-5-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Fri, Oct 14, 2016 at 03:21:36PM -0400, Jarod Wilson wrote:
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/iwpmd-11-1.el7.x86_64.rpm
FC used to call this libiwpm for some reason..
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libibcm-11-1.el7.x86_64.rpm
Do you want to try and do as I did with debian and put the SONAME data
into the package version for the libraries? eg
libibcm1_1.0.11-1_amd64.deb
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libcxgb3-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libcxgb4-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libhfi1-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libi40iw-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libipathverbs-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libmlx4-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libmlx5-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libmthca-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libnes-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/libocrdma-11-1.el7.x86_64.rpm
> Wrote: /home/jwilson/rpmbuild/RPMS/x86_64/librxe-11-1.el7.x86_64.rpm
Does this mean RH is not going to do a single package for the
providers? You know another 5 or so are coming..
Any feedback if things build on your supported arches? I'd be
interested to see compiler log if it isn't silent.
> +install -D -m0644 Documentation/{ibacm,ibsrpdm,libibcm,libibverbs,librdmacm,rxe}.md %{buildroot}/%{_docdir}/%{name}-%{version}/
> +install -D -m0644 README.md %{buildroot}/%{_docdir}/%{name}-%{version}/
I guess README should go in that patch I sent you..
> +%{buildroot}/%{_bindir}/ib_acme -D . -O
> +# Fixup a multilib conflict in ibacm_opts.cfg:
> +sed -i -e '/^# Specifies the directory of the provider libraries$/ a\
> +# Use /usr/lib64/ibacm on 64bit, /usr/lib/libacm on 32bit.
> +' -e 's%^\(# provider_lib_path
> /usr/\)lib\(64\)\?/ibacm$%\1lib64/ibacm%' ibacm_opts.cfg
Hum? I'm pretty sure this is basically fixed in the code now, was done here
5eebdb9baaaae420a4bb16e586a96807823916a0
Adjusting the comment like that doesn't really make sense, the acm
daemon has a fixed endianness and looks in a single place to load the
plugin. If someone wants to use 32 bit plugins they have to install
the 32 bit acm daemon, which would have the 32 bit path in the sample
conf file...
> +install -D -m0644 ibacm/man/*.1 %{buildroot}/%{_mandir}/man1/
> +install -D -m0644 ibacm/man/*.7 %{buildroot}/%{_mandir}/man7/
> +sed -e 's|@ACM_PROVIDER_DIR@|%{libdir}/%{name}/|g' -e 's|@CMAKE_INSTALL_FULL_LOCALSTATEDIR@|%{_localstatedir}|g' ibacm/man/ibacm_prov.7.in > %{buildroot}/%{_mandir}/man7/ibacm_prov.7
?? cmake is supposed to install these.. Looks like it works. What did
you need done here to open code it?
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
* [PATCH v2 net-next 00/11] net: Fix netdev adjacency tracking
From: David Ahern @ 2016-10-15 1:28 UTC (permalink / raw)
To: jiri, netdev, davem
Cc: dledford, sean.hefty, hal.rosenstock, linux-rdma, j.vosburgh,
vfalico, andy, jeffrey.t.kirsher, intel-wired-lan, David Ahern
The netdev adjacency tracking is failing to create proper dependencies
for some topologies. For example this topology
+--------+
| myvrf |
+--------+
| |
| +---------+
| | macvlan |
| +---------+
| |
+----------+
| bridge |
+----------+
|
+--------+
| bond1 |
+--------+
|
+--------+
| eth3 |
+--------+
hits 1 of 2 problems depending on the order of enslavement. The base set of
commands for both cases:
ip link add bond1 type bond
ip link set bond1 up
ip link set eth3 down
ip link set eth3 master bond1
ip link set eth3 up
ip link add bridge type bridge
ip link set bridge up
ip link add macvlan link bridge type macvlan
ip link set macvlan up
ip link add myvrf type vrf table 1234
ip link set myvrf up
ip link set bridge master myvrf
Case 1 enslave macvlan to the vrf before enslaving the bond to the bridge:
ip link set macvlan master myvrf
ip link set bond1 master bridge
Attempts to delete the VRF:
ip link delete myvrf
trigger the BUG in __netdev_adjacent_dev_remove:
[ 587.405260] tried to remove device eth3 from myvrf
[ 587.407269] ------------[ cut here ]------------
[ 587.408918] kernel BUG at /home/dsa/kernel.git/net/core/dev.c:5661!
[ 587.411113] invalid opcode: 0000 [#1] SMP
[ 587.412454] Modules linked in: macvlan bridge stp llc bonding vrf
[ 587.414765] CPU: 0 PID: 726 Comm: ip Not tainted 4.8.0+ #109
[ 587.416766] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
[ 587.420241] task: ffff88013ab6eec0 task.stack: ffffc90000628000
[ 587.422163] RIP: 0010:[<ffffffff813cef03>] [<ffffffff813cef03>] __netdev_adjacent_dev_remove+0x40/0x12c
...
[ 587.446053] Call Trace:
[ 587.446424] [<ffffffff813d1542>] __netdev_adjacent_dev_unlink+0x20/0x3c
[ 587.447390] [<ffffffff813d16a3>] netdev_upper_dev_unlink+0xfa/0x15e
[ 587.448297] [<ffffffffa00003a3>] vrf_del_slave+0x13/0x2a [vrf]
[ 587.449153] [<ffffffffa00004a4>] vrf_dev_uninit+0xea/0x114 [vrf]
[ 587.450036] [<ffffffff813d19b0>] rollback_registered_many+0x22b/0x2da
[ 587.450974] [<ffffffff813d1aac>] unregister_netdevice_many+0x17/0x48
[ 587.451903] [<ffffffff813de444>] rtnl_delete_link+0x3c/0x43
[ 587.452719] [<ffffffff813dedcd>] rtnl_dellink+0x180/0x194
When the BUG is converted to a WARN_ON it shows 4 missing adjacencies:
eth3 - myvrf, mvrf - eth3, bond1 - myvrf and myvrf - bond1
All of those are because the __netdev_upper_dev_link function does not
properly link macvlan lower devices to myvrf when it is enslaved.
The second case just flips the ordering of the enslavements:
ip link set bond1 master bridge
ip link set macvlan master myvrf
Then run:
ip link delete bond1
ip link delete myvrf
The vrf delete command hangs because myvrf has a reference that has not
been released. In this case the removal code does not account for 2 paths
between eth3 and myvrf - one from bridge to vrf and the other through the
macvlan.
Rather than try to maintain a linked list of all upper and lower devices
per netdevice, only track the direct neighbors. The remaining stack can
be determined by recursively walking the neighbors.
The existing netdev_for_each_all_upper_dev_rcu,
netdev_for_each_all_lower_dev and netdev_for_each_all_lower_dev_rcu macros
are replaced with APIs that walk the upper and lower device lists. The
new APIs take a callback function and a data arg that is passed to the
callback for each device in the list. Drivers using the old macros are
converted in separate patches to make it easier on reviewers. It is an
API conversion only; no functional change is intended.
DaveM: Given the impact of this bug (both cases requiring a reboot) I
would like to get this backported to at least the 4.8 tree which as I
understand it has been targeted as the next LTS.
v2
- fixed bond0 references in cover-letter
- fixed definition of netdev_next_lower_dev_rcu to mirror the upper_dev
version.
David Ahern (11):
net: Remove refnr arg when inserting link adjacencies
net: Introduce new api for walking upper and lower devices
net: bonding: Flip to the new dev walk API
IB/core: Flip to the new dev walk API
IB/ipoib: Flip to new dev walk API
ixgbe: Flip to the new dev walk API
mlxsw: Flip to the new dev walk API
rocker: Flip to the new dev walk API
net: Remove all_adj_list and its references
net: Add warning if any lower device is still in adjacency list
net: dev: Improve debug statements for adjacency tracking
drivers/infiniband/core/core_priv.h | 9 +-
drivers/infiniband/core/roce_gid_mgmt.c | 42 +--
drivers/infiniband/ulp/ipoib/ipoib_main.c | 37 ++-
drivers/net/bonding/bond_alb.c | 82 +++---
drivers/net/bonding/bond_main.c | 21 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 132 +++++----
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 37 ++-
drivers/net/ethernet/rocker/rocker_main.c | 31 ++-
include/linux/netdevice.h | 38 ++-
net/core/dev.c | 356 ++++++++++++-------------
10 files changed, 433 insertions(+), 352 deletions(-)
--
2.1.4
^ permalink raw reply
* [PATCH net-next 01/11] net: Remove refnr arg when inserting link adjacencies
From: David Ahern @ 2016-10-15 1:28 UTC (permalink / raw)
To: jiri-VPRAkNaXOzVWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA,
davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
j.vosburgh-Re5JQEeQqe8AvxtiuMwx3w, vfalico-Re5JQEeQqe8AvxtiuMwx3w,
andy-QlMahl40kYEqcZcGjlUOXw,
jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w,
intel-wired-lan-qjLDD68F18P21nG7glBr7A, David Ahern
In-Reply-To: <1476494931-31813-1-git-send-email-dsa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org>
Commit 93409033ae65 ("net: Add netdev all_adj_list refcnt propagation to
fix panic") propagated the refnr to insert and remove functions tracking
the netdev adjacency graph. However, for the insert path the refnr can
only be 1. Accordingly, remove the refnr argument to make that clear.
ie., the refnr arg in 93409033ae65 was only needed for the remove path.
Signed-off-by: David Ahern <dsa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org>
---
net/core/dev.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 6498cc2ba8f6..5399af8fdac0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5453,7 +5453,6 @@ static inline bool netdev_adjacent_is_neigh_list(struct net_device *dev,
static int __netdev_adjacent_dev_insert(struct net_device *dev,
struct net_device *adj_dev,
- u16 ref_nr,
struct list_head *dev_list,
void *private, bool master)
{
@@ -5463,7 +5462,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
adj = __netdev_find_adj(adj_dev, dev_list);
if (adj) {
- adj->ref_nr += ref_nr;
+ adj->ref_nr += 1;
return 0;
}
@@ -5473,7 +5472,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
adj->dev = adj_dev;
adj->master = master;
- adj->ref_nr = ref_nr;
+ adj->ref_nr = 1;
adj->private = private;
dev_hold(adj_dev);
@@ -5547,22 +5546,21 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
static int __netdev_adjacent_dev_link_lists(struct net_device *dev,
struct net_device *upper_dev,
- u16 ref_nr,
struct list_head *up_list,
struct list_head *down_list,
void *private, bool master)
{
int ret;
- ret = __netdev_adjacent_dev_insert(dev, upper_dev, ref_nr, up_list,
+ ret = __netdev_adjacent_dev_insert(dev, upper_dev, up_list,
private, master);
if (ret)
return ret;
- ret = __netdev_adjacent_dev_insert(upper_dev, dev, ref_nr, down_list,
+ ret = __netdev_adjacent_dev_insert(upper_dev, dev, down_list,
private, false);
if (ret) {
- __netdev_adjacent_dev_remove(dev, upper_dev, ref_nr, up_list);
+ __netdev_adjacent_dev_remove(dev, upper_dev, 1, up_list);
return ret;
}
@@ -5570,10 +5568,9 @@ static int __netdev_adjacent_dev_link_lists(struct net_device *dev,
}
static int __netdev_adjacent_dev_link(struct net_device *dev,
- struct net_device *upper_dev,
- u16 ref_nr)
+ struct net_device *upper_dev)
{
- return __netdev_adjacent_dev_link_lists(dev, upper_dev, ref_nr,
+ return __netdev_adjacent_dev_link_lists(dev, upper_dev,
&dev->all_adj_list.upper,
&upper_dev->all_adj_list.lower,
NULL, false);
@@ -5602,12 +5599,12 @@ static int __netdev_adjacent_dev_link_neighbour(struct net_device *dev,
struct net_device *upper_dev,
void *private, bool master)
{
- int ret = __netdev_adjacent_dev_link(dev, upper_dev, 1);
+ int ret = __netdev_adjacent_dev_link(dev, upper_dev);
if (ret)
return ret;
- ret = __netdev_adjacent_dev_link_lists(dev, upper_dev, 1,
+ ret = __netdev_adjacent_dev_link_lists(dev, upper_dev,
&dev->adj_list.upper,
&upper_dev->adj_list.lower,
private, master);
@@ -5676,7 +5673,7 @@ static int __netdev_upper_dev_link(struct net_device *dev,
list_for_each_entry(j, &upper_dev->all_adj_list.upper, list) {
pr_debug("Interlinking %s with %s, non-neighbour\n",
i->dev->name, j->dev->name);
- ret = __netdev_adjacent_dev_link(i->dev, j->dev, i->ref_nr);
+ ret = __netdev_adjacent_dev_link(i->dev, j->dev);
if (ret)
goto rollback_mesh;
}
@@ -5686,7 +5683,7 @@ static int __netdev_upper_dev_link(struct net_device *dev,
list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) {
pr_debug("linking %s's upper device %s with %s\n",
upper_dev->name, i->dev->name, dev->name);
- ret = __netdev_adjacent_dev_link(dev, i->dev, i->ref_nr);
+ ret = __netdev_adjacent_dev_link(dev, i->dev);
if (ret)
goto rollback_upper_mesh;
}
@@ -5695,7 +5692,7 @@ static int __netdev_upper_dev_link(struct net_device *dev,
list_for_each_entry(i, &dev->all_adj_list.lower, list) {
pr_debug("linking %s's lower device %s with %s\n", dev->name,
i->dev->name, upper_dev->name);
- ret = __netdev_adjacent_dev_link(i->dev, upper_dev, i->ref_nr);
+ ret = __netdev_adjacent_dev_link(i->dev, upper_dev);
if (ret)
goto rollback_lower_mesh;
}
--
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 net-next 02/11] net: Introduce new api for walking upper and lower devices
From: David Ahern @ 2016-10-15 1:28 UTC (permalink / raw)
To: jiri-VPRAkNaXOzVWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA,
davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
j.vosburgh-Re5JQEeQqe8AvxtiuMwx3w, vfalico-Re5JQEeQqe8AvxtiuMwx3w,
andy-QlMahl40kYEqcZcGjlUOXw,
jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w,
intel-wired-lan-qjLDD68F18P21nG7glBr7A, David Ahern
In-Reply-To: <1476494931-31813-1-git-send-email-dsa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org>
This patch introduces netdev_walk_all_upper_dev_rcu,
netdev_walk_all_lower_dev and netdev_walk_all_lower_dev_rcu. These
functions recursively walk the adj_list of devices to determine all upper
and lower devices.
The functions take a callback function that is invoked for each device
in the list. If the callback returns non-0, the walk is terminated and
the functions return that code back to callers.
v2
- fixed definition of netdev_next_lower_dev_rcu to mirror the upper_dev
version.
Signed-off-by: David Ahern <dsa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org>
---
include/linux/netdevice.h | 17 +++++
net/core/dev.c | 161 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 178 insertions(+)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index bf341b65ca5e..a5902d995907 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3778,6 +3778,14 @@ struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
updev; \
updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
+int netdev_walk_all_upper_dev_rcu(struct net_device *dev,
+ int (*fn)(struct net_device *upper_dev,
+ void *data),
+ void *data);
+
+bool netdev_has_upper_dev_all_rcu(struct net_device *dev,
+ struct net_device *upper_dev);
+
void *netdev_lower_get_next_private(struct net_device *dev,
struct list_head **iter);
void *netdev_lower_get_next_private_rcu(struct net_device *dev,
@@ -3821,6 +3829,15 @@ struct net_device *netdev_all_lower_get_next_rcu(struct net_device *dev,
ldev; \
ldev = netdev_all_lower_get_next_rcu(dev, &(iter)))
+int netdev_walk_all_lower_dev(struct net_device *dev,
+ int (*fn)(struct net_device *lower_dev,
+ void *data),
+ void *data);
+int netdev_walk_all_lower_dev_rcu(struct net_device *dev,
+ int (*fn)(struct net_device *lower_dev,
+ void *data),
+ void *data);
+
void *netdev_adjacent_get_private(struct list_head *adj_list);
void *netdev_lower_get_first_private_rcu(struct net_device *dev);
struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index 5399af8fdac0..1780f94ed25f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5156,6 +5156,37 @@ bool netdev_has_upper_dev(struct net_device *dev,
EXPORT_SYMBOL(netdev_has_upper_dev);
/**
+ * netdev_has_upper_dev_all - Check if device is linked to an upper device
+ * @dev: device
+ * @upper_dev: upper device to check
+ *
+ * Find out if a device is linked to specified upper device and return true
+ * in case it is. Note that this checks the entire upper device chain.
+ * The caller must hold rcu lock.
+ */
+
+static int __netdev_has_upper_dev(struct net_device *upper_dev, void *data)
+{
+ struct net_device *dev = (struct net_device *)data;
+
+ if (upper_dev == dev)
+ return 1;
+
+ return 0;
+}
+
+bool netdev_has_upper_dev_all_rcu(struct net_device *dev,
+ struct net_device *upper_dev)
+{
+ if (netdev_walk_all_upper_dev_rcu(dev, __netdev_has_upper_dev,
+ upper_dev))
+ return true;
+
+ return false;
+}
+EXPORT_SYMBOL(netdev_has_upper_dev_all_rcu);
+
+/**
* netdev_has_any_upper_dev - Check if device is linked to some device
* @dev: device
*
@@ -5255,6 +5286,51 @@ struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
}
EXPORT_SYMBOL(netdev_all_upper_get_next_dev_rcu);
+static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev,
+ struct list_head **iter)
+{
+ struct netdev_adjacent *upper;
+
+ WARN_ON_ONCE(!rcu_read_lock_held() && !lockdep_rtnl_is_held());
+
+ upper = list_entry_rcu((*iter)->next, struct netdev_adjacent, list);
+
+ if (&upper->list == &dev->adj_list.upper)
+ return NULL;
+
+ *iter = &upper->list;
+
+ return upper->dev;
+}
+
+int netdev_walk_all_upper_dev_rcu(struct net_device *dev,
+ int (*fn)(struct net_device *dev,
+ void *data),
+ void *data)
+{
+ struct net_device *udev;
+ struct list_head *iter;
+ int ret;
+
+ for (iter = &dev->adj_list.upper,
+ udev = netdev_next_upper_dev_rcu(dev, &iter);
+ udev;
+ udev = netdev_next_upper_dev_rcu(dev, &iter)) {
+ /* first is the upper device itself */
+ ret = fn(udev, data);
+ if (ret)
+ return ret;
+
+ /* then look at all of its upper devices */
+ ret = netdev_walk_all_upper_dev_rcu(udev, fn, data);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(netdev_walk_all_upper_dev_rcu);
+
/**
* netdev_lower_get_next_private - Get the next ->private from the
* lower neighbour list
@@ -5361,6 +5437,49 @@ struct net_device *netdev_all_lower_get_next(struct net_device *dev, struct list
}
EXPORT_SYMBOL(netdev_all_lower_get_next);
+static struct net_device *netdev_next_lower_dev(struct net_device *dev,
+ struct list_head **iter)
+{
+ struct netdev_adjacent *lower;
+
+ lower = list_entry(*iter, struct netdev_adjacent, list);
+
+ if (&lower->list == &dev->adj_list.lower)
+ return NULL;
+
+ *iter = lower->list.next;
+
+ return lower->dev;
+}
+
+int netdev_walk_all_lower_dev(struct net_device *dev,
+ int (*fn)(struct net_device *dev,
+ void *data),
+ void *data)
+{
+ struct net_device *ldev;
+ struct list_head *iter;
+ int ret;
+
+ for (iter = &dev->adj_list.lower,
+ ldev = netdev_next_lower_dev(dev, &iter);
+ ldev;
+ ldev = netdev_next_lower_dev(dev, &iter)) {
+ /* first is the lower device itself */
+ ret = fn(ldev, data);
+ if (ret)
+ return ret;
+
+ /* then look at all of its lower devices */
+ ret = netdev_walk_all_lower_dev(ldev, fn, data);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(netdev_walk_all_lower_dev);
+
/**
* netdev_all_lower_get_next_rcu - Get the next device from all
* lower neighbour list, RCU variant
@@ -5382,6 +5501,48 @@ struct net_device *netdev_all_lower_get_next_rcu(struct net_device *dev,
}
EXPORT_SYMBOL(netdev_all_lower_get_next_rcu);
+static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
+ struct list_head **iter)
+{
+ struct netdev_adjacent *lower;
+
+ lower = list_entry_rcu((*iter)->next, struct netdev_adjacent, list);
+ if (&lower->list == &dev->adj_list.lower)
+ return NULL;
+
+ *iter = &lower->list;
+
+ return lower->dev;
+}
+
+int netdev_walk_all_lower_dev_rcu(struct net_device *dev,
+ int (*fn)(struct net_device *dev,
+ void *data),
+ void *data)
+{
+ struct net_device *ldev;
+ struct list_head *iter;
+ int ret;
+
+ for (iter = &dev->adj_list.lower,
+ ldev = netdev_next_lower_dev_rcu(dev, &iter);
+ ldev;
+ ldev = netdev_next_lower_dev_rcu(dev, &iter)) {
+ /* first is the lower device itself */
+ ret = fn(ldev, data);
+ if (ret)
+ return ret;
+
+ /* then look at all of its lower devices */
+ ret = netdev_walk_all_lower_dev_rcu(ldev, fn, data);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(netdev_walk_all_lower_dev_rcu);
+
/**
* netdev_lower_get_first_private_rcu - Get the first ->private from the
* lower neighbour list, RCU
--
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
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox