Message ID | 20221129130933.25231-2-vburru@marvell.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | octeon_ep: Update PF mailbox for VF | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 38 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
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 >
> -----Original Message----- > From: Leon Romanovsky <leon@kernel.org> > Sent: Wednesday, November 30, 2022 1:25 AM > To: Veerasenareddy Burru <vburru@marvell.com> > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Liron Himi > <lironh@marvell.com>; Abhijit Ayarekar <aayarekar@marvell.com>; Sathesh > B Edara <sedara@marvell.com>; Satananda Burla <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: [EXT] Re: [PATCH net-next v2 1/9] octeon_ep: defer probe if > firmware not ready > > External Email > > ---------------------------------------------------------------------- > 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. > Yes, we can just return bool; Thanks for the suggestion. Will implement this. > > +{ > > + 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; > > .... > Sure, will change this. > > + 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. We will change this to true/false. > > And I think that you can put this check earlier in octep_probe(). We will check and move this to earlier point in octep_probe(). Thanks > > 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 > >
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) +{ + 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) { + 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) { + 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) {