Received: by 10.213.65.68 with SMTP id h4csp56046imn; Fri, 30 Mar 2018 14:09:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/jE2FMDi5vH9KAs0/1N+kGWVE4iIjT8Up1ooQnTRPHPPgt+xp0Aj4pOV6VV9qNEVbJWGZT X-Received: by 2002:a17:902:20cb:: with SMTP id v11-v6mr620587plg.82.1522444199020; Fri, 30 Mar 2018 14:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522444198; cv=none; d=google.com; s=arc-20160816; b=Y4iYyDNbhrIcjtnE3FzTxNYLZoKaD4J9dh2/uOcFRMpW21ynOQQL797QMwupU3H7tN bFqT+HMt2agmzQDkAoXx6w5IOYed7H8D+gvsIrjcn9ubNvh2B+gcAdQM9E91iP8JGRSX DdBtyQhkm3r2G2JaWB3opvqdTaUdjY96NQ6M/sp32gv1DiXryfIRtoLacJxZSMjq7aNE HH/bZf9HSO9q4kcV437SkVXkg/NPzJubuN9PB4KZAPT0gZsE86k4e9mRQ695eBN3zcAZ L5wEky8w0X9p37GvS4BBYiwARcjzDGFQoRyKCTFEssAikqBfSmX2+YWEXIAfxM8748GO kzCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dmarc-filter:arc-authentication-results; bh=3OPJGTydNpmBtHoqGpHDPqbnRp74FOi5GN//UcIHL7k=; b=tfzqUHPeLjWMKX1OjcBdAOE0V9L7IGm7GLoXXro+q/qPOdLr2yytLIkodyX+cJtbdc eolwknnal/5Q1OSto9++UQajoW/aK2bzomhJCV6Qy21MOy6Ps+puzGj2bHQFsGeO4BZK ckPKikkC9JoSSSia6idz9Lyy9dfKB7B+1UV7at9Dv4wos+wI8DzAYuVRVwTHJHc2AMDH LtAWJuct5qZjyec/h5c/xQ3ebflebME2o8phucpBKiQbQdMV0sf9X14COIFTMZ95Jo/5 mW7uZ0EH/Kz/UMcSYE0/quyY+JcyKm/NeyLV39/JZrPVucp61akEwNgY8OuLSs7ACXpZ FULA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63si6109224pgc.474.2018.03.30.14.09.45; Fri, 30 Mar 2018 14:09:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753258AbeC3VG0 (ORCPT + 99 others); Fri, 30 Mar 2018 17:06:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:33980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752639AbeC3VGY (ORCPT ); Fri, 30 Mar 2018 17:06:24 -0400 Received: from localhost (unknown [69.71.5.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66C0B21777; Fri, 30 Mar 2018 21:06:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66C0B21777 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Subject: [PATCH v5 13/14] ixgbe: Report PCIe link properties with pcie_print_link_status() From: Bjorn Helgaas To: Tal Gilboa Cc: Tariq Toukan , Jacob Keller , Ariel Elior , Ganesh Goudar , Jeff Kirsher , everest-linux-l2@cavium.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Date: Fri, 30 Mar 2018 16:06:21 -0500 Message-ID: <152244398122.135666.12981274179207169419.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <152244269202.135666.3064353823697623332.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <152244269202.135666.3064353823697623332.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Helgaas Use pcie_print_link_status() to report PCIe link speed and possible limitations instead of implementing this in the driver itself. Note that pcie_get_minimum_link() can return misleading information because it finds the slowest link and the narrowest link without considering the total bandwidth of the link. If the path contains a 16 GT/s x1 link and a 2.5 GT/s x16 link, pcie_get_minimum_link() returns 2.5 GT/s x1, which corresponds to 250 MB/s of bandwidth, not the actual available bandwidth of about 2000 MB/s for a 16 GT/s x1 link. Signed-off-by: Bjorn Helgaas --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 47 +------------------------ 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 0da5aa2c8aba..38bb9c17d333 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -270,9 +270,6 @@ static void ixgbe_check_minimum_link(struct ixgbe_adapter *adapter, int expected_gts) { struct ixgbe_hw *hw = &adapter->hw; - int max_gts = 0; - enum pci_bus_speed speed = PCI_SPEED_UNKNOWN; - enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN; struct pci_dev *pdev; /* Some devices are not connected over PCIe and thus do not negotiate @@ -288,49 +285,7 @@ static void ixgbe_check_minimum_link(struct ixgbe_adapter *adapter, else pdev = adapter->pdev; - if (pcie_get_minimum_link(pdev, &speed, &width) || - speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN) { - e_dev_warn("Unable to determine PCI Express bandwidth.\n"); - return; - } - - switch (speed) { - case PCIE_SPEED_2_5GT: - /* 8b/10b encoding reduces max throughput by 20% */ - max_gts = 2 * width; - break; - case PCIE_SPEED_5_0GT: - /* 8b/10b encoding reduces max throughput by 20% */ - max_gts = 4 * width; - break; - case PCIE_SPEED_8_0GT: - /* 128b/130b encoding reduces throughput by less than 2% */ - max_gts = 8 * width; - break; - default: - e_dev_warn("Unable to determine PCI Express bandwidth.\n"); - return; - } - - e_dev_info("PCI Express bandwidth of %dGT/s available\n", - max_gts); - e_dev_info("(Speed:%s, Width: x%d, Encoding Loss:%s)\n", - (speed == PCIE_SPEED_8_0GT ? "8.0GT/s" : - speed == PCIE_SPEED_5_0GT ? "5.0GT/s" : - speed == PCIE_SPEED_2_5GT ? "2.5GT/s" : - "Unknown"), - width, - (speed == PCIE_SPEED_2_5GT ? "20%" : - speed == PCIE_SPEED_5_0GT ? "20%" : - speed == PCIE_SPEED_8_0GT ? "<2%" : - "Unknown")); - - if (max_gts < expected_gts) { - e_dev_warn("This is not sufficient for optimal performance of this card.\n"); - e_dev_warn("For optimal performance, at least %dGT/s of bandwidth is required.\n", - expected_gts); - e_dev_warn("A slot with more lanes and/or higher speed is suggested.\n"); - } + pcie_print_link_status(pdev); } static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter)