In certain cases, the PF for the iavf driver may support VIRTCHNL_VF_CAP_PTP but will not enable Rx timestamps. If this occurs, the iavf driver will attempt to continue anyways. When that happens, the resulting timestamps will appear to function initially. Upon closer inspection it becomes clear that the timestamps are invalid and bogus.
First, when reporting a timestamp, always check the validity bit instead of blindly reporting it. This avoids extending an invalid (likely zero'd) timestamp value from the Rx descriptor. Second, don't enable the RTE_ETH_RX_OFFLOAD_TIMESTAMP capability if the PF doesn't indicate we have support. This will prevent applications from trying to timestamp when it is not properly enabled. Typically, this should not happen, as the PFs which support VIRTCHNL_VF_CAP_PTP should support Rx timestamping. However, we recently discovered a flaw in some implementations of the VIRTCHNL_OP_1588_PTP_GET_CAPS command. The layout of the capabilities structure is incorrect, with the caps member placed at a different byte offset than the expected structure layout. This is the case with the upstream Linux ice PF driver. This results in the PF rejecting the request for Rx timestamping, and leaving timestamping disabled. A proper fix for this situation is difficult. If we merely changed the structure layout in DPDK, then it would stop being compatible with other host OSes and with other implementations of the Linux ice PF. If we changed the layout upstream, it would break compatibility with the upstream iAVF VF driver. A proper fix to resolve this will take some time, as we will likely have to introduce a new flag or ops capability across many drivers. In the mean time, we should at least make sure the DPDK driver stops reporting bogus timestamps in such a setup. Signed-off-by: Jacob Keller <[email protected]> --- Jacob Keller (2): net/iavf: check if PF actually indicates Rx timestamps net/iavf: check Rx timestamp validity bit drivers/net/intel/iavf/iavf_rxtx.h | 3 +++ drivers/net/intel/iavf/iavf_ethdev.c | 3 ++- drivers/net/intel/iavf/iavf_rxtx.c | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) --- base-commit: be0112878b4fc3a1b918370ed2fe615c52039d77 change-id: 20251113-jk-dpdk-iavf-rx-timestamping-improvements-a06d21385371 Best regards, -- Jacob Keller <[email protected]>

