Skip to content

Commit f16a916

Browse files
Edwin Peerdavem330
authored andcommitted
bnxt_en: Do not destroy health reporters during reset
Health reporter state should be maintained over resets. Previously reporters were destroyed if the device capabilities changed, but since none of the reporters depend on capabilities anymore, this logic should be removed. Signed-off-by: Edwin Peer <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c492a2 commit f16a916

File tree

3 files changed

+24
-29
lines changed

3 files changed

+24
-29
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12149,11 +12149,6 @@ int bnxt_fw_init_one(struct bnxt *bp)
1214912149
if (rc)
1215012150
return rc;
1215112151

12152-
/* In case fw capabilities have changed, destroy the unneeded
12153-
* reporters and create newly capable ones.
12154-
*/
12155-
bnxt_dl_fw_reporters_destroy(bp, false);
12156-
bnxt_dl_fw_reporters_create(bp);
1215712152
bnxt_fw_init_one_p3(bp);
1215812153
return 0;
1215912154
}
@@ -12982,7 +12977,7 @@ static void bnxt_remove_one(struct pci_dev *pdev)
1298212977
cancel_delayed_work_sync(&bp->fw_reset_task);
1298312978
bp->sp_event = 0;
1298412979

12985-
bnxt_dl_fw_reporters_destroy(bp, true);
12980+
bnxt_dl_fw_reporters_destroy(bp);
1298612981
bnxt_dl_unregister(bp);
1298712982
bnxt_shutdown_tc(bp);
1298812983

drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -241,37 +241,37 @@ static const struct devlink_health_reporter_ops bnxt_dl_fw_reporter_ops = {
241241
.recover = bnxt_fw_recover,
242242
};
243243

244-
void bnxt_dl_fw_reporters_create(struct bnxt *bp)
244+
static struct devlink_health_reporter *
245+
__bnxt_dl_reporter_create(struct bnxt *bp,
246+
const struct devlink_health_reporter_ops *ops)
245247
{
246-
struct bnxt_fw_health *health = bp->fw_health;
247-
248-
if (!health || health->fw_reporter)
249-
return;
248+
struct devlink_health_reporter *reporter;
250249

251-
health->fw_reporter =
252-
devlink_health_reporter_create(bp->dl, &bnxt_dl_fw_reporter_ops,
253-
0, bp);
254-
if (IS_ERR(health->fw_reporter)) {
255-
netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n",
256-
PTR_ERR(health->fw_reporter));
257-
health->fw_reporter = NULL;
258-
bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
250+
reporter = devlink_health_reporter_create(bp->dl, ops, 0, bp);
251+
if (IS_ERR(reporter)) {
252+
netdev_warn(bp->dev, "Failed to create %s health reporter, rc = %ld\n",
253+
ops->name, PTR_ERR(reporter));
254+
return NULL;
259255
}
256+
257+
return reporter;
260258
}
261259

262-
void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all)
260+
void bnxt_dl_fw_reporters_create(struct bnxt *bp)
263261
{
264-
struct bnxt_fw_health *health = bp->fw_health;
262+
struct bnxt_fw_health *fw_health = bp->fw_health;
265263

266-
if (!health)
267-
return;
264+
if (fw_health && !fw_health->fw_reporter)
265+
fw_health->fw_reporter = __bnxt_dl_reporter_create(bp, &bnxt_dl_fw_reporter_ops);
266+
}
268267

269-
if ((bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) && !all)
270-
return;
268+
void bnxt_dl_fw_reporters_destroy(struct bnxt *bp)
269+
{
270+
struct bnxt_fw_health *fw_health = bp->fw_health;
271271

272-
if (health->fw_reporter) {
273-
devlink_health_reporter_destroy(health->fw_reporter);
274-
health->fw_reporter = NULL;
272+
if (fw_health && fw_health->fw_reporter) {
273+
devlink_health_reporter_destroy(fw_health->fw_reporter);
274+
fw_health->fw_reporter = NULL;
275275
}
276276
}
277277

drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void bnxt_devlink_health_fw_report(struct bnxt *bp);
7575
void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy);
7676
void bnxt_dl_health_fw_recovery_done(struct bnxt *bp);
7777
void bnxt_dl_fw_reporters_create(struct bnxt *bp);
78-
void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all);
78+
void bnxt_dl_fw_reporters_destroy(struct bnxt *bp);
7979
int bnxt_dl_register(struct bnxt *bp);
8080
void bnxt_dl_unregister(struct bnxt *bp);
8181

0 commit comments

Comments
 (0)