Skip to content

Commit 88be36b

Browse files
committed
SAI switch attribute to enable PTP on all ports
Signed-off-by: Rich Sugarman <rsugarman@nvidia.com>
1 parent ee6f49b commit 88be36b

3 files changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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

inc/saiport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ typedef enum _sai_port_priority_flow_control_mode_t
395395

396396
/**
397397
* @brief PTP mode
398+
* These modes can be used at the port and switch level.
399+
* All ports use the value set at the switch level unless explicitly configured
400+
* at the port level to a value other than SAI_PORT_PTP_MODE_NONE.
398401
*/
399402
typedef enum _sai_port_ptp_mode_t
400403
{

inc/saiswitch.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,6 +3197,18 @@ typedef enum _sai_switch_attr_t
31973197
*/
31983198
SAI_SWITCH_ATTR_SHARED_BUFFER_CELL_SIZE,
31993199

3200+
/**
3201+
* @brief Global PTP mode configuration
3202+
*
3203+
* Global PTP mode configuration for the switch.
3204+
* Applies to all ports unless overridden by port-specific settings.
3205+
*
3206+
* @type sai_port_ptp_mode_t
3207+
* @flags CREATE_AND_SET
3208+
* @default SAI_PORT_PTP_MODE_NONE
3209+
*/
3210+
SAI_SWITCH_ATTR_PORT_PTP_MODE,
3211+
32003212
/**
32013213
* @brief End of attributes
32023214
*/

0 commit comments

Comments
 (0)