bnxt.c (25e1acd6b92bde36c03273d883c44c4d0e8995e6) | bnxt.c (cde49a42a9bbba18d7f33550fd70037930c14e97) |
---|---|
1/* Broadcom NetXtreme-C/E network driver. 2 * 3 * Copyright (c) 2014-2016 Broadcom Corporation 4 * Copyright (c) 2016-2018 Broadcom Limited 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation. --- 37 unchanged lines hidden (view full) --- 46#include <linux/prefetch.h> 47#include <linux/cache.h> 48#include <linux/log2.h> 49#include <linux/aer.h> 50#include <linux/bitmap.h> 51#include <linux/cpu_rmap.h> 52#include <linux/cpumask.h> 53#include <net/pkt_cls.h> | 1/* Broadcom NetXtreme-C/E network driver. 2 * 3 * Copyright (c) 2014-2016 Broadcom Corporation 4 * Copyright (c) 2016-2018 Broadcom Limited 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation. --- 37 unchanged lines hidden (view full) --- 46#include <linux/prefetch.h> 47#include <linux/cache.h> 48#include <linux/log2.h> 49#include <linux/aer.h> 50#include <linux/bitmap.h> 51#include <linux/cpu_rmap.h> 52#include <linux/cpumask.h> 53#include <net/pkt_cls.h> |
54#include <linux/hwmon.h> 55#include <linux/hwmon-sysfs.h> |
|
54 55#include "bnxt_hsi.h" 56#include "bnxt.h" 57#include "bnxt_ulp.h" 58#include "bnxt_sriov.h" 59#include "bnxt_ethtool.h" 60#include "bnxt_dcb.h" 61#include "bnxt_xdp.h" --- 6722 unchanged lines hidden (view full) --- 6784 if (!BNXT_PF(bp) || !(bp->flags & BNXT_FLAG_WOL_CAP)) 6785 return; 6786 6787 do { 6788 handle = bnxt_hwrm_get_wol_fltrs(bp, handle); 6789 } while (handle && handle != 0xffff); 6790} 6791 | 56 57#include "bnxt_hsi.h" 58#include "bnxt.h" 59#include "bnxt_ulp.h" 60#include "bnxt_sriov.h" 61#include "bnxt_ethtool.h" 62#include "bnxt_dcb.h" 63#include "bnxt_xdp.h" --- 6722 unchanged lines hidden (view full) --- 6786 if (!BNXT_PF(bp) || !(bp->flags & BNXT_FLAG_WOL_CAP)) 6787 return; 6788 6789 do { 6790 handle = bnxt_hwrm_get_wol_fltrs(bp, handle); 6791 } while (handle && handle != 0xffff); 6792} 6793 |
6794#ifdef CONFIG_BNXT_HWMON 6795static ssize_t bnxt_show_temp(struct device *dev, 6796 struct device_attribute *devattr, char *buf) 6797{ 6798 struct hwrm_temp_monitor_query_input req = {0}; 6799 struct hwrm_temp_monitor_query_output *resp; 6800 struct bnxt *bp = dev_get_drvdata(dev); 6801 u32 temp = 0; 6802 6803 resp = bp->hwrm_cmd_resp_addr; 6804 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); 6805 mutex_lock(&bp->hwrm_cmd_lock); 6806 if (!_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) 6807 temp = resp->temp * 1000; /* display millidegree */ 6808 mutex_unlock(&bp->hwrm_cmd_lock); 6809 6810 return sprintf(buf, "%u\n", temp); 6811} 6812static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0); 6813 6814static struct attribute *bnxt_attrs[] = { 6815 &sensor_dev_attr_temp1_input.dev_attr.attr, 6816 NULL 6817}; 6818ATTRIBUTE_GROUPS(bnxt); 6819 6820static void bnxt_hwmon_close(struct bnxt *bp) 6821{ 6822 if (bp->hwmon_dev) { 6823 hwmon_device_unregister(bp->hwmon_dev); 6824 bp->hwmon_dev = NULL; 6825 } 6826} 6827 6828static void bnxt_hwmon_open(struct bnxt *bp) 6829{ 6830 struct pci_dev *pdev = bp->pdev; 6831 6832 bp->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, 6833 DRV_MODULE_NAME, bp, 6834 bnxt_groups); 6835 if (IS_ERR(bp->hwmon_dev)) { 6836 bp->hwmon_dev = NULL; 6837 dev_warn(&pdev->dev, "Cannot register hwmon device\n"); 6838 } 6839} 6840#else 6841static void bnxt_hwmon_close(struct bnxt *bp) 6842{ 6843} 6844 6845static void bnxt_hwmon_open(struct bnxt *bp) 6846{ 6847} 6848#endif 6849 |
|
6792static bool bnxt_eee_config_ok(struct bnxt *bp) 6793{ 6794 struct ethtool_eee *eee = &bp->eee; 6795 struct bnxt_link_info *link_info = &bp->link_info; 6796 6797 if (!(bp->flags & BNXT_FLAG_EEE_CAP)) 6798 return true; 6799 --- 235 unchanged lines hidden (view full) --- 7035{ 7036 struct bnxt *bp = netdev_priv(dev); 7037 int rc; 7038 7039 bnxt_hwrm_if_change(bp, true); 7040 rc = __bnxt_open_nic(bp, true, true); 7041 if (rc) 7042 bnxt_hwrm_if_change(bp, false); | 6850static bool bnxt_eee_config_ok(struct bnxt *bp) 6851{ 6852 struct ethtool_eee *eee = &bp->eee; 6853 struct bnxt_link_info *link_info = &bp->link_info; 6854 6855 if (!(bp->flags & BNXT_FLAG_EEE_CAP)) 6856 return true; 6857 --- 235 unchanged lines hidden (view full) --- 7093{ 7094 struct bnxt *bp = netdev_priv(dev); 7095 int rc; 7096 7097 bnxt_hwrm_if_change(bp, true); 7098 rc = __bnxt_open_nic(bp, true, true); 7099 if (rc) 7100 bnxt_hwrm_if_change(bp, false); |
7101 7102 bnxt_hwmon_open(bp); 7103 |
|
7043 return rc; 7044} 7045 7046static bool bnxt_drv_busy(struct bnxt *bp) 7047{ 7048 return (test_bit(BNXT_STATE_IN_SP_TASK, &bp->state) || 7049 test_bit(BNXT_STATE_READ_STATS, &bp->state)); 7050} --- 46 unchanged lines hidden (view full) --- 7097 __bnxt_close_nic(bp, irq_re_init, link_re_init); 7098 return rc; 7099} 7100 7101static int bnxt_close(struct net_device *dev) 7102{ 7103 struct bnxt *bp = netdev_priv(dev); 7104 | 7104 return rc; 7105} 7106 7107static bool bnxt_drv_busy(struct bnxt *bp) 7108{ 7109 return (test_bit(BNXT_STATE_IN_SP_TASK, &bp->state) || 7110 test_bit(BNXT_STATE_READ_STATS, &bp->state)); 7111} --- 46 unchanged lines hidden (view full) --- 7158 __bnxt_close_nic(bp, irq_re_init, link_re_init); 7159 return rc; 7160} 7161 7162static int bnxt_close(struct net_device *dev) 7163{ 7164 struct bnxt *bp = netdev_priv(dev); 7165 |
7166 bnxt_hwmon_close(bp); |
|
7105 bnxt_close_nic(bp, true, true); 7106 bnxt_hwrm_shutdown_link(bp); 7107 bnxt_hwrm_if_change(bp, false); 7108 return 0; 7109} 7110 7111/* rtnl_lock held */ 7112static int bnxt_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) --- 2108 unchanged lines hidden --- | 7167 bnxt_close_nic(bp, true, true); 7168 bnxt_hwrm_shutdown_link(bp); 7169 bnxt_hwrm_if_change(bp, false); 7170 return 0; 7171} 7172 7173/* rtnl_lock held */ 7174static int bnxt_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) --- 2108 unchanged lines hidden --- |