Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 May 2018 16:19:47 +0000 (UTC)
From:      Slava Shwartsman <slavash@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r333217 - stable/11/contrib/ofed/libibumad
Message-ID:  <201805031619.w43GJlPU064142@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: slavash
Date: Thu May  3 16:19:47 2018
New Revision: 333217
URL: https://svnweb.freebsd.org/changeset/base/333217

Log:
  MFC r333115:
  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.
  
  Approved by:    hselasky (mentor), kib (mentor)
  Sponsored by:   Mellanox Technologies

Modified:
  stable/11/contrib/ofed/libibumad/umad.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/ofed/libibumad/umad.c
==============================================================================
--- stable/11/contrib/ofed/libibumad/umad.c	Thu May  3 15:47:49 2018	(r333216)
+++ stable/11/contrib/ofed/libibumad/umad.c	Thu May  3 16:19:47 2018	(r333217)
@@ -138,6 +138,7 @@ static int get_port(const char *ca_name, const char *d
 	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 *d
 		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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805031619.w43GJlPU064142>