Skip to content

Commit

Permalink
eth: fbnic: Revert "eth: fbnic: Add hardware monitoring support via H…
Browse files Browse the repository at this point in the history
…WMON interface"

There is a garbage value problem in fbnic_mac_get_sensor_asic(). 'fw_cmpl'
is uninitialized which makes 'sensor' and '*val' to be stored garbage
value. Revert commit d85ebad ("eth: fbnic: Add hardware monitoring
support via HWMON interface") to avoid this problem.

Fixes: d85ebad ("eth: fbnic: Add hardware monitoring support via HWMON interface")
Signed-off-by: Su Hui <suhui@nfschina.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Suggested-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Link: https://patch.msgid.link/20250106023647.47756-1-suhui@nfschina.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Su Hui authored and Jakub Kicinski committed Jan 7, 2025
1 parent fd48f07 commit 9597893
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 126 deletions.
1 change: 0 additions & 1 deletion drivers/net/ethernet/meta/fbnic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ fbnic-y := fbnic_csr.o \
fbnic_ethtool.o \
fbnic_fw.o \
fbnic_hw_stats.o \
fbnic_hwmon.o \
fbnic_irq.o \
fbnic_mac.o \
fbnic_netdev.o \
Expand Down
5 changes: 0 additions & 5 deletions drivers/net/ethernet/meta/fbnic/fbnic.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ struct fbnic_dev {
struct device *dev;
struct net_device *netdev;
struct dentry *dbg_fbd;
struct device *hwmon;

u32 __iomem *uc_addr0;
u32 __iomem *uc_addr4;
Expand All @@ -33,7 +32,6 @@ struct fbnic_dev {

struct fbnic_fw_mbx mbx[FBNIC_IPC_MBX_INDICES];
struct fbnic_fw_cap fw_cap;
struct fbnic_fw_completion *cmpl_data;
/* Lock protecting Tx Mailbox queue to prevent possible races */
spinlock_t fw_tx_lock;

Expand Down Expand Up @@ -142,9 +140,6 @@ void fbnic_devlink_unregister(struct fbnic_dev *fbd);
int fbnic_fw_enable_mbx(struct fbnic_dev *fbd);
void fbnic_fw_disable_mbx(struct fbnic_dev *fbd);

void fbnic_hwmon_register(struct fbnic_dev *fbd);
void fbnic_hwmon_unregister(struct fbnic_dev *fbd);

int fbnic_pcs_irq_enable(struct fbnic_dev *fbd);
void fbnic_pcs_irq_disable(struct fbnic_dev *fbd);

Expand Down
7 changes: 0 additions & 7 deletions drivers/net/ethernet/meta/fbnic/fbnic_fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ struct fbnic_fw_cap {
u8 link_fec;
};

struct fbnic_fw_completion {
struct {
s32 millivolts;
s32 millidegrees;
} tsene;
};

void fbnic_mbx_init(struct fbnic_dev *fbd);
void fbnic_mbx_clean(struct fbnic_dev *fbd);
void fbnic_mbx_poll(struct fbnic_dev *fbd);
Expand Down
81 changes: 0 additions & 81 deletions drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c

This file was deleted.

22 changes: 0 additions & 22 deletions drivers/net/ethernet/meta/fbnic/fbnic_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,27 +686,6 @@ fbnic_mac_get_eth_mac_stats(struct fbnic_dev *fbd, bool reset,
MAC_STAT_TX_BROADCAST);
}

static int fbnic_mac_get_sensor_asic(struct fbnic_dev *fbd, int id, long *val)
{
struct fbnic_fw_completion fw_cmpl;
s32 *sensor;

switch (id) {
case FBNIC_SENSOR_TEMP:
sensor = &fw_cmpl.tsene.millidegrees;
break;
case FBNIC_SENSOR_VOLTAGE:
sensor = &fw_cmpl.tsene.millivolts;
break;
default:
return -EINVAL;
}

*val = *sensor;

return 0;
}

static const struct fbnic_mac fbnic_mac_asic = {
.init_regs = fbnic_mac_init_regs,
.pcs_enable = fbnic_pcs_enable_asic,
Expand All @@ -716,7 +695,6 @@ static const struct fbnic_mac fbnic_mac_asic = {
.get_eth_mac_stats = fbnic_mac_get_eth_mac_stats,
.link_down = fbnic_mac_link_down_asic,
.link_up = fbnic_mac_link_up_asic,
.get_sensor = fbnic_mac_get_sensor_asic,
};

/**
Expand Down
7 changes: 0 additions & 7 deletions drivers/net/ethernet/meta/fbnic/fbnic_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ enum {
#define FBNIC_LINK_MODE_PAM4 (FBNIC_LINK_50R1)
#define FBNIC_LINK_MODE_MASK (FBNIC_LINK_AUTO - 1)

enum fbnic_sensor_id {
FBNIC_SENSOR_TEMP, /* Temp in millidegrees Centigrade */
FBNIC_SENSOR_VOLTAGE, /* Voltage in millivolts */
};

/* This structure defines the interface hooks for the MAC. The MAC hooks
* will be configured as a const struct provided with a set of function
* pointers.
Expand Down Expand Up @@ -88,8 +83,6 @@ struct fbnic_mac {

void (*link_down)(struct fbnic_dev *fbd);
void (*link_up)(struct fbnic_dev *fbd, bool tx_pause, bool rx_pause);

int (*get_sensor)(struct fbnic_dev *fbd, int id, long *val);
};

int fbnic_mac_init(struct fbnic_dev *fbd);
Expand Down
3 changes: 0 additions & 3 deletions drivers/net/ethernet/meta/fbnic/fbnic_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ static int fbnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Capture snapshot of hardware stats so netdev can calculate delta */
fbnic_reset_hw_stats(fbd);

fbnic_hwmon_register(fbd);

if (!fbd->dsn) {
dev_warn(&pdev->dev, "Reading serial number failed\n");
goto init_failure_mode;
Expand Down Expand Up @@ -360,7 +358,6 @@ static void fbnic_remove(struct pci_dev *pdev)
fbnic_netdev_free(fbd);
}

fbnic_hwmon_unregister(fbd);
fbnic_dbg_fbd_exit(fbd);
fbnic_devlink_unregister(fbd);
fbnic_fw_disable_mbx(fbd);
Expand Down

0 comments on commit 9597893

Please sign in to comment.