The driver can be premature in detecting stalled firmware
when the heartbeat is not updated because the firmware can
occasionally take a long time (more than 2 seconds) to service
a request, and doesn't update the heartbeat during that time.
The firmware heartbeat is not necessarily a steady 1 second
periodic beat, but better described as something that should
progress at least once in every DECVMD_TIMEOUT period.
The single-threaded design in the FW means that if a devcmd
or adminq request launches a large internal job, it is stuck
waiting for that job to finish before it can get back to
updating the heartbeat. Since all requests are "guaranteed"
to finish within the DEVCMD_TIMEOUT period, the driver needs
to less aggressive in checking the heartbeat progress.
We change our current 2 second window to something bigger than
DEVCMD_TIMEOUT which should take care of most of the issue.
We stop checking for the heartbeat while waiting for a request,
as long as we're still watching for the FW status. Lastly,
we make sure our FW status is up to date before running a
devcmd request.
Once we do this, we need to not check the heartbeat on DEV
commands because it may be stalled while we're on the fw_down
path. Instead, we can rely on the is_fw_running check.
Fixes: b2b9a8d7ed
("ionic: avoid races in ionic_heartbeat_check")
Signed-off-by: Brett Creeley <brett@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
97 lines
2.8 KiB
C
97 lines
2.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
|
|
|
|
#ifndef _IONIC_H_
|
|
#define _IONIC_H_
|
|
|
|
struct ionic_lif;
|
|
|
|
#include "ionic_if.h"
|
|
#include "ionic_dev.h"
|
|
#include "ionic_devlink.h"
|
|
|
|
#define IONIC_DRV_NAME "ionic"
|
|
#define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver"
|
|
|
|
#define PCI_VENDOR_ID_PENSANDO 0x1dd8
|
|
|
|
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002
|
|
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003
|
|
|
|
#define DEVCMD_TIMEOUT 5
|
|
#define IONIC_ADMINQ_TIME_SLICE msecs_to_jiffies(100)
|
|
|
|
#define IONIC_PHC_UPDATE_NS 10000000000 /* 10s in nanoseconds */
|
|
#define NORMAL_PPB 1000000000 /* one billion parts per billion */
|
|
#define SCALED_PPM (1000000ull << 16) /* 2^16 million parts per 2^16 million */
|
|
|
|
struct ionic_vf {
|
|
u16 index;
|
|
u8 macaddr[6];
|
|
__le32 maxrate;
|
|
__le16 vlanid;
|
|
u8 spoofchk;
|
|
u8 trusted;
|
|
u8 linkstate;
|
|
dma_addr_t stats_pa;
|
|
struct ionic_lif_stats stats;
|
|
};
|
|
|
|
struct ionic {
|
|
struct pci_dev *pdev;
|
|
struct device *dev;
|
|
struct devlink_port dl_port;
|
|
struct ionic_dev idev;
|
|
struct mutex dev_cmd_lock; /* lock for dev_cmd operations */
|
|
struct dentry *dentry;
|
|
struct ionic_dev_bar bars[IONIC_BARS_MAX];
|
|
unsigned int num_bars;
|
|
struct ionic_identity ident;
|
|
struct ionic_lif *lif;
|
|
unsigned int nnqs_per_lif;
|
|
unsigned int neqs_per_lif;
|
|
unsigned int ntxqs_per_lif;
|
|
unsigned int nrxqs_per_lif;
|
|
unsigned int nintrs;
|
|
DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX);
|
|
struct work_struct nb_work;
|
|
struct notifier_block nb;
|
|
struct rw_semaphore vf_op_lock; /* lock for VF operations */
|
|
struct ionic_vf *vfs;
|
|
int num_vfs;
|
|
struct timer_list watchdog_timer;
|
|
int watchdog_period;
|
|
};
|
|
|
|
struct ionic_admin_ctx {
|
|
struct completion work;
|
|
union ionic_adminq_cmd cmd;
|
|
union ionic_adminq_comp comp;
|
|
};
|
|
|
|
int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
|
|
int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,
|
|
const int err, const bool do_msg);
|
|
int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
|
|
int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
|
|
void ionic_adminq_netdev_err_print(struct ionic_lif *lif, u8 opcode,
|
|
u8 status, int err);
|
|
|
|
int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
|
|
int ionic_dev_cmd_wait_nomsg(struct ionic *ionic, unsigned long max_wait);
|
|
void ionic_dev_cmd_dev_err_print(struct ionic *ionic, u8 opcode, u8 status,
|
|
int err);
|
|
int ionic_set_dma_mask(struct ionic *ionic);
|
|
int ionic_setup(struct ionic *ionic);
|
|
|
|
int ionic_identify(struct ionic *ionic);
|
|
int ionic_init(struct ionic *ionic);
|
|
int ionic_reset(struct ionic *ionic);
|
|
|
|
int ionic_port_identify(struct ionic *ionic);
|
|
int ionic_port_init(struct ionic *ionic);
|
|
int ionic_port_reset(struct ionic *ionic);
|
|
|
|
const char *ionic_vf_attr_to_str(enum ionic_vf_attr attr);
|
|
|
|
#endif /* _IONIC_H_ */
|