From patchwork Fri Oct 27 12:30:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 10029717 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 B43936032C for ; Fri, 27 Oct 2017 12:32:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC04B28EC6 for ; Fri, 27 Oct 2017 12:32:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A119028F18; Fri, 27 Oct 2017 12:32:02 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 3692928EC6 for ; Fri, 27 Oct 2017 12:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752459AbdJ0McA (ORCPT ); Fri, 27 Oct 2017 08:32:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:46651 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752258AbdJ0Mb7 (ORCPT ); Fri, 27 Oct 2017 08:31:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 20F92AB9D; Fri, 27 Oct 2017 12:31:58 +0000 (UTC) From: Thomas Bogendoerfer To: Matan Barak , Leon Romanovsky , Doug Ledford , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/mlx5: give back valid speed/width even without plugged in SFP module Date: Fri, 27 Oct 2017 14:30:11 +0200 Message-Id: <20171027123011.10454-1-tbogendoerfer@suse.de> X-Mailer: git-send-email 2.12.3 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 If there is no SFP module plugged into a port of mlx5 cards 'cat /sys/class/infniband/mlx5_X/ports/1/rate' returns Invalid argument. This causes tools like 'ibstat' to malfunction. This change adjusts mlx5 to all other RoCE/iWarp drivers, which always return valid speed/width. Signed-off-by: Thomas Bogendoerfer Reported-by: Ghazale Hosseinabadi --- drivers/infiniband/hw/mlx5/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 260f8be1d0ed..4388618e3434 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -246,7 +246,10 @@ static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed, *active_speed = IB_SPEED_EDR; break; default: - return -EINVAL; + /* Unknown */ + *active_width = IB_WIDTH_1X; + *active_speed = IB_SPEED_SDR; + break; } return 0;