diff mbox series

[v3,net-next,3/4] ionic: pull out common bits from fw_up

Message ID 20230717170001.30539-4-shannon.nelson@amd.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series ionic: add FLR support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers warning 2 maintainers not CCed: pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
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: 1365 this patch: 1365
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 93 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Nelson, Shannon July 17, 2023, 5 p.m. UTC
Pull out some code from ionic_lif_handle_fw_up() that can be
used in the coming FLR recovery patch.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 66 ++++++++++++-------
 1 file changed, 43 insertions(+), 23 deletions(-)

Comments

Simon Horman July 19, 2023, 5:56 p.m. UTC | #1
On Mon, Jul 17, 2023 at 10:00:00AM -0700, Shannon Nelson wrote:
> Pull out some code from ionic_lif_handle_fw_up() that can be
> used in the coming FLR recovery patch.
> 
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>

...

> @@ -3317,17 +3301,13 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
>  			goto err_txrx_free;
>  	}
>  
> +	clear_bit(IONIC_LIF_F_FW_RESET, lif->state);
>  	mutex_unlock(&lif->queue_lock);
>  
> -	clear_bit(IONIC_LIF_F_FW_RESET, lif->state);

Hi Shannon,

Moving clear_bit() inside the critical section seems
unrelated to the patch description.

>  	ionic_link_status_check_request(lif, CAN_SLEEP);
>  	netif_device_attach(lif->netdev);
> -	dev_info(ionic->dev, "FW Up: LIFs restarted\n");
>  
> -	/* restore the hardware timestamping queues */
> -	ionic_lif_hwstamp_replay(lif);
> -
> -	return;
> +	return 0;
>  
>  err_txrx_free:
>  	ionic_txrx_free(lif);

...
Nelson, Shannon July 20, 2023, 12:04 a.m. UTC | #2
On 7/19/23 10:56 AM, Simon Horman wrote:
> 
> On Mon, Jul 17, 2023 at 10:00:00AM -0700, Shannon Nelson wrote:
>> Pull out some code from ionic_lif_handle_fw_up() that can be
>> used in the coming FLR recovery patch.
>>
>> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
> 
> ...
> 
>> @@ -3317,17 +3301,13 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
>>                        goto err_txrx_free;
>>        }
>>
>> +     clear_bit(IONIC_LIF_F_FW_RESET, lif->state);
>>        mutex_unlock(&lif->queue_lock);
>>
>> -     clear_bit(IONIC_LIF_F_FW_RESET, lif->state);
> 
> Hi Shannon,
> 
> Moving clear_bit() inside the critical section seems
> unrelated to the patch description.

I can make that a separate patch in the future, I'll pull it out for a 
next rev.

Thanks,
sln


> 
>>        ionic_link_status_check_request(lif, CAN_SLEEP);
>>        netif_device_attach(lif->netdev);
>> -     dev_info(ionic->dev, "FW Up: LIFs restarted\n");
>>
>> -     /* restore the hardware timestamping queues */
>> -     ionic_lif_hwstamp_replay(lif);
>> -
>> -     return;
>> +     return 0;
>>
>>   err_txrx_free:
>>        ionic_txrx_free(lif);
> 
> ...
diff mbox series

Patch

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 612b0015dc43..94b14ea6ffee 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -3266,27 +3266,11 @@  static void ionic_lif_handle_fw_down(struct ionic_lif *lif)
 	dev_info(ionic->dev, "FW Down: LIFs stopped\n");
 }
 
-static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
+static int ionic_restart_lif(struct ionic_lif *lif)
 {
 	struct ionic *ionic = lif->ionic;
 	int err;
 
-	if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state))
-		return;
-
-	dev_info(ionic->dev, "FW Up: restarting LIFs\n");
-
-	ionic_init_devinfo(ionic);
-	err = ionic_identify(ionic);
-	if (err)
-		goto err_out;
-	err = ionic_port_identify(ionic);
-	if (err)
-		goto err_out;
-	err = ionic_port_init(ionic);
-	if (err)
-		goto err_out;
-
 	mutex_lock(&lif->queue_lock);
 
 	if (test_and_clear_bit(IONIC_LIF_F_BROKEN, lif->state))
@@ -3317,17 +3301,13 @@  static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
 			goto err_txrx_free;
 	}
 
+	clear_bit(IONIC_LIF_F_FW_RESET, lif->state);
 	mutex_unlock(&lif->queue_lock);
 
-	clear_bit(IONIC_LIF_F_FW_RESET, lif->state);
 	ionic_link_status_check_request(lif, CAN_SLEEP);
 	netif_device_attach(lif->netdev);
-	dev_info(ionic->dev, "FW Up: LIFs restarted\n");
 
-	/* restore the hardware timestamping queues */
-	ionic_lif_hwstamp_replay(lif);
-
-	return;
+	return 0;
 
 err_txrx_free:
 	ionic_txrx_free(lif);
@@ -3337,6 +3317,46 @@  static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
 	ionic_qcqs_free(lif);
 err_unlock:
 	mutex_unlock(&lif->queue_lock);
+
+	return err;
+}
+
+static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
+{
+	struct ionic *ionic = lif->ionic;
+	int err;
+
+	if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state))
+		return;
+
+	dev_info(ionic->dev, "FW Up: restarting LIFs\n");
+
+	/* This is a little different from what happens at
+	 * probe time because the LIF already exists so we
+	 * just need to reanimate it.
+	 */
+	ionic_init_devinfo(ionic);
+	err = ionic_identify(ionic);
+	if (err)
+		goto err_out;
+	err = ionic_port_identify(ionic);
+	if (err)
+		goto err_out;
+	err = ionic_port_init(ionic);
+	if (err)
+		goto err_out;
+
+	err = ionic_restart_lif(lif);
+	if (err)
+		goto err_out;
+
+	dev_info(ionic->dev, "FW Up: LIFs restarted\n");
+
+	/* restore the hardware timestamping queues */
+	ionic_lif_hwstamp_replay(lif);
+
+	return;
+
 err_out:
 	dev_err(ionic->dev, "FW Up: LIFs restart failed - err %d\n", err);
 }