[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240116194908.253437-61-sashal@kernel.org>
Date: Tue, 16 Jan 2024 14:46:27 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Shannon Nelson <shannon.nelson@....com>,
Brett Creeley <brett.creeley@....com>,
"David S . Miller" <davem@...emloft.net>,
Sasha Levin <sashal@...nel.org>,
drivers@...sando.io,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
cai.huoqing@...ux.dev,
leon@...nel.org,
florian.fainelli@...adcom.com,
nitya.sunkad@....com,
neel.patel@....com,
Julia.Lawall@...ia.fr,
allen.hubbe@....com,
keescook@...omium.org,
justinstitt@...gle.com,
netdev@...r.kernel.org
Subject: [PATCH AUTOSEL 6.6 061/104] ionic: bypass firmware cmds when stuck in reset
From: Shannon Nelson <shannon.nelson@....com>
[ Upstream commit ca5fdf9a7c5b65968c718f2be159cda4c13556a1 ]
If the driver or firmware is stuck in reset state, don't bother
trying to use adminq commands. This speeds up shutdown and
prevents unnecessary timeouts and error messages.
This includes a bit of rework on ionic_adminq_post_wait()
and ionic_adminq_post_wait_nomsg() to both use
__ionic_adminq_post_wait() which can do the checks needed in
both cases.
Signed-off-by: Shannon Nelson <shannon.nelson@....com>
Reviewed-by: Brett Creeley <brett.creeley@....com>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
.../ethernet/pensando/ionic/ionic_bus_pci.c | 4 ++++
.../net/ethernet/pensando/ionic/ionic_lif.c | 3 +++
.../net/ethernet/pensando/ionic/ionic_main.c | 20 ++++++++++++-------
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
index d6ce113a4210..fa4237c27e06 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
@@ -392,6 +392,10 @@ static void ionic_remove(struct pci_dev *pdev)
del_timer_sync(&ionic->watchdog_timer);
if (ionic->lif) {
+ /* prevent adminq cmds if already known as down */
+ if (test_and_clear_bit(IONIC_LIF_F_FW_RESET, ionic->lif->state))
+ set_bit(IONIC_LIF_F_FW_STOPPING, ionic->lif->state);
+
ionic_lif_unregister(ionic->lif);
ionic_devlink_unregister(ionic);
ionic_lif_deinit(ionic->lif);
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index c9bd2c57a37d..adb0f9b01bb1 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -3238,6 +3238,9 @@ static void ionic_lif_reset(struct ionic_lif *lif)
{
struct ionic_dev *idev = &lif->ionic->idev;
+ if (!ionic_is_fw_running(idev))
+ return;
+
mutex_lock(&lif->ionic->dev_cmd_lock);
ionic_dev_cmd_lif_reset(idev, lif->index);
ionic_dev_cmd_wait(lif->ionic, DEVCMD_TIMEOUT);
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
index baa865af49ad..f019277fec57 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
@@ -410,22 +410,28 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,
do_msg);
}
-int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
+static int __ionic_adminq_post_wait(struct ionic_lif *lif,
+ struct ionic_admin_ctx *ctx,
+ const bool do_msg)
{
int err;
+ if (!ionic_is_fw_running(&lif->ionic->idev))
+ return 0;
+
err = ionic_adminq_post(lif, ctx);
- return ionic_adminq_wait(lif, ctx, err, true);
+ return ionic_adminq_wait(lif, ctx, err, do_msg);
}
-int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
+int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
{
- int err;
-
- err = ionic_adminq_post(lif, ctx);
+ return __ionic_adminq_post_wait(lif, ctx, true);
+}
- return ionic_adminq_wait(lif, ctx, err, false);
+int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
+{
+ return __ionic_adminq_post_wait(lif, ctx, false);
}
static void ionic_dev_cmd_clean(struct ionic *ionic)
--
2.43.0
Powered by blists - more mailing lists