All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Nelson <snelson@pensando.io>
To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org
Cc: drivers@pensando.io, Brett Creeley <brett@pensando.io>,
	Shannon Nelson <snelson@pensando.io>
Subject: [PATCH net 09/16] ionic: Allow flexibility for error reporting on dev commands
Date: Mon, 24 Jan 2022 10:53:05 -0800	[thread overview]
Message-ID: <20220124185312.72646-10-snelson@pensando.io> (raw)
In-Reply-To: <20220124185312.72646-1-snelson@pensando.io>

From: Brett Creeley <brett@pensando.io>

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 <brett@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 drivers/net/ethernet/pensando/ionic/ionic.h   |  3 ++
 .../net/ethernet/pensando/ionic/ionic_main.c  | 31 ++++++++++++++++---
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h
index 5e25411ff02f..6783c0e6ba4f 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic.h
+++ b/drivers/net/ethernet/pensando/ionic/ionic.h
@@ -78,6 +78,9 @@ 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);
 
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
index 7693b4336394..163174f07ed7 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
@@ -384,7 +384,20 @@ static void ionic_dev_cmd_clean(struct ionic *ionic)
 	memset_io(&idev->dev_cmd_regs->cmd, 0, sizeof(idev->dev_cmd_regs->cmd));
 }
 
-int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
+void ionic_dev_cmd_dev_err_print(struct ionic *ionic, u8 opcode, u8 status,
+				 int err)
+{
+	const char *stat_str;
+
+	stat_str = (err == -ETIMEDOUT) ? "TIMEOUT" :
+					 ionic_error_to_str(status);
+
+	dev_err(ionic->dev, "DEV_CMD %s (%d) error, %s (%d) failed\n",
+		ionic_opcode_to_str(opcode), opcode, stat_str, err);
+}
+
+static int __ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds,
+				const bool do_msg)
 {
 	struct ionic_dev *idev = &ionic->idev;
 	unsigned long start_time;
@@ -452,9 +465,9 @@ int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
 		}
 
 		if (!(opcode == IONIC_CMD_FW_CONTROL && err == IONIC_RC_EAGAIN))
-			dev_err(ionic->dev, "DEV_CMD %s (%d) error, %s (%d) failed\n",
-				ionic_opcode_to_str(opcode), opcode,
-				ionic_error_to_str(err), err);
+			if (do_msg)
+				ionic_dev_cmd_dev_err_print(ionic, opcode, err,
+							    ionic_error_to_errno(err));
 
 		return ionic_error_to_errno(err);
 	}
@@ -462,6 +475,16 @@ int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
 	return 0;
 }
 
+int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
+{
+	return __ionic_dev_cmd_wait(ionic, max_seconds, true);
+}
+
+int ionic_dev_cmd_wait_nomsg(struct ionic *ionic, unsigned long max_seconds)
+{
+	return __ionic_dev_cmd_wait(ionic, max_seconds, false);
+}
+
 int ionic_setup(struct ionic *ionic)
 {
 	int err;
-- 
2.17.1


  parent reply	other threads:[~2022-01-24 18:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 18:52 [PATCH net 00/16] ionic: updates for stable FW recovery Shannon Nelson
2022-01-24 18:52 ` [PATCH net 01/16] ionic: fix type complaint in ionic_dev_cmd_clean() Shannon Nelson
2022-01-24 18:52 ` [PATCH net 02/16] ionic: start watchdog after all is setup Shannon Nelson
2022-01-24 18:52 ` [PATCH net 03/16] ionic: separate function for watchdog init Shannon Nelson
2022-01-24 18:53 ` [PATCH net 04/16] ionic: Don't send reset commands if FW isn't running Shannon Nelson
2022-01-24 18:53 ` [PATCH net 05/16] ionic: add FW_STOPPING state Shannon Nelson
2022-01-24 18:53 ` [PATCH net 06/16] ionic: better handling of RESET event Shannon Nelson
2022-01-24 18:53 ` [PATCH net 07/16] ionic: fix up printing of timeout error Shannon Nelson
2022-01-24 18:53 ` [PATCH net 08/16] ionic: Correctly print AQ errors if completions aren't received Shannon Nelson
2022-01-24 18:53 ` Shannon Nelson [this message]
2022-01-24 18:53 ` [PATCH net 10/16] ionic: Query FW when getting VF info via ndo_get_vf_config Shannon Nelson
2022-01-24 18:53 ` [PATCH net 11/16] ionic: Prevent filter add/del err msgs when the device is not available Shannon Nelson
2022-01-24 18:53 ` [PATCH net 12/16] ionic: Cleanups in the Tx hotpath code Shannon Nelson
2022-01-24 18:53 ` [PATCH net 13/16] ionic: disable napi when ionic_lif_init() fails Shannon Nelson
2022-01-24 18:53 ` [PATCH net 14/16] ionic: remove the dbid_inuse bitmap Shannon Nelson
2022-01-24 18:53 ` [PATCH net 15/16] ionic: stretch heartbeat detection Shannon Nelson
2022-01-24 18:53 ` [PATCH net 16/16] ionic: replace set_vf data with union Shannon Nelson
2022-01-25 18:03 ` [PATCH net 00/16] ionic: updates for stable FW recovery Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220124185312.72646-10-snelson@pensando.io \
    --to=snelson@pensando.io \
    --cc=brett@pensando.io \
    --cc=davem@davemloft.net \
    --cc=drivers@pensando.io \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.