net: stmmac: Add PCI bus info to ethtool driver query output
authorWong Vee Khee <vee.khee.wong@intel.com>
Wed, 17 Feb 2021 09:57:05 +0000 (17:57 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 Feb 2021 22:25:50 +0000 (14:25 -0800)
This patch populates the PCI bus info in the ethtool driver query data.

Users will be able to view PCI bus info using 'ethtool -i <interface>'.

Signed-off-by: Wong Vee Khee <vee.khee.wong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
include/linux/stmmac.h

index 1c9c67b641a20e13f4d62660066ed74f4fe8853d..751dfdeec41c04949430884f98d286238490ac1b 100644 (file)
@@ -236,6 +236,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
        int ret;
        int i;
 
+       plat->pdev = pdev;
        plat->phy_addr = -1;
        plat->clk_csr = 5;
        plat->has_gmac = 0;
index 9e54f953634b7d7656b46cfece6e357e4c5b6cf9..c5642985ef95cd55f7d686e5cb2a522fc700d349 100644 (file)
@@ -268,6 +268,10 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
                strlcpy(info->driver, MAC100_ETHTOOL_NAME,
                        sizeof(info->driver));
 
+       if (priv->plat->pdev) {
+               strlcpy(info->bus_info, pci_name(priv->plat->pdev),
+                       sizeof(info->bus_info));
+       }
        strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
 }
 
index 15ca6b4167cc90ac4ecc3db5cee9717830c143f8..a302982de2d7435db4d5100820322f75e8b60f86 100644 (file)
@@ -202,5 +202,6 @@ struct plat_stmmacenet_data {
        bool vlan_fail_q_en;
        u8 vlan_fail_q;
        unsigned int eee_usecs_rate;
+       struct pci_dev *pdev;
 };
 #endif