Skip to content

Commit

Permalink
net/e1000: initialize PTP to system time
Browse files Browse the repository at this point in the history
Currently, e1000 driver initializes PTP timestamp to 0. This is different
from what kernel driver does (which initializes it to system time).

Align the DPDK driver to kernel driver by setting PTP timestamp to system
time when enabling PTP.

Note that e1000 driver always uses zero-based timestamps for PTP, so we
would only ever update the internal timecounter and not the actual NIC
registers.

Signed-off-by: Anatoly Burakov <[email protected]>
Tested-by: Hailin Xu <[email protected]>
Acked-by: Bruce Richardson <[email protected]>
  • Loading branch information
anatolyburakov authored and bruce-richardson committed Nov 26, 2024
1 parent e13e157 commit f5a11c5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/e1000/igb_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4817,6 +4817,9 @@ igb_timesync_enable(struct rte_eth_dev *dev)
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t tsync_ctl;
uint32_t tsauxc;
struct timespec ts;

memset(&ts, 0, sizeof(struct timespec));

/* Stop the timesync system time. */
E1000_WRITE_REG(hw, E1000_TIMINCA, 0x0);
Expand Down Expand Up @@ -4861,6 +4864,9 @@ igb_timesync_enable(struct rte_eth_dev *dev)
tsync_ctl |= E1000_TSYNCTXCTL_ENABLED;
E1000_WRITE_REG(hw, E1000_TSYNCTXCTL, tsync_ctl);

/* e1000 uses zero-based timestamping so only adjust timecounter */
igb_timesync_write_time(dev, &ts);

return 0;
}

Expand Down

0 comments on commit f5a11c5

Please sign in to comment.