From patchwork Mon Sep 28 21:29:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 260004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CCA3C2D0A8 for ; Mon, 28 Sep 2020 21:30:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBDAF208FE for ; Mon, 28 Sep 2020 21:30:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726954AbgI1VaI (ORCPT ); Mon, 28 Sep 2020 17:30:08 -0400 Received: from mga01.intel.com ([192.55.52.88]:22998 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbgI1VaI (ORCPT ); Mon, 28 Sep 2020 17:30:08 -0400 IronPort-SDR: OmTWHv4UauIaWjYm6z/nbZ20nvSnGD/c+7dGlfh5BLivCN/zX9AwZomIiP+GfLqHSfviHQcvWY XD+KJZCKa85w== X-IronPort-AV: E=McAfee;i="6000,8403,9758"; a="180222306" X-IronPort-AV: E=Sophos;i="5.77,315,1596524400"; d="scan'208";a="180222306" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 14:30:07 -0700 IronPort-SDR: h+s1f5TnVQWn+IfbJywgtXwgWkRoEj6o5t9PZTtM2GomZ4bZhA6JyM7Q33lISxVxAH9j48TXm0 AcCpaPJ7vR1A== X-IronPort-AV: E=Sophos;i="5.77,315,1596524400"; d="scan'208";a="340559687" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.4]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 14:30:07 -0700 From: Jacob Keller To: netdev@vger.kernel.org Cc: Jacob Keller Subject: [net-next] ice: use new timeout for devlink flash notify on erasing Date: Mon, 28 Sep 2020 14:29:11 -0700 Message-Id: <20200928212911.3369696-1-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.28.0.497.g54e85e7af1ac MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When erasing, notify userspace of how long we will potentially take to erase a module. This allows for better status reporting, because the devlink program can display the timeout to the user in case the command takes more than a few seconds to complete. Since we're re-using the erase timeout value, make it a macro rather than a magic number. Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ice/ice_fw_update.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) base-commit: bcbf1be0ad49eed35f3cf27fb668f77e0c94f5f7 diff --git a/drivers/net/ethernet/intel/ice/ice_fw_update.c b/drivers/net/ethernet/intel/ice/ice_fw_update.c index 142123155a0f..1ab805873cb1 100644 --- a/drivers/net/ethernet/intel/ice/ice_fw_update.c +++ b/drivers/net/ethernet/intel/ice/ice_fw_update.c @@ -399,6 +399,11 @@ ice_write_nvm_module(struct ice_pf *pf, u16 module, const char *component, return err; } +/* Length in seconds to wait before timing out when erasing a flash module. + * Yes, erasing really can take minutes to complete. + */ +#define ICE_FW_ERASE_TIMEOUT 300 + /** * ice_erase_nvm_module - Erase an NVM module and await firmware completion * @pf: the PF data structure @@ -429,7 +434,7 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component, devlink = priv_to_devlink(pf); - devlink_flash_update_status_notify(devlink, "Erasing", component, 0, 0); + devlink_flash_update_timeout_notify(devlink, "Erasing", component, ICE_FW_ERASE_TIMEOUT); status = ice_aq_erase_nvm(hw, module, NULL); if (status) { @@ -441,8 +446,7 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component, goto out_notify_devlink; } - /* Yes, this really can take minutes to complete */ - err = ice_aq_wait_for_event(pf, ice_aqc_opc_nvm_erase, 300 * HZ, &event); + err = ice_aq_wait_for_event(pf, ice_aqc_opc_nvm_erase, ICE_FW_ERASE_TIMEOUT * HZ, &event); if (err) { dev_err(dev, "Timed out waiting for firmware to respond with erase completion for %s (module 0x%02x), err %d\n", component, module, err);