On 30/06/2026 14:15, Ding Meng via Intel-wired-lan wrote:
When CONFIG_NET_RX_BUSY_POLL is deactivated, fetching RX HW timestamps
from the NIC no longer works as expected, often resulting in incorrect
or negative values such as "HW raw -121948.050407424".

This occurs because disabling CONFIG_NET_RX_BUSY_POLL disables the
SKB NAPI mapping in __skb_mark_napi_id(). Consequently, get_timestamp()
fails to perform its driver lookup, and the igc driver's struct
net_device_ops::ndo_get_tstamp is never invoked.

Instead, get_timestamp() falls back to use shhwtstamps(skb)->hwtstamp,
a field that the driver has not populated. This results in incorrect
timestamps.

Fix this by populating the hwtstamp field with the correct timestamp
in the default timer when CONFIG_NET_RX_BUSY_POLL is disabled.
The "igc_adapter" is passed to igc_construct_skb() to enable
igc_ptp_rx_pktstamp() to access the necessary adapter details for
adjusting the timestamp.

Test case:
  Disable CONFIG_NET_RX_BUSY_POLL.
  Sender:
  # tools/testing/selftests/net/timestamping en0 \
         SOF_TIMESTAMPING_TX_HARDWARE PTPV2 IP_MULTICAST_LOOP
  Receiver:
  # tools/testing/selftests/net/timestamping en0 \
         SOF_TIMESTAMPING_RX_HARDWARE SOF_TIMESTAMPING_RAW_HARDWARE PTPV2

Before patch, receiver prints
  HW raw -121948.050407424
After patch, receiver prints
  HW raw 1760648763.746974064

Fixes: 069b142f5819 ("igc: Add support for PTP .getcyclesx64()")
Cc:[email protected]
Co-developed-by: Florian Bezdeka<[email protected]>
Signed-off-by: Florian Bezdeka<[email protected]>
Signed-off-by: Ding Meng<[email protected]>
Reviewed-by: Aleksandr Loktionov<[email protected]>
Reviewed-by: Piotr Kwapulinski<[email protected]>
---
V2:
   - update commit message(suggested by Paul Menzel):
       add error log
       explain why need to pass igc_adapter
       add test case
   - move variable declarations on top of the function
   - [email protected]
V1:https://lore.kernel.org/intel-wired-lan/[email protected]/
---
  drivers/net/ethernet/intel/igc/igc_main.c | 41 ++++++++++++++++-------
  1 file changed, 29 insertions(+), 12 deletions(-)

Tested-by: Avigail Dahan <[email protected]>

Reply via email to