svn commit: r333115 - head/contrib/ofed/libibumad

Slava Shwartsman slavash at FreeBSD.org
Mon Apr 30 15:23:46 UTC 2018


Author: slavash
Date: Mon Apr 30 15:23:45 2018
New Revision: 333115
URL: https://svnweb.freebsd.org/changeset/base/333115

Log:
  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

Modified:
  head/contrib/ofed/libibumad/umad.c

Modified: head/contrib/ofed/libibumad/umad.c
==============================================================================
--- head/contrib/ofed/libibumad/umad.c	Mon Apr 30 15:18:38 2018	(r333114)
+++ head/contrib/ofed/libibumad/umad.c	Mon Apr 30 15:23:45 2018	(r333115)
@@ -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;
 


More information about the svn-src-all mailing list