Hello community, here is the log from the commit of package rdma-core for openSUSE:Factory checked in at 2018-04-30 22:51:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rdma-core (Old) and /work/SRC/openSUSE:Factory/.rdma-core.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rdma-core" Mon Apr 30 22:51:37 2018 rev:22 rq:601126 version:16.4 Changes: -------- --- /work/SRC/openSUSE:Factory/rdma-core/rdma-core.changes 2018-03-24 16:10:55.461134834 +0100 +++ /work/SRC/openSUSE:Factory/.rdma-core.new/rdma-core.changes 2018-04-30 22:51:44.660211542 +0200 @@ -1,0 +2,6 @@ +Thu Apr 26 08:27:29 UTC 2018 - nmoreychaisemar...@suse.com + +- Add umad-Do-not-check-for-umad-sysfs-files-in-umad_init.patch to fix + umad/ibstat support on RoCE hardware (bsc#1088441). + +------------------------------------------------------------------- New: ---- umad-Do-not-check-for-umad-sysfs-files-in-umad_init.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rdma-core.spec ++++++ --- /var/tmp/diff_new_pack.ehdr2N/_old 2018-04-30 22:51:46.152157106 +0200 +++ /var/tmp/diff_new_pack.ehdr2N/_new 2018-04-30 22:51:46.152157106 +0200 @@ -49,6 +49,7 @@ Source: rdma-core-%{version}%{git_ver}.tar.gz Source1: baselibs.conf Patch0: Remove-the-obsolete-libibcm-library.patch +Patch1: umad-Do-not-check-for-umad-sysfs-files-in-umad_init.patch BuildRequires: binutils BuildRequires: cmake >= 2.8.11 BuildRequires: gcc @@ -315,6 +316,7 @@ %prep %setup -q -n %{name}-%{version}%{git_ver} %patch0 +%patch1 %build ++++++ umad-Do-not-check-for-umad-sysfs-files-in-umad_init.patch ++++++ commit e326c6065d8daa51189abc84a968e0da7b0c2394 Author: Jason Gunthorpe <j...@mellanox.com> Date: Thu Apr 5 11:04:14 2018 -0600 umad: Do not check for umad sysfs files in umad_init Now that we don't load the umad module if the HW doesn't use it (eg for roce only hardware) umad_init is failing to read the ABI version from the kernel. Applications still want to use some libibumad services that are not related to the char device, so move the version check to umad_open_port instead. Backport from: * abf72057c277 (umad: Do not check for umad sysfs files in umad_init) * c4b883dd49ae (libibumad/man/umad_init.3.md: Trivial punctuation changes) * b19fb6d4194e (libibumad/man/umad_open_port.3: Update return values) Signed-off-by: Jason Gunthorpe <j...@mellanox.com> Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemar...@suse.com> diff --git libibumad/man/umad_init.3 libibumad/man/umad_init.3 index 64366b9de7e4..32c41a9e9878 100644 --- libibumad/man/umad_init.3 +++ libibumad/man/umad_init.3 @@ -13,26 +13,23 @@ umad_init, umad_done \- perform library initialization and finalization .BI "int umad_done(void); .fi .SH "DESCRIPTION" -.B umad_init() -initializes the umad library for use. Must be called before any -other call to this library. -.PP -.B umad_done() -finalizes the use of the umad library. +.B umad_init(), umad_done() +do nothing. .SH "RETURN VALUE" +Always 0. +.SH "COMPATIBILITY" +For compatibility applications should continue to call .B umad_init() -and -.B umad_done() -return 0 on success, and \-1 on error. -Error is returned from +, and check the return code, prior to calling other +.B umad_ +functions. +.PP +If .B umad_init() -if infiniband umad -can\'t be opened, or the abi version doesn\'t match. -There are no errors currently returned by -.B umad_done(). -.SH "NOTES" -If an error occurs during the library initialization, no further use of the -umad library should be attempted. +returns an error, then no further use of the umad library +should be attempted. +If an error occurs during the library initialization, +no further use of the umad library should be attempted. .SH "AUTHORS" .TP Hal Rosenstock <h...@voltaire.com> diff --git libibumad/man/umad_open_port.3 libibumad/man/umad_open_port.3 index cac01a71026b..bd7026be39c0 100644 --- libibumad/man/umad_open_port.3 +++ libibumad/man/umad_open_port.3 @@ -24,11 +24,12 @@ for details). .SH "RETURN VALUE" .B umad_open_port() returns 0 or an unique positive value of umad device descriptor on success, and a negative value on error as follows: - -ENODEV IB device can\'t be resolved - -EINVAL port is not valid (bad + -EOPNOTSUPP ABI version doesn\'t match + -ENODEV IB device can\'t be resolved + -EINVAL port is not valid (bad .I portnum\fR or no umad device) - -EIO umad device for this port can\'t be opened + -EIO umad device for this port can\'t be opened .SH "SEE ALSO" .BR umad_close_port (3), .BR umad_get_cas_names (3), diff --git libibumad/umad.c libibumad/umad.c index dcb2c6809eb1..08efb089d990 100644 --- libibumad/umad.c +++ libibumad/umad.c @@ -90,9 +90,31 @@ static int umaddebug = 0; static const char *def_ca_name = "mthca0"; static int def_ca_port = 1; -static unsigned abi_version; static unsigned new_user_mad_api; +static unsigned int get_abi_version(void) +{ + static unsigned int abi_version; + + if (abi_version != 0) + return abi_version & 0x7FFFFFFF; + + if (sys_read_uint(IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, &abi_version) < + 0) { + IBWARN("can't read ABI version from %s/%s (%m): is ib_umad module loaded?", + IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE); + abi_version = 1 << 31; + return 0; + } + + if (abi_version < IB_UMAD_ABI_VERSION) { + abi_version = 1 << 31; + return 0; + } + + return abi_version; +} + /************************************* * Port */ @@ -502,19 +524,6 @@ static int dev_to_umad_id(const char *dev, unsigned port) int umad_init(void) { TRACE("umad_init"); - if (sys_read_uint(IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, &abi_version) < 0) { - IBWARN - ("can't read ABI version from %s/%s (%m): is ib_umad module loaded?", - IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE); - return -1; - } - if (abi_version < IB_UMAD_ABI_VERSION) { - IBWARN - ("wrong ABI version: %s/%s is %d but library minimal ABI is %d", - IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, abi_version, - IB_UMAD_ABI_VERSION); - return -1; - } return 0; } @@ -618,9 +627,13 @@ int umad_open_port(const char *ca_name, int portnum) { char dev_file[UMAD_DEV_FILE_SZ]; int umad_id, fd; + unsigned int abi_version = get_abi_version(); TRACE("ca %s port %d", ca_name, portnum); + if (!abi_version) + return -EOPNOTSUPP; + if (!(ca_name = resolve_ca_name(ca_name, &portnum))) return -ENODEV;