osi: Use osd_usleep vs osd_udelay appropriately

Issue: osd_udelay is used irrespective of the
       duration of the delay/sleep. In certain
       environments like HVRTOS, udelay is a
       busy loop and it starves other tasks on the CPU.
Fix:   Use udelay only for small tight checks, and use
       usleep for larger delays.

Bug 4676601

Change-Id: I59d9a403f34d46c6e2d17ca6f7e8a277d5283db5
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3176350
(cherry picked from commit c2abe16a34af853f86fcaa4bb91b7036e2a8eb79)
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3250083
Reviewed-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
This commit is contained in:
Srinivas Ramachandran
2024-10-17 08:59:51 +00:00
committed by mobile promotions
parent 8b85eca5f2
commit 1e8dfafa84
11 changed files with 303 additions and 179 deletions

View File

@@ -514,6 +514,7 @@ typedef my_lint_64 nvel64_t;
#define OSI_DELAY_1000US 1000U
#define OSI_DELAY_1US 1U
#define RCHLIST_SIZE 48U
/**
* @addtogroup PTP PTP related information
*
@@ -1260,9 +1261,9 @@ struct osd_core_ops {
void (*ops_log)(void *priv, const nve8_t *func, nveu32_t line,
nveu32_t level, nveu32_t type, const nve8_t *err,
nveul64_t loga);
/** udelay callback */
/** udelay callback for sleep < 7usec as this is busy wait in most OSes */
void (*udelay)(nveu64_t usec);
/** usleep range callback */
/** usleep range callback for longer sleep duration */
void (*usleep_range)(nveu64_t umin, nveu64_t umax);
/** ivcsend callback*/
nve32_t (*ivc_send)(void *priv, struct ivc_msg_common *ivc,