netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware
@ 2017-08-18  6:10 Felix Manlunas
  2017-08-18  6:11 ` [PATCH net-next 1/2] liquidio: with embedded f/w, don't reload f/w, issue pf flr at exit Felix Manlunas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Felix Manlunas @ 2017-08-18  6:10 UTC (permalink / raw)
  To: davem
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	ricardo.farrington

From: Rick Farrington <ricardo.farrington@cavium.com>

Fix problems when using an adapter w/embedded f/w (param "fw_type=none").

1. Add support for PF FLR when exiting.
2. Skip some initialization (don't try to load f/w, activate consoles).
3. Issue credits BEFORE enabling DROQs.

Rick Farrington (2):
  liquidio: with embedded f/w, don't reload f/w, issue pf flr at exit
  liquidio: with embedded f/w, issue droq credits before enablement

 drivers/net/ethernet/cavium/liquidio/lio_main.c | 90 ++++++++++++++++---------
 1 file changed, 58 insertions(+), 32 deletions(-)

-- 
2.9.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] liquidio: with embedded f/w, don't reload f/w, issue pf flr at exit
  2017-08-18  6:10 [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware Felix Manlunas
@ 2017-08-18  6:11 ` Felix Manlunas
  2017-08-18  6:11 ` [PATCH net-next 2/2] liquidio: with embedded f/w, issue droq credits before enablement Felix Manlunas
  2017-08-18 17:15 ` [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Felix Manlunas @ 2017-08-18  6:11 UTC (permalink / raw)
  To: davem
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	ricardo.farrington

From: Rick Farrington <ricardo.farrington@cavium.com>

1. Add support for PF FLR when exiting
   (enables CORE_DRV_ACTIVE upon next driver init)
2. Skip some initialization (don't try to load f/w, activate consoles).

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
---
 drivers/net/ethernet/cavium/liquidio/lio_main.c | 70 ++++++++++++++++---------
 1 file changed, 46 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index db85f8f..dccd447 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -1122,6 +1122,33 @@ static bool fw_type_is_none(void)
 }
 
 /**
+ * \brief PCI FLR for each Octeon device.
+ * @param oct octeon device
+ */
+static void octeon_pci_flr(struct octeon_device *oct)
+{
+	int rc;
+
+	pci_save_state(oct->pci_dev);
+
+	pci_cfg_access_lock(oct->pci_dev);
+
+	/* Quiesce the device completely */
+	pci_write_config_word(oct->pci_dev, PCI_COMMAND,
+			      PCI_COMMAND_INTX_DISABLE);
+
+	rc = __pci_reset_function_locked(oct->pci_dev);
+
+	if (rc != 0)
+		dev_err(&oct->pci_dev->dev, "Error %d resetting PCI function %d\n",
+			rc, oct->pf_num);
+
+	pci_cfg_access_unlock(oct->pci_dev);
+
+	pci_restore_state(oct->pci_dev);
+}
+
+/**
  *\brief Destroy resources associated with octeon device
  * @param pdev PCI device structure
  * @param ent unused
@@ -1269,14 +1296,16 @@ static void octeon_destroy_resources(struct octeon_device *oct)
 	case OCT_DEV_PCI_MAP_DONE:
 		refcount = octeon_deregister_device(oct);
 
-		if (!fw_type_is_none()) {
-			/* Soft reset the octeon device before exiting.
-			 * Implementation note: here, we reset the device
-			 * if it is a CN6XXX OR the last CN23XX device.
-			 */
-			if (OCTEON_CN6XXX(oct) || !refcount)
-				oct->fn_list.soft_reset(oct);
-		}
+		/* Soft reset the octeon device before exiting.
+		 * However, if fw was loaded from card (i.e. autoboot),
+		 * perform an FLR instead.
+		 * Implementation note: only soft-reset the device
+		 * if it is a CN6XXX OR the LAST CN23XX device.
+		 */
+		if (fw_type_is_none())
+			octeon_pci_flr(oct);
+		else if (OCTEON_CN6XXX(oct) || !refcount)
+			oct->fn_list.soft_reset(oct);
 
 		octeon_unmap_pci_barx(oct, 0);
 		octeon_unmap_pci_barx(oct, 1);
@@ -1903,11 +1932,6 @@ static int load_firmware(struct octeon_device *oct)
 	char fw_name[LIO_MAX_FW_FILENAME_LEN];
 	char *tmp_fw_type;
 
-	if (fw_type_is_none()) {
-		dev_info(&oct->pci_dev->dev, "Skipping firmware load\n");
-		return ret;
-	}
-
 	if (fw_type[0] == '\0')
 		tmp_fw_type = LIO_FW_NAME_TYPE_NIC;
 	else
@@ -3891,18 +3915,16 @@ static int octeon_device_init(struct octeon_device *octeon_dev)
 	octeon_dev->app_mode = CVM_DRV_INVALID_APP;
 
 	if (OCTEON_CN23XX_PF(octeon_dev)) {
-		if (!cn23xx_fw_loaded(octeon_dev)) {
+		if (!cn23xx_fw_loaded(octeon_dev) && !fw_type_is_none()) {
 			fw_loaded = 0;
-			if (!fw_type_is_none()) {
-				/* Do a soft reset of the Octeon device. */
-				if (octeon_dev->fn_list.soft_reset(octeon_dev))
-					return 1;
-				/* things might have changed */
-				if (!cn23xx_fw_loaded(octeon_dev))
-					fw_loaded = 0;
-				else
-					fw_loaded = 1;
-			}
+			/* Do a soft reset of the Octeon device. */
+			if (octeon_dev->fn_list.soft_reset(octeon_dev))
+				return 1;
+			/* things might have changed */
+			if (!cn23xx_fw_loaded(octeon_dev))
+				fw_loaded = 0;
+			else
+				fw_loaded = 1;
 		} else {
 			fw_loaded = 1;
 		}
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] liquidio: with embedded f/w, issue droq credits before enablement
  2017-08-18  6:10 [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware Felix Manlunas
  2017-08-18  6:11 ` [PATCH net-next 1/2] liquidio: with embedded f/w, don't reload f/w, issue pf flr at exit Felix Manlunas
@ 2017-08-18  6:11 ` Felix Manlunas
  2017-08-18 17:15 ` [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Felix Manlunas @ 2017-08-18  6:11 UTC (permalink / raw)
  To: davem
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	ricardo.farrington

From: Rick Farrington <ricardo.farrington@cavium.com>

1. Issue credits BEFORE enabling DROQ's; this prevents PKTPF_ERR interrupt.

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
---
 drivers/net/ethernet/cavium/liquidio/lio_main.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index dccd447..89d4bbc 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -4040,6 +4040,18 @@ static int octeon_device_init(struct octeon_device *octeon_dev)
 
 	atomic_set(&octeon_dev->status, OCT_DEV_INTR_SET_DONE);
 
+	/* Send Credit for Octeon Output queues. Credits are always sent BEFORE
+	 * the output queue is enabled.
+	 * This ensures that we'll receive the f/w CORE DRV_ACTIVE message in
+	 * case we've configured CN23XX_SLI_GBL_CONTROL[NOPTR_D] = 0.
+	 * Otherwise, it is possible that the DRV_ACTIVE message will be sent
+	 * before any credits have been issued, causing the ring to be reset
+	 * (and the f/w appear to never have started).
+	 */
+	for (j = 0; j < octeon_dev->num_oqs; j++)
+		writel(octeon_dev->droq[j]->max_count,
+		       octeon_dev->droq[j]->pkts_credit_reg);
+
 	/* Enable the input and output queues for this Octeon device */
 	ret = octeon_dev->fn_list.enable_io_queues(octeon_dev);
 	if (ret) {
@@ -4124,14 +4136,6 @@ static int octeon_device_init(struct octeon_device *octeon_dev)
 
 	atomic_set(&octeon_dev->status, OCT_DEV_HOST_OK);
 
-	/* Send Credit for Octeon Output queues. Credits are always sent after
-	 * the output queue is enabled.
-	 */
-	for (j = 0; j < octeon_dev->num_oqs; j++)
-		writel(octeon_dev->droq[j]->max_count,
-		       octeon_dev->droq[j]->pkts_credit_reg);
-
-	/* Packets can start arriving on the output queues from this point. */
 	return 0;
 }
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware
  2017-08-18  6:10 [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware Felix Manlunas
  2017-08-18  6:11 ` [PATCH net-next 1/2] liquidio: with embedded f/w, don't reload f/w, issue pf flr at exit Felix Manlunas
  2017-08-18  6:11 ` [PATCH net-next 2/2] liquidio: with embedded f/w, issue droq credits before enablement Felix Manlunas
@ 2017-08-18 17:15 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-08-18 17:15 UTC (permalink / raw)
  To: felix.manlunas
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	ricardo.farrington

From: Felix Manlunas <felix.manlunas@cavium.com>
Date: Thu, 17 Aug 2017 23:10:37 -0700

> From: Rick Farrington <ricardo.farrington@cavium.com>
> 
> Fix problems when using an adapter w/embedded f/w (param "fw_type=none").
> 
> 1. Add support for PF FLR when exiting.
> 2. Skip some initialization (don't try to load f/w, activate consoles).
> 3. Issue credits BEFORE enabling DROQs.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-18 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-18  6:10 [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware Felix Manlunas
2017-08-18  6:11 ` [PATCH net-next 1/2] liquidio: with embedded f/w, don't reload f/w, issue pf flr at exit Felix Manlunas
2017-08-18  6:11 ` [PATCH net-next 2/2] liquidio: with embedded f/w, issue droq credits before enablement Felix Manlunas
2017-08-18 17:15 ` [PATCH net-next 0/2] liquidio: initialization fixes for embedded firmware David Miller

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).