|
| 1 | +# Global PTP Configuration in SAI Switch |
| 2 | + |
| 3 | +Title | Global PTP Configuration in SAI Switch |
| 4 | +------------|---------------------------------------- |
| 5 | +Authors | Open |
| 6 | +Status | Draft |
| 7 | +Type | Standards track |
| 8 | +Created | 2024-03-03 |
| 9 | +SAI-Version | 1.15 |
| 10 | + |
| 11 | +## Overview |
| 12 | +Introducing a PTP (Precision Time Protocol) attribute to the SAI switch object, allowing for switch-wide PTP mode settings that affect all ports on the switch. |
| 13 | + |
| 14 | +A switch that does not set this attribute will observe no change in behavior. |
| 15 | + |
| 16 | +## Motivation |
| 17 | +Currently, PTP configuration in SAI is port-based, and many switches only support configuration of PTP on a global basis. |
| 18 | +In addition, many existing switches have a configuration model which allows global configuration of PTP, and then override on a port level. SAI should follow this flexible example. |
| 19 | + |
| 20 | +## Technical Specification |
| 21 | + |
| 22 | +### Updated description of existing PORT PTP type - the main comment is new |
| 23 | +```c |
| 24 | +/** |
| 25 | + * @brief PTP mode |
| 26 | + * |
| 27 | + * These modes can be used at the port and switch level. |
| 28 | + * All ports use the value set at the switch level unless explicitly configured |
| 29 | + * at the port level to a value other than SAI_PORT_PTP_MODE_NONE. |
| 30 | + */ |
| 31 | +typedef enum _sai_port_ptp_mode_t |
| 32 | +{ |
| 33 | + /** No special processing for PTP packets */ |
| 34 | + SAI_PORT_PTP_MODE_NONE, |
| 35 | + |
| 36 | + /** Single-step Timestamp mode for the PTP packets */ |
| 37 | + SAI_PORT_PTP_MODE_SINGLE_STEP_TIMESTAMP, |
| 38 | + |
| 39 | + /** Two-step Timestamp mode for the PTP packets */ |
| 40 | + SAI_PORT_PTP_MODE_TWO_STEP_TIMESTAMP, |
| 41 | + |
| 42 | +} sai_port_ptp_mode_t; |
| 43 | + |
| 44 | + |
| 45 | +### New Switch Attribute |
| 46 | +```c |
| 47 | +typedef enum _sai_switch_attr_t |
| 48 | +{ |
| 49 | + // ... existing attributes ... |
| 50 | + |
| 51 | + /** |
| 52 | + * @brief Global PTP mode configuration |
| 53 | + * |
| 54 | + * Global PTP mode configuration for the switch. |
| 55 | + * Applies to all ports unless overridden by port-specific settings. |
| 56 | + * |
| 57 | + * @type sai_port_ptp_mode_t |
| 58 | + * @flags CREATE_AND_SET |
| 59 | + * @default SAI_PORT_PTP_MODE_NONE |
| 60 | + */ |
| 61 | + SAI_SWITCH_ATTR_PORT_PTP_MODE, |
| 62 | + |
| 63 | + // ... existing attributes ... |
| 64 | +} sai_switch_attr_t; |
| 65 | +``` |
| 66 | + |
| 67 | +## Usage Example |
| 68 | +```c |
| 69 | +// Set global PTP configuration at switch level |
| 70 | +sai_attribute_t attr; |
| 71 | +attr.id = SAI_SWITCH_ATTR_PORT_PTP_MODE; |
| 72 | +attr.value.s32 = SAI_PORT_PTP_MODE_SINGLE_STEP_TIMESTAMP; |
| 73 | + |
| 74 | +sai_status_t status = sai_switch_api->set_switch_attribute( |
| 75 | + switch_id, |
| 76 | + &attr); |
| 77 | + |
| 78 | +// Get global PTP configuration |
| 79 | +attr.id = SAI_SWITCH_ATTR_PORT_PTP_MODE; |
| 80 | +status = sai_switch_api->get_switch_attribute( |
| 81 | + switch_id, |
| 82 | + 1, |
| 83 | + &attr); |
| 84 | +``` |
| 85 | +
|
| 86 | +## References |
| 87 | +1. IEEE 1588-2008 Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems |
| 88 | +2. IEEE 1588-2019 Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems |
0 commit comments