From: Leon Romanovsky <leon@kernel.org>
To: Veerasenareddy Burru <vburru@marvell.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
lironh@marvell.com, aayarekar@marvell.com, sedara@marvell.com,
sburla@marvell.com, linux-doc@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next v2 1/9] octeon_ep: defer probe if firmware not ready
Date: Wed, 30 Nov 2022 11:24:43 +0200 [thread overview]
Message-ID: <Y4chWyR6qTlptkTE@unreal> (raw)
In-Reply-To: <20221129130933.25231-2-vburru@marvell.com>
On Tue, Nov 29, 2022 at 05:09:24AM -0800, Veerasenareddy Burru wrote:
> Defer probe if firmware is not ready for device usage.
>
> Signed-off-by: Veerasenareddy Burru <vburru@marvell.com>
> Signed-off-by: Abhijit Ayarekar <aayarekar@marvell.com>
> Signed-off-by: Satananda Burla <sburla@marvell.com>
> ---
> v1 -> v2:
> * was scheduling workqueue task to wait for firmware ready,
> to probe/initialize the device.
> * now, removed the workqueue task; the probe returns EPROBE_DEFER,
> if firmware is not ready.
> * removed device status oct->status, as it is not required with the
> modified implementation.
>
> .../ethernet/marvell/octeon_ep/octep_main.c | 26 +++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> index 5a898fb88e37..aa7d0ced9807 100644
> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> @@ -1017,6 +1017,25 @@ static void octep_device_cleanup(struct octep_device *oct)
> oct->conf = NULL;
> }
>
> +static u8 get_fw_ready_status(struct pci_dev *pdev)
Please change this function to return bool, you are not interested in
status.
> +{
> + u32 pos = 0;
> + u16 vsec_id;
> + u8 status;
> +
> + while ((pos = pci_find_next_ext_capability(pdev, pos,
> + PCI_EXT_CAP_ID_VNDR))) {
> + pci_read_config_word(pdev, pos + 4, &vsec_id);
> +#define FW_STATUS_VSEC_ID 0xA3
> + if (vsec_id == FW_STATUS_VSEC_ID) {
Success oriented flow, plase
if (vsec_id != FW_STATUS_VSEC_ID)
cotitnue;
....
> + pci_read_config_byte(pdev, (pos + 8), &status);
> + dev_info(&pdev->dev, "Firmware ready %u\n", status);
> + return status;
> + }
> + }
> + return 0;
> +}
> +
> /**
> * octep_probe() - Octeon PCI device probe handler.
> *
> @@ -1053,6 +1072,13 @@ static int octep_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> pci_enable_pcie_error_reporting(pdev);
> pci_set_master(pdev);
>
> +#define FW_STATUS_READY 1
> + if (get_fw_ready_status(pdev) != FW_STATUS_READY) {
No need to this new define if you change get_fw_ready_status() to return
true/false.
And I think that you can put this check earlier in octep_probe().
Thanks
> + dev_notice(&pdev->dev, "Firmware not ready; defer probe.\n");
> + err = -EPROBE_DEFER;
> + goto err_alloc_netdev;
> + }
> +
> netdev = alloc_etherdev_mq(sizeof(struct octep_device),
> OCTEP_MAX_QUEUES);
> if (!netdev) {
> --
> 2.36.0
>
next prev parent reply other threads:[~2022-11-30 9:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 13:09 [PATCH net-next v2 0/9] octeon_ep: Update PF mailbox for VF Veerasenareddy Burru
2022-11-29 13:09 ` [PATCH net-next v2 1/9] octeon_ep: defer probe if firmware not ready Veerasenareddy Burru
2022-11-30 9:24 ` Leon Romanovsky [this message]
2022-11-30 15:50 ` [EXT] " Veerasenareddy Burru
2022-11-29 13:09 ` [PATCH net-next v2 2/9] octeon_ep: poll for control messages Veerasenareddy Burru
2022-11-30 9:30 ` Leon Romanovsky
2022-11-30 15:44 ` [EXT] " Veerasenareddy Burru
2022-12-01 8:11 ` Leon Romanovsky
2022-12-05 4:46 ` Veerasenareddy Burru
2022-12-05 8:10 ` Leon Romanovsky
2022-12-06 0:16 ` Jakub Kicinski
2022-12-06 8:58 ` Leon Romanovsky
2022-12-06 17:23 ` Jakub Kicinski
2022-12-06 21:19 ` Veerasenareddy Burru
2022-12-07 1:26 ` Jakub Kicinski
2022-12-08 3:17 ` Veerasenareddy Burru
2022-12-08 4:02 ` Jakub Kicinski
2022-12-08 4:41 ` Veerasenareddy Burru
2022-12-08 4:47 ` Jakub Kicinski
2022-12-14 7:15 ` Veerasenareddy Burru
2022-11-29 13:09 ` [PATCH net-next v2 3/9] octeon_ep: control mailbox for multiple PFs Veerasenareddy Burru
2022-11-29 13:09 ` [PATCH net-next v2 4/9] octeon_ep: enhance control mailbox for VF support Veerasenareddy Burru
2022-11-29 13:09 ` [PATCH net-next v2 5/9] octeon_ep: support asynchronous notifications Veerasenareddy Burru
2022-11-29 13:09 ` [PATCH net-next v2 6/9] octeon_ep: control mbox support for VF stats and link info Veerasenareddy Burru
2022-11-29 13:09 ` [PATCH net-next v2 7/9] octeon_ep: add SRIOV VF creation Veerasenareddy Burru
2022-11-29 13:09 ` [PATCH net-next v2 8/9] octeon_ep: add PF-VF mailbox communication Veerasenareddy Burru
2022-12-09 8:48 ` Dan Carpenter
2022-11-29 13:09 ` [PATCH net-next v2 9/9] octeon_ep: add heartbeat monitor Veerasenareddy Burru
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=Y4chWyR6qTlptkTE@unreal \
--to=leon@kernel.org \
--cc=aayarekar@marvell.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lironh@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sburla@marvell.com \
--cc=sedara@marvell.com \
--cc=vburru@marvell.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 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).