linux/drivers
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
..
accessibility speakup ttyio: Do not schedule() in ttyio_in_nowait 2020-11-09 18:14:29 +01:00
acpi Merge branch 'acpi-fan' 2020-11-19 14:03:52 +01:00
amba
android task_work: cleanup notification modes 2020-10-17 15:05:30 -06:00
ata libata-5.10-2020-10-30 2020-10-30 14:51:01 -07:00
atm atm: nicstar: Unmap DMA on send error 2020-11-18 16:42:07 -08:00
auxdisplay
base PM: runtime: Resume the device earlier in __device_release_driver() 2020-11-02 18:14:07 +01:00
bcma bcma: use semicolons rather than commas to separate statements 2020-10-01 16:23:50 +03:00
block loop: Fix occasional uevent drop 2020-11-12 13:59:04 -07:00
bluetooth Bluetooth: btintel: Replace zero-length array with flexible-array member 2020-10-30 16:57:41 -05:00
bus ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
cdrom
char Char/Misc driver fixes for 5.10-rc4 2020-11-15 10:15:17 -08:00
clk clk: imx8m: fix bus critical clk registration 2020-11-04 17:13:12 -08:00
clocksource treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
connector
counter counter: use semicolons rather than commas to separate statements 2020-09-29 17:27:08 +01:00
cpufreq Merge branch 'cpufreq/arm/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2020-11-17 13:25:06 +01:00
cpuidle cpuidle: tegra: Annotate tegra_pm_set_cpu_in_lp2() with RCU_NONIDLE 2020-11-16 13:24:32 +01:00
crypto crypto: sun8x-ce*: update entries to its documentation 2020-10-28 11:41:15 -06:00
dax fuse update for 5.10 2020-10-19 14:28:30 -07:00
dca
devfreq
dio
dma misc: mic: remove the MIC drivers 2020-10-28 19:12:03 +01:00
dma-buf dma-mapping updates for 5.10 2020-10-15 14:43:29 -07:00
edac EFI changes for v5.10: 2020-10-12 13:26:49 -07:00
eisa
extcon
firewire
firmware firmware: xilinx: fix out-of-bounds access 2020-11-09 18:35:35 +01:00
fpga
fsi
gnss
gpio gpio: sifive: Fix SiFive gpio probe 2020-11-11 09:53:09 +01:00
gpu Merge branch 'linux-5.10' of git://github.com/skeggsb/linux into drm-fixes 2020-11-16 06:36:31 +10:00
greybus
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2020-10-23 16:16:31 -07:00
hsi
hv hyperv-fixes for 5.10-rc5 2020-11-16 15:02:33 -08:00
hwmon hwmon: (amd_energy) modify the visibility of the counters 2020-11-13 06:46:20 -08:00
hwspinlock
hwtracing coresight: cti: Initialize dynamic sysfs attributes 2020-10-29 20:10:25 +01:00
i2c i2c: designware: slave should do WRITE_REQUESTED before WRITE_RECEIVED 2020-11-06 16:02:00 +01:00
i3c * Fix DAA for the pre-reserved address case 2020-10-17 11:01:01 -07:00
ide block-5.10-2020-10-12 2020-10-13 12:12:44 -07:00
idle intel_idle: Fix max_cstate for processor models without C-state tables 2020-10-27 19:03:53 +01:00
iio chrome platform changes for 5.10 2020-10-23 10:54:13 -07:00
infiniband IB/hfi1: Fix error return code in hfi1_init_dd() 2020-11-13 12:25:21 -04:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2020-11-17 12:00:40 -08:00
interconnect interconnect: qcom: use icc_sync state for sm8[12]50 2020-10-27 16:01:22 +02:00
iommu A small set of fixes for x86: 2020-11-15 09:49:56 -08:00
ipack
irqchip A set of fixes for interrupt chip drivers: 2020-11-08 09:52:57 -08:00
isdn
leds leds: pwm: Remove platform_data support 2020-10-07 12:02:58 +02:00
lightnvm lightnvm: fix out-of-bounds write to array devices->info[] 2020-10-16 09:28:45 -06:00
macintosh powerpc updates for 5.10 2020-10-16 12:21:15 -07:00
mailbox ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
mcb
md - Improve DM core's bio splitting to use blk_max_size_offset(). Also 2020-10-14 15:05:38 -07:00
media dma-mapping updates for 5.10 2020-10-15 14:43:29 -07:00
memory ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
memstick
message scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove() 2020-10-26 16:57:18 -04:00
mfd - New Drivers 2020-10-14 15:56:58 -07:00
misc habanalabs/gaudi: mask WDT error in QMAN 2020-11-04 08:56:07 +02:00
mmc Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD cards" 2020-11-10 13:58:01 +01:00
most
mtd mtd: rawnand: stm32_fmc2: fix broken ECC 2020-10-30 18:24:51 +01:00
mux
net enetc: Let the hardware auto-advance the taprio base-time of 0 2020-11-25 12:36:27 -08:00
nfc nfc: s3fwrn5: use signed integer for parsing GPIO numbers 2020-11-24 15:00:53 -08:00
ntb Bug fixes for v5.10 2020-10-25 11:12:31 -07:00
nubus
nvdimm mm/memremap_pages: support multiple ranges per invocation 2020-10-13 18:38:28 -07:00
nvme nvme: fix incorrect behavior when BLKROSET is called by the user 2020-11-09 17:39:15 +01:00
nvmem
of of/address: Fix of_node memory leak in of_dma_is_coherent 2020-11-11 17:10:16 -06:00
opp opp: Reduce the size of critical section in _opp_table_kref_release() 2020-10-27 13:21:03 +05:30
oprofile
parisc dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
parport
pci PCI: mvebu: Fix duplicate resource requests 2020-11-04 13:55:30 -06:00
pcmcia
perf perf: arm-cmn: Fix conversion specifiers for node type 2020-10-01 22:30:07 +01:00
phy pci-v5.10-changes 2020-10-22 12:41:00 -07:00
pinctrl intel-pinctrl for v5.10-2 2020-11-10 15:35:41 +01:00
platform Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2020-10-23 16:16:31 -07:00
pnp PNP: fix kernel-doc markups 2020-10-27 19:23:04 +01:00
power ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
powercap Merge branch 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux 2020-11-10 10:02:31 -08:00
pps
ps3
ptp
pwm ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
rapidio rapidio: fix the missed put_device() for rio_mport_add_riodev 2020-10-16 11:11:22 -07:00
ras
regulator regulator: ti-abb: Fix array out of bound read access on the first transition 2020-11-18 17:59:24 +00:00
remoteproc remoteproc updates for v5.10 2020-10-22 12:56:33 -07:00
reset ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
rpmsg rpmsg updates for 5.10 2020-10-22 12:58:21 -07:00
rtc RTC for 5.10 2020-10-21 11:22:08 -07:00
s390 s390/qeth: fix tear down of async TX buffers 2020-11-20 18:59:48 -08:00
sbus
scsi SCSI fixes on 20201113 2020-11-14 12:19:21 -08:00
sfi
sh
siox
slimbus
soc soc: ti: ti_sci_pm_domains: check for proper args count in xlate 2020-10-29 22:13:38 +01:00
soundwire soundwire updates for 5.10-rc1 2020-10-01 22:59:55 +02:00
spi spi: npcm-fiu: Don't leak SPI master in probe error path 2020-11-17 17:08:39 +00:00
spmi
ssb
staging This pull contains a series of warning fixes from Mauro; once applied, the 2020-11-03 13:14:14 -08:00
target scsi: target: tcmu: Replace zero-length array with flexible-array member 2020-10-29 17:22:59 -05:00
tc
tee AMD-TEE driver bug fixes 2020-11-13 13:44:05 +01:00
thermal thermal: ti-soc-thermal: Disable the CPU PM notifier for OMAP4430 2020-11-12 12:30:29 +01:00
thunderbolt thunderbolt: Add support for Intel Tiger Lake-H 2020-11-06 16:39:11 +03:00
tty TTY/Serial fixes for 5.10-rc3 2020-11-08 11:28:08 -08:00
uio uio: Fix use-after-free in uio_unregister_device() 2020-11-09 18:54:30 +01:00
usb usb: cdc-acm: Add DISABLE_ECHO for Renesas USB Download mode 2020-11-13 15:26:49 +01:00
vdpa vhost,vdpa: fixes 2020-11-16 14:58:23 -08:00
vfio vfio/pci: Bypass IGD init in case of -ENODEV 2020-11-03 11:07:40 -07:00
vhost vhost scsi: Add support for LUN resets. 2020-11-15 17:30:55 -05:00
video video: hyperv_fb: include vmalloc.h 2020-11-09 08:17:46 +01:00
virt nitro_enclaves: Fixup type and simplify logic of the poll mask setup 2020-11-09 18:20:36 +01:00
virtio vhost,vdpa,virtio: cleanups, fixes 2020-10-23 11:00:57 -07:00
visorbus
vlynq
vme
w1 w1: w1_therm: make w1_poll_completion static 2020-10-05 14:49:24 +02:00
watchdog ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
xen swiotlb: remove the tbl_dma_addr argument to swiotlb_tbl_map_single 2020-11-02 10:10:39 -05:00
zorro
Kconfig
Makefile