Skip to content

Commit b640b55

Browse files
brettcreeleydavem330
authored andcommitted
ionic: Allow flexibility for error reporting on dev commands
When dev commands fail, an error message will always be printed, which may be overly alarming the to system administrators, especially if the driver shouldn't be printing the error due to some unsupported capability. Similar to recent adminq request changes, we can update the dev command interface with the ability to selectively print error messages to allow the driver to prevent printing errors that are expected. Signed-off-by: Brett Creeley <[email protected]> Signed-off-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bc43ed4 commit b640b55

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

drivers/net/ethernet/pensando/ionic/ionic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ void ionic_adminq_netdev_err_print(struct ionic_lif *lif, u8 opcode,
7878
u8 status, int err);
7979

8080
int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
81+
int ionic_dev_cmd_wait_nomsg(struct ionic *ionic, unsigned long max_wait);
82+
void ionic_dev_cmd_dev_err_print(struct ionic *ionic, u8 opcode, u8 status,
83+
int err);
8184
int ionic_set_dma_mask(struct ionic *ionic);
8285
int ionic_setup(struct ionic *ionic);
8386

drivers/net/ethernet/pensando/ionic/ionic_main.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,20 @@ static void ionic_dev_cmd_clean(struct ionic *ionic)
384384
memset_io(&idev->dev_cmd_regs->cmd, 0, sizeof(idev->dev_cmd_regs->cmd));
385385
}
386386

387-
int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
387+
void ionic_dev_cmd_dev_err_print(struct ionic *ionic, u8 opcode, u8 status,
388+
int err)
389+
{
390+
const char *stat_str;
391+
392+
stat_str = (err == -ETIMEDOUT) ? "TIMEOUT" :
393+
ionic_error_to_str(status);
394+
395+
dev_err(ionic->dev, "DEV_CMD %s (%d) error, %s (%d) failed\n",
396+
ionic_opcode_to_str(opcode), opcode, stat_str, err);
397+
}
398+
399+
static int __ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds,
400+
const bool do_msg)
388401
{
389402
struct ionic_dev *idev = &ionic->idev;
390403
unsigned long start_time;
@@ -452,16 +465,26 @@ int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
452465
}
453466

454467
if (!(opcode == IONIC_CMD_FW_CONTROL && err == IONIC_RC_EAGAIN))
455-
dev_err(ionic->dev, "DEV_CMD %s (%d) error, %s (%d) failed\n",
456-
ionic_opcode_to_str(opcode), opcode,
457-
ionic_error_to_str(err), err);
468+
if (do_msg)
469+
ionic_dev_cmd_dev_err_print(ionic, opcode, err,
470+
ionic_error_to_errno(err));
458471

459472
return ionic_error_to_errno(err);
460473
}
461474

462475
return 0;
463476
}
464477

478+
int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
479+
{
480+
return __ionic_dev_cmd_wait(ionic, max_seconds, true);
481+
}
482+
483+
int ionic_dev_cmd_wait_nomsg(struct ionic *ionic, unsigned long max_seconds)
484+
{
485+
return __ionic_dev_cmd_wait(ionic, max_seconds, false);
486+
}
487+
465488
int ionic_setup(struct ionic *ionic)
466489
{
467490
int err;

0 commit comments

Comments
 (0)