Skip to content

TEST-PTP-STIME-001: Verify PHC Hardware Clock Get/Set Timestamp IOCTLs #318

Description

@zarfld

Test Description

Verify that the AVB filter driver correctly implements IOCTL_AVB_SET_TIMESTAMP and
IOCTL_AVB_GET_TIMESTAMP for direct PHC (PTP Hardware Clock) time read/write operations
on Intel I210, I219, and I226 NICs.

Test Objectives

  • Validate that IOCTL_AVB_SET_TIMESTAMP writes the PHC register (SYSTIML/SYSTIMH) correctly
  • Validate that IOCTL_AVB_GET_TIMESTAMP returns a non-zero, monotonically incrementing value
  • Verify readback delta is within expected clock run-on bounds (<100 ms after 10 ms sleep)
  • Confirm behaviour across multiple distinct timestamp values

Preconditions

  • AVB filter driver installed and loaded
  • Intel I210, I219-V, or I226-LM NIC with PTP hardware clock
  • Test executable ptp_clock_control_test.exe built (Debug configuration)
  • Driver handle successfully opened (OPEN_ADAPTER)
  • No other process writing PHC concurrently

Test Cases

TC-STIME-001a: Set PHC to non-zero reference value and verify readback

Steps:

  1. Call IOCTL_AVB_SET_TIMESTAMP with value 5,000,000,000 ns (5 seconds)
  2. Sleep 10 ms
  3. Call IOCTL_AVB_GET_TIMESTAMP
  4. Compute delta = readback − written

Expected Result: 0 ≤ delta < 100,000,000 ns (clock ran on during 10 ms sleep)

TC-STIME-001b: Set PHC to boundary alignment value and verify readback

Steps:

  1. Call IOCTL_AVB_SET_TIMESTAMP with value 0x0000000100000000 (~4.3 seconds)
  2. Sleep 10 ms
  3. Call IOCTL_AVB_GET_TIMESTAMP
  4. Compute delta = readback − written

Expected Result: 0 ≤ delta < 100,000,000 ns

TC-STIME-001c: Verify IOCTL_AVB_SET_TIMESTAMP IOCTL path

Steps:

  1. Call IOCTL_AVB_SET_TIMESTAMP with value 0x5555555555555555 via DeviceIoControl
  2. Sleep 10 ms
  3. Call IOCTL_AVB_GET_TIMESTAMP
  4. Verify result or note implementation-specific behaviour

Expected Result: Either readback in range OR informational note (implementation-specific for some adapters)

Acceptance Criteria

  • IOCTL_AVB_SET_TIMESTAMP succeeds without error (DeviceIoControl returns TRUE)
  • IOCTL_AVB_GET_TIMESTAMP returns non-zero, monotonically incrementing timestamp
  • ✅ Readback delta is within [0, 100 ms] after 10 ms sleep for all test cases
  • ✅ Behaviour consistent across I210, I219-V, I226-LM adapters

Test Type

  • Type: Functional, Integration
  • Priority: P1 (High — core PTP clock I/O path)
  • Automation: Automated — tests/integration/ptp/ptp_clock_control_test.c, TestTimestampSetting() (Test 1a/1b/1c)
  • Status: ✅ Implemented and PASSING (commit f1fba3c, 2026-04-21, all adapters)

Evidence

  • Test function: TestTimestampSetting() in tests/integration/ptp/ptp_clock_control_test.c
  • Commit: f1fba3c — local run confirms 6/6 subtests PASS on I219-V, I226-LM, I210

Traceability

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions