[4/6] net/hns3: fix the time waiting for PF reset completion

Message ID 20220228032146.37407-5-humin29@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series bugfixes for hns3 PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

humin (Q) Feb. 28, 2022, 3:21 a.m. UTC
  From: Huisong Li <lihuisong@huawei.com>

On the case that PF and VF need to be reset, after the hardware reset is
complete, VF needs wait for 1 second to restore the configuration so that
VF does not fail to recover because PF reset isn't complete. But the
estimated time is not sufficient. This patch fixes it to 5 seconds.

Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 drivers/net/hns3/hns3_ethdev_vf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Feb. 28, 2022, 5:09 p.m. UTC | #1
On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
> @@ -1895,12 +1896,14 @@ hns3vf_wait_hardware_ready(struct hns3_adapter *hns)
>   			return 0;
>   
>   		wait_data->check_completion = NULL;
> -		wait_data->interval = 1 * MSEC_PER_SEC * USEC_PER_MSEC;
> +		wait_data->interval =
> +		HNS3_WAIT_PF_RESET_READY_TIME * MSEC_PER_SEC * USEC_PER_MSEC;

Can you please fix the syntax?
I guess all can fit into single line...
  
humin (Q) March 1, 2022, 6:32 a.m. UTC | #2
Hi, Ferruh,

在 2022/3/1 1:09, Ferruh Yigit 写道:
> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>> @@ -1895,12 +1896,14 @@ hns3vf_wait_hardware_ready(struct hns3_adapter 
>> *hns)
>>               return 0;
>>           wait_data->check_completion = NULL;
>> -        wait_data->interval = 1 * MSEC_PER_SEC * USEC_PER_MSEC;
>> +        wait_data->interval =
>> +        HNS3_WAIT_PF_RESET_READY_TIME * MSEC_PER_SEC * USEC_PER_MSEC;
> 
> Can you please fix the syntax?
> I guess all can fit into single line...
If not so, the code in single line will exceed 80 characters.

> .
  
Ferruh Yigit March 1, 2022, 10:44 a.m. UTC | #3
On 3/1/2022 6:32 AM, Min Hu (Connor) wrote:
> Hi, Ferruh,
> 
> 在 2022/3/1 1:09, Ferruh Yigit 写道:
>> On 2/28/2022 3:21 AM, Min Hu (Connor) wrote:
>>> @@ -1895,12 +1896,14 @@ hns3vf_wait_hardware_ready(struct hns3_adapter *hns)
>>>               return 0;
>>>           wait_data->check_completion = NULL;
>>> -        wait_data->interval = 1 * MSEC_PER_SEC * USEC_PER_MSEC;
>>> +        wait_data->interval =
>>> +        HNS3_WAIT_PF_RESET_READY_TIME * MSEC_PER_SEC * USEC_PER_MSEC;
>>
>> Can you please fix the syntax?
>> I guess all can fit into single line...
> If not so, the code in single line will exceed 80 characters.
> 

Right, it doesn't fit into single line, still it can be formatted better.

wait_data->interval = HNS3_WAIT_PF_RESET_READY_TIME *
	MSEC_PER_SEC * USEC_PER_MSEC;
  

Patch

diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 8f18e7dd54..7d414b1af8 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1875,6 +1875,7 @@  hns3vf_is_reset_pending(struct hns3_adapter *hns)
 static int
 hns3vf_wait_hardware_ready(struct hns3_adapter *hns)
 {
+#define HNS3_WAIT_PF_RESET_READY_TIME 5
 	struct hns3_hw *hw = &hns->hw;
 	struct hns3_wait_data *wait_data = hw->reset.wait_data;
 	struct timeval tv;
@@ -1895,12 +1896,14 @@  hns3vf_wait_hardware_ready(struct hns3_adapter *hns)
 			return 0;
 
 		wait_data->check_completion = NULL;
-		wait_data->interval = 1 * MSEC_PER_SEC * USEC_PER_MSEC;
+		wait_data->interval =
+		HNS3_WAIT_PF_RESET_READY_TIME * MSEC_PER_SEC * USEC_PER_MSEC;
 		wait_data->count = 1;
 		wait_data->result = HNS3_WAIT_REQUEST;
 		rte_eal_alarm_set(wait_data->interval, hns3_wait_callback,
 				  wait_data);
-		hns3_warn(hw, "hardware is ready, delay 1 sec for PF reset complete");
+		hns3_warn(hw, "hardware is ready, delay %d sec for PF reset complete",
+				HNS3_WAIT_PF_RESET_READY_TIME);
 		return -EAGAIN;
 	} else if (wait_data->result == HNS3_WAIT_TIMEOUT) {
 		hns3_clock_gettime(&tv);