diff options
author | David Brunecz <david.brunecz@netronome.com> | 2017-05-28 17:53:00 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-30 11:27:06 -0400 |
commit | eefbde7e10026273a81f54ab3b76e959f4f0ef09 (patch) | |
tree | cc5076435064c56d2e0e4d3123569269a0ba6d89 /drivers/net/ethernet/netronome/nfp/nfp_main.c | |
parent | a87853f383afd6cb1cbda982d895e9cadf435098 (diff) |
nfp: add hwmon support
Add support for retrieving temperature and power sensor and limits via NSP.
Signed-off-by: David Brunecz <david.brunecz@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_main.c')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_main.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c index ba174e163834..68cd34d5a9fb 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c @@ -257,7 +257,6 @@ exit_release_fw: static int nfp_nsp_init(struct pci_dev *pdev, struct nfp_pf *pf) { - struct nfp_nsp_identify *nspi; struct nfp_nsp *nsp; int err; @@ -274,11 +273,9 @@ static int nfp_nsp_init(struct pci_dev *pdev, struct nfp_pf *pf) pf->eth_tbl = __nfp_eth_read_ports(pf->cpp, nsp); - nspi = __nfp_nsp_identify(nsp); - if (nspi) { - dev_info(&pdev->dev, "BSP: %s\n", nspi->version); - kfree(nspi); - } + pf->nspi = __nfp_nsp_identify(nsp); + if (pf->nspi) + dev_info(&pdev->dev, "BSP: %s\n", pf->nspi->version); err = nfp_fw_load(pdev, pf, nsp); if (err < 0) { @@ -383,14 +380,23 @@ static int nfp_pci_probe(struct pci_dev *pdev, if (err) goto err_sriov_unlimit; + err = nfp_hwmon_register(pf); + if (err) { + dev_err(&pdev->dev, "Failed to register hwmon info\n"); + goto err_net_remove; + } + return 0; +err_net_remove: + nfp_net_pci_remove(pf); err_sriov_unlimit: pci_sriov_set_totalvfs(pf->pdev, 0); err_fw_unload: if (pf->fw_loaded) nfp_fw_unload(pf); kfree(pf->eth_tbl); + kfree(pf->nspi); err_devlink_unreg: devlink_unregister(devlink); err_cpp_free: @@ -412,6 +418,8 @@ static void nfp_pci_remove(struct pci_dev *pdev) struct nfp_pf *pf = pci_get_drvdata(pdev); struct devlink *devlink; + nfp_hwmon_unregister(pf); + devlink = priv_to_devlink(pf); nfp_net_pci_remove(pf); @@ -428,6 +436,7 @@ static void nfp_pci_remove(struct pci_dev *pdev) nfp_cpp_free(pf->cpp); kfree(pf->eth_tbl); + kfree(pf->nspi); mutex_destroy(&pf->lock); devlink_free(devlink); pci_release_regions(pdev); |