netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next v2 3/9] bnxt_en: Report PCIe link speed and width during driver load
Date: Sun, 15 May 2016 03:04:45 -0400	[thread overview]
Message-ID: <1463295891-15216-4-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1463295891-15216-1-git-send-email-michael.chan@broadcom.com>

From: Ajit Khaparde <ajit.khaparde@broadcom.com>

Add code to log a message during driver load indicating PCIe link
speed and width.

The log message will look like this:
bnxt_en 0000:86:00.0 eth0: PCIe: Speed 8.0GT/s Width x8

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 59b2e36..ba0c3e5 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -6198,6 +6198,22 @@ static int bnxt_set_dflt_rings(struct bnxt *bp)
 	return rc;
 }
 
+static void bnxt_parse_log_pcie_link(struct bnxt *bp)
+{
+	enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
+	enum pci_bus_speed speed = PCI_SPEED_UNKNOWN;
+
+	if (pcie_get_minimum_link(bp->pdev, &speed, &width) ||
+	    speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN)
+		netdev_info(bp->dev, "Failed to determine PCIe Link Info\n");
+	else
+		netdev_info(bp->dev, "PCIe: Speed %s Width x%d\n",
+			    speed == PCIE_SPEED_2_5GT ? "2.5GT/s" :
+			    speed == PCIE_SPEED_5_0GT ? "5.0GT/s" :
+			    speed == PCIE_SPEED_8_0GT ? "8.0GT/s" :
+			    "Unknown", width);
+}
+
 static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	static int version_printed;
@@ -6318,6 +6334,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		    board_info[ent->driver_data].name,
 		    (long)pci_resource_start(pdev, 0), dev->dev_addr);
 
+	bnxt_parse_log_pcie_link(bp);
+
 	return 0;
 
 init_err:
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-15  7:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-15  7:04 [PATCH net-next v2 0/9] bnxt_en: updates for net-next Michael Chan
2016-05-15  7:04 ` [PATCH net-next v2 1/9] bnxt_en: Fix invalid max channel parameter in ethtool -l Michael Chan
2016-05-15  7:04 ` [PATCH net-next v2 2/9] bnxt_en: Add Support for ETHTOOL_GMODULEINFO and ETHTOOL_GMODULEEEPRO Michael Chan
2016-05-15  7:04 ` Michael Chan [this message]
2016-05-15  7:04 ` [PATCH net-next v2 4/9] bnxt_en: Reduce maximum ring pages if page size is 64K Michael Chan
2016-05-15  7:04 ` [PATCH net-next v2 5/9] bnxt_en: Improve the delay logic for firmware response Michael Chan
2016-05-15  7:04 ` [PATCH net-next v2 6/9] bnxt_en: Fix length value in dmesg log firmware error message Michael Chan
2016-05-15  7:04 ` [PATCH net-next v2 7/9] bnxt_en: Simplify and improve unsupported SFP+ module reporting Michael Chan
2016-05-15  7:04 ` [PATCH net-next v2 8/9] bnxt_en: Add BCM57314 device ID Michael Chan
2016-05-15  7:04 ` [PATCH net-next v2 9/9] bnxt_en: Use dma_rmb() instead of rmb() Michael Chan
2016-05-15 17:36 ` [PATCH net-next v2 0/9] bnxt_en: updates for net-next David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463295891-15216-4-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).