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 net-next 02/11] qed/qede: make devlink survive recovery
Date: Fri, 21 Aug 2020 10:28:14 -0700 [thread overview]
Message-ID: <20200821102814.00003002@intel.com> (raw)
In-Reply-To: <20200727184310.462-3-irusskikh@marvell.com>
Igor Russkikh wrote:
> Before that, devlink instance lifecycle was linked to qed_dev object,
> that causes devlink to be recreated on each recovery.
>
> Changing it by making higher level driver (qede) responsible for its
> life. This way devlink will survive recoveries.
>
> qede will store devlink structure pointer as a part of its device
> object, devlink private data contains a linkage structure, it'll
> contain extra devlink related content in following patches.
>
> The same lifecycle should be applied to storage drivers (qedf/qedi) later.
>
> 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 1aaae3203f5a..7c2d948b2035 100644
> --- a/drivers/net/ethernet/qlogic/qede/qede_main.c
> +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
> @@ -1172,10 +1172,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) {
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.
> + 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));
next prev parent reply other threads:[~2020-08-21 17:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 18:42 [PATCH net-next 00/11] qed: introduce devlink health support Igor Russkikh
2020-07-27 18:43 ` [PATCH net-next 01/11] qed: move out devlink logic into a new file Igor Russkikh
2020-08-21 17:32 ` Jesse Brandeburg
2020-07-27 18:43 ` [PATCH net-next 02/11] qed/qede: make devlink survive recovery Igor Russkikh
2020-08-21 17:28 ` Jesse Brandeburg [this message]
2020-07-27 18:43 ` [PATCH net-next 03/11] qed: swap param init and publish Igor Russkikh
2020-08-21 17:33 ` Jesse Brandeburg
2020-07-27 18:43 ` [PATCH net-next 04/11] qed: fix kconfig help entries Igor Russkikh
2020-08-21 17:34 ` Jesse Brandeburg
2020-07-27 18:43 ` [PATCH net-next 05/11] qed: implement devlink info request Igor Russkikh
2020-08-21 17:42 ` Jesse Brandeburg
2020-07-27 18:43 ` [PATCH net-next 06/11] qed: health reporter init deinit seq Igor Russkikh
2020-08-21 17:46 ` Jesse Brandeburg
2020-07-27 18:43 ` [PATCH net-next 07/11] qed: use devlink logic to report errors Igor Russkikh
2020-08-21 17:49 ` Jesse Brandeburg
2020-07-27 18:43 ` [PATCH net-next 08/11] qed*: make use of devlink recovery infrastructure Igor Russkikh
2020-07-27 18:43 ` [PATCH net-next 09/11] qed: implement devlink dump Igor Russkikh
2020-07-27 20:40 ` kernel test robot
2020-07-27 18:43 ` [PATCH net-next 10/11] qed: align adjacent indent Igor Russkikh
2020-07-27 18:43 ` [PATCH net-next 11/11] qede: make driver reliable on unload after failures Igor Russkikh
2020-08-21 17:54 ` [PATCH net-next 00/11] qed: introduce devlink health support Jesse Brandeburg
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=20200821102814.00003002@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 \
/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).