Thread (19 messages) 19 messages, 3 authors, 2023-03-22

Re: [PATCH net-next v3 1/7] octeon_ep: defer probe if firmware not ready

From: Leon Romanovsky <leon@kernel.org>
Date: 2023-02-15 11:43:22
Also in: linux-doc, lkml

On Tue, Feb 14, 2023 at 06:32:05PM +0100, Maciej Fijalkowski wrote:
On Mon, Feb 13, 2023 at 09:14:16PM -0800, Veerasenareddy Burru wrote:
quoted
Defer probe if firmware is not ready for device usage.

Signed-off-by: Veerasenareddy Burru <vburru@marvell.com>
Signed-off-by: Abhijit Ayarekar <redacted>
Signed-off-by: Satananda Burla <sburla@marvell.com>
---
v2 -> v3:
 * fix review comments
   https://lore.kernel.org/all/Y4chWyR6qTlptkTE@unreal/ (local)
   - change get_fw_ready_status() to return bool
   - fix the success oriented flow while looking for
     PCI extended capability
 
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..5620df4c6d55 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
@@ -1017,6 +1017,26 @@ static void octep_device_cleanup(struct octep_device *oct)
 	oct->conf = NULL;
 }
 
+static bool 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)
+			continue;
+
+		pci_read_config_byte(pdev, (pos + 8), &status);
+		dev_info(&pdev->dev, "Firmware ready status = %u\n", status);
+		return status ? true : false;
nit:

return !!status;
"return status;" is enough, there is no need in "!!".

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help