Skip to content

Commit 5c90527

Browse files
committed
Merge branch 'pds_core-error-handling-fixes'
Shannon Nelson says: ==================== pds_core: error handling fixes Some fixes for better handling of broken states. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b3d26c5 + 0ea064e commit 5c90527

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

drivers/net/ethernet/amd/pds_core/core.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing)
464464
{
465465
int i;
466466

467-
pdsc_devcmd_reset(pdsc);
467+
if (!pdsc->pdev->is_virtfn)
468+
pdsc_devcmd_reset(pdsc);
468469
pdsc_qcq_free(pdsc, &pdsc->notifyqcq);
469470
pdsc_qcq_free(pdsc, &pdsc->adminqcq);
470471

@@ -524,7 +525,8 @@ static void pdsc_fw_down(struct pdsc *pdsc)
524525
}
525526

526527
/* Notify clients of fw_down */
527-
devlink_health_report(pdsc->fw_reporter, "FW down reported", pdsc);
528+
if (pdsc->fw_reporter)
529+
devlink_health_report(pdsc->fw_reporter, "FW down reported", pdsc);
528530
pdsc_notify(PDS_EVENT_RESET, &reset_event);
529531

530532
pdsc_stop(pdsc);
@@ -554,8 +556,9 @@ static void pdsc_fw_up(struct pdsc *pdsc)
554556

555557
/* Notify clients of fw_up */
556558
pdsc->fw_recoveries++;
557-
devlink_health_reporter_state_update(pdsc->fw_reporter,
558-
DEVLINK_HEALTH_REPORTER_STATE_HEALTHY);
559+
if (pdsc->fw_reporter)
560+
devlink_health_reporter_state_update(pdsc->fw_reporter,
561+
DEVLINK_HEALTH_REPORTER_STATE_HEALTHY);
559562
pdsc_notify(PDS_EVENT_RESET, &reset_event);
560563

561564
return;

drivers/net/ethernet/amd/pds_core/dev.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static const char *pdsc_devcmd_str(int opcode)
121121
}
122122
}
123123

124-
static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)
124+
static int pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, int max_seconds)
125125
{
126126
struct device *dev = pdsc->dev;
127127
unsigned long start_time;
@@ -131,9 +131,6 @@ static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)
131131
int done = 0;
132132
int err = 0;
133133
int status;
134-
int opcode;
135-
136-
opcode = ioread8(&pdsc->cmd_regs->cmd.opcode);
137134

138135
start_time = jiffies;
139136
max_wait = start_time + (max_seconds * HZ);
@@ -180,10 +177,10 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
180177

181178
memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
182179
pdsc_devcmd_dbell(pdsc);
183-
err = pdsc_devcmd_wait(pdsc, max_seconds);
180+
err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds);
184181
memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
185182

186-
if (err == -ENXIO || err == -ETIMEDOUT)
183+
if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq)
187184
queue_work(pdsc->wq, &pdsc->health_work);
188185

189186
return err;

drivers/net/ethernet/amd/pds_core/devlink.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ pdsc_viftype *pdsc_dl_find_viftype_by_id(struct pdsc *pdsc,
1010
{
1111
int vt;
1212

13+
if (!pdsc->viftype_status)
14+
return NULL;
15+
1316
for (vt = 0; vt < PDS_DEV_TYPE_MAX; vt++) {
1417
if (pdsc->viftype_status[vt].dl_id == dl_id)
1518
return &pdsc->viftype_status[vt];

0 commit comments

Comments
 (0)