From owner-svn-src-head@freebsd.org Mon Apr 30 15:23:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4180EFAE3ED; Mon, 30 Apr 2018 15:23:46 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7CE179306; Mon, 30 Apr 2018 15:23:45 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E215415022; Mon, 30 Apr 2018 15:23:45 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3UFNjvI056721; Mon, 30 Apr 2018 15:23:45 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3UFNjF9056720; Mon, 30 Apr 2018 15:23:45 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201804301523.w3UFNjF9056720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Mon, 30 Apr 2018 15:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333115 - head/contrib/ofed/libibumad X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/contrib/ofed/libibumad X-SVN-Commit-Revision: 333115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 15:23:46 -0000 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;