net/hns3: fix time delta calculation
authorChengwen Feng <fengchengwen@huawei.com>
Wed, 28 Apr 2021 07:20:53 +0000 (15:20 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 29 Apr 2021 16:25:40 +0000 (18:25 +0200)
commit78dbb6f999314ae05c2f5fb617660ec020a5309c
tree0760556da6d83a5ad122932ced902dbf11ff76a6
parentc9a63bb64e79ab5fa6b5bd298df5b5695067d1e5
net/hns3: fix time delta calculation

Currently, driver uses gettimeofday() API to get the time, and
then calculate the time delta, the delta will be used mainly in
judging timeout process.

But the time which gets from gettimeofday() API isn't monotonically
increasing. The process may fail if the system time is changed.

We use the following scheme to fix it:
1. Add hns3_clock_gettime() API which will get the monotonically
   increasing time.
2. Add hns3_clock_calctime_ms() API which will get the milliseconds of
   the monotonically increasing time.
3. Add hns3_clock_calctime_ms() API which will calc the milliseconds of
   a given time.

Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
drivers/net/hns3/hns3_ethdev.c
drivers/net/hns3/hns3_ethdev.h
drivers/net/hns3/hns3_ethdev_vf.c
drivers/net/hns3/hns3_intr.c