numam-dpdk/drivers
Qi Zhang 4e1d404e03 net/ice/base: fix division during E822 PTP init
When initializing the device hardware for PTP, the E822 devices
requirea number of values to be calculated and programmed to
hardware.These values are calculated using unsigned 64-bit
division.

The DIV_64BIT macro currently translates into a specific Linux
functionthat triggers a *signed* division. This produces incorrect
results when operating on a dividend larger than an s64. The
division calculation effectively overflows and results in totally
unexpected behavior.

In this case, the UIX value for 10Gb/40Gb link speeds are calculated
incorrectly. This ultimately cascades into a failure of the Tx
timestamps. Specifically, the reported Tx timestamps become wildly
inaccurate and not representing nominal time.

The root cause of this bug is the assumption that DIV_64BIT can
correctly handle both signed and unsigned division. In fact the
entire reason we need this is because the Linux kernel compilation
target does not provide native 64 bit division ops, and requires
explicit use of kernel functions which explicitly do either signed
or unsigned division.

To correctly solve this, introduce new functions, DIV_U64 and
DIV_S64 which are specifically intended for signed or unsigned
division. To help catch issues, use static inline functions so
that we get strict type checking.

Fixes: 97f4f78bbd ("net/ice/base: add functions for device clock control")
Cc: stable@dpdk.org

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
2022-09-18 16:12:32 +02:00
..
baseband dev: hide driver object 2022-09-23 16:14:34 +02:00
bus bus/pci: fill bus specific information 2022-09-23 16:14:34 +02:00
common common/iavf: support flow subscription 2022-09-07 20:33:26 +02:00
compress dev: hide driver object 2022-09-23 16:14:34 +02:00
crypto crypto/openssl: fix HMAC output length 2022-09-27 18:20:35 +02:00
dma dev: hide driver object 2022-09-23 16:14:34 +02:00
event event/cnxk: update event vector Tx routine 2022-09-27 15:41:59 +02:00
gpu dev: hide driver object 2022-09-23 16:14:34 +02:00
mempool common/cnxk: reserve AURA zero on CN10KA NPA 2022-09-22 10:44:04 +02:00
net net/ice/base: fix division during E822 PTP init 2022-09-18 16:12:32 +02:00
raw raw/ioat: remove deprecated driver 2022-09-28 14:41:07 +02:00
regex dev: hide driver object 2022-09-23 16:14:34 +02:00
vdpa bus/pci: make driver-only headers private 2022-09-23 16:14:34 +02:00
meson.build build: export drivers headers 2022-09-23 16:14:34 +02:00