aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2019-10-02 10:59:44 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2019-10-02 10:59:44 +0000
commit7bf46a63ce25ae5c118691ad4b63806ce66c69a5 (patch)
tree85887e0a7e420a6783814d14028bd1073bf5a7ff
parenteff4361d8864b68f990a54b4f7eb4b46d564f7ba (diff)
downloadsrc-7bf46a63ce25ae5c118691ad4b63806ce66c69a5.tar.gz
src-7bf46a63ce25ae5c118691ad4b63806ce66c69a5.zip
Randomize the delay when waiting for VSC flag in mlx5core.
The PRM suggests random 0 - 10ms to prevent multiple waiters on the same interval in order to avoid starvation. Submitted by: slavash@ MFC after: 3 days Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/head/; revision=352993
-rw-r--r--sys/dev/mlx5/mlx5_core/mlx5_vsc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_vsc.c b/sys/dev/mlx5/mlx5_core/mlx5_vsc.c
index eb5a46978186..81574c14ec3f 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_vsc.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_vsc.c
@@ -52,7 +52,7 @@ int mlx5_vsc_lock(struct mlx5_core_dev *mdev)
* The PRM suggests random 0 - 10ms to prevent multiple
* waiters on the same interval in order to avoid starvation
*/
- DELAY((random() % 11) * 1000);
+ DELAY((random() % 9000) + 1000);
continue;
}
@@ -99,7 +99,7 @@ mlx5_vsc_wait_on_flag(struct mlx5_core_dev *mdev, u32 expected)
break;
retries++;
- DELAY(10);
+ DELAY((random() % 90) + 10);
}
return 0;