bnxt_en: Report PCIe link speed and width during driver load
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Sun, 15 May 2016 07:04:45 +0000 (03:04 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 May 2016 17:35:47 +0000 (13:35 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 448ab296ddb2bf56bbf299eec3ee0a8a9425192a..1171ad14d3235cd5324524eb5b59278667317224 100644 (file)
@@ -6261,6 +6261,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;
@@ -6381,6 +6397,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: