LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer.

This allows other threads to execute, typically during hardware waiting loops.
This also maches how the function works in Linux.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2021-07-10 21:56:29 +02:00
parent f52783fcf5
commit 05f56ac92f

View File

@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
* Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
* Copyright (c) 2013-2021 Mellanox Technologies, Ltd.
* Copyright (c) 2014 François Tigeot
* All rights reserved.
*
@ -68,7 +68,10 @@ ndelay(unsigned long x)
static inline void
usleep_range(unsigned long min, unsigned long max)
{
DELAY(min);
/* guard against invalid values */
if (min == 0)
min = 1;
pause_sbt("lnxsleep", ustosbt(min), 0, C_HARDCLOCK);
}
extern unsigned int linux_msleep_interruptible(unsigned int ms);