diff mbox series

[net-next,3/6] ionic: add lif quiesce

Message ID 20201104223354.63856-4-snelson@pensando.io
State Changes Requested
Delegated to: Netdev Driver Reviewers
Headers show
Series ionic updates | expand

Checks

Context Check Description
jkicinski/cover_letter success Link
jkicinski/fixes_present success Link
jkicinski/patch_count success Link
jkicinski/tree_selection success Clearly marked for net-next
jkicinski/subject_prefix success Link
jkicinski/source_inline success Was 0 now: 0
jkicinski/verify_signedoff success Link
jkicinski/module_param success Was 0 now: 0
jkicinski/build_32bit success Errors and warnings before: 0 this patch: 0
jkicinski/kdoc success Errors and warnings before: 0 this patch: 0
jkicinski/verify_fixes success Link
jkicinski/checkpatch success total: 0 errors, 0 warnings, 0 checks, 36 lines checked
jkicinski/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
jkicinski/header_inline success Link
jkicinski/stable success Stable not CCed

Commit Message

Shannon Nelson Nov. 4, 2020, 10:33 p.m. UTC
After the queues are stopped, expressly quiesce the lif.
This assures that even if the queues were in an odd state,
the firmware will close up everything cleanly.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Saeed Mahameed Nov. 5, 2020, 12:50 a.m. UTC | #1
On Wed, 2020-11-04 at 14:33 -0800, Shannon Nelson wrote:
> After the queues are stopped, expressly quiesce the lif.
> This assures that even if the queues were in an odd state,
> the firmware will close up everything cleanly.
> 
> Signed-off-by: Shannon Nelson <snelson@pensando.io>
> ---
>  .../net/ethernet/pensando/ionic/ionic_lif.c   | 24
> +++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 519d544821af..28044240caf2 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -1625,6 +1625,28 @@ static void ionic_lif_rss_deinit(struct
> ionic_lif *lif)
>  	ionic_lif_rss_config(lif, 0x0, NULL, NULL);
>  }
>  
> +static int ionic_lif_quiesce(struct ionic_lif *lif)
> +{
> +	struct ionic_admin_ctx ctx = {
> +		.work = COMPLETION_INITIALIZER_ONSTACK(ctx.work),
> +		.cmd.lif_setattr = {
> +			.opcode = IONIC_CMD_LIF_SETATTR,
> +			.index = cpu_to_le16(lif->index),
> +			.attr = IONIC_LIF_ATTR_STATE,
> +			.state = IONIC_LIF_QUIESCE,
> +		},
> +	};
> +	int err;
> +
> +	err = ionic_adminq_post_wait(lif, &ctx);
> +	if (err) {
> +		netdev_err(lif->netdev, "lif quiesce failed %d\n",
> err);
> +		return err;
> +	}
> +
> +	return 0;
> +}
> +
>  static void ionic_txrx_disable(struct ionic_lif *lif)
>  {
>  	unsigned int i;
> @@ -1639,6 +1661,8 @@ static void ionic_txrx_disable(struct ionic_lif
> *lif)
>  		for (i = 0; i < lif->nxqs; i++)
>  			err = ionic_qcq_disable(lif->rxqcqs[i], (err !=
> -ETIMEDOUT));
>  	}
> +
> +	ionic_lif_quiesce(lif);

if you don't care about return value just void out the function retval
Shannon Nelson Nov. 5, 2020, 6:49 p.m. UTC | #2
On 11/4/20 4:50 PM, Saeed Mahameed wrote:
> On Wed, 2020-11-04 at 14:33 -0800, Shannon Nelson wrote:
>> After the queues are stopped, expressly quiesce the lif.
>> This assures that even if the queues were in an odd state,
>> the firmware will close up everything cleanly.
>>
>> Signed-off-by: Shannon Nelson <snelson@pensando.io>
>> ---
>>   .../net/ethernet/pensando/ionic/ionic_lif.c   | 24
>> +++++++++++++++++++
>>   1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
>> b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
>> index 519d544821af..28044240caf2 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
>> @@ -1625,6 +1625,28 @@ static void ionic_lif_rss_deinit(struct
>> ionic_lif *lif)
>>   	ionic_lif_rss_config(lif, 0x0, NULL, NULL);
>>   }
>>   
>> +static int ionic_lif_quiesce(struct ionic_lif *lif)
>> +{
>> +	struct ionic_admin_ctx ctx = {
>> +		.work = COMPLETION_INITIALIZER_ONSTACK(ctx.work),
>> +		.cmd.lif_setattr = {
>> +			.opcode = IONIC_CMD_LIF_SETATTR,
>> +			.index = cpu_to_le16(lif->index),
>> +			.attr = IONIC_LIF_ATTR_STATE,
>> +			.state = IONIC_LIF_QUIESCE,
>> +		},
>> +	};
>> +	int err;
>> +
>> +	err = ionic_adminq_post_wait(lif, &ctx);
>> +	if (err) {
>> +		netdev_err(lif->netdev, "lif quiesce failed %d\n",
>> err);
>> +		return err;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>>   static void ionic_txrx_disable(struct ionic_lif *lif)
>>   {
>>   	unsigned int i;
>> @@ -1639,6 +1661,8 @@ static void ionic_txrx_disable(struct ionic_lif
>> *lif)
>>   		for (i = 0; i < lif->nxqs; i++)
>>   			err = ionic_qcq_disable(lif->rxqcqs[i], (err !=
>> -ETIMEDOUT));
>>   	}
>> +
>> +	ionic_lif_quiesce(lif);
> if you don't care about return value just void out the function retval
>

Sure.
sln
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 519d544821af..28044240caf2 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -1625,6 +1625,28 @@  static void ionic_lif_rss_deinit(struct ionic_lif *lif)
 	ionic_lif_rss_config(lif, 0x0, NULL, NULL);
 }
 
+static int ionic_lif_quiesce(struct ionic_lif *lif)
+{
+	struct ionic_admin_ctx ctx = {
+		.work = COMPLETION_INITIALIZER_ONSTACK(ctx.work),
+		.cmd.lif_setattr = {
+			.opcode = IONIC_CMD_LIF_SETATTR,
+			.index = cpu_to_le16(lif->index),
+			.attr = IONIC_LIF_ATTR_STATE,
+			.state = IONIC_LIF_QUIESCE,
+		},
+	};
+	int err;
+
+	err = ionic_adminq_post_wait(lif, &ctx);
+	if (err) {
+		netdev_err(lif->netdev, "lif quiesce failed %d\n", err);
+		return err;
+	}
+
+	return 0;
+}
+
 static void ionic_txrx_disable(struct ionic_lif *lif)
 {
 	unsigned int i;
@@ -1639,6 +1661,8 @@  static void ionic_txrx_disable(struct ionic_lif *lif)
 		for (i = 0; i < lif->nxqs; i++)
 			err = ionic_qcq_disable(lif->rxqcqs[i], (err != -ETIMEDOUT));
 	}
+
+	ionic_lif_quiesce(lif);
 }
 
 static void ionic_txrx_deinit(struct ionic_lif *lif)