@@ -5405,6 +5405,49 @@ int rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
54055405 */
54065406int rte_eth_timesync_adjust_time (uint16_t port_id , int64_t delta );
54075407
5408+ /**
5409+ * Adjust the clock frequency on an Ethernet device.
5410+ *
5411+ * Adjusts the base frequency by a specified percentage of ppm (parts per
5412+ * million). This is usually used in conjunction with other Ethdev timesync
5413+ * functions to synchronize the device time using the IEEE1588/802.1AS
5414+ * protocol.
5415+ *
5416+ * The clock is subject to frequency deviation and rate of change drift due to
5417+ * the environment. The upper layer APP calculates the frequency compensation
5418+ * value of the slave clock relative to the master clock via a servo algorithm
5419+ * and adjusts the device clock frequency via "rte_eth_timesync_adjust_freq()".
5420+ * Commonly used servo algorithms are pi/linreg/ntpshm, for implementation
5421+ * see: https://github.com/nxp-archive/openil_linuxptp.git.
5422+ *
5423+ * The adjustment value obtained by the servo algorithm is usually in
5424+ * ppb (parts per billion). For consistency with the kernel driver .adjfine,
5425+ * the tuning values are in ppm. Note that 1 ppb is approximately 65.536 scaled
5426+ * ppm, see Linux kernel upstream commit 1060707e3809 (‘ptp: introduce helpers
5427+ * to adjust by scaled parts per million’).
5428+ *
5429+ * In addition, the device reference frequency is usually also the stepping
5430+ * threshold for the servo algorithm, and the frequency up and down adjustment
5431+ * range is limited by the device. The device clock frequency should be
5432+ * adjusted with "rte_eth_timesync_adjust_freq()" every time the clock is
5433+ * synchronised. Also use ‘rte_eth_timesync_adjust_time()’ to update the device
5434+ * clock only if the absolute value of the master/slave clock offset is greater than
5435+ * or equal to the step threshold.
5436+ *
5437+ * @param port_id
5438+ * The port identifier of the Ethernet device.
5439+ * @param ppm
5440+ * Parts per million with 16-bit fractional field
5441+ *
5442+ * @return
5443+ * - 0: Success.
5444+ * - -ENODEV: The port ID is invalid.
5445+ * - -EIO: if device is removed.
5446+ * - -ENOTSUP: The function is not supported by the Ethernet driver.
5447+ */
5448+ __rte_experimental
5449+ int rte_eth_timesync_adjust_freq (uint16_t port_id , int64_t ppm );
5450+
54085451/**
54095452 * Read the time from the timesync clock on an Ethernet device.
54105453 *
0 commit comments