All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Shannon Nelson <shannon.nelson@amd.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	brett.creeley@amd.com, drivers@pensando.io
Subject: Re: [PATCH net-next 5/5] ionic: add FLR recovery support
Date: Wed, 12 Jul 2023 12:01:19 +0300	[thread overview]
Message-ID: <ZK5r307SRIBUfpgF@shredder> (raw)
In-Reply-To: <20230712002025.24444-6-shannon.nelson@amd.com>

On Tue, Jul 11, 2023 at 05:20:25PM -0700, Shannon Nelson wrote:
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> index b141a29177df..8679d463e98a 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> @@ -320,6 +320,8 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	if (err)
>  		goto err_out;
>  
> +	pci_save_state(pdev);

Can you please explain why this is needed? See more below.

> +
>  	/* Allocate and init the LIF */
>  	err = ionic_lif_size(ionic);
>  	if (err) {
> @@ -408,12 +410,68 @@ static void ionic_remove(struct pci_dev *pdev)
>  	ionic_devlink_free(ionic);
>  }
>  
> +static void ionic_reset_prepare(struct pci_dev *pdev)
> +{
> +	struct ionic *ionic = pci_get_drvdata(pdev);
> +	struct ionic_lif *lif = ionic->lif;
> +
> +	dev_dbg(ionic->dev, "%s: device stopping\n", __func__);

Nit: You can use pci_dbg(pdev, ...);

> +
> +	del_timer_sync(&ionic->watchdog_timer);
> +	cancel_work_sync(&lif->deferred.work);
> +
> +	mutex_lock(&lif->queue_lock);
> +	ionic_stop_queues_reconfig(lif);
> +	ionic_txrx_free(lif);
> +	ionic_lif_deinit(lif);
> +	ionic_qcqs_free(lif);
> +	mutex_unlock(&lif->queue_lock);
> +
> +	ionic_dev_teardown(ionic);
> +	ionic_clear_pci(ionic);
> +	ionic_debugfs_del_dev(ionic);
> +}
> +
> +static void ionic_reset_done(struct pci_dev *pdev)
> +{
> +	struct ionic *ionic = pci_get_drvdata(pdev);
> +	struct ionic_lif *lif = ionic->lif;
> +	int err;
> +
> +	err = ionic_setup_one(ionic);
> +	if (err)
> +		goto err_out;
> +
> +	pci_restore_state(pdev);
> +	pci_save_state(pdev);

It's not clear to me why this is needed. Before issuing the reset, PCI
core calls pci_dev_save_and_disable() which saves the configuration
space of the device. After the reset, but before invoking the
reset_done() handler, PCI core restores the configuration space of the
device by calling pci_restore_state(). IOW, these calls seem to be
redundant.

I'm asking because I have patches that implement these handlers as well,
but I'm not calling pci_save_state() / pci_restore_state() in this flow
and it seems to work fine.

> +
> +	ionic_debugfs_add_sizes(ionic);
> +	ionic_debugfs_add_lif(ionic->lif);
> +
> +	err = ionic_restart_lif(lif);
> +	if (err)
> +		goto err_out;
> +
> +	mod_timer(&ionic->watchdog_timer, jiffies + 1);
> +
> +err_out:
> +	dev_dbg(ionic->dev, "%s: device recovery %s\n",
> +		__func__, err ? "failed" : "done");
> +}
> +
> +static const struct pci_error_handlers ionic_err_handler = {
> +	/* FLR handling */
> +	.reset_prepare      = ionic_reset_prepare,
> +	.reset_done         = ionic_reset_done,
> +};

  reply	other threads:[~2023-07-12  9:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12  0:20 [PATCH net-next 0/5] ionic: add FLR support Shannon Nelson
2023-07-12  0:20 ` [PATCH net-next 1/5] ionic: remove dead device fail path Shannon Nelson
2023-07-12  0:20 ` [PATCH net-next 2/5] ionic: extract common bits from ionic_remove Shannon Nelson
2023-07-12  0:20 ` [PATCH net-next 3/5] ionic: extract common bits from ionic_probe Shannon Nelson
2023-07-12  0:20 ` [PATCH net-next 4/5] ionic: pull out common bits from fw_up Shannon Nelson
2023-07-12  0:20 ` [PATCH net-next 5/5] ionic: add FLR recovery support Shannon Nelson
2023-07-12  9:01   ` Ido Schimmel [this message]
2023-07-12 17:02     ` Shannon Nelson

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=ZK5r307SRIBUfpgF@shredder \
    --to=idosch@idosch.org \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=drivers@pensando.io \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shannon.nelson@amd.com \
    /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.