mbox series

[v5,iwl-next,00/10] idpf: add initial PTP support

Message ID 20250117124109.967889-1-milena.olech@intel.com
Headers show
Series idpf: add initial PTP support | expand

Message

Milena Olech Jan. 17, 2025, 12:41 p.m. UTC
This patch series introduces support for Precision Time Protocol (PTP) to
Intel(R) Infrastructure Data Path Function (IDPF) driver. PTP feature is
supported when the PTP capability is negotiated with the Control
Plane (CP). IDPF creates a PTP clock and sets a set of supported
functions.

During the PTP initialization, IDPF requests a set of PTP capabilities
and receives a writeback from the CP with the set of supported options.
These options are:
- get time of the PTP clock
- get cross timestamp
- set the time of the PTP clock
- adjust the PTP clock
- Tx timestamping

Each feature is considered to have direct access, where the operations
on PCIe BAR registers are allowed, or the mailbox access, where the
virtchnl messages are used to perform any PTP action. Mailbox access
means that PTP requests are sent to the CP through dedicated secondary
mailbox and the CP reads/writes/modifies desired resource - PTP Clock
or Tx timestamp registers.

Tx timestamp capabilities are negotiated only for vports that have
UPLINK_VPORT flag set by the CP. Capabilities provide information about
the number of available Tx timestamp latches, their indexes and size of
the Tx timestamp value. IDPF requests Tx timestamp by setting the
TSYN bit and the requested timestamp index in the context descriptor for
the PTP packets. When the completion tag for that packet is received,
IDPF schedules a worker to read the Tx timestamp value.

Current implementation of the IDPF driver does not allow to get stable
Tx timestamping, when more than 1 request per 1 second is sent to the
driver. Debug is in progress, however PTP feature seems to be affected by
the IDPF transmit flow, as the Tx timestamping relies on the completion
tag.

v4 -> v5: fix spin unlock when Tx timestamp index is requested
v3 -> v4: change timestamp filters dependent on Tx timestamp cap,
rewrite function that extends Tx timestamp value, minor fixes
v2 -> v3: fix minor issues, revert idpf_for_each_vport changes,
extend idpf_ptp_set_rx_tstamp, split tstamp statistics
v1 -> v2: add stats for timestamping, use ndo_hwtamp_get/set,
fix minor spelling issues

Milena Olech (10):
  idpf: add initial PTP support
  virtchnl: add PTP virtchnl definitions
  idpf: move virtchnl structures to the header file
  idpf: negotiate PTP capabilities and get PTP clock
  idpf: add mailbox access to read PTP clock time
  idpf: add PTP clock configuration
  idpf: add Tx timestamp capabilities negotiation
  idpf: add Tx timestamp flows
  idpf: add support for Rx timestamping
  idpf: change the method for mailbox workqueue allocation

 drivers/net/ethernet/intel/idpf/Kconfig       |   1 +
 drivers/net/ethernet/intel/idpf/Makefile      |   3 +
 drivers/net/ethernet/intel/idpf/idpf.h        |  34 +
 .../ethernet/intel/idpf/idpf_controlq_api.h   |   3 +
 drivers/net/ethernet/intel/idpf/idpf_dev.c    |  14 +
 .../net/ethernet/intel/idpf/idpf_ethtool.c    |  70 +-
 .../ethernet/intel/idpf/idpf_lan_pf_regs.h    |   4 +
 .../net/ethernet/intel/idpf/idpf_lan_txrx.h   |  13 +-
 drivers/net/ethernet/intel/idpf/idpf_lib.c    |  47 +
 drivers/net/ethernet/intel/idpf/idpf_main.c   |   9 +-
 drivers/net/ethernet/intel/idpf/idpf_ptp.c    | 983 ++++++++++++++++++
 drivers/net/ethernet/intel/idpf/idpf_ptp.h    | 351 +++++++
 drivers/net/ethernet/intel/idpf/idpf_txrx.c   | 169 ++-
 drivers/net/ethernet/intel/idpf/idpf_txrx.h   |  18 +-
 .../net/ethernet/intel/idpf/idpf_virtchnl.c   | 160 ++-
 .../net/ethernet/intel/idpf/idpf_virtchnl.h   |  84 ++
 .../ethernet/intel/idpf/idpf_virtchnl_ptp.c   | 677 ++++++++++++
 drivers/net/ethernet/intel/idpf/virtchnl2.h   | 314 +++++-
 18 files changed, 2852 insertions(+), 102 deletions(-)
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_ptp.c
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_ptp.h
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c


base-commit: e1e8afea623cb80941623188a8190d3ca80a6e08

Comments

Singh, Krishneil K Feb. 7, 2025, 10:34 p.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Milena Olech
> Sent: Friday, January 17, 2025 4:41 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Olech, Milena <milena.olech@intel.com>
> Subject: [Intel-wired-lan] [PATCH v5 iwl-next 00/10] idpf: add initial PTP
> support
> 
> This patch series introduces support for Precision Time Protocol (PTP) to
> Intel(R) Infrastructure Data Path Function (IDPF) driver. PTP feature is
> supported when the PTP capability is negotiated with the Control
> Plane (CP). IDPF creates a PTP clock and sets a set of supported
> functions.
> 
> During the PTP initialization, IDPF requests a set of PTP capabilities
> and receives a writeback from the CP with the set of supported options.
> These options are:
> - get time of the PTP clock
> - get cross timestamp
> - set the time of the PTP clock
> - adjust the PTP clock
> - Tx timestamping
> 
> Each feature is considered to have direct access, where the operations
> on PCIe BAR registers are allowed, or the mailbox access, where the
> virtchnl messages are used to perform any PTP action. Mailbox access
> means that PTP requests are sent to the CP through dedicated secondary
> mailbox and the CP reads/writes/modifies desired resource - PTP Clock
> or Tx timestamp registers.
> 
> Tx timestamp capabilities are negotiated only for vports that have
> UPLINK_VPORT flag set by the CP. Capabilities provide information about
> the number of available Tx timestamp latches, their indexes and size of
> the Tx timestamp value. IDPF requests Tx timestamp by setting the
> TSYN bit and the requested timestamp index in the context descriptor for
> the PTP packets. When the completion tag for that packet is received,
> IDPF schedules a worker to read the Tx timestamp value.
> 
> Current implementation of the IDPF driver does not allow to get stable
> Tx timestamping, when more than 1 request per 1 second is sent to the
> driver. Debug is in progress, however PTP feature seems to be affected by
> the IDPF transmit flow, as the Tx timestamping relies on the completion
> tag.
> 
> v4 -> v5: fix spin unlock when Tx timestamp index is requested
> v3 -> v4: change timestamp filters dependent on Tx timestamp cap,
> rewrite function that extends Tx timestamp value, minor fixes
> v2 -> v3: fix minor issues, revert idpf_for_each_vport changes,
> extend idpf_ptp_set_rx_tstamp, split tstamp statistics
> v1 -> v2: add stats for timestamping, use ndo_hwtamp_get/set,
> fix minor spelling issues
> 
> Milena Olech (10):
>   idpf: add initial PTP support
>   virtchnl: add PTP virtchnl definitions
>   idpf: move virtchnl structures to the header file
>   idpf: negotiate PTP capabilities and get PTP clock
>   idpf: add mailbox access to read PTP clock time
>   idpf: add PTP clock configuration
>   idpf: add Tx timestamp capabilities negotiation
>   idpf: add Tx timestamp flows
>   idpf: add support for Rx timestamping
>   idpf: change the method for mailbox workqueue allocation
> 
>  drivers/net/ethernet/intel/idpf/Kconfig       |   1 +
>  drivers/net/ethernet/intel/idpf/Makefile      |   3 +
>  drivers/net/ethernet/intel/idpf/idpf.h        |  34 +
>  .../ethernet/intel/idpf/idpf_controlq_api.h   |   3 +
>  drivers/net/ethernet/intel/idpf/idpf_dev.c    |  14 +
>  .../net/ethernet/intel/idpf/idpf_ethtool.c    |  70 +-
>  .../ethernet/intel/idpf/idpf_lan_pf_regs.h    |   4 +
>  .../net/ethernet/intel/idpf/idpf_lan_txrx.h   |  13 +-
>  drivers/net/ethernet/intel/idpf/idpf_lib.c    |  47 +
>  drivers/net/ethernet/intel/idpf/idpf_main.c   |   9 +-
>  drivers/net/ethernet/intel/idpf/idpf_ptp.c    | 983 ++++++++++++++++++
>  drivers/net/ethernet/intel/idpf/idpf_ptp.h    | 351 +++++++
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c   | 169 ++-
>  drivers/net/ethernet/intel/idpf/idpf_txrx.h   |  18 +-
>  .../net/ethernet/intel/idpf/idpf_virtchnl.c   | 160 ++-
>  .../net/ethernet/intel/idpf/idpf_virtchnl.h   |  84 ++
>  .../ethernet/intel/idpf/idpf_virtchnl_ptp.c   | 677 ++++++++++++
>  drivers/net/ethernet/intel/idpf/virtchnl2.h   | 314 +++++-
>  18 files changed, 2852 insertions(+), 102 deletions(-)
>  create mode 100644 drivers/net/ethernet/intel/idpf/idpf_ptp.c
>  create mode 100644 drivers/net/ethernet/intel/idpf/idpf_ptp.h
>  create mode 100644 drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c
> 
> 
> base-commit: e1e8afea623cb80941623188a8190d3ca80a6e08
> --
> 2.31.1

On testing on this [series|patch], the following issue was observed, PTP hardware receive filter modes does not report all the supported modes from hardware.
 
Time stamping parameters for ethX:
Capabilities:
        hardware-transmit
        software-transmit
        hardware-receive
        software-receive
        software-system-clock
        hardware-raw-clock
PTP Hardware Clock: 2
Hardware Transmit Timestamp Modes:
        off
        on
Hardware Receive Filter Modes: none

Thank You 
Krishneil Singh