Author: hselasky
Date: Wed Oct  2 10:59:44 2019
New Revision: 352993
URL: https://svnweb.freebsd.org/changeset/base/352993

Log:
  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

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c      Wed Oct  2 10:58:27 2019        
(r352992)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c      Wed Oct  2 10:59:44 2019        
(r352993)
@@ -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 
                        break;
 
                retries++;
-               DELAY(10);
+               DELAY((random() % 90) + 10);
        }
 
        return 0;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to