Commit 9524067b authored by Igor Russkikh's avatar Igor Russkikh Committed by David S. Miller

qed: health reporter init deinit seq

Here we declare health reporter ops (empty for now)
and register these in qed probe and remove callbacks.

This way we get devlink attached to all kind of qed* PCI
device entities: networking or storage offload entity.
Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 53916a67
...@@ -14,6 +14,36 @@ enum qed_devlink_param_id { ...@@ -14,6 +14,36 @@ enum qed_devlink_param_id {
QED_DEVLINK_PARAM_ID_IWARP_CMT, QED_DEVLINK_PARAM_ID_IWARP_CMT,
}; };
static const struct devlink_health_reporter_ops qed_fw_fatal_reporter_ops = {
.name = "fw_fatal",
};
#define QED_REPORTER_FW_GRACEFUL_PERIOD 1200000
void qed_fw_reporters_create(struct devlink *devlink)
{
struct qed_devlink *dl = devlink_priv(devlink);
dl->fw_reporter = devlink_health_reporter_create(devlink, &qed_fw_fatal_reporter_ops,
QED_REPORTER_FW_GRACEFUL_PERIOD, dl);
if (IS_ERR(dl->fw_reporter)) {
DP_NOTICE(dl->cdev, "Failed to create fw reporter, err = %ld\n",
PTR_ERR(dl->fw_reporter));
dl->fw_reporter = NULL;
}
}
void qed_fw_reporters_destroy(struct devlink *devlink)
{
struct qed_devlink *dl = devlink_priv(devlink);
struct devlink_health_reporter *rep;
rep = dl->fw_reporter;
if (!IS_ERR_OR_NULL(rep))
devlink_health_reporter_destroy(rep);
}
static int qed_dl_param_get(struct devlink *dl, u32 id, static int qed_dl_param_get(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx) struct devlink_param_gset_ctx *ctx)
{ {
...@@ -126,6 +156,8 @@ struct devlink *qed_devlink_register(struct qed_dev *cdev) ...@@ -126,6 +156,8 @@ struct devlink *qed_devlink_register(struct qed_dev *cdev)
devlink_params_publish(dl); devlink_params_publish(dl);
cdev->iwarp_cmt = false; cdev->iwarp_cmt = false;
qed_fw_reporters_create(dl);
return dl; return dl;
err_unregister: err_unregister:
...@@ -142,6 +174,8 @@ void qed_devlink_unregister(struct devlink *devlink) ...@@ -142,6 +174,8 @@ void qed_devlink_unregister(struct devlink *devlink)
if (!devlink) if (!devlink)
return; return;
qed_fw_reporters_destroy(devlink);
devlink_params_unregister(devlink, qed_devlink_params, devlink_params_unregister(devlink, qed_devlink_params,
ARRAY_SIZE(qed_devlink_params)); ARRAY_SIZE(qed_devlink_params));
......
...@@ -12,4 +12,7 @@ ...@@ -12,4 +12,7 @@
struct devlink *qed_devlink_register(struct qed_dev *cdev); struct devlink *qed_devlink_register(struct qed_dev *cdev);
void qed_devlink_unregister(struct devlink *devlink); void qed_devlink_unregister(struct devlink *devlink);
void qed_fw_reporters_create(struct devlink *devlink);
void qed_fw_reporters_destroy(struct devlink *devlink);
#endif #endif
...@@ -782,6 +782,7 @@ enum qed_nvm_flash_cmd { ...@@ -782,6 +782,7 @@ enum qed_nvm_flash_cmd {
struct qed_devlink { struct qed_devlink {
struct qed_dev *cdev; struct qed_dev *cdev;
struct devlink_health_reporter *fw_reporter;
}; };
struct qed_common_cb_ops { struct qed_common_cb_ops {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment