diff --git a/.gitignore b/.gitignore index f9fdfc1..47dd511 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/rdma-core-22.1.tar.gz +SOURCES/rdma-core-22.4.tar.gz diff --git a/.rdma-core.metadata b/.rdma-core.metadata index a6ec431..c3dfb32 100644 --- a/.rdma-core.metadata +++ b/.rdma-core.metadata @@ -1 +1 @@ -63b67ad27ba0998d716262d4baece854a8d0f830 SOURCES/rdma-core-22.1.tar.gz +cee363f1b8ef856bd80979a64684479cc55c8a0c SOURCES/rdma-core-22.4.tar.gz diff --git a/SOURCES/0000-rdma-core-v22.1-to-stable-v22-update.patch b/SOURCES/0000-rdma-core-v22.1-to-stable-v22-update.patch deleted file mode 100644 index a4c1a35..0000000 --- a/SOURCES/0000-rdma-core-v22.1-to-stable-v22-update.patch +++ /dev/null @@ -1,928 +0,0 @@ -commit 098d4238d9b9e584aaf4b9adb533defa6d310481 -Author: Mark Haywood -Date: Fri Apr 26 17:56:19 2019 +0200 - - ibacm: fix double hint.ai_family assignment in ib_acm_connect_open() - - [ Upstream commit 08843dc99669ae50c5ba204db644d5423fe8e910 ] - - It appears that a previous fix accidentally introduced a double - assignment to hint.ai_family and, in the process, accidentally removed - the assignment to hint.ai_protocol. This patch will fix both - assignments. - - Fixes: 579b6bf8 ("ibacm: Adding new configuration option 'server_mode'") - - Signed-off-by: Mark Haywood - Signed-off-by: Nicolas Morey-Chaisemartin - -commit 6c7d8a5152fccc0d17e7470318f925faed322b57 -Author: Mark Haywood -Date: Fri Apr 26 17:09:28 2019 +0200 - - ibacm: acme does not work if server_mode != unix - - [ Upstream commit 75ce9310735f7bcfc93e2bf442f0e5d268e0c5ab ] - - Running the ibacm server in mode loopback or open and then trying to run - ib_acme against it, fails: - - $ ib_acme -S 127.0.0.1 -v -f i -s 10.196.100.60 -d 10.196.1.60 - *** Error in `ib_acme': double free or corruption (fasttop): 0x000000000177c380 *** - ======= Backtrace: ========= - /lib64/libc.so.6(+0x7c619)[0x7f540121d619] - /lib64/libc.so.6(freeaddrinfo+0x28)[0x7f5401282fe8] - ib_acme[0x4049eb] - ib_acme[0x401841] - /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f54011c2c05] - ib_acme[0x40315b] - - In ib_acm_connect_open(), there is a double freeaddrinfo() that needs - to be fixed. And the socket close() should only be called if connect() - fails. - - Afterwards: - - $ ib_acme -S 127.0.0.1 -v -f i -s 10.196.100.60 -d 10.196.1.60 - Service: 127.0.0.1 - Destination: 10.196.1.60 - Source: 10.196.100.60 - Path information - dgid: fe80::10:e000:128:d021 - sgid: fe80::10:e000:128:d021 - dlid: 19 - slid: 19 - flow label: 0x0 - hop limit: 0 - tclass: 0 - reversible: 1 - pkey: 0xffff - sl: 0 - mtu: 4 - rate: 7 - packet lifetime: 0 - SA verification: success - - return status 0x0 - - Fixes: 579b6bf8 ("ibacm: Adding new configuration option 'server_mode'") - - Signed-off-by: Mark Haywood - Signed-off-by: Nicolas Morey-Chaisemartin - -commit d26a969c00c7743c25e0d3083aa3c1b926bd05cb -Author: Mark Haywood -Date: Fri Apr 26 16:40:14 2019 +0200 - - ibacm: ib_acm_connect() is doing too much - - [ Upstream commit c58daf0f1e6c71945907339afec17a350c0d49a6 ] - - The ib_acm_connect() function is performing multiple functions. It - handles setting up the connections for the three server modes, "unix", - "open" and "loop". The "open" and "loop" mode logic should share one - function. The "linux" mode logic should have its own function. - And ib_acm_connect() can call the appropriate helper function. - - Signed-off-by: Mark Haywood - Signed-off-by: Nicolas Morey-Chaisemartin - -commit aaba94df0afb6b3cf61f23a030410395f137c974 -Author: Mark Haywood -Date: Mon Apr 15 22:43:01 2019 +0200 - - verbs: The ibv_xsrq_pingpong "-c" option is broken - - [ Upstream commit 2bdfa37f61bb3899e0afcee497432e0b34c14a35 ] - - $ ibv_xsrq_pingpong -c 2 - Segmentation fault - - The getopt_long() optstring was modifed by 257470c2 to remove ':' from - the string leaving an optstring of "p:d:i:s:m:q:r:n:l:eg:c". The - explanation for this change in 257470c2 is: - - "Also, The buffer validation option doesn't require an extra parameter, - remove the extra ':' from all ibv_*_pingpong examples." - - In other ibv_*_pingpong examples, the "-c" option refers to the chk - (buffer validation) option. So, it made sense to make the change in - those example programs, but not in ibv_xsrq_pingpong. - - Fixes: 257470c2 ("verbs: Fix pingpong buffer validation") - - Signed-off-by: Mark Haywood - Signed-off-by: Nicolas Morey-Chaisemartin - -commit 17cb113341bd4933ea785c5aac0197b0fa836a1e -Author: Michael Guralnik -Date: Mon Apr 15 17:08:42 2019 +0300 - - mlx5: Fix masking service level in mlx5_create_ah - - [ Upstream commit 30978598c761a3f5b0e0cc4337107d91e897cf2e ] - - Fix masking of service level when creating AH to 4 bits in case of IB - link layer to match PRM definition. - - Fixes: 4e0c23429839 ("mlx5: Fix SL to Ethernet priority conversion") - Signed-off-by: Michael Guralnik - Signed-off-by: Yishai Hadas - Signed-off-by: Nicolas Morey-Chaisemartin - -commit 4ef38020957e478f8b5d1df0dea7fd60a25c7a9e -Author: Leon Romanovsky -Date: Wed Apr 17 16:46:36 2019 +0300 - - cmake: Explicitly convert build type to be STRING - - [ Upstream commit 10998b0068bd1503ed1c3c213c5450faf194e5cf ] - - The build type was declared As "String" instead of "STRING" and it - produced the following warning while rdma-core was built. - - CMake Warning (dev) at buildlib/RDMA_BuildType.cmake:11 (set): - implicitly converting 'String' to 'STRING' type. - Call Stack (most recent call first): - CMakeLists.txt:170 (RDMA_BuildType) - This warning is for project developers. Use -Wno-dev to suppress it. - - Fixes: 7cb1daa8d9e6 ("Be consistent about defining NDEBUG") - Signed-off-by: Leon Romanovsky - Signed-off-by: Nicolas Morey-Chaisemartin - -commit d05900db873f1a4ab6af1159ee87e50a15296352 -Author: Lijun Ou -Date: Sat Mar 23 10:05:09 2019 +0800 - - libhns: Bugfix for filtering zero length sge - - [ Upstream commit 1c2def4817f31c15342669144ef6bb894bd9616d ] - - When user posts a wqe with n sges, the driver needs to - determine to if each sge is valid and filter the invalid - sge, fill the number of valid sges into sq wqe. Hip08 - hardware allocates the correct memory location for each - valid sge based on the number of valid sge. For exmaple, - when posts a wqe with 3 sges. if 3 sge is valid, the first - and second sges will be filled into the wqe and the last - sge will fill the indpendent memory location which the - hardware allocated additionally. However, it will happen - error if the first and the second sges is invalid. - Because the driver will filter the first two sge and fill - the last sge into hardware. But the valid sge will be - stored in the extended memory and the correct way - should be stored in wqe. - - The other situation example as follows: - Posting five sge and have two invalid sge. - ________________________________________ - |___0____|__1____|___0____|__1___|___1__| - - the 0 express the sge is invalid, the 1 express the sge is valid. - Based on the above situation. the hardware will store the second - and the fourth sge into sq wqe. The last sge will be stored in - the extend memory location. the number of valid sge is 3. - - Fixes: 29ef2625c4e1 ("libhns: Filter for zero length of sge in hip08 userspace") - Signed-off-by: Lijun Ou - Signed-off-by: Nicolas Morey-Chaisemartin - -commit f3bb8968d3c1b622d586b51b6782ea26d4362489 -Author: Guy Levi -Date: Tue Mar 19 12:45:00 2019 +0200 - - buildlib: Ensure stanza is properly sorted - - [ Upstream commit 7d9a24f18372587608bcbfc42c3251d7697ea6ef ] - - A sanity check which verifies that the stanza version is the newest, - triggers a false alarm due to wrong sorting method. For example, a new - version tagged by 1.10 was sorted as older than 1.2 tag. Replacing the - sort method by LooseVersion from distutils fixes the issue. - - Fixes: 7cff8245374c ("Have travis check shared library filenames") - Signed-off-by: Guy Levi - Reviewed-by: Leon Romanovsky - Signed-off-by: Yishai Hadas - Signed-off-by: Nicolas Morey-Chaisemartin - -commit e02238eae4901cb2f0570b887c88f05824d76d47 -Author: Tzafrir Cohen -Date: Wed Mar 13 21:46:52 2019 +0200 - - debian: Create empty pyverbs package for builds without pyverbs - - [ Upstream commit ae52ee74cefcff13ebc6786a28740a881c38b2f0 ] - - Other parts of the standard Debian build toolchain (specifically: - dpkg-genchangelog, but possibly others) expect a package to exist. - - dpkg-genchanges: error: cannot fstat file - ../python3-pyverbs_23.0~201903120844+git272bb55~ubuntu16.04.1_amd64.deb: No such file or directory - dpkg-buildpackage: error: dpkg-genchanges gave error exit status 2 - - Link: https://launchpadlibrarian.net/414799420/buildlog_ubuntu-xenial-amd64.rdma-core_23.0~201903120844+git272bb55~ubuntu16.04.1_BUILDING.txt.gz - Fixes: 841c9f041f0af ("debian: Add pyverbs to Debian package") - Signed-off-by: Tzafrir Cohen - Signed-off-by: Leon Romanovsky - Signed-off-by: Nicolas Morey-Chaisemartin - -commit 90886054afbb91fdeb7df3fc7e6424eaec72fdea -Author: Artemy Kovalyov -Date: Sat Feb 23 16:40:17 2019 +0200 - - verbs: Fix attribute returning - - [ Upstream commit 888c598db4df509dfb2d44a151df7490450a118e ] - - Fix copying of returned attributes to chained buffers. - - Fixes: 776003b23f51 ("verbs: Allow all commands to be invoked by ioctl") - Fixes: a93098a32fdf ("verbs: Fix attribute preparation") - Signed-off-by: Artemy Kovalyov - Reviewed-by: Jason Gunthorpe - Signed-off-by: Yishai Hadas - Signed-off-by: Nicolas Morey-Chaisemartin - -commit c7c842a3cc4e0e7cca10613dc7e74e73fbbdf6f1 -Author: Tzafrir Cohen -Date: Thu Feb 28 15:19:06 2019 +0200 - - build: Fix pyverbs build issues on Debian - - [ Upstream commit ea5d6a50e76f3f6c88ac2db0b7143496d827100f ] - - Cython is used to build pyverbs, which is only supported in Python3. - Don't try to look for Cython if we don't have Python3. - Also update debian/rules file: - - configure: Check if Python3 is supported instead of relying on - EXTRA_CMAKE_FLAGS which is not set at this point. - - install: Add pyverbs to ignored missing packages if it wasn't built - (this decision will be taken by cmake at this point). - - build: Ignore pyverbs if it wasn't built. - - Fixes: 1ce4a3e8 ('pyverbs: Update cmake to include pyverbs package') - Signed-off-by: Tzafrir Cohen - Signed-off-by: Noa Osherovich - Signed-off-by: Jason Gunthorpe - Signed-off-by: Leon Romanovsky - Signed-off-by: Nicolas Morey-Chaisemartin - -commit 8043035f921f79ee723b764947f99398e580bc86 -Author: Leon Romanovsky -Date: Thu Mar 7 20:22:06 2019 +0200 - - travis: Change SuSE package target due to Travis CI failures - - [ Upstream commit b65dbb91bd80119065eaefb8c9bee773b8f347ec ] - - Change SuSE package target to leap due to random sigfaults while - running zypper command in tumbleweed under Travis CI environment. - - Signed-off-by: Leon Romanovsky - Signed-off-by: Nicolas Morey-Chaisemartin - -commit a4bbfc338f631648c65e02149f91da9939c21e2f -Author: Ariel Levkovich -Date: Mon Jan 21 22:09:00 2019 +0200 - - verbs: Avoid inline send when using device memory in rc_pingpong - - [ Upstream commit 9548325b725e1eb37b8f3553d54d27fac6cf1a92 ] - - Fix rc_pingpong example to avoid setting the inline send flag when using - device memory. - - When using device memory, posting send with inline data is not supported - since the device memory address is zero based and accessing it to copy - data will cause segmentation fault. - - Fixes: f06164d5ea8d ("verbs: Add device memory support in rc_pingpong example") - Signed-off-by: Ariel Levkovich - Signed-off-by: Yishai Hadas - Signed-off-by: Nicolas Morey-Chaisemartin - -commit 4b38d3cdfb939800976ad63fedaf8971439b6fa3 -Author: Ariel Levkovich -Date: Wed Feb 6 00:48:38 2019 +0200 - - mlx5: Use copy loop to read from device memory - - [ Upstream commit e84d7117aa0cbf47695dd0a663f6f1cb1d273e28 ] - - Revise the flow of copying data from device memory buffer to use a 4 - byte load loop since memcpy may use SSE instructions while the device - memory is an uncachable, IO mapped memory. - - Fixes: 9bb70e385874 ("mlx5: Device memory support") - Signed-off-by: Ariel Levkovich - Signed-off-by: Yishai Hadas - Signed-off-by: Nicolas Morey-Chaisemartin - -commit d38817ea554a9fd140e56414a7c74e7eef444c50 -Author: Mark Bloch -Date: Wed Feb 20 20:00:45 2019 +0000 - - verbs: clear cmd buffer when creating indirection table - - [ Upstream commit 34225464c1d165f63ffd462364810cc9f374109d ] - - Make sure we clear the cmd buffer, not doing so will make the kernel to - fail the command. - - Fixes: 75c65bbcadcd ("verbs: Consolidate duplicate code in create_rwq_ind_table") - Signed-off-by: Mark Bloch - Signed-off-by: Yishai Hadas - Signed-off-by: Nicolas Morey-Chaisemartin - -commit 9dcfa6cd2e0b84fcf74218198e98e18c04ec374f -Author: Lijun Ou -Date: Thu Feb 21 10:40:43 2019 +0800 - - libhns: Bugfix for using buffer length - - [ Upstream commit e25684538c95e0286de7bfd96a643c7b2d34deda ] - - We should use the length of buffer after aligned according the - input size for ibv_dontfork_range function. - - Fixes: c24583975044 ("libhns: Add verbs of qp support") - Signed-off-by: Lijun Ou - Signed-off-by: Nicolas Morey-Chaisemartin - -commit 23e3a5dac44f9ec81ee5402c5e45009715aee241 -Author: Bodong Wang -Date: Thu Sep 27 15:32:27 2018 -0500 - - mlx5: Fix incorrect error handling when SQ wqe count is 0 - - [ Upstream commit 37bd67876947fb600f4d1691391796778af89843 ] - - Driver allocates memory based on wqe count and checks whether the memory - allocation succeeded. However, this memory check should not be performed - when wqe count is 0. - - Fixes: 8c4791ae2395 ("libmlx5: First version of libmlx5") - Signed-off-by: Bodong Wang - Signed-off-by: Yishai Hadas - Signed-off-by: Nicolas Morey-Chaisemartin -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8310ec6c..0a8ad522 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -360,23 +360,23 @@ else() - set(HAVE_FULL_SYMBOL_VERSIONS 1) - endif() - --if (${NO_PYVERBS}) -- set(CYTHON_EXECUTABLE "") --else () -- # Look for Python. We prefer some variant of python 3 if the system has it. -- FIND_PACKAGE(PythonInterp 3 QUIET) -- if (NOT ${PythonInterp_FOUND}) -- FIND_PACKAGE(PythonInterp REQUIRED) -- endif() -- FIND_PACKAGE(cython) --endif() -- - # Look for Python. We prefer some variant of python 3 if the system has it. - FIND_PACKAGE(PythonInterp 3 QUIET) --if (NOT ${PythonInterp_FOUND}) -+if (PythonInterp_FOUND) -+ # pyverbs can only use python3: -+ if (NO_PYVERBS) -+ set(CYTHON_EXECUTABLE "") -+ else() -+ FIND_PACKAGE(cython) -+ endif() -+else() -+ # But we still must have python (be it 2) for the build process: - FIND_PACKAGE(PythonInterp REQUIRED) -+ set(CYTHON_EXECUTABLE "") - endif() -+ - # A cython & python-devel installation that matches our selected interpreter. -+ - if (CYTHON_EXECUTABLE) - # cmake has really bad logic here, if PythonIterp has been run it tries to - # find a matching -devel installation but will happily return a non-matching -diff --git a/buildlib/RDMA_BuildType.cmake b/buildlib/RDMA_BuildType.cmake -index 0951edad..17206f51 100644 ---- a/buildlib/RDMA_BuildType.cmake -+++ b/buildlib/RDMA_BuildType.cmake -@@ -8,7 +8,7 @@ function(RDMA_BuildType) - # in performance contexts it doesn't make much sense to have the default build - # turn off the optimizer. - if(NOT CMAKE_BUILD_TYPE) -- set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE String -+ set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING - "Options are ${build_types}" - FORCE - ) -diff --git a/buildlib/cbuild b/buildlib/cbuild -index 9ced0de6..15095d0c 100755 ---- a/buildlib/cbuild -+++ b/buildlib/cbuild -@@ -641,10 +641,6 @@ def run_deb_build(args,env): - "-e","DEB_BUILD_OPTIONS=parallel=%u"%(multiprocessing.cpu_count()), - ]; - -- if not env.build_pyverbs: -- opts.append("-e"); -- opts.append("EXTRA_CMAKE_FLAGS=%s"%(' '.join(["-DNO_PYVERBS=1"]))); -- - # Create a go.py that will let us run the compilation as the user and - # then switch to root only for the packaging step. - with open(os.path.join(tmpdir,"go.py"),"w") as F: -diff --git a/buildlib/check-build b/buildlib/check-build -index 5ae0cc1c..348b0590 100755 ---- a/buildlib/check-build -+++ b/buildlib/check-build -@@ -14,6 +14,7 @@ import copy - import shlex - import pipes - from contextlib import contextmanager; -+from distutils.version import LooseVersion; - - def get_src_dir(): - """Get the source directory using git""" -@@ -106,7 +107,7 @@ def check_lib_symver(args,fn): - private,args.PACKAGE_VERSION)); - - syms = list(syms - private); -- syms.sort(key=lambda x:re.split('[._]',x)); -+ syms.sort(key=LooseVersion) - if newest_symver != syms[-1]: - raise ValueError("Symbol version %r implied by filename %r not the newest in ELF (%r)"%( - newest_symver,fn,syms)); -diff --git a/buildlib/package-build-test b/buildlib/package-build-test -index 46a1cf6f..29c17838 100755 ---- a/buildlib/package-build-test -+++ b/buildlib/package-build-test -@@ -11,7 +11,7 @@ if [ -e "/.dockerenv" ] || (grep -q docker /proc/self/cgroup &>/dev/null); then - exit 0 - fi - --for OS in centos7 tumbleweed -+for OS in centos7 leap - do - echo - echo "Checking package build for ${OS} ...." -diff --git a/debian/rules b/debian/rules -index dceb6352..2d5b2670 100755 ---- a/debian/rules -+++ b/debian/rules -@@ -37,14 +37,15 @@ DH_AUTO_CONFIGURE := "--" \ - $(EXTRA_CMAKE_FLAGS) - - override_dh_auto_configure: --ifeq ($(EXTRA_CMAKE_FLAGS), -DNO_PYVERBS=1) -- dh_auto_configure $(DH_AUTO_CONFIGURE) --else -- dh_auto_configure $(DH_AUTO_CONFIGURE) \ -- -DNO_PYVERBS=0 \ -- -DPYTHON_EXECUTABLE:PATH=/usr/bin/python3 \ -- -DCMAKE_INSTALL_PYTHON_ARCH_LIB:PATH=/usr/lib/python3/dist-packages --endif -+ if [ -e /usr/bin/python3 ]; then \ -+ dh_auto_configure $(DH_AUTO_CONFIGURE) \ -+ -DPYTHON_EXECUTABLE:PATH=/usr/bin/python3 \ -+ -DCMAKE_INSTALL_PYTHON_ARCH_LIB:PATH=/usr/lib/python3/dist-packages; \ -+ else \ -+ dh_auto_configure $(DH_AUTO_CONFIGURE) \ -+ -DNO_PYVERBS=1; \ -+ fi -+ - - override_dh_auto_build: - ninja -C build-deb -v -@@ -72,7 +73,11 @@ ifeq ($(EXTRA_CMAKE_FLAGS), -DNO_PYVERBS=1) - endif - INST_EXCLUDE := $(addprefix -X,$(INST_EXCLUDE)) - override_dh_install: -- dh_install --fail-missing $(INST_EXCLUDE) -+ if [ -e build-deb/python/pyverbs/__init__.py ]; then \ -+ dh_install --fail-missing $(INST_EXCLUDE); \ -+ else \ -+ dh_install -Npython3-pyverbs --fail-missing $(INST_EXCLUDE) --remaining-packages; \ -+ fi - - # cmake installs the correct init scripts in the correct place, just setup the - # pre-postrms -@@ -99,13 +104,6 @@ override_dh_strip: - dh_strip -plibrdmacm1 --dbg-package=librdmacm1-dbg - dh_strip --remaining-packages - --override_dh_builddeb: --ifeq ($(EXTRA_CMAKE_FLAGS), -DNO_PYVERBS=1) -- dh_builddeb -Npython3-pyverbs --remaining-packages --else -- dh_builddeb --remaining-package --endif -- - # Upstream encourages the use of 'build' as the developer build output - # directory, allow that directory to be present and still allow dh to work. - .PHONY: build -diff --git a/ibacm/src/libacm.c b/ibacm/src/libacm.c -index 1d9d7145..e50fbf43 100644 ---- a/ibacm/src/libacm.c -+++ b/ibacm/src/libacm.c -@@ -56,7 +56,7 @@ static void acm_set_server_port(void) - } - } - --int ib_acm_connect(char *dest) -+static int ib_acm_connect_open(char *dest) - { - struct addrinfo hint, *res; - int ret; -@@ -64,67 +64,72 @@ int ib_acm_connect(char *dest) - acm_set_server_port(); - memset(&hint, 0, sizeof hint); - -- if (dest && *dest != '/') { -- hint.ai_family = AF_INET; -- hint.ai_family = AF_UNSPEC; -- -- ret = getaddrinfo(dest, NULL, &hint, &res); -- if (ret) -- return ret; -- -- sock = socket(res->ai_family, res->ai_socktype, -- res->ai_protocol); -- if (sock == -1) { -- ret = errno; -- goto err1; -- } -+ hint.ai_family = AF_UNSPEC; -+ hint.ai_protocol = IPPROTO_TCP; - -- ((struct sockaddr_in *) res->ai_addr)->sin_port = -- htobe16(server_port); -- ret = connect(sock, res->ai_addr, res->ai_addrlen); -- if (ret) -- goto err2; -+ ret = getaddrinfo(dest, NULL, &hint, &res); -+ if (ret) -+ return ret; - -- freeaddrinfo(res); -+ sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); -+ if (sock == -1) { -+ ret = errno; -+ goto freeaddr; -+ } - --err2: -+ ((struct sockaddr_in *) res->ai_addr)->sin_port = htobe16(server_port); -+ ret = connect(sock, res->ai_addr, res->ai_addrlen); -+ if (ret) { - close(sock); - sock = -1; --err1: -- freeaddrinfo(res); -- } else { -- struct sockaddr_un addr; -- -- addr.sun_family = AF_UNIX; -- if (dest) { -- if (snprintf(addr.sun_path, sizeof(addr.sun_path), -- "%s", dest) >= sizeof(addr.sun_path)) { -- errno = ENAMETOOLONG; -- return errno; -- } -- } else { -- BUILD_ASSERT(sizeof(IBACM_IBACME_SERVER_PATH) <= -- sizeof(addr.sun_path)); -- strcpy(addr.sun_path, IBACM_IBACME_SERVER_PATH); -- } -+ } - -- sock = socket(AF_UNIX, SOCK_STREAM, 0); -- if (sock < 0) -- return errno; -+freeaddr: -+ freeaddrinfo(res); -+ return ret; -+} - -- if (connect(sock, -- (struct sockaddr *)&addr, sizeof(addr)) != 0) { -- ret = errno; -- close(sock); -- sock = -1; -- errno = ret; -- return ret; -+static int ib_acm_connect_unix(char *dest) -+{ -+ struct sockaddr_un addr; -+ int ret; -+ -+ addr.sun_family = AF_UNIX; -+ if (dest) { -+ if (snprintf(addr.sun_path, sizeof(addr.sun_path), -+ "%s", dest) >= sizeof(addr.sun_path)) { -+ errno = ENAMETOOLONG; -+ return errno; - } -+ } else { -+ BUILD_ASSERT(sizeof(IBACM_IBACME_SERVER_PATH) <= -+ sizeof(addr.sun_path)); -+ strcpy(addr.sun_path, IBACM_IBACME_SERVER_PATH); -+ } -+ -+ sock = socket(AF_UNIX, SOCK_STREAM, 0); -+ if (sock < 0) -+ return errno; -+ -+ if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) { -+ ret = errno; -+ close(sock); -+ sock = -1; -+ errno = ret; -+ return ret; - } - - return 0; - } - -+int ib_acm_connect(char *dest) -+{ -+ if (dest && *dest == '/') -+ return ib_acm_connect_unix(dest); -+ -+ return ib_acm_connect_open(dest); -+} -+ - void ib_acm_disconnect(void) - { - if (sock != -1) { -diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c -index 34c71e56..5817c598 100644 ---- a/libibverbs/cmd.c -+++ b/libibverbs/cmd.c -@@ -1854,6 +1854,7 @@ int ibv_cmd_create_rwq_ind_table(struct ibv_context *context, - cmd_size = sizeof(*cmd) + num_tbl_entries * sizeof(cmd->wq_handles[0]); - cmd_size = (cmd_size + 7) / 8 * 8; - cmd = alloca(cmd_size); -+ memset(cmd, 0, cmd_size); - - for (i = 0; i < num_tbl_entries; i++) - cmd->wq_handles[i] = init_attr->ind_tbl[i]->handle; -diff --git a/libibverbs/cmd_ioctl.c b/libibverbs/cmd_ioctl.c -index 82ef2cd7..2a46c49c 100644 ---- a/libibverbs/cmd_ioctl.c -+++ b/libibverbs/cmd_ioctl.c -@@ -79,7 +79,6 @@ static void prepare_attrs(struct ibv_command_buffer *cmd) - } - - cmd->hdr.num_attrs = end - cmd->hdr.attrs; -- cmd->last_attr = end; - - /* - * We keep the in UHW uninlined until directly before sending to -@@ -113,7 +112,7 @@ static void finalize_attrs(struct ibv_command_buffer *cmd) - struct ibv_command_buffer *link; - struct ib_uverbs_attr *end; - -- for (end = cmd->hdr.attrs; end != cmd->last_attr; end++) -+ for (end = cmd->hdr.attrs; end != cmd->next_attr; end++) - finalize_attr(end); - - for (link = cmd->next; link; link = link->next) { -diff --git a/libibverbs/examples/rc_pingpong.c b/libibverbs/examples/rc_pingpong.c -index 8b2253d5..0f37f5df 100644 ---- a/libibverbs/examples/rc_pingpong.c -+++ b/libibverbs/examples/rc_pingpong.c -@@ -488,9 +488,8 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size, - } - - ibv_query_qp(ctx->qp, &attr, IBV_QP_CAP, &init_attr); -- if (init_attr.cap.max_inline_data >= size) { -+ if (init_attr.cap.max_inline_data >= size && !use_dm) - ctx->send_flags |= IBV_SEND_INLINE; -- } - } - - { -diff --git a/libibverbs/examples/xsrq_pingpong.c b/libibverbs/examples/xsrq_pingpong.c -index 4c0d825f..cfd3c34a 100644 ---- a/libibverbs/examples/xsrq_pingpong.c -+++ b/libibverbs/examples/xsrq_pingpong.c -@@ -876,7 +876,7 @@ int main(int argc, char *argv[]) - {} - }; - -- c = getopt_long(argc, argv, "p:d:i:s:m:n:l:eg:c", long_options, -+ c = getopt_long(argc, argv, "p:d:i:s:m:n:l:eg:c:", long_options, - NULL); - if (c == -1) - break; -diff --git a/providers/hns/hns_roce_u_buf.c b/providers/hns/hns_roce_u_buf.c -index f92ea651..27ed90c2 100644 ---- a/providers/hns/hns_roce_u_buf.c -+++ b/providers/hns/hns_roce_u_buf.c -@@ -46,7 +46,7 @@ int hns_roce_alloc_buf(struct hns_roce_buf *buf, unsigned int size, - if (buf->buf == MAP_FAILED) - return errno; - -- ret = ibv_dontfork_range(buf->buf, size); -+ ret = ibv_dontfork_range(buf->buf, buf->length); - if (ret) - munmap(buf->buf, buf->length); - -diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c -index af3bab1f..dd71fb14 100644 ---- a/providers/hns/hns_roce_u_hw_v2.c -+++ b/providers/hns/hns_roce_u_hw_v2.c -@@ -555,7 +555,6 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, - unsigned int ind_sge; - unsigned int ind; - int nreq; -- int i; - void *wqe; - int ret = 0; - struct hns_roce_qp *qp = to_hr_qp(ibvqp); -@@ -563,7 +562,10 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, - struct hns_roce_rc_sq_wqe *rc_sq_wqe; - struct hns_roce_v2_wqe_data_seg *dseg; - struct ibv_qp_attr attr; -+ int valid_num_sge; - int attr_mask; -+ int j; -+ int i; - - pthread_spin_lock(&qp->sq.lock); - -@@ -598,17 +600,25 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, - memset(rc_sq_wqe, 0, sizeof(struct hns_roce_rc_sq_wqe)); - - qp->sq.wrid[ind & (qp->sq.wqe_cnt - 1)] = wr->wr_id; -- for (i = 0; i < wr->num_sge; i++) -+ -+ valid_num_sge = wr->num_sge; -+ j = 0; -+ -+ for (i = 0; i < wr->num_sge; i++) { -+ if (unlikely(!wr->sg_list[i].length)) -+ valid_num_sge--; -+ - rc_sq_wqe->msg_len = - htole32(le32toh(rc_sq_wqe->msg_len) + - wr->sg_list[i].length); -+ } - - if (wr->opcode == IBV_WR_SEND_WITH_IMM || - wr->opcode == IBV_WR_RDMA_WRITE_WITH_IMM) - rc_sq_wqe->immtdata = htole32(be32toh(wr->imm_data)); - - roce_set_field(rc_sq_wqe->byte_16, RC_SQ_WQE_BYTE_16_SGE_NUM_M, -- RC_SQ_WQE_BYTE_16_SGE_NUM_S, wr->num_sge); -+ RC_SQ_WQE_BYTE_16_SGE_NUM_S, valid_num_sge); - - roce_set_field(rc_sq_wqe->byte_20, - RC_SQ_WQE_BYTE_20_MSG_START_SGE_IDX_S, -@@ -774,7 +784,7 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, - set_data_seg_v2(dseg, wr->sg_list); - wqe += sizeof(struct hns_roce_v2_wqe_data_seg); - set_atomic_seg(wqe, wr); -- } else if (wr->send_flags & IBV_SEND_INLINE && wr->num_sge) { -+ } else if (wr->send_flags & IBV_SEND_INLINE && valid_num_sge) { - if (le32toh(rc_sq_wqe->msg_len) > qp->max_inline_data) { - ret = EINVAL; - *bad_wr = wr; -@@ -801,7 +811,7 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, - RC_SQ_WQE_BYTE_4_INLINE_S, 1); - } else { - /* set sge */ -- if (wr->num_sge <= 2) { -+ if (valid_num_sge <= 2) { - for (i = 0; i < wr->num_sge; i++) - if (likely(wr->sg_list[i].length)) { - set_data_seg_v2(dseg, -@@ -814,7 +824,7 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, - RC_SQ_WQE_BYTE_20_MSG_START_SGE_IDX_S, - ind_sge & (qp->sge.sge_cnt - 1)); - -- for (i = 0; i < 2; i++) -+ for (i = 0; i < wr->num_sge && j < 2; i++) - if (likely(wr->sg_list[i].length)) { - set_data_seg_v2(dseg, - wr->sg_list + i); -@@ -824,10 +834,10 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, - dseg = get_send_sge_ex(qp, ind_sge & - (qp->sge.sge_cnt - 1)); - -- for (i = 0; i < wr->num_sge - 2; i++) { -- if (likely(wr->sg_list[i + 2].length)) { -+ for (; i < wr->num_sge; i++) { -+ if (likely(wr->sg_list[i].length)) { - set_data_seg_v2(dseg, -- wr->sg_list + 2 + i); -+ wr->sg_list + i); - dseg++; - ind_sge++; - } -diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c -index bab675f6..890ed980 100644 ---- a/providers/mlx5/verbs.c -+++ b/providers/mlx5/verbs.c -@@ -1452,13 +1452,13 @@ static int mlx5_alloc_qp_buf(struct ibv_context *context, - err = -1; - goto ex_wrid; - } -- } - -- qp->sq.wqe_head = malloc(qp->sq.wqe_cnt * sizeof(*qp->sq.wqe_head)); -- if (!qp->sq.wqe_head) { -- errno = ENOMEM; -- err = -1; -+ qp->sq.wqe_head = malloc(qp->sq.wqe_cnt * sizeof(*qp->sq.wqe_head)); -+ if (!qp->sq.wqe_head) { -+ errno = ENOMEM; -+ err = -1; - goto ex_wrid; -+ } - } - - if (qp->rq.wqe_cnt) { -@@ -2432,7 +2432,7 @@ struct ibv_ah *mlx5_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) - ah->av.fl_mlid = attr->src_path_bits & 0x7f; - ah->av.rlid = htobe16(attr->dlid); - grh = 1; -- ah->av.stat_rate_sl = (static_rate << 4) | (attr->sl & 0x7); -+ ah->av.stat_rate_sl = (static_rate << 4) | (attr->sl & 0xf); - } - if (attr->is_global) { - ah->av.tclass = attr->grh.traffic_class; -@@ -3494,13 +3494,14 @@ int mlx5_destroy_flow_action(struct ibv_flow_action *action) - return ret; - } - --static inline int mlx5_memcpy_to_dm(struct ibv_dm *ibdm, uint64_t dm_offset, -- const void *host_addr, size_t length) -+static inline int mlx5_access_dm(struct ibv_dm *ibdm, uint64_t dm_offset, -+ void *host_addr, size_t length, -+ uint32_t read) - { - struct mlx5_dm *dm = to_mdm(ibdm); - atomic_uint32_t *dm_ptr = - (atomic_uint32_t *)dm->start_va + dm_offset / 4; -- const uint32_t *host_ptr = host_addr; -+ uint32_t *host_ptr = host_addr; - const uint32_t *host_end = host_ptr + length / 4; - - if (dm_offset + length > dm->length) -@@ -3515,31 +3516,34 @@ static inline int mlx5_memcpy_to_dm(struct ibv_dm *ibdm, uint64_t dm_offset, - /* Copy granularity should be 4 Bytes since we enforce copy size to be - * a multiple of 4 bytes. - */ -- while (host_ptr != host_end) { -- atomic_store_explicit(dm_ptr, *host_ptr, memory_order_relaxed); -- host_ptr++; -- dm_ptr++; -+ if (read) { -+ while (host_ptr != host_end) { -+ *host_ptr = atomic_load_explicit(dm_ptr, -+ memory_order_relaxed); -+ host_ptr++; -+ dm_ptr++; -+ } -+ } else { -+ while (host_ptr != host_end) { -+ atomic_store_explicit(dm_ptr, *host_ptr, -+ memory_order_relaxed); -+ host_ptr++; -+ dm_ptr++; -+ } - } - - return 0; - } -+static inline int mlx5_memcpy_to_dm(struct ibv_dm *ibdm, uint64_t dm_offset, -+ const void *host_addr, size_t length) -+{ -+ return mlx5_access_dm(ibdm, dm_offset, (void *)host_addr, length, 0); -+} - - static inline int mlx5_memcpy_from_dm(void *host_addr, struct ibv_dm *ibdm, - uint64_t dm_offset, size_t length) - { -- struct mlx5_dm *dm = to_mdm(ibdm); -- void *dm_va = dm->start_va + dm_offset; -- -- if (dm_offset + length > dm->length) -- return EFAULT; -- -- /* DM access address must be aligned to 4 bytes */ -- if (dm_offset & 3) -- return EINVAL; -- -- memcpy(host_addr, dm_va, length); -- -- return 0; -+ return mlx5_access_dm(ibdm, dm_offset, host_addr, length, 1); - } - - struct ibv_dm *mlx5_alloc_dm(struct ibv_context *context, diff --git a/SOURCES/0001-ibacm-Do-not-open-non-InfiniBand-device.patch b/SOURCES/0001-ibacm-Do-not-open-non-InfiniBand-device.patch new file mode 100644 index 0000000..08060cb --- /dev/null +++ b/SOURCES/0001-ibacm-Do-not-open-non-InfiniBand-device.patch @@ -0,0 +1,66 @@ +From 9ecb459f5bb442174189f25e9ce6c59d66b5b943 Mon Sep 17 00:00:00 2001 +From: Honggang Li +Date: Tue, 4 Feb 2020 09:01:11 +0800 +Subject: [PATCH] ibacm: Do not open non InfiniBand device + +For dual port HCA, which has an InfiniBand port and an Ethernet port, +only open InfiniBand port will introduce segment fault issues. + +Because the Ethernet port did not open yet, segment fault when active +the Ethernet port. The second segment fault issue happens when there +is asyn event on the Ethernet port. + +We should skip pure iWARP or RoCE devices, but not device which has at +least one InfiniBand port. + +Signed-off-by: Honggang Li +--- + ibacm/src/acm.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c +index 1aa08f4b..77828d8c 100644 +--- a/ibacm/src/acm.c ++++ b/ibacm/src/acm.c +@@ -2600,9 +2600,11 @@ static void acm_open_dev(struct ibv_device *ibdev) + { + struct acmc_device *dev; + struct ibv_device_attr attr; ++ struct ibv_port_attr port_attr; + struct ibv_context *verbs; + size_t size; + int i, ret; ++ bool has_ib_port = false; + + acm_log(1, "%s\n", ibdev->name); + verbs = ibv_open_device(ibdev); +@@ -2617,6 +2619,26 @@ static void acm_open_dev(struct ibv_device *ibdev) + goto err1; + } + ++ for (i = 0; i < attr.phys_port_cnt; i++) { ++ ret = ibv_query_port(verbs, i + 1, &port_attr); ++ if (ret) { ++ acm_log(0, "ERROR - ibv_query_port (%s, %d) return (%d)\n", ++ ibdev->name, i + 1, ret); ++ continue; ++ } ++ ++ if (port_attr.link_layer == IBV_LINK_LAYER_INFINIBAND) { ++ acm_log(1, "%s port %d is an InfiniBand port\n", ibdev->name, i); ++ has_ib_port = true; ++ } else ++ acm_log(1, "%s port %d is not an InfiniBand port\n", ibdev->name, i); ++ } ++ ++ if (!has_ib_port) { ++ acm_log(1, "%s does not support InfiniBand.\n", ibdev->name); ++ goto err1; ++ } ++ + size = sizeof(*dev) + sizeof(struct acmc_port) * attr.phys_port_cnt; + dev = (struct acmc_device *) calloc(1, size); + if (!dev) +-- +2.24.1 + diff --git a/SOURCES/0001-srp_daemon-fix-a-double-free-segment-fault-for-ibsrp.patch b/SOURCES/0001-srp_daemon-fix-a-double-free-segment-fault-for-ibsrp.patch new file mode 100644 index 0000000..b33c8c0 --- /dev/null +++ b/SOURCES/0001-srp_daemon-fix-a-double-free-segment-fault-for-ibsrp.patch @@ -0,0 +1,51 @@ +From 213d508e72e5243db5711510b1d48b93b0aed9df Mon Sep 17 00:00:00 2001 +From: Honggang Li +Date: Thu, 19 Sep 2019 14:40:45 +0800 +Subject: [PATCH rdma-core 1/5] srp_daemon: fix a double free segment fault for + ibsrpdm + +[ Upstream commit 0b09980860a05ec5feb25f7849c2d703db5c157e ] + +Command: ./ibsrpdm -d /dev/infiniband/umadX + +Invalid free() / delete / delete[] / realloc() + at 0x4C320DC: free (vg_replace_malloc.c:540) + by 0x403BBB: free_config (srp_daemon.c:1811) + by 0x4031BE: ibsrpdm (srp_daemon.c:2113) + by 0x4031BE: main (srp_daemon.c:2153) + Address 0x5ee5fd0 is 0 bytes inside a block of size 16 free'd + at 0x4C320DC: free (vg_replace_malloc.c:540) + by 0x404851: translate_umad_to_ibdev_and_port (srp_daemon.c:729) + by 0x404851: set_conf_dev_and_port (srp_daemon.c:1586) + by 0x403171: ibsrpdm (srp_daemon.c:2092) + by 0x403171: main (srp_daemon.c:2153) + Block was alloc'd at + at 0x4C30EDB: malloc (vg_replace_malloc.c:309) + by 0x40478D: translate_umad_to_ibdev_and_port (srp_daemon.c:698) + by 0x40478D: set_conf_dev_and_port (srp_daemon.c:1586) + by 0x403171: ibsrpdm (srp_daemon.c:2092) + by 0x403171: main (srp_daemon.c:2153) + +Signed-off-by: Honggang Li +Reviewed-by: Bart Van Assche +Signed-off-by: Leon Romanovsky +Signed-off-by: Nicolas Morey-Chaisemartin +--- + srp_daemon/srp_daemon.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c +index baf4957a..82dc929f 100644 +--- a/srp_daemon/srp_daemon.c ++++ b/srp_daemon/srp_daemon.c +@@ -724,6 +724,7 @@ end: + if (ret) { + free(*ibport); + free(*ibdev); ++ *ibdev = NULL; + } + free(class_dev_path); + +-- +2.20.1 + diff --git a/SOURCES/0002-cxgb4-free-appropriate-pointer-in-error-case.patch b/SOURCES/0002-cxgb4-free-appropriate-pointer-in-error-case.patch new file mode 100644 index 0000000..8154ceb --- /dev/null +++ b/SOURCES/0002-cxgb4-free-appropriate-pointer-in-error-case.patch @@ -0,0 +1,39 @@ +From 2e940ac7836816efa47be134725934e9150c93db Mon Sep 17 00:00:00 2001 +From: Potnuri Bharat Teja +Date: Thu, 31 Oct 2019 16:05:59 +0530 +Subject: [PATCH rdma-core 2/5] cxgb4: free appropriate pointer in error case + +[ Upstream commit 151068ef86cc28d75b4cd73906b79c52fe55ee9c ] + +error unmap case wrongly frees only the cqid2ptr for qp/mmid2ptr. +This patch frees the appropriate pointer. + +Fixes: 9b2d3af5735e ("Query device to get the max supported stags, qps, and cqs") +Signed-off-by: Potnuri Bharat Teja +--- +v0 -> v1: +- add missing description +Signed-off-by: Nicolas Morey-Chaisemartin +--- + providers/cxgb4/dev.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c +index aba007f0..1377cf87 100644 +--- a/providers/cxgb4/dev.c ++++ b/providers/cxgb4/dev.c +@@ -203,9 +203,9 @@ err_free: + if (rhp->cqid2ptr) + free(rhp->cqid2ptr); + if (rhp->qpid2ptr) +- free(rhp->cqid2ptr); ++ free(rhp->qpid2ptr); + if (rhp->mmid2ptr) +- free(rhp->cqid2ptr); ++ free(rhp->mmid2ptr); + verbs_uninit_context(&context->ibv_ctx); + free(context); + return NULL; +-- +2.20.1 + diff --git a/SOURCES/0003-man-Fix-return-value-for-ibv_reg_dm_mr.patch b/SOURCES/0003-man-Fix-return-value-for-ibv_reg_dm_mr.patch new file mode 100644 index 0000000..4545904 --- /dev/null +++ b/SOURCES/0003-man-Fix-return-value-for-ibv_reg_dm_mr.patch @@ -0,0 +1,33 @@ +From 35a879329128596bdf0f1ac51fcd786cb1b59d86 Mon Sep 17 00:00:00 2001 +From: Noa Osherovich +Date: Sun, 10 Nov 2019 15:11:50 +0200 +Subject: [PATCH rdma-core 3/5] man: Fix return value for ibv_reg_dm_mr + +[ Upstream commit bd96015f5167dded567ecb73f11a04d1d00a8036 ] + +ibv_reg_dm_mr returns a struct ibv_mr pointer while man page defined +it as returning an int. Fix the description. + +Fixes: e1cebbf50c262 ('verbs: Add device memory (DM) support in libibverbs') +Signed-off-by: Noa Osherovich +Signed-off-by: Nicolas Morey-Chaisemartin +--- + libibverbs/man/ibv_alloc_dm.3 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libibverbs/man/ibv_alloc_dm.3 b/libibverbs/man/ibv_alloc_dm.3 +index d28a955c..28fa488a 100644 +--- a/libibverbs/man/ibv_alloc_dm.3 ++++ b/libibverbs/man/ibv_alloc_dm.3 +@@ -70,7 +70,7 @@ is done with a byte offset from the beginning of the region. + .sp + This type of registration is done using ibv_reg_dm_mr. + .sp +-.BI "int ibv_reg_dm_mr(struct ibv_pd " "*pd" ", struct ibv_dm " "*dm" ", uint64_t " "dm_offset", ++.BI "struct ibv_mr* ibv_reg_dm_mr(struct ibv_pd " "*pd" ", struct ibv_dm " "*dm" ", uint64_t " "dm_offset", + .BI " size_t " "length" ", uint32_t " "access"); + .sp + .I pd +-- +2.20.1 + diff --git a/SOURCES/0004-Update-kernel-headers.patch b/SOURCES/0004-Update-kernel-headers.patch new file mode 100644 index 0000000..c18aec9 --- /dev/null +++ b/SOURCES/0004-Update-kernel-headers.patch @@ -0,0 +1,68 @@ +From 12cee2d80a7e616c73d1de1d5ce1cbc8e33c524f Mon Sep 17 00:00:00 2001 +From: Yishai Hadas +Date: Thu, 2 May 2019 13:35:41 +0300 +Subject: [PATCH rdma-core 4/5] Update kernel headers + +To commit 7249c8ea227a ("IB/mlx5: Fix scatter to CQE in DCT QP +creation") + +Signed-off-by: Yishai Hadas +--- + kernel-headers/rdma/mlx5-abi.h | 1 + + kernel-headers/rdma/rdma_netlink.h | 20 ++++++++++++++++++-- + 2 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/kernel-headers/rdma/mlx5-abi.h b/kernel-headers/rdma/mlx5-abi.h +index 87b3198f..f4d4010b 100644 +--- a/kernel-headers/rdma/mlx5-abi.h ++++ b/kernel-headers/rdma/mlx5-abi.h +@@ -238,6 +238,7 @@ enum mlx5_ib_query_dev_resp_flags { + MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0, + MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD = 1 << 1, + MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE = 1 << 2, ++ MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT = 1 << 3, + }; + + enum mlx5_ib_tunnel_offloads { +diff --git a/kernel-headers/rdma/rdma_netlink.h b/kernel-headers/rdma/rdma_netlink.h +index 2e18b77a..6791ccc7 100644 +--- a/kernel-headers/rdma/rdma_netlink.h ++++ b/kernel-headers/rdma/rdma_netlink.h +@@ -229,9 +229,11 @@ enum rdma_nldev_command { + RDMA_NLDEV_CMD_GET, /* can dump */ + RDMA_NLDEV_CMD_SET, + +- /* 3 - 4 are free to use */ ++ RDMA_NLDEV_CMD_NEWLINK, + +- RDMA_NLDEV_CMD_PORT_GET = 5, /* can dump */ ++ RDMA_NLDEV_CMD_DELLINK, ++ ++ RDMA_NLDEV_CMD_PORT_GET, /* can dump */ + + /* 6 - 8 are free to use */ + +@@ -430,6 +432,20 @@ enum rdma_nldev_attr { + RDMA_NLDEV_ATTR_DRIVER_S64, /* s64 */ + RDMA_NLDEV_ATTR_DRIVER_U64, /* u64 */ + ++ /* ++ * Indexes to get/set secific entry, ++ * for QP use RDMA_NLDEV_ATTR_RES_LQPN ++ */ ++ RDMA_NLDEV_ATTR_RES_PDN, /* u32 */ ++ RDMA_NLDEV_ATTR_RES_CQN, /* u32 */ ++ RDMA_NLDEV_ATTR_RES_MRN, /* u32 */ ++ RDMA_NLDEV_ATTR_RES_CM_IDN, /* u32 */ ++ RDMA_NLDEV_ATTR_RES_CTXN, /* u32 */ ++ /* ++ * Identifies the rdma driver. eg: "rxe" or "siw" ++ */ ++ RDMA_NLDEV_ATTR_LINK_TYPE, /* string */ ++ + /* + * Always the end + */ +-- +2.20.1 + diff --git a/SOURCES/0005-mlx5-Support-scatter-to-CQE-over-DCT-QP.patch b/SOURCES/0005-mlx5-Support-scatter-to-CQE-over-DCT-QP.patch new file mode 100644 index 0000000..8b58f61 --- /dev/null +++ b/SOURCES/0005-mlx5-Support-scatter-to-CQE-over-DCT-QP.patch @@ -0,0 +1,168 @@ +From d962bef7ac575c971f5792fc83dbccd17eb23989 Mon Sep 17 00:00:00 2001 +From: Alaa Hleihel +Date: Thu, 21 Nov 2019 16:25:34 -0500 +Subject: [PATCH rdma-core 5/5] mlx5: Support scatter to CQE over DCT QP + +Bugzilla: http://bugzilla.redhat.com/BZNUM +Upstream: origin/master +Conflicts: + - providers/mlx5/verbs.c + Had small context diff and dropped an hunk that is not relevant due to + missing patches. + +commit cd231947e19d5f40d55b8a493aa8c069b88df9e9 +Author: Guy Levi +Date: Tue Mar 26 09:40:17 2019 +0200 + + mlx5: Support scatter to CQE over DCT QP + + Scatter to CQE which is a performance feature has never been enabled on + DCT QP. + + A new capability which allows to enable the feature on DCT QP is + reported in query device related verb. Correspondingly, this patch + enables the feature functionality so it is aligned with other QPs and + the man page. It will be controlled by the legacy environment variable + and can be override by the DV creation flags. + + Fixes: b9967a9d722a ("mlx5: Create DC transport QPs") + Signed-off-by: Guy Levi + Signed-off-by: Yishai Hadas + +Signed-off-by: Jarod Wilson +--- + providers/mlx5/mlx5.h | 1 + + providers/mlx5/verbs.c | 37 +++++++++++++++++++++++++++---------- + 2 files changed, 28 insertions(+), 10 deletions(-) + +diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h +index 75d599ad..4b6d903a 100644 +--- a/providers/mlx5/mlx5.h ++++ b/providers/mlx5/mlx5.h +@@ -186,6 +186,7 @@ enum mlx5_vendor_cap_flags { + MLX5_VENDOR_CAP_FLAGS_CQE_128B_COMP = 1 << 3, + MLX5_VENDOR_CAP_FLAGS_CQE_128B_PAD = 1 << 4, + MLX5_VENDOR_CAP_FLAGS_PACKET_BASED_CREDIT_MODE = 1 << 5, ++ MLX5_VENDOR_CAP_FLAGS_SCAT2CQE_DCT = 1 << 6, + }; + + enum { +diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c +index 890ed980..dad20c4f 100644 +--- a/providers/mlx5/verbs.c ++++ b/providers/mlx5/verbs.c +@@ -1642,7 +1642,7 @@ enum { + static int create_dct(struct ibv_context *context, + struct ibv_qp_init_attr_ex *attr, + struct mlx5dv_qp_init_attr *mlx5_qp_attr, +- struct mlx5_qp *qp) ++ struct mlx5_qp *qp, uint32_t mlx5_create_flags) + { + struct mlx5_create_qp cmd = {}; + struct mlx5_create_qp_resp resp = {}; +@@ -1658,14 +1658,26 @@ static int create_dct(struct ibv_context *context, + return errno; + } + +- if (!check_comp_mask(mlx5_qp_attr->comp_mask, MLX5DV_QP_INIT_ATTR_MASK_DC)) { ++ if (!check_comp_mask(mlx5_qp_attr->comp_mask, ++ MLX5DV_QP_INIT_ATTR_MASK_DC | ++ MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS)) { + mlx5_dbg(fp, MLX5_DBG_QP, + "Unsupported vendor comp_mask for %s\n", __func__); + errno = EINVAL; + return errno; + } + +- cmd.flags = MLX5_QP_FLAG_TYPE_DCT; ++ if (!check_comp_mask(mlx5_create_flags, MLX5_QP_FLAG_SCATTER_CQE)) { ++ mlx5_dbg(fp, MLX5_DBG_QP, ++ "Unsupported creation flags requested for DCT QP\n"); ++ errno = EINVAL; ++ return errno; ++ } ++ ++ if (!(ctx->vendor_cap_flags & MLX5_VENDOR_CAP_FLAGS_SCAT2CQE_DCT)) ++ mlx5_create_flags &= ~MLX5_QP_FLAG_SCATTER_CQE; ++ ++ cmd.flags = MLX5_QP_FLAG_TYPE_DCT | mlx5_create_flags; + cmd.access_key = mlx5_qp_attr->dc_init_attr.dct_access_key; + + if (ctx->cqe_version) { +@@ -1709,7 +1721,6 @@ static struct ibv_qp *create_qp(struct ibv_context *context, + int32_t usr_idx = 0; + uint32_t mlx5_create_flags = 0; + struct mlx5_bf *bf = NULL; +- bool scatter_to_cqe_configured = false; + FILE *fp = ctx->dbg_fp; + struct mlx5_parent_domain *mparent_domain; + struct mlx5_ib_create_qp_resp *resp_drv; +@@ -1745,6 +1756,9 @@ static struct ibv_qp *create_qp(struct ibv_context *context, + memset(&resp, 0, sizeof(resp)); + memset(&resp_ex, 0, sizeof(resp_ex)); + ++ if (use_scatter_to_cqe()) ++ mlx5_create_flags |= MLX5_QP_FLAG_SCATTER_CQE; ++ + if (mlx5_qp_attr) { + if (!check_comp_mask(mlx5_qp_attr->comp_mask, + MLX5_DV_CREATE_QP_SUP_COMP_MASK)) { +@@ -1792,14 +1806,13 @@ static struct ibv_qp *create_qp(struct ibv_context *context, + errno = EINVAL; + goto err; + } +- scatter_to_cqe_configured = true; ++ mlx5_create_flags &= ~MLX5_QP_FLAG_SCATTER_CQE; + } + if (mlx5_qp_attr->create_flags & + MLX5DV_QP_CREATE_ALLOW_SCATTER_TO_CQE) { + mlx5_create_flags |= + (MLX5_QP_FLAG_ALLOW_SCATTER_CQE | + MLX5_QP_FLAG_SCATTER_CQE); +- scatter_to_cqe_configured = true; + } + if (mlx5_qp_attr->create_flags & + MLX5DV_QP_CREATE_PACKET_BASED_CREDIT_MODE) +@@ -1810,7 +1823,8 @@ static struct ibv_qp *create_qp(struct ibv_context *context, + if (attr->qp_type == IBV_QPT_DRIVER) { + if (mlx5_qp_attr->comp_mask & MLX5DV_QP_INIT_ATTR_MASK_DC) { + if (mlx5_qp_attr->dc_init_attr.dc_type == MLX5DV_DCTYPE_DCT) { +- ret = create_dct(context, attr, mlx5_qp_attr, qp); ++ ret = create_dct(context, attr, mlx5_qp_attr, ++ qp, mlx5_create_flags); + if (ret) + goto err; + return ibqp; +@@ -1833,6 +1847,9 @@ static struct ibv_qp *create_qp(struct ibv_context *context, + } + + if (attr->comp_mask & IBV_QP_INIT_ATTR_RX_HASH) { ++ /* Scatter2CQE is unsupported for RSS QP */ ++ mlx5_create_flags &= ~MLX5_QP_FLAG_SCATTER_CQE; ++ + ret = mlx5_cmd_create_rss_qp(context, attr, qp, + mlx5_create_flags); + if (ret) +@@ -1846,9 +1863,6 @@ static struct ibv_qp *create_qp(struct ibv_context *context, + if (qp->wq_sig) + cmd.flags |= MLX5_QP_FLAG_SIGNATURE; + +- if (!scatter_to_cqe_configured && use_scatter_to_cqe()) +- cmd.flags |= MLX5_QP_FLAG_SCATTER_CQE; +- + ret = mlx5_calc_wq_size(ctx, attr, qp); + if (ret < 0) { + errno = -ret; +@@ -2887,6 +2901,9 @@ int mlx5_query_device_ex(struct ibv_context *context, + if (resp.flags & MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE) + mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_PACKET_BASED_CREDIT_MODE; + ++ if (resp.flags & MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT) ++ mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_SCAT2CQE_DCT; ++ + major = (raw_fw_ver >> 32) & 0xffff; + minor = (raw_fw_ver >> 16) & 0xffff; + sub_minor = raw_fw_ver & 0xffff; +-- +2.20.1 + diff --git a/SOURCES/rdma-core-unclamp-ipoib-mtu.patch b/SOURCES/rdma-core-unclamp-ipoib-mtu.patch new file mode 100644 index 0000000..521aa84 --- /dev/null +++ b/SOURCES/rdma-core-unclamp-ipoib-mtu.patch @@ -0,0 +1,32 @@ +--- rdma-core-22.1.orig/redhat/rdma.ifup-ib 2019-08-27 10:15:27.537044097 -0400 ++++ rdma-core-22.1/redhat/rdma.ifup-ib 2019-08-27 10:14:42.453131658 -0400 +@@ -110,19 +110,25 @@ if [ -e /sys/class/net/${DEVICE}/mode ]; + # cycle, allowing people to change the mode without rebooting + if [ "${CONNECTED_MODE}" = yes ]; then + echo connected > /sys/class/net/${DEVICE}/mode +- # cap the MTU where we should based upon mode ++ # set default MTU based upon mode if none specified + [ -z "$MTU" ] && MTU=65520 +- [ "$MTU" -gt 65520 ] && MTU=65520 + else + echo datagram > /sys/class/net/${DEVICE}/mode +- # cap the MTU where we should based upon mode ++ # set default MTU based upon mode if none specified + [ -z "$MTU" ] && MTU=2044 +- [ "$MTU" -gt 4092 ] && MTU=4092 ++ fi ++ # cap the MTU to roughly the same as Ethernet's max MTU ++ if [ "$MTU" -gt 65520 ]; then ++ MTU=65520 ++ net_log $"Warning: capping device ${DEVICE} MTU to ${MTU}." + fi + fi + + if [ -n "${MTU}" ]; then + ip link set dev ${DEVICE} mtu ${MTU} ++ if [ "$?" ]; then ++ net_log $"Error setting device ${DEVICE} MTU to ${MTU}, using HW default." ++ fi + fi + + # slave device? diff --git a/SPECS/rdma-core.spec b/SPECS/rdma-core.spec index 18348fd..487a0fc 100644 --- a/SPECS/rdma-core.spec +++ b/SPECS/rdma-core.spec @@ -1,5 +1,5 @@ Name: rdma-core -Version: 22.1 +Version: 22.4 Release: 3%{?dist} Summary: RDMA core userspace libraries and daemons @@ -10,8 +10,6 @@ Summary: RDMA core userspace libraries and daemons License: GPLv2 or BSD Url: https://github.com/linux-rdma/rdma-core Source: https://github.com/linux-rdma/rdma-core/releases/download/v%{version}/%{name}-%{version}.tar.gz -# Diff between v22.1 and head of stable-v22 branch -Patch0: 0000-rdma-core-v22.1-to-stable-v22-update.patch # Red Hat patches Patch1: 0001-redhat-kernel-init-ocrdma-is-tech-preview-too.patch Patch2: 0002-redhat-kernel-init-libi40iw-no-longer-tech-preview.patch @@ -20,10 +18,19 @@ Patch4: 0004-Revert-redhat-remove-files-that-we-no-longer-use.patch Patch5: 0005-fix_mtu_limiting_for_ipoib.patch Patch6: 0006-srp_daemon-Remove-unsupported-systemd-configurations.patch Patch7: 0007-srp_daemon-srp_daemon.service-should-be-started-afte.patch -# Additional upstream patches from master branch -Patch101: 0101-Update-kernel-headers.patch -Patch102: 0102-bnxt_re-lib-Enable-Broadcom-s-57500-RoCE-adapter.patch -Patch103: 0103-mlx5-Add-new-device-IDs.patch +Patch8: rdma-core-unclamp-ipoib-mtu.patch +# Additional upstream patches from branch v23 +Patch11: 0101-Update-kernel-headers.patch +Patch12: 0102-bnxt_re-lib-Enable-Broadcom-s-57500-RoCE-adapter.patch +Patch13: 0103-mlx5-Add-new-device-IDs.patch +# Additional upstream patches from stable-vX/master branch +Patch101: 0001-srp_daemon-fix-a-double-free-segment-fault-for-ibsrp.patch +Patch102: 0002-cxgb4-free-appropriate-pointer-in-error-case.patch +Patch103: 0003-man-Fix-return-value-for-ibv_reg_dm_mr.patch +# Patches backported from master branch +Patch104: 0004-Update-kernel-headers.patch +Patch105: 0005-mlx5-Support-scatter-to-CQE-over-DCT-QP.patch +Patch106: 0001-ibacm-Do-not-open-non-InfiniBand-device.patch # Do not build static libs by default. %define with_static %{?_with_static: 1} %{?!_with_static: 0} @@ -267,7 +274,6 @@ discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand. %prep %setup -%patch0 -p1 %patch1 -p1 %patch2 -p1 %patch3 -p1 @@ -275,9 +281,16 @@ discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand. %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch8 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1 +%patch104 -p1 +%patch105 -p1 +%patch106 -p1 %build @@ -529,6 +542,26 @@ rm -rf %{buildroot}/%{_initrddir}/ %doc %{_docdir}/%{name}-%{version}/ibsrpdm.md %changelog +* Mon Mar 30 2020 Honggang Li - 22.4-3 +- Restore three patches +- Resolves: rhbz#1817412 + +* Wed Feb 19 2020 Honggang Li - 22.4-2 +- Fix ibacm segfault for dual port HCA support IB and Ethernet +- Resolves: rhbz#1793585 + +* Thu Nov 21 2019 Jarod Wilson 22.4-1 +- Update to v22.4 stable release +- Support mlx5 scatter to CQE over DCT QP +- Fix ibacm segfault on non-IB hardware +- Resolves: rhbz#1715489 +- Resolves: rhbz#1712296 + +* Tue Aug 27 2019 Jarod Wilson 22.3-1 +- Update to v22.3 stable release +- Unclamp IPoIP MTUs +- Resolves: rhbz#1647541 + * Thu May 30 2019 Jarod Wilson 22.1-3 - Actually apply ConnectX-6 DX device ID patch - Related: rhbz#1687426