aboutsummaryrefslogtreecommitdiff
path: root/contrib/ofed
diff options
context:
space:
mode:
authorSlava Shwartsman <slavash@FreeBSD.org>2018-04-30 15:23:45 +0000
committerSlava Shwartsman <slavash@FreeBSD.org>2018-04-30 15:23:45 +0000
commit37e576b25e2978119909addc7c6d1d465b05ccc1 (patch)
tree2fb9ba18b2cc76209d137bb5925369827c4b7b9e /contrib/ofed
parent4535e8046f0082ac2ebe1247a2e46b330b086184 (diff)
downloadsrc-37e576b25e2978119909addc7c6d1d465b05ccc1.tar.gz
src-37e576b25e2978119909addc7c6d1d465b05ccc1.zip
libibumad/umad.c: In get_port, ignore sysctl get rate errors
This can cause ibpanic in ibstat when width is not set properly as can occur when Ethernet port is connected to InfiniBand fabric. ibpanic: [8167] main: stat of IB device 'mlx5_0' failed: m With this change, Rate is displayed as 0 with ibstat for this scenario. MFC after: 3 days Approved by: hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/head/; revision=333115
Diffstat (limited to 'contrib/ofed')
-rw-r--r--contrib/ofed/libibumad/umad.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/ofed/libibumad/umad.c b/contrib/ofed/libibumad/umad.c
index dbcfc0bfc8f1..af0a28eeea28 100644
--- a/contrib/ofed/libibumad/umad.c
+++ b/contrib/ofed/libibumad/umad.c
@@ -138,6 +138,7 @@ static int get_port(const char *ca_name, const char *dir, int portnum, umad_port
strncpy(port->ca_name, ca_name, sizeof port->ca_name - 1);
port->portnum = portnum;
port->pkeys = NULL;
+ port->rate = 0;
len = snprintf(port_dir, sizeof(port_dir), "%s/%d", dir, portnum);
if (len < 0 || len > sizeof(port_dir))
@@ -155,8 +156,12 @@ static int get_port(const char *ca_name, const char *dir, int portnum, umad_port
goto clean;
if (sys_read_uint(port_dir, SYS_PORT_PHY_STATE, &port->phys_state) < 0)
goto clean;
- if (sys_read_uint(port_dir, SYS_PORT_RATE, &port->rate) < 0)
- goto clean;
+ /*
+ * If width was not set properly this read may fail.
+ * Instead of failing everything, we will just skip the check
+ * and it will be set to 0.
+ */
+ sys_read_uint(port_dir, SYS_PORT_RATE, &port->rate);
if (sys_read_uint(port_dir, SYS_PORT_CAPMASK, &capmask) < 0)
goto clean;