osi: use udelay in timestamp poll paths

- Use udelay() for timestamp register poll paths
  to avoid linux crash issues.
- Reduce reg polling time to 10msec instead of 1sec.

Bug 4951493

Change-Id: Id86a05c91f5e54b48912409225e7d7a850b097a3
Signed-off-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3247162
(cherry picked from commit 3ccfb43c977bfdd5e38ed32eafda234e9972d888)
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3250080
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Hareesh Kesireddy
2024-11-12 12:46:53 +00:00
committed by mobile promotions
parent 1e8dfafa84
commit 6fa36e885d
4 changed files with 8 additions and 10 deletions

View File

@@ -158,7 +158,7 @@
#endif /* !OSI_STRIPPED_LIB */ #endif /* !OSI_STRIPPED_LIB */
#define OSI_PTP_REQ_CLK_FREQ 250000000U #define OSI_PTP_REQ_CLK_FREQ 250000000U
#define OSI_POLL_COUNT 1000U #define OSI_POLL_COUNT 10000U
#ifndef UINT_MAX #ifndef UINT_MAX
/** Max value of uint */ /** Max value of uint */
#define UINT_MAX (0xFFFFFFFFU) #define UINT_MAX (0xFFFFFFFFU)

View File

@@ -30,7 +30,7 @@
nve32_t poll_check(struct osi_core_priv_data *const osi_core, nveu8_t *addr, nve32_t poll_check(struct osi_core_priv_data *const osi_core, nveu8_t *addr,
nveu32_t bit_check, nveu32_t *value) nveu32_t bit_check, nveu32_t *value)
{ {
nveu32_t retry = RETRY_COUNT; nveu32_t retry = OSI_POLL_COUNT;
nve32_t cond = COND_NOT_MET; nve32_t cond = COND_NOT_MET;
nveu32_t count; nveu32_t count;
nve32_t ret = 0; nve32_t ret = 0;
@@ -51,8 +51,7 @@ nve32_t poll_check(struct osi_core_priv_data *const osi_core, nveu8_t *addr,
if ((*value & bit_check) == OSI_NONE) { if ((*value & bit_check) == OSI_NONE) {
cond = COND_MET; cond = COND_MET;
} else { } else {
osi_core->osd_ops.usleep_range(OSI_DELAY_1000US, osi_core->osd_ops.udelay(OSI_DELAY_1US);
OSI_DELAY_1000US + MIN_USLEEP_10US);
} }
} }
fail: fail:
@@ -837,7 +836,7 @@ static inline nve32_t hw_est_read(struct osi_core_priv_data *osi_core,
} }
if (((val & MTL_EST_ERR0) == MTL_EST_ERR0) || if (((val & MTL_EST_ERR0) == MTL_EST_ERR0) ||
(retry <= 0)) { (retry <= 0U)) {
ret = -1; ret = -1;
goto err; goto err;
} }
@@ -1148,7 +1147,7 @@ static nve32_t hw_est_write(struct osi_core_priv_data *osi_core,
} }
if (((val & MTL_EST_ERR0) == MTL_EST_ERR0) || if (((val & MTL_EST_ERR0) == MTL_EST_ERR0) ||
(retry <= 0)) { (retry <= 0U)) {
ret = -1; ret = -1;
} }

View File

@@ -2336,7 +2336,7 @@ static inline nve32_t eqos_poll_for_update_ts_complete(
struct osi_core_priv_data *const osi_core, struct osi_core_priv_data *const osi_core,
nveu32_t *mac_tcr) nveu32_t *mac_tcr)
{ {
nveu32_t retry = RETRY_COUNT; nveu32_t retry = OSI_POLL_COUNT;
nveu32_t count; nveu32_t count;
nve32_t cond = COND_NOT_MET; nve32_t cond = COND_NOT_MET;
nve32_t ret = 0; nve32_t ret = 0;
@@ -2358,7 +2358,7 @@ static inline nve32_t eqos_poll_for_update_ts_complete(
} }
count++; count++;
osi_core->osd_ops.usleep_range(OSI_DELAY_1000US, OSI_DELAY_1000US + MIN_USLEEP_10US); osi_core->osd_ops.udelay(OSI_DELAY_1US);
} }
fail: fail:
return ret; return ret;

View File

@@ -4563,8 +4563,7 @@ static inline nve32_t mgbe_poll_for_update_ts_complete(
} }
retry++; retry++;
osi_core->osd_ops.usleep_range(OSI_DELAY_1000US, osi_core->osd_ops.udelay(OSI_DELAY_1US);
OSI_DELAY_1000US + MIN_USLEEP_10US);
} }
return ret; return ret;