Page MenuHomeFreeBSD

D46342.diff
No OneTemporary

D46342.diff

diff --git a/sys/contrib/ena-com/ena_com.h b/sys/contrib/ena-com/ena_com.h
--- a/sys/contrib/ena-com/ena_com.h
+++ b/sys/contrib/ena-com/ena_com.h
@@ -302,6 +302,9 @@
/* PHC shared memory - virtual address */
struct ena_admin_phc_resp *virt_addr;
+ /* System time of last PHC request */
+ ena_time_high_res_t system_time;
+
/* Spin lock to ensure a single outstanding PHC read */
ena_spinlock_t lock;
@@ -321,6 +324,12 @@
*/
u32 block_timeout_usec;
+ /* PHC shared memory - physical address */
+ dma_addr_t phys_addr;
+
+ /* PHC shared memory handle */
+ ena_mem_handle_t mem_handle;
+
/* Cached error bound per timestamp sample */
u32 error_bound;
@@ -329,12 +338,6 @@
/* True if PHC is active in the device */
bool active;
-
- /* PHC shared memory - physical address */
- dma_addr_t phys_addr;
-
- /* PHC shared memory handle */
- ena_mem_handle_t mem_handle;
};
struct ena_rss {
diff --git a/sys/contrib/ena-com/ena_com.c b/sys/contrib/ena-com/ena_com.c
--- a/sys/contrib/ena-com/ena_com.c
+++ b/sys/contrib/ena-com/ena_com.c
@@ -1901,12 +1901,11 @@
int ena_com_phc_get_timestamp(struct ena_com_dev *ena_dev, u64 *timestamp)
{
volatile struct ena_admin_phc_resp *read_resp = ena_dev->phc.virt_addr;
+ const ena_time_high_res_t zero_system_time = ENA_TIME_INIT_HIGH_RES();
struct ena_com_phc_info *phc = &ena_dev->phc;
- ena_time_high_res_t initial_time = ENA_TIME_INIT_HIGH_RES();
- static ena_time_high_res_t start_time;
- unsigned long flags = 0;
ena_time_high_res_t expire_time;
ena_time_high_res_t block_time;
+ unsigned long flags = 0;
int ret = ENA_COM_OK;
if (!phc->active) {
@@ -1917,9 +1916,10 @@
ENA_SPINLOCK_LOCK(phc->lock, flags);
/* Check if PHC is in blocked state */
- if (unlikely(ENA_TIME_COMPARE_HIGH_RES(start_time, initial_time))) {
+ if (unlikely(ENA_TIME_COMPARE_HIGH_RES(phc->system_time, zero_system_time))) {
/* Check if blocking time expired */
- block_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(start_time, phc->block_timeout_usec);
+ block_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(phc->system_time,
+ phc->block_timeout_usec);
if (!ENA_TIME_EXPIRE_HIGH_RES(block_time)) {
/* PHC is still in blocked state, skip PHC request */
phc->stats.phc_skp++;
@@ -1941,9 +1941,9 @@
}
/* Setting relative timeouts */
- start_time = ENA_GET_SYSTEM_TIME_HIGH_RES();
- block_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(start_time, phc->block_timeout_usec);
- expire_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(start_time, phc->expire_timeout_usec);
+ phc->system_time = ENA_GET_SYSTEM_TIME_HIGH_RES();
+ block_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(phc->system_time, phc->block_timeout_usec);
+ expire_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(phc->system_time, phc->expire_timeout_usec);
/* We expect the device to return this req_id once the new PHC timestamp is updated */
phc->req_id++;
@@ -1998,7 +1998,7 @@
phc->stats.phc_cnt++;
/* This indicates PHC state is active */
- start_time = initial_time;
+ phc->system_time = zero_system_time;
break;
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jun 18, 12:54 PM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34051007
Default Alt Text
D46342.diff (2 KB)

Event Timeline