linux/drivers/net/ethernet/intel/ice
Jacob Keller 30f1587409 ice: fix handling of burst Tx timestamps
Commit 1229b33973 ("ice: Add low latency Tx timestamp read") refactored
PTP timestamping logic to use a threaded IRQ instead of a separate kthread.

This implementation introduced ice_misc_intr_thread_fn and redefined the
ice_ptp_process_ts function interface to return a value of whether or not
the timestamp processing was complete.

ice_misc_intr_thread_fn would take the return value from ice_ptp_process_ts
and convert it into either IRQ_HANDLED if there were no more timestamps to
be processed, or IRQ_WAKE_THREAD if the thread should continue processing.

This is not correct, as the kernel does not re-schedule threaded IRQ
functions automatically. IRQ_WAKE_THREAD can only be used by the main IRQ
function.

This results in the ice_ptp_process_ts function (and in turn the
ice_ptp_tx_tstamp function) from only being called exactly once per
interrupt.

If an application sends a burst of Tx timestamps without waiting for a
response, the interrupt will trigger for the first timestamp. However,
later timestamps may not have arrived yet. This can result in dropped or
discarded timestamps. Worse, on E822 hardware this results in the interrupt
logic getting stuck such that no future interrupts will be triggered. The
result is complete loss of Tx timestamp functionality.

Fix this by modifying the ice_misc_intr_thread_fn to perform its own
polling of the ice_ptp_process_ts function. We sleep for a few microseconds
between attempts to avoid wasting significant CPU time. The value was
chosen to allow time for the Tx timestamps to complete without wasting so
much time that we overrun application wait budgets in the worst case.

The ice_ptp_process_ts function also currently returns false in the event
that the Tx tracker is not initialized. This would result in the threaded
IRQ handler never exiting if it gets started while the tracker is not
initialized.

Fix the function to appropriately return true when the tracker is not
initialized.

Note that this will not reproduce with default ptp4l behavior, as the
program always synchronously waits for a timestamp response before sending
another timestamp request.

Reported-by: Siddaraju DH <siddaraju.dh@intel.com>
Fixes: 1229b33973 ("ice: Add low latency Tx timestamp read")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20221118222729.1565317-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-11-21 20:50:35 -08:00
..
ice.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-08-25 16:07:42 -07:00
ice_adminq_cmd.h ice: Add additional flags to ice_nvm_write_activate 2022-08-24 08:45:54 -07:00
ice_arfs.c ice: arfs: fix use-after-free when freeing @rx_cpu_rmap 2022-04-08 09:08:36 -07:00
ice_arfs.h
ice_base.c ice: Fix spurious interrupt during removal of trusted VF 2022-11-09 13:20:38 -08:00
ice_base.h
ice_cgu_regs.h
ice_common.c ice: support features on new E810T variants 2022-09-28 11:40:57 -07:00
ice_common.h ice: Add port option admin queue commands 2022-08-24 08:45:53 -07:00
ice_controlq.c
ice_controlq.h
ice_dcb.c
ice_dcb.h
ice_dcb_lib.c
ice_dcb_lib.h
ice_dcb_nl.c
ice_dcb_nl.h
ice_devids.h ice: support features on new E810T variants 2022-09-28 11:40:57 -07:00
ice_devlink.c ice: Implement devlink port split operations 2022-08-24 08:45:55 -07:00
ice_devlink.h
ice_eswitch.c net: drop the weight argument from netif_napi_add 2022-09-28 18:57:14 -07:00
ice_eswitch.h ice: allow creating VFs for !CONFIG_NET_SWITCHDEV 2022-04-14 08:19:54 -07:00
ice_ethtool.c ice: Allow 100M speeds for some devices 2022-08-18 08:23:44 -07:00
ice_ethtool_fdir.c ice: Use correct order for the parameters of devm_kcalloc() 2022-06-08 08:55:13 -07:00
ice_fdir.c
ice_fdir.h
ice_flex_pipe.c ice: Add support for PPPoE hardware offload 2022-07-26 10:56:32 -07:00
ice_flex_pipe.h
ice_flex_type.h
ice_flow.c
ice_flow.h
ice_fltr.c ice: Ignore error message when setting same promiscuous mode 2022-08-17 09:30:44 -07:00
ice_fltr.h
ice_fw_update.c ice: handle E822 generic device ID in PLDM header 2022-07-12 09:25:34 -07:00
ice_fw_update.h
ice_gnss.c ice: add write functionality for GNSS TTY 2022-07-21 13:25:17 -07:00
ice_gnss.h ice: add write functionality for GNSS TTY 2022-07-21 13:25:17 -07:00
ice_hw_autogen.h
ice_idc.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-05-12 16:15:30 -07:00
ice_idc_int.h
ice_lag.c ice: remove non-inclusive language 2022-08-18 08:26:11 -07:00
ice_lag.h ice: remove non-inclusive language 2022-08-18 08:26:11 -07:00
ice_lan_tx_rx.h
ice_lib.c ice: Fix spurious interrupt during removal of trusted VF 2022-11-09 13:20:38 -08:00
ice_lib.h ice: Fix spurious interrupt during removal of trusted VF 2022-11-09 13:20:38 -08:00
ice_main.c ice: fix handling of burst Tx timestamps 2022-11-21 20:50:35 -08:00
ice_nvm.c ice: Add additional flags to ice_nvm_write_activate 2022-08-24 08:45:54 -07:00
ice_nvm.h ice: Add additional flags to ice_nvm_write_activate 2022-08-24 08:45:54 -07:00
ice_osdep.h
ice_pf_vsi_vlan_ops.c
ice_pf_vsi_vlan_ops.h
ice_protocol_type.h ice: Add L2TPv3 hardware offload support 2022-09-20 09:13:38 +02:00
ice_ptp.c ice: fix handling of burst Tx timestamps 2022-11-21 20:50:35 -08:00
ice_ptp.h ice: Merge pin initialization of E810 and E810T adapters 2022-09-28 11:40:57 -07:00
ice_ptp_consts.h
ice_ptp_hw.c ice: Add low latency Tx timestamp read 2022-09-20 16:14:28 -07:00
ice_ptp_hw.h ice: Add low latency Tx timestamp read 2022-09-20 16:14:28 -07:00
ice_repr.c ice: reorder PF/representor devlink port register/unregister flows 2022-09-27 07:54:45 -07:00
ice_repr.h
ice_sbq_cmd.h
ice_sched.c ice: Simplify memory allocation in ice_sched_init_port() 2022-09-06 13:55:47 -07:00
ice_sched.h
ice_sriov.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-07-28 18:21:16 -07:00
ice_sriov.h
ice_switch.c ice: Add L2TPv3 hardware offload support 2022-09-20 09:13:38 +02:00
ice_switch.h ice: Introduce enabling promiscuous mode on multiple VF's 2022-07-28 11:44:22 -07:00
ice_tc_lib.c ice: Add support for VLAN priority filters in switchdev 2022-09-28 11:40:57 -07:00
ice_tc_lib.h ice: Add support for VLAN priority filters in switchdev 2022-09-28 11:40:57 -07:00
ice_trace.h
ice_txrx.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-09-29 14:30:51 -07:00
ice_txrx.h ice: Implement control of FCS/CRC stripping 2022-08-18 08:08:23 -07:00
ice_txrx_lib.c
ice_txrx_lib.h
ice_type.h ice: Add low latency Tx timestamp read 2022-09-20 16:14:28 -07:00
ice_vf_lib.c ice: Fix spurious interrupt during removal of trusted VF 2022-11-09 13:20:38 -08:00
ice_vf_lib.h ice: Fix promiscuous mode not turning off 2022-07-28 11:44:40 -07:00
ice_vf_lib_private.h
ice_vf_mbx.c
ice_vf_mbx.h
ice_vf_vsi_vlan_ops.c
ice_vf_vsi_vlan_ops.h
ice_virtchnl.c ice: Fix VF not able to send tagged traffic with no VLAN filters 2022-08-17 09:30:44 -07:00
ice_virtchnl.h
ice_virtchnl_allowlist.c
ice_virtchnl_allowlist.h
ice_virtchnl_fdir.c ice: always check VF VSI pointer values 2022-05-05 11:28:36 -07:00
ice_virtchnl_fdir.h
ice_vlan.h
ice_vlan_mode.c ice: Add support for VLAN TPID filters in switchdev 2022-06-30 13:53:33 -07:00
ice_vlan_mode.h
ice_vsi_vlan_lib.c
ice_vsi_vlan_lib.h
ice_vsi_vlan_ops.c
ice_vsi_vlan_ops.h
ice_xsk.c ice: xsk: drop power of 2 ring size restriction for AF_XDP 2022-09-27 09:01:01 -07:00
ice_xsk.h ice: xsk: change batched Tx descriptor cleaning 2022-09-27 08:11:02 -07:00
Makefile ice: fix access-beyond-end in the switch code 2022-06-02 12:41:10 +02:00