From patchwork Tue Oct 31 12:14:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 10034379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01C00600C5 for ; Tue, 31 Oct 2017 12:15:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDFE11FFE6 for ; Tue, 31 Oct 2017 12:15:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2CA3289B1; Tue, 31 Oct 2017 12:15:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC31C2883E for ; Tue, 31 Oct 2017 12:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751519AbdJaMPB (ORCPT ); Tue, 31 Oct 2017 08:15:01 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:54123 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751095AbdJaMPB (ORCPT ); Tue, 31 Oct 2017 08:15:01 -0400 Received: by mail-qk0-f195.google.com with SMTP id y23so20079440qkb.10 for ; Tue, 31 Oct 2017 05:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=FMH30xO8+rI56cos9yh7HteK51GuHInVxyVOlhFWhDo=; b=cSnyAScVTNEsIAONTSJDPLqSd6b8hD48u20LkVWhik7t3we8QTREo2hn6rLV3zLFE4 eT8ItasWFMFtJeFrp623TSWyLLzMO2FKHK8HdbZ6FuX739lfFIYexvKIeB4WRnAXKcfs IC4tHh5wmzjKeHF3x7jbSnvnp8n4e8N3t7pxbkz7fYymlsaYCr2DwkvlwgqDvMPwKfE0 pb/jQ/oFW7WBwbHJsSarJUE/2XNP2n0nLJJPa9t99TlctBH5U9hYn47+UlAnmpd+gYK9 gNsxsmHs7sSrjhmmfOEGBxr7BpIA5SAZD+hpvC+JS0BAggT0CVMSDoGGwayT7gTkGl2n NgZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=FMH30xO8+rI56cos9yh7HteK51GuHInVxyVOlhFWhDo=; b=hXQPc77mSxbkJ+QxLJoLfYqClr3EY+xgjR4beBbAFLNY7RloGe60EyHOOC+taxUZiY hwbaERbyjq1TYTTuRqKA3kuMmQOojYmZswl+klJz3pk8D5j0qkcKt80voR4Thm6HRD4Q QU2MEPxg4oZSUua9yzvXy9D4FZWn2Pq+GHwZkKr1EunXPcnnTqunhdzjvH1B978aRgMe V6tJMFz0oAA+MroBY0LjRsVaucUFMrZYVbCoDW7BHA2q2gfPXCaVxiwFzo0HE67lahrf IqsdsYVcLeC6JOzrG3oOeU8OMkaKvl/06p3g6teLMEp0sQyRS1/3TUXh1pNfh8vRfkO/ kqbw== X-Gm-Message-State: AMCzsaXKfPxMhfo+jjLAAO7Ql4Cy2ZT0AJkPgCb4RdudViN7Is9Sh/rG ezzOBh3KrI3EM/37HmiPhC2ez9v9 X-Google-Smtp-Source: ABhQp+SzWz/d105molAB51GGpOnCSXqq/4zXIm8oDLvgMh5QMUjgDHhHTM7obmFnBhNvrr9OUC9VAA== X-Received: by 10.55.51.212 with SMTP id z203mr657178qkz.93.1509452100520; Tue, 31 Oct 2017 05:15:00 -0700 (PDT) Received: from [192.168.1.183] (c-73-182-207-166.hsd1.ma.comcast.net. [73.182.207.166]) by smtp.googlemail.com with ESMTPSA id j129sm761894qkd.32.2017.10.31.05.14.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Oct 2017 05:14:59 -0700 (PDT) To: "linux-rdma@vger.kernel.org" Cc: Ghazale Hosseinabadi From: Hal Rosenstock Subject: [PATCH rdma-core] libibumad/umad.c: In get_port, ignore sysfs rate file errors Message-ID: Date: Tue, 31 Oct 2017 08:14:58 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This can cause ibpanic in ibstat when width is not set properly as can occur when QSPF is not plugged into port. ibpanic: [7851] main: stat of IB device 'mlx5_1' failed: Invalid argument It's caused by kernel sysfs.c:show_rate returning -EINVAL and that error being treated as failure in umad.c:get_port. With this change, Rate is displayed as 0 with ibstat for this scenario. Signed-off-by: Hal Rosenstock --- libibumad/umad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libibumad/umad.c b/libibumad/umad.c index 535256e..dcb2c68 100644 --- a/libibumad/umad.c +++ b/libibumad/umad.c @@ -150,8 +150,7 @@ 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; + sys_read_uint(port_dir, SYS_PORT_RATE, &port->rate); if (sys_read_uint(port_dir, SYS_PORT_CAPMASK, &capmask) < 0) goto clean;