On rare situation test_link_bonding test case fail due to timespec
tv_nsec overflow, which causes pthread_cond_timedwait to return EINVAL
and test to fail.
Fixes:
76d29903f5f5 ("bond: support link status interrupt")
Cc: stable@dpdk.org
Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
ts.tv_sec = tp.tv_sec;
ts.tv_nsec = tp.tv_usec * 1000;
ts.tv_nsec += wait_us * 1000;
+ /* Normalize tv_nsec to [0,999999999L] */
+ while (ts.tv_nsec > 1000000000L) {
+ ts.tv_nsec -= 1000000000L;
+ ts.tv_sec += 1;
+ }
pthread_mutex_lock(&mutex);
if (test_lsc_interrupt_count < 1)