1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/ethernet/freescale/enetc
Vladimir Oltean 90cf87d16b enetc: Let the hardware auto-advance the taprio base-time of 0
The tc-taprio base time indicates the beginning of the tc-taprio
schedule, which is cyclic by definition (where the length of the cycle
in nanoseconds is called the cycle time). The base time is a 64-bit PTP
time in the TAI domain.

Logically, the base-time should be a future time. But that imposes some
restrictions to user space, which has to retrieve the current PTP time
from the NIC first, then calculate a base time that will still be larger
than the base time by the time the kernel driver programs this value
into the hardware. Actually ensuring that the programmed base time is in
the future is still a problem even if the kernel alone deals with this.

Luckily, the enetc hardware already advances a base-time that is in the
past into a congruent time in the immediate future, according to the
same formula that can be found in the software implementation of taprio
(in taprio_get_start_time):

	/* Schedule the start time for the beginning of the next
	 * cycle.
	 */
	n = div64_s64(ktime_sub_ns(now, base), cycle);
	*start = ktime_add_ns(base, (n + 1) * cycle);

There's only one problem: the driver doesn't let the hardware do that.
It interferes with the base-time passed from user space, by special-casing
the situation when the base-time is zero, and replaces that with the
current PTP time. This changes the intended effective base-time of the
schedule, which will in the end have a different phase offset than if
the base-time of 0.000000000 was to be advanced by an integer multiple
of the cycle-time.

Fixes: 34c6adf197 ("enetc: Configure the Time-Aware Scheduler via tc-taprio offload")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20201124220259.3027991-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 12:36:27 -08:00
..
enetc.c enetc: Workaround for MDIO register access issue 2020-11-17 12:12:12 -08:00
enetc.h enetc: Migrate to PHYLINK and PCS_LYNX 2020-10-11 11:04:42 -07:00
enetc_cbdr.c enetc: Configure the Time-Aware Scheduler via tc-taprio offload 2019-11-16 12:49:16 -08:00
enetc_ethtool.c enetc: Migrate to PHYLINK and PCS_LYNX 2020-10-11 11:04:42 -07:00
enetc_hw.h enetc: Workaround for MDIO register access issue 2020-11-17 12:12:12 -08:00
enetc_mdio.c enetc: Workaround for MDIO register access issue 2020-11-17 12:12:12 -08:00
enetc_msg.c enetc: Add vf to pf messaging support 2019-01-24 21:55:53 -08:00
enetc_pci_mdio.c net: enetc: fix an issue about leak system resources 2020-05-04 10:51:20 -07:00
enetc_pf.c enetc: Migrate to PHYLINK and PCS_LYNX 2020-10-11 11:04:42 -07:00
enetc_pf.h enetc: Migrate to PHYLINK and PCS_LYNX 2020-10-11 11:04:42 -07:00
enetc_ptp.c enetc: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions 2019-08-31 23:53:17 -07:00
enetc_qos.c enetc: Let the hardware auto-advance the taprio base-time of 0 2020-11-25 12:36:27 -08:00
enetc_vf.c enetc: simplify the return expression of enetc_vf_set_mac_addr() 2020-09-21 13:47:51 -07:00
Kconfig enetc: Workaround for MDIO register access issue 2020-11-17 12:12:12 -08:00
Makefile enetc: Make MDIO accessors more generic and export to include/linux/fsl 2020-01-05 23:22:32 -08:00