Skip to content

Commit 818d90e

Browse files
bibibibi89carlescufi
authored andcommitted
net: gptp: Fix sync_receipt_time calculation in gptp_mi
Fix #42800 Both pss->rate_ratio and port_ds->neighbor_rate_ratio are double type but sync_receipt_time is uint64_t. If pss->rate_ratio is less than 1 or sync_receipt_time * port_ds->neighbor_rate_ratio is less than 1, sync_receipt_time becomes 0 due to double to uint64_t cast. Assign port_ds->neighbor_prop_delay to sync_receipt_time first to fix this issue. Signed-off-by: Lu Ding <[email protected]>
1 parent e05c966 commit 818d90e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/net/l2/ethernet/gptp/gptp_mi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,9 @@ static void gptp_mi_clk_slave_sync_compute(void)
706706

707707
pss = &state->pss_rcv_ptr->sync_info;
708708

709-
sync_receipt_time = pss->rate_ratio;
709+
sync_receipt_time = port_ds->neighbor_prop_delay;
710+
sync_receipt_time *= pss->rate_ratio;
710711
sync_receipt_time /= port_ds->neighbor_rate_ratio;
711-
sync_receipt_time *= port_ds->neighbor_prop_delay;
712712
sync_receipt_time += pss->follow_up_correction_field;
713713
sync_receipt_time += port_ds->delay_asymmetry;
714714

0 commit comments

Comments
 (0)