Donny9 opened a new pull request, #3247:
URL: https://github.com/apache/nuttx-apps/pull/3247

   ## Summary
   
   This patch series brings comprehensive PTP (Precision Time Protocol) daemon
   support to NuttX, implementing a complete IEEE 1588 PTPv2 stack with the
   following key enhancements:
   
   1. **Core Infrastructure** (dc94b2418a, 32ef6dc612):
      - Added CMake build system support for ptpd
      - Fixed structure byte alignment for cross-core communication 
compatibility
   
   2. **Debug and Logging** (5aecb30da3):
      - Migrated from custom NETUTILS_PTPD_DEBUG to standard DEBUG_PTP_* macros
      - Integrated with NuttX PTP clock device debug framework
   
   3. **Task Management Redesign** (e2737dd6f1, 09420b3f46):
      - Replaced separate task creation with main task execution model
      - Unified command interface: `ptpd -i eth0 &` for start, `ptpd -d pid` 
for stop
      - Introduced struct ptpd_config_s for dynamic configuration
      - Enables background execution with proper lifecycle management
   
   4. **Hardware Timestamping Support** (0985006e26, d5713d2494):
      - Runtime-configurable hardware timestamp via hardware_ts flag
      - Replaced CONFIG_NET_TIMESTAMP with dynamic configuration
      - Enhanced precision using SO_TIMESTAMPNS for nanosecond timestamps
   
   5. **PTP Clock Device Integration** (71598b6f5d, 10b7258a14, 757744add4):
      - Added NET_PKT dependency for PTP clock device support
      - Implemented clock_adjtime() support for PTP hardware clocks via CLOCKFD
      - Added CONFIG_NETUTILS_PTPD_ADJTIME_THRESHOLD_NS for accelerated 
adjustment
      - Optimized time adjustment convergence speed
   
   6. **BMCA and Clock Selection** (3b20797945, 3cab597f01):
      - Fixed missing comparisons in is_better_clock() for BMCA compliance
      - Added semaphore cleanup in ptpd_status() to prevent resource leaks
   
   7. **Transport Layer** (ebd885e1dd, 8f8bc63769):
      - Implemented PTP Ethernet transport (Layer 2) via raw socket support
      - Added -B option to control BMCA (Best Master Clock Algorithm) messages
   
   8. **Configuration Flexibility** (32b4ef4dc5):
      - Dynamic runtime configuration for client-only and delay-e2e modes
      - Removed compile-time Kconfig restrictions (PTPD_CLIENT/PTPD_SERVER)
      - Fixed compilation warnings when enabling subset configurations
   
   9. **gPTP Switch Support** (f61389ed64):
      - Added path delay correction field support for gPTP-aware switches
      - Enables accurate time synchronization in switched network topologies
   
   The series transforms ptpd from a basic proof-of-concept into a 
production-ready
   PTP daemon with hardware timestamp support, flexible transport options, and 
full
   integration with NuttX PTP clock framework.
   
   ## Impact
   
   **Users:**
   - New command-line interface requires updating ptpd invocation scripts
   - Old: `ptpd start eth0 &`, New: `ptpd -i eth0 &`
   - Background execution now mandatory using '&' operator
   - Client-only and delay mode now configured at runtime, not compile-time
   
   **Build System:**
   - CMake support added alongside Make build system
   - New Kconfig dependencies: requires NET_PKT when using PTP clock devices
   - Removed several Kconfig options in favor of runtime configuration
   
   **Hardware Requirements:**
   - Hardware timestamping now supported but optional (fallback to software)
   - PTP clock device (/dev/ptp*) integration requires CONFIG_PTP_CLOCK
   - Network drivers should implement SO_TIMESTAMPNS for best accuracy
   
   **Configuration:**
   - CONFIG_NETUTILS_PTPD_ADJTIME_THRESHOLD_NS controls adjustment speed
   - BMCA behavior controlled via -B command-line option
   - Transport type (UDP/Ethernet) selected automatically based on capabilities
   
   **Compatibility:**
   - Breaking: Command-line interface changed
   - Breaking: Some Kconfig options removed
   - Forward: Maintains IEEE 1588-2008 PTPv2 protocol compatibility
   - Enhanced: Better interoperability with gPTP switches
   
   **Documentation:**
   - New command syntax requires documentation updates
   - PTP clock device integration needs cross-reference to driver docs
   
   **Security:**
   - Raw socket support (Ethernet transport) requires appropriate permissions
   - No authentication mechanisms added (per IEEE 1588 standard)
   
   ## Testing
   
   ptp sync base on tricore tc4 platform:
   Initial synchronization error: ±50 μs, converging to ±2.5 μs within 3 
seconds.
   
   <img width="1280" height="749" alt="image" 
src="https://github.com/user-attachments/assets/fb764ae2-9ebf-42f1-a58d-c40882626bdf";
 />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to