netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, sassmann@redhat.com,
	anthony.l.nguyen@intel.com,
	Tony Brelinski <tonyx.brelinski@intel.com>
Subject: [PATCH net-next 10/15] ice: add error message when pldmfw_flash_image fails
Date: Mon,  7 Jun 2021 09:53:20 -0700	[thread overview]
Message-ID: <20210607165325.182087-11-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20210607165325.182087-1-anthony.l.nguyen@intel.com>

From: Jacob Keller <jacob.e.keller@intel.com>

When flashing a new firmware image onto the device, the pldmfw library
parses the image contents looking for a matching record. If no record
can be found, the function reports an error of -ENOENT. This can produce
a very confusing error message and experience for the user:

  $devlink dev flash pci/0000:ab:00.0 file image.bin
  devlink answers: No such file or directory

This is because the ENOENT error code is interpreted as a missing file
or directory. The pldmfw library does not have direct access to the
extack pointer as it is generic and non-netdevice specific. The only way
that ENOENT is returned by the pldmfw library is when no record matches.

Catch this specific error and report a suitable extended ack message:

  $devlink dev flash pci/0000:ab:00.0 file image.bin
  Error: ice: Firmware image has no record matching this device
  devlink answers: No such file or directory

In addition, ensure that we log an error message to the console whenever
this function fails. Because our driver specific PLDM operation
functions potentially set the extended ACK message, avoid overwriting
this with a generic message.

This change should result in an improved experience when attempting to
flash an image that does not have a compatible record.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_fw_update.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_fw_update.c b/drivers/net/ethernet/intel/ice/ice_fw_update.c
index dcec0360ce55..f8601d5b0b19 100644
--- a/drivers/net/ethernet/intel/ice/ice_fw_update.c
+++ b/drivers/net/ethernet/intel/ice/ice_fw_update.c
@@ -702,6 +702,16 @@ int ice_flash_pldm_image(struct ice_pf *pf, const struct firmware *fw,
 	}
 
 	err = pldmfw_flash_image(&priv.context, fw);
+	if (err == -ENOENT) {
+		dev_err(dev, "Firmware image has no record matching this device\n");
+		NL_SET_ERR_MSG_MOD(extack, "Firmware image has no record matching this device");
+	} else if (err) {
+		/* Do not set a generic extended ACK message here. A more
+		 * specific message may already have been set by one of our
+		 * ops.
+		 */
+		dev_err(dev, "Failed to flash PLDM image, err %d", err);
+	}
 
 	ice_release_nvm(hw);
 
-- 
2.26.2


  parent reply	other threads:[~2021-06-07 16:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 16:53 [PATCH net-next 00/15][pull request] 100GbE Intel Wired LAN Driver Updates 2021-06-07 Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 01/15] virtchnl: Use pad byte in virtchnl_ether_addr to specify MAC type Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 02/15] ice: Manage VF's MAC address for both legacy and new cases Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 03/15] ice: Save VF's MAC across reboot Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 04/15] ice: Refactor ice_setup_rx_ctx Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 05/15] ice: Refactor VIRTCHNL_OP_CONFIG_VSI_QUEUES handling Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 06/15] ice: set the value of global config lock timeout longer Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 07/15] ice: Re-organizes reqstd/avail {R, T}XQ check/code for efficiency Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 08/15] ice: use static inline for dummy functions Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 09/15] ice: add extack when unable to read device caps Tony Nguyen
2021-06-07 16:53 ` Tony Nguyen [this message]
2021-06-07 16:53 ` [PATCH net-next 11/15] ice: wait for reset before reporting devlink info Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 12/15] ice: (re)initialize NVM fields when rebuilding Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 13/15] ice: Detect and report unsupported module power levels Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 14/15] ice: downgrade error print to debug print Tony Nguyen
2021-06-07 16:53 ` [PATCH net-next 15/15] ice: fix clang warning regarding deadcode.DeadStores Tony Nguyen
2021-06-07 20:40 ` [PATCH net-next 00/15][pull request] 100GbE Intel Wired LAN Driver Updates 2021-06-07 patchwork-bot+netdevbpf

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=20210607165325.182087-11-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    --cc=tonyx.brelinski@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).