Subject: Re: [PATCH net 10/15] ibmvnic: no reset timeout for 5 seconds after reset

From: drt <[email-masked]>
Date: Fri, 20 Nov 2020 15:01:09 -0800

On 2020-11-20 14:40, Lijun Pan wrote:
> From: Dany Madden <[email-masked]>
> 
> Reset timeout is going off right after adapter reset. This patch 
> ensures
> that timeout is scheduled if it has been 5 seconds since the last 
> reset.
> 5 seconds is the default watchdog timeout.
> 

Suggested-by: Brian King <[email-masked]>

> Signed-off-by: Dany Madden <[email-masked]>

Sorry I missed this. Thanks, Brian!

Dany

> ---
>  drivers/net/ethernet/ibm/ibmvnic.c | 11 +++++++++--
>  drivers/net/ethernet/ibm/ibmvnic.h |  2 ++
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
> b/drivers/net/ethernet/ibm/ibmvnic.c
> index 9d2eebd31ff6..252af4ab6468 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -2291,6 +2291,7 @@ static void __ibmvnic_reset(struct work_struct 
> *work)
>  			rc = do_reset(adapter, rwi, reset_state);
>  		}
>  		kfree(rwi);
> +		adapter->last_reset_time = jiffies;
> 
>  		if (rc)
>  			netdev_dbg(adapter->netdev, "Reset failed, rc=%d\n", rc);
> @@ -2394,7 +2395,13 @@ static void ibmvnic_tx_timeout(struct
> net_device *dev, unsigned int txqueue)
>  			   "Adapter is resetting, skip timeout reset\n");
>  		return;
>  	}
> -
> +	/* No queuing up reset until at least 5 seconds (default watchdog 
> val)
> +	 * after last reset
> +	 */
> +	if (time_before(jiffies, (adapter->last_reset_time + 
> dev->watchdog_timeo))) {
> +		netdev_dbg(dev, "Not yet time to tx timeout.\n");
> +		return;
> +	}
>  	ibmvnic_reset(adapter, VNIC_RESET_TIMEOUT);
>  }
> 
> @@ -5316,7 +5323,7 @@ static int ibmvnic_probe(struct vio_dev *dev,
> const struct vio_device_id *id)
>  	adapter->state = VNIC_PROBED;
> 
>  	adapter->wait_for_reset = false;
> -
> +	adapter->last_reset_time = jiffies;
>  	return 0;
> 
>  ibmvnic_register_fail:
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.h
> b/drivers/net/ethernet/ibm/ibmvnic.h
> index 9b1f34602f33..d15866cbc2a6 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.h
> +++ b/drivers/net/ethernet/ibm/ibmvnic.h
> @@ -1089,6 +1089,8 @@ struct ibmvnic_adapter {
>  	unsigned long resetting;
>  	bool napi_enabled, from_passive_init;
>  	bool login_pending;
> +	/* last device reset time */
> +	unsigned long last_reset_time;
> 
>  	bool failover_pending;
>  	bool force_reset_recovery;