Received: by 10.192.165.148 with SMTP id m20csp2249599imm; Thu, 3 May 2018 13:02:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoFGtUPJSJuJRsLr54zNqiMNlY+ihyExGZ1wAFkDgUHwwn2f9soeFNmGXe4mtubQelj8CZM X-Received: by 2002:a17:902:a512:: with SMTP id s18-v6mr25116113plq.223.1525377726216; Thu, 03 May 2018 13:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525377726; cv=none; d=google.com; s=arc-20160816; b=jJp5EcY2WbWUdi/pWU93bOU2+YVPk9P4S0+j480uYfgf6zw3HzTpErditNhRII2xHr HL9N73WfEUULWtAmhnT4DRqwveDXQSZIC0VrmbHzN+3LPFjd96CXxi7HrMttq7X5o4if xn5Ks6KtGAaRwXH1Xigw+aqcE94QeY3ZK3tLQ4Bef+kNN+7yQ8WWvoBsiW1ZfLrP129x Rvl/t5WVYETfShFOfeIFv3rNH2X1mptEJBFboJ9kUKsYwoo42VCWj6n1SuZRxea1yOIH 2vIuJaqv6qsk+T8DeiAa/qcfjf7BGzy15y03McwKKtl7RBesXbl0YPWzOfl8Jv2TggbS V3kQ== 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:dkim-signature:arc-authentication-results; bh=lvtagOAniWtnWHV1mpyelNFZ2nBHjMNWyjgim2N/ybE=; b=JSPcSyeQcuEW2aOQ9djlyJqyoOxfwu0djeHUaEwOJ5Iq4hKAeJ8t202PQPZNOx92xt aD2XNU5RONwRYH6gd6ieOlAGgyj5nD7YIJFmjevfSrKCP6o2kHVWgVxNEKTpgIkE1Cll oTt6xGBafbG7o87hwqxMF77tzFqVhnJuI9YAXyr5Bh4w7vxmhI0HBS/+J6i8voJ5kvbo syVP57vevZkB74sTuJw3Qqm72cjxRaaYcILxKEcCmccJGaoHsCTzN1irMlzgi25nUwRB 187ppjTY05xVmDbaiUIQyon5drA8HksCM0K7Sz2fAm7UPlL/zRUJut61HiXh9qKAqRkG oqiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1se8pP3H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l67si14571030pfg.326.2018.05.03.13.01.34; Thu, 03 May 2018 13:02:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=1se8pP3H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751502AbeECUAm (ORCPT + 99 others); Thu, 3 May 2018 16:00:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:34178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750823AbeECUAj (ORCPT ); Thu, 3 May 2018 16:00:39 -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 92C122176D; Thu, 3 May 2018 20:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525377638; bh=qBVMNACNhTkJajFGgLbb49GA1jxO76CFZaLYSbH8qY4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=1se8pP3Hvu1t1gjPg6ToJxTpKaImey3q6spR+583N3fgMxDu5jIeH8GJ0VAGsbDpc 0CV3CthM3k0cB98Moni0mifayHmUzG4/eG4fkZ9fCkk3vQvggPLXFJ0bOtYeEeQdKC 2296zfT1650wEy29CknRQTc7siMbhJiJGKDY/n3M= Subject: [PATCH v6 4/5] ixgbe: Report PCIe link properties with pcie_print_link_status() From: Bjorn Helgaas To: Jeff Kirsher , Ganesh Goudar , Michael Chan , Ariel Elior Cc: linux-pci@vger.kernel.org, everest-linux-l2@cavium.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Tal Gilboa , Tariq Toukan , Jacob Keller , Jakub Kicinski Date: Thu, 03 May 2018 15:00:36 -0500 Message-ID: <152537763602.62474.15659483976051204438.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <152537719056.62474.2571390812509425478.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <152537719056.62474.2571390812509425478.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 Previously the driver used pcie_get_minimum_link() to warn when the NIC is in a slot that can't supply as much bandwidth as the NIC could use. pcie_get_minimum_link() can be misleading because it finds the slowest link and the narrowest link (which may be different links) without considering the total bandwidth of each link. For a path with a 16 GT/s x1 link and a 2.5 GT/s x16 link, it returns 2.5 GT/s x1, which corresponds to 250 MB/s of bandwidth, not the true available bandwidth of about 1969 MB/s for a 16 GT/s x1 link. Use pcie_print_link_status() to report PCIe link speed and possible limitations instead of implementing this in the driver itself. This finds the slowest link in the path to the device by computing the total bandwidth of each link and compares that with the capabilities of the device. The dmesg change is: - PCI Express bandwidth of %dGT/s available - (Speed:%s, Width: x%d, Encoding Loss:%s) + %u.%03u Gb/s available PCIe bandwidth (%s x%d link) or, if the device is capable of better performance than is available in the current slot: - This is not sufficient for optimal performance of this card. - For optimal performance, at least %dGT/s of bandwidth is required. - A slot with more lanes and/or higher speed is suggested. + %u.%03u Gb/s available PCIe bandwidth, limited by %s x%d link at %s (capable of %u.%03u Gb/s with %s x%d link) Note that the driver previously used dev_warn() to suggest using a different slot, but pcie_print_link_status() uses dev_info() because if the platform has no faster slot available, the user can't do anything about the warning and may not want to be bothered with it. 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 afadba99f7b8..8990285f6e12 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)