Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
To: Igor Russkikh <irusskikh@marvell.com>
Cc: <netdev@vger.kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Ariel Elior <aelior@marvell.com>,
	Michal Kalderon <mkalderon@marvell.com>,
	"Alexander Lobakin" <alobakin@marvell.com>,
	Michal Kalderon <michal.kalderon@marvell.com>
Subject: Re: [PATCH v6 net-next 02/10] qed/qede: make devlink survive recovery
Date: Fri, 21 Aug 2020 11:18:00 -0700	[thread overview]
Message-ID: <20200821111800.00004fb1@intel.com> (raw)
In-Reply-To: <20200820185204.652-3-irusskikh@marvell.com>

Igor Russkikh wrote:

> Devlink instance lifecycle was linked to qed_dev object,
> that caused devlink to be recreated on each recovery.
> 
> Changing it by making higher level driver (qede) responsible for its
> life. This way devlink now survives recoveries.
> 
> qede now stores devlink structure pointer as a part of its device
> object, devlink private data contains a linkage structure,
> qed_devlink.
> 
> 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>

<snip>

> diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
> index 140a392a81bb..93071d41afe4 100644
> --- a/drivers/net/ethernet/qlogic/qede/qede_main.c
> +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
> @@ -1170,10 +1170,23 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
>  			rc = -ENOMEM;
>  			goto err2;
>  		}
> +
> +		edev->devlink = qed_ops->common->devlink_register(cdev);
> +		if (IS_ERR(edev->devlink)) {
> +			DP_NOTICE(edev, "Cannot register devlink\n");
> +			edev->devlink = NULL;
> +			/* Go on, we can live without devlink */
> +		}
>  	} else {
>  		struct net_device *ndev = pci_get_drvdata(pdev);
>  
>  		edev = netdev_priv(ndev);
> +
> +		if (edev && edev->devlink) {
> +			struct qed_devlink *qdl = devlink_priv(edev->devlink);
> +
> +			qdl->cdev = cdev;
> +		}
>  		edev->cdev = cdev;
>  		memset(&edev->stats, 0, sizeof(edev->stats));
>  		memcpy(&edev->dev_info, &dev_info, sizeof(dev_info));

same comment as against old version:

cppcheck notes that the edev check here before the && is either
unnecessary, or the original code had a possible null pointer
dereference.  I figure the code should just be
		if (edev->devlink) {

And I recommend that you try to run cppcheck --enable=all on your code,
it finds several style violations and a few other null pointer checks
that can be fixed up.

  reply	other threads:[~2020-08-21 18:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 18:51 [PATCH v6 net-next 00/10] qed: introduce devlink health support Igor Russkikh
2020-08-20 18:51 ` [PATCH v6 net-next 01/10] qed: move out devlink logic into a new file Igor Russkikh
2020-08-21 17:56   ` Jesse Brandeburg
2020-08-20 18:51 ` [PATCH v6 net-next 02/10] qed/qede: make devlink survive recovery Igor Russkikh
2020-08-21 18:18   ` Jesse Brandeburg [this message]
2020-08-20 18:51 ` [PATCH v6 net-next 03/10] qed: fix kconfig help entries Igor Russkikh
2020-08-20 18:51 ` [PATCH v6 net-next 04/10] qed: implement devlink info request Igor Russkikh
2020-08-21 17:32   ` Jakub Kicinski
2020-08-23 10:57     ` [EXT] " Igor Russkikh
2020-08-20 18:51 ` [PATCH v6 net-next 05/10] qed: health reporter init deinit seq Igor Russkikh
2020-08-21 17:34   ` Jakub Kicinski
2020-08-20 18:52 ` [PATCH v6 net-next 06/10] qed: use devlink logic to report errors Igor Russkikh
2020-08-21 17:34   ` Jakub Kicinski
2020-08-20 18:52 ` [PATCH v6 net-next 07/10] qed*: make use of devlink recovery infrastructure Igor Russkikh
2020-08-21 17:35   ` Jakub Kicinski
2020-08-20 18:52 ` [PATCH v6 net-next 08/10] qed: implement devlink dump Igor Russkikh
2020-08-20 18:52 ` [PATCH v6 net-next 09/10] qed: align adjacent indent Igor Russkikh
2020-08-21 19:40   ` Jesse Brandeburg
2020-08-20 18:52 ` [PATCH v6 net-next 10/10] qede: make driver reliable on unload after failures Igor Russkikh
2020-08-21 19:54 ` [PATCH v6 net-next 00/10] qed: introduce devlink health support Jesse Brandeburg
2020-08-21 20:37   ` [EXT] " Igor Russkikh

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=20200821111800.00004fb1@intel.com \
    --to=jesse.brandeburg@intel.com \
    --cc=aelior@marvell.com \
    --cc=alobakin@marvell.com \
    --cc=davem@davemloft.net \
    --cc=irusskikh@marvell.com \
    --cc=kuba@kernel.org \
    --cc=michal.kalderon@marvell.com \
    --cc=mkalderon@marvell.com \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH v6 net-next 02/10] qed/qede: make devlink survive recovery' \
    /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

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).