From patchwork Fri Mar 30 07:14:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tal Gilboa X-Patchwork-Id: 893118 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40CCYb5V0Vz9s16 for ; Fri, 30 Mar 2018 18:14:59 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752671AbeC3HO5 (ORCPT ); Fri, 30 Mar 2018 03:14:57 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:33131 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752672AbeC3HO4 (ORCPT ); Fri, 30 Mar 2018 03:14:56 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from talgi@mellanox.com) with ESMTPS (AES256-SHA encrypted); 30 Mar 2018 10:15:49 +0300 Received: from gen-l-vrt-178.mtl.labs.mlnx (gen-l-vrt-178.mtl.labs.mlnx [10.137.178.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w2U7Er3P008164; Fri, 30 Mar 2018 10:14:53 +0300 Received: from gen-l-vrt-178.mtl.labs.mlnx (localhost [127.0.0.1]) by gen-l-vrt-178.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id w2U7Ergr003601; Fri, 30 Mar 2018 10:14:53 +0300 Received: (from talgi@localhost) by gen-l-vrt-178.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id w2U7Eo6V003600; Fri, 30 Mar 2018 10:14:50 +0300 From: Tal Gilboa To: Bjorn Helgaas Cc: Linux PCI , Tariq Toukan , Saeed Mahameed , Keller Jacob E , Tal Gilboa Subject: [PATCH next V4 0/8] Report PCI device link status Date: Fri, 30 Mar 2018 10:14:38 +0300 Message-Id: <1522394086-3555-1-git-send-email-talgi@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org These patches introduce the ability to report PCI link width and speed for all PCI devices in kernel log. This would reduce code duplication between drivers and unify the approach for reporting PCI link status. Implemented and tested for Mellanox devices. v4: Reverted most of v2, meaning re-introduced bandwidth limitation calculation. Limiting device is now returned from the available PCIe bandwidth calculation function and is logged in kernel log (suggested by Bjorn Helgaas and Jacob E. Keller). Applied PCIe encoding overhead to PCIe bandwidth calculation (available/capable). this way upper bandwidth limit of the device is more accurate. v3: Add Reviewed-by: Tariq Toukan to all commits. v2: Remove chain BW calculation. This might be a nice feature, but without the ability to know the exact limiting part, it is more confusing than useful. Remove warnings for failed PCI query actions, leaving only the status and gaps from max capabilities report. Use pci_warn()/pci_info() instead of dev_warn()/dev_info(). (suggested by Bjorn Helgaas). v1: Split to multiple patches, calculate BW limitation and remove MACRO definition for LNKCAP shift (suggested by Bjorn Helgaas). Multiple fixes - conventions, typos, function naming and functional (suggested by Tariq Toukan). Tal Gilboa (8): PCI: Add a query function for PCI device's speed cap PCI: Add a query function for PCI device's width cap PCI: Add device link bandwidth capabilities calculation PCI: Calculate available bandwidth for PCI devices PCI: Print PCI device link status in kernel log net/mlx4_core: Report PCI properties using dedicated function net/mlx5: Report device PCI link status and issues net/mlx5e: Use generic PCI function for bandwidth calculation drivers/net/ethernet/mellanox/mlx4/main.c | 81 +---------- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 17 +-- drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 + drivers/pci/pci-sysfs.c | 28 ++-- drivers/pci/pci.c | 161 +++++++++++++++++++++- include/linux/pci.h | 24 ++++ 6 files changed, 194 insertions(+), 121 deletions(-) Acked-by: Jacob Keller