All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Russkikh <irusskikh@marvell.com>
To: <netdev@vger.kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Ariel Elior <aelior@marvell.com>,
	Michal Kalderon <mkalderon@marvell.com>,
	Denis Bolotin <dbolotin@marvell.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Igor Russkikh <irusskikh@marvell.com>,
	Alexander Lobakin <alobakin@marvell.com>,
	Michal Kalderon <michal.kalderon@marvell.com>
Subject: [PATCH v5 net-next 10/10] qede: make driver reliable on unload after failures
Date: Sun, 2 Aug 2020 13:08:34 +0300	[thread overview]
Message-ID: <20200802100834.383-11-irusskikh@marvell.com> (raw)
In-Reply-To: <20200802100834.383-1-irusskikh@marvell.com>

In case recovery was not successful, netdev still should be
present. But we should clear cdev if something bad happens
on recovery.

We also check cdev for null on dev close. That could be a case
if recovery was not successful.

Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
---
 drivers/net/ethernet/qlogic/qede/qede_main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 287e10effb49..01a7bff91d6c 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1240,7 +1240,10 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
 err4:
 	qede_rdma_dev_remove(edev, (mode == QEDE_PROBE_RECOVERY));
 err3:
-	free_netdev(edev->ndev);
+	if (mode != QEDE_PROBE_RECOVERY)
+		free_netdev(edev->ndev);
+	else
+		edev->cdev = NULL;
 err2:
 	qed_ops->common->slowpath_stop(cdev);
 err1:
@@ -2475,7 +2478,8 @@ static int qede_close(struct net_device *ndev)
 
 	qede_unload(edev, QEDE_UNLOAD_NORMAL, false);
 
-	edev->ops->common->update_drv_state(edev->cdev, false);
+	if (edev->cdev)
+		edev->ops->common->update_drv_state(edev->cdev, false);
 
 	return 0;
 }
-- 
2.17.1


      parent reply	other threads:[~2020-08-02 10:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 10:08 [PATCH v5 net-next 00/10] qed: introduce devlink health support Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 01/10] qed: move out devlink logic into a new file Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 02/10] qed/qede: make devlink survive recovery Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 03/10] qed: fix kconfig help entries Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 04/10] qed: implement devlink info request Igor Russkikh
2020-08-03 21:29   ` Jakub Kicinski
2020-08-04  7:21     ` [EXT] " Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 05/10] qed: health reporter init deinit seq Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 06/10] qed: use devlink logic to report errors Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 07/10] qed*: make use of devlink recovery infrastructure Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 08/10] qed: implement devlink dump Igor Russkikh
2020-08-02 10:08 ` [PATCH v5 net-next 09/10] qed: align adjacent indent Igor Russkikh
2020-08-02 10:08 ` Igor Russkikh [this message]

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=20200802100834.383-11-irusskikh@marvell.com \
    --to=irusskikh@marvell.com \
    --cc=aelior@marvell.com \
    --cc=alobakin@marvell.com \
    --cc=davem@davemloft.net \
    --cc=dbolotin@marvell.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=michal.kalderon@marvell.com \
    --cc=mkalderon@marvell.com \
    --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.